public class WxMaServiceImpl extends Object implements WxMaService, RequestHttp<org.apache.http.impl.client.CloseableHttpClient,org.apache.http.HttpHost>
| 限定符和类型 | 字段和说明 |
|---|---|
protected static com.google.gson.Gson |
GSON |
GET_ACCESS_TOKEN_URL, GET_PAID_UNION_ID_URL, JSCODE_TO_SESSION_URL| 构造器和说明 |
|---|
WxMaServiceImpl() |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
checkSignature(String timestamp,
String nonce,
String signature)
验证消息的确来自微信服务器.
|
<T,E> T |
execute(RequestExecutor<T,E> executor,
String uri,
E data)
向微信端发送请求,在这里执行的策略是当发生access_token过期时才去刷新,然后重新执行请求,而不是全局定时请求
|
String |
get(String url,
String queryParam)
当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求.
|
String |
getAccessToken()
获取access_token, 不强制刷新access_token.
|
String |
getAccessToken(boolean forceRefresh)
获取access_token,本方法线程安全.
|
WxMaAnalysisService |
getAnalysisService()
数据分析相关查询服务.
|
WxMaCodeService |
getCodeService()
返回代码操作相关的 API.
|
WxMaJsapiService |
getJsapiService()
返回jsapi操作相关的 API服务类对象.
|
WxMaMediaService |
getMediaService()
返回素材相关接口方法的实现类对象,以方便调用其各个接口.
|
WxMaMsgService |
getMsgService()
返回消息(客服消息和模版消息)发送接口方法实现类,以方便调用其各个接口.
|
String |
getPaidUnionId(String openid,
String transactionId,
String mchId,
String outTradeNo)
用户支付完成后,获取该用户的 UnionId,无需用户授权。
|
WxMaPluginService |
getPluginService()
返回插件相关接口服务对象.
|
WxMaQrcodeService |
getQrcodeService()
返回二维码相关接口方法的实现类对象,以方便调用其各个接口.
|
RequestHttp |
getRequestHttp()
请求http请求相关信息.
|
org.apache.http.impl.client.CloseableHttpClient |
getRequestHttpClient() |
org.apache.http.HttpHost |
getRequestHttpProxy() |
HttpType |
getRequestType() |
WxMaRunService |
getRunService()
返回微信运动相关接口服务对象.
|
WxMaSecCheckService |
getSecCheckService()
返回内容安全相关接口服务对象.
|
WxMaSettingService |
getSettingService()
小程序修改服务器地址、成员管理 API.
|
WxMaShareService |
getShareService()
返回分享相关查询服务.
|
WxMaTemplateService |
getTemplateService()
返回模板配置相关接口方法的实现类对象, 以方便调用其各个接口.
|
WxMaUserService |
getUserService()
返回用户相关接口方法的实现类对象,以方便调用其各个接口.
|
WxMaConfig |
getWxMaConfig()
获取WxMaConfig 对象.
|
void |
initHttp()
初始化http请求对象.
|
WxMaJscode2SessionResult |
jsCode2SessionInfo(String jsCode)
获取登录后的session信息.
|
String |
post(String url,
String postData)
当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的POST请求.
|
void |
setMaxRetryTimes(int maxRetryTimes)
设置当微信系统响应系统繁忙时,最大重试次数.
|
void |
setRetrySleepMillis(int retrySleepMillis)
设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试.
|
void |
setWxMaConfig(WxMaConfig wxConfigProvider)
注入
WxMaConfig 的实现. |
public org.apache.http.impl.client.CloseableHttpClient getRequestHttpClient()
getRequestHttpClient 在接口中 RequestHttp<org.apache.http.impl.client.CloseableHttpClient,org.apache.http.HttpHost>public org.apache.http.HttpHost getRequestHttpProxy()
getRequestHttpProxy 在接口中 RequestHttp<org.apache.http.impl.client.CloseableHttpClient,org.apache.http.HttpHost>public HttpType getRequestType()
getRequestType 在接口中 RequestHttp<org.apache.http.impl.client.CloseableHttpClient,org.apache.http.HttpHost>public void initHttp()
WxMaServiceinitHttp 在接口中 WxMaServicepublic RequestHttp getRequestHttp()
WxMaServicegetRequestHttp 在接口中 WxMaServicepublic String getAccessToken(boolean forceRefresh) throws WxErrorException
WxMaService获取access_token,本方法线程安全. 且在多线程同时刷新时只刷新一次,避免超出2000次/日的调用次数上限 另:本service的所有方法都会在access_token过期是调用此方法 程序员在非必要情况下尽量不要主动调用此方法 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140183&token=&lang=zh_CN
getAccessToken 在接口中 WxMaServiceforceRefresh - 强制刷新WxErrorExceptionpublic String getPaidUnionId(String openid, String transactionId, String mchId, String outTradeNo) throws WxErrorException
WxMaService用户支付完成后,获取该用户的 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
getPaidUnionId 在接口中 WxMaServiceopenid - 必填 支付用户唯一标识transactionId - 非必填 微信支付订单号mchId - 非必填 微信支付分配的商户号,和商户订单号配合使用outTradeNo - 非必填 微信支付商户订单号,和商户号配合使用WxErrorExceptionpublic WxMaJscode2SessionResult jsCode2SessionInfo(String jsCode) throws WxErrorException
WxMaServicejsCode2SessionInfo 在接口中 WxMaServicejsCode - 登录时获取的 codeWxErrorExceptionpublic boolean checkSignature(String timestamp, String nonce, String signature)
WxMaService验证消息的确来自微信服务器. 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421135319&token=&lang=zh_CN
checkSignature 在接口中 WxMaServicepublic String getAccessToken() throws WxErrorException
WxMaServicegetAccessToken 在接口中 WxMaServiceWxErrorExceptionWxMaService.getAccessToken(boolean)public String get(String url, String queryParam) throws WxErrorException
WxMaServiceget 在接口中 WxMaServiceWxErrorExceptionpublic String post(String url, String postData) throws WxErrorException
WxMaServicepost 在接口中 WxMaServiceWxErrorExceptionpublic <T,E> T execute(RequestExecutor<T,E> executor, String uri, E data) throws WxErrorException
execute 在接口中 WxMaServiceWxErrorExceptionpublic WxMaConfig getWxMaConfig()
WxMaServicegetWxMaConfig 在接口中 WxMaServicepublic void setWxMaConfig(WxMaConfig wxConfigProvider)
WxMaServiceWxMaConfig 的实现.setWxMaConfig 在接口中 WxMaServicepublic void setRetrySleepMillis(int retrySleepMillis)
WxMaService设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试. 默认:1000ms
setRetrySleepMillis 在接口中 WxMaServicepublic void setMaxRetryTimes(int maxRetryTimes)
WxMaService设置当微信系统响应系统繁忙时,最大重试次数. 默认:5次
setMaxRetryTimes 在接口中 WxMaServicepublic WxMaMsgService getMsgService()
WxMaServicegetMsgService 在接口中 WxMaServicepublic WxMaMediaService getMediaService()
WxMaServicegetMediaService 在接口中 WxMaServicepublic WxMaUserService getUserService()
WxMaServicegetUserService 在接口中 WxMaServicepublic WxMaQrcodeService getQrcodeService()
WxMaServicegetQrcodeService 在接口中 WxMaServicepublic WxMaTemplateService getTemplateService()
WxMaServicegetTemplateService 在接口中 WxMaServicepublic WxMaAnalysisService getAnalysisService()
WxMaServicegetAnalysisService 在接口中 WxMaServicepublic WxMaCodeService getCodeService()
WxMaServicegetCodeService 在接口中 WxMaServicepublic WxMaJsapiService getJsapiService()
WxMaServicegetJsapiService 在接口中 WxMaServicepublic WxMaSettingService getSettingService()
WxMaServicegetSettingService 在接口中 WxMaServicepublic WxMaShareService getShareService()
WxMaServicegetShareService 在接口中 WxMaServicepublic WxMaRunService getRunService()
WxMaServicegetRunService 在接口中 WxMaServicepublic WxMaSecCheckService getSecCheckService()
WxMaServicegetSecCheckService 在接口中 WxMaServicepublic WxMaPluginService getPluginService()
WxMaServicegetPluginService 在接口中 WxMaServiceCopyright © 2019. All rights reserved.