public interface WxMaService extends WxService
限定符和类型 | 字段和说明 |
---|---|
static String |
GET_ACCESS_TOKEN_URL
获取access_token.
|
static String |
GET_PAID_UNION_ID_URL
getPaidUnionId
|
static String |
GET_STABLE_ACCESS_TOKEN |
static String |
JSCODE_TO_SESSION_URL
The constant JSCODE_TO_SESSION_URL.
|
static String |
SET_DYNAMIC_DATA_URL
导入抽样数据
|
static final String JSCODE_TO_SESSION_URL
WxMaJscode2SessionResult jsCode2SessionInfo(String jsCode) throws WxErrorException
jsCode
- 登录时获取的 codeWxErrorException
- the wx error exceptionvoid setDynamicData(int lifespan, String type, int scene, String data) throws WxErrorException
第三方通过调用微信API,将数据写入到setdynamicdata这个API。每个Post数据包不超过5K,若数据过多可开多进(线)程并发导入数据(例如:数据量为十万量级可以开50个线程并行导数据)。 文档地址:https://wsad.weixin.qq.com/wsad/zh_CN/htmledition/widget-docs-v3/html/custom/quickstart/implement/import/index.html http请求方式:POST http(s)://api.weixin.qq.com/wxa/setdynamicdata?access_token=ACCESS_TOKEN
lifespan
- 数据有效时间,秒为单位,一般为86400,一天一次导入的频率type
- 用于标识数据所属的服务类目scene
- 1代表用于搜索的数据data
- 推送到微信后台的数据列表,该数据被微信用于流量分配,注意该字段为string类型而不是objectWxErrorException
- .boolean checkSignature(String timestamp, String nonce, String signature)
验证消息的确来自微信服务器. 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421135319&token=&lang=zh_CN
timestamp
- the timestampnonce
- the noncesignature
- the signatureString getAccessToken() throws WxErrorException
WxErrorException
- the wx error exception#getAccessToken(boolean)
String getAccessToken(boolean forceRefresh) throws WxErrorException
获取access_token,本方法线程安全. 且在多线程同时刷新时只刷新一次,避免超出2000次/日的调用次数上限 另:本service的所有方法都会在access_token过期是调用此方法 程序员在非必要情况下尽量不要主动调用此方法 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140183&token=&lang=zh_CN
forceRefresh
- 强制刷新WxErrorException
- the wx error exceptionString getPaidUnionId(String openid, String transactionId, String mchId, String outTradeNo) throws WxErrorException
用户支付完成后,获取该用户的 UnionId,无需用户授权。本接口支持第三方平台代理查询。 注意:调用前需要用户完成支付,且在支付后的五分钟内有效。 请求地址: GET https://api.weixin.qq.com/wxa/getpaidunionid?access_token=ACCESS_TOKEN&openid=OPENID 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api/getPaidUnionId.html
openid
- 必填 支付用户唯一标识transactionId
- 非必填 微信支付订单号mchId
- 非必填 微信支付分配的商户号,和商户订单号配合使用outTradeNo
- 非必填 微信支付商户订单号,和商户号配合使用WxErrorException
- .<T,E> T execute(RequestExecutor<T,E> executor, String uri, E data) throws WxErrorException
Service没有实现某个API的时候,可以用这个, 比WxService.get(java.lang.String, java.lang.String)
和WxService.post(java.lang.String, java.lang.String)
方法更灵活,可以自己构造RequestExecutor用来处理不同的参数和不同的返回类型。 可以参考,MediaUploadRequestExecutor
的实现方法
T
- .E
- .executor
- 执行器uri
- 接口请求地址data
- 参数或请求数据WxErrorException
- the wx error exceptionWxMaApiResponse execute(ApiSignaturePostRequestExecutor executor, String uri, Map<String,String> headers, String data) throws WxErrorException
WxErrorException
void setRetrySleepMillis(int retrySleepMillis)
设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试. 默认:1000ms
retrySleepMillis
- 重试等待毫秒数void setMaxRetryTimes(int maxRetryTimes)
设置当微信系统响应系统繁忙时,最大重试次数. 默认:5次
maxRetryTimes
- 最大重试次数WxMaConfig getWxMaConfig()
void setWxMaConfig(WxMaConfig maConfig)
WxMaConfig
的实现.maConfig
- configvoid addConfig(String miniappId, WxMaConfig configStorage)
WxMaConfig
,适用于动态添加新的微信公众号配置.miniappId
- 小程序标识configStorage
- 新的微信配置void removeConfig(String miniappId)
miniappId
所对应的 WxMaConfig
,适用于动态移除小程序配置.miniappId
- 对应小程序的标识void setMultiConfigs(Map<String,WxMaConfig> configs)
configs
- WxMaConfig mapvoid setMultiConfigs(Map<String,WxMaConfig> configs, String defaultMiniappId)
configs
- WxMaConfig mapdefaultMiniappId
- 设置一个WxMaConfig
所对应的defaultMiniappId
进行Http初始化boolean switchover(String mpId)
mpId
- 公众号标识WxMaService switchoverTo(String miniAppId)
miniAppId
- 小程序标识WxMaService switchoverTo(String miniAppId, java.util.function.Function<String,WxMaConfig> func)
miniAppId
- 小程序标识func
- 当对应的小程序配置不存在时,允许通过函数的方式进行调用获取WxMaMsgService getMsgService()
WxMaMediaService getMediaService()
WxMaUserService getUserService()
WxMaQrcodeService getQrcodeService()
WxMaSchemeService getWxMaSchemeService()
WxMaSubscribeService getSubscribeService()
WxMaAnalysisService getAnalysisService()
WxMaCodeService getCodeService()
WxMaJsapiService getJsapiService()
WxMaSettingService getSettingService()
WxMaShareService getShareService()
WxMaRunService getRunService()
WxMaSecurityService getSecurityService()
WxMaPluginService getPluginService()
void initHttp()
RequestHttp getRequestHttp()
WxMaExpressService getExpressService()
WxMaCloudService getCloudService()
WxMaInternetService getInternetService()
WxMaLiveService getLiveService()
WxMaLiveGoodsService getLiveGoodsService()
WxMaLiveMemberService getLiveMemberService()
WxOcrService getOcrService()
WxImgProcService getImgProcService()
WxMaShopAfterSaleService getShopAfterSaleService()
WxMaShopDeliveryService getShopDeliveryService()
WxMaShopOrderService getShopOrderService()
WxMaShopSpuService getShopSpuService()
WxMaShopRegisterService getShopRegisterService()
WxMaShopAccountService getShopAccountService()
WxMaShopCatService getShopCatService()
WxMaShopImgService getShopImgService()
WxMaShopAuditService getShopAuditService()
WxMaLinkService getLinkService()
WxMaReimburseInvoiceService getReimburseInvoiceService()
WxMaDeviceSubscribeService getDeviceSubscribeService()
WxMaMarketingService getMarketingService()
WxMaImmediateDeliveryService getWxMaImmediateDeliveryService()
WxMaShopSharerService getShopSharerService()
WxMaProductService getProductService()
WxMaProductOrderService getProductOrderService()
WxMaShopCouponService getWxMaShopCouponService()
WxMaShopPayService getWxMaShopPayService()
WxMaOrderShippingService getWxMaOrderShippingService()
WxMaOpenApiService getWxMaOpenApiService()
WxMaVodService getWxMaVodService()
WxMaXPayService getWxMaXPayService()
WxMaExpressDeliveryReturnService getWxMaExpressDeliveryReturnService()
WxMaPromotionService getWxMaPromotionService()
String postWithSignature(String url, Object obj) throws WxErrorException
WxErrorException
String postWithSignature(String url, com.google.gson.JsonObject jsonObject) throws WxErrorException
WxErrorException
WxMaIntracityService getIntracityService()
Copyright © 2024. All rights reserved.