public abstract class BaseWxCpTpServiceImpl<H,P> extends Object implements WxCpTpService, RequestHttp<H,P>
| 限定符和类型 | 字段和说明 |
|---|---|
protected WxCpTpConfigStorage |
configStorage |
protected Object |
globalSuiteAccessTokenRefreshLock
全局的是否正在刷新access token的锁.
|
protected Object |
globalSuiteTicketRefreshLock
全局的是否正在刷新jsapi_ticket的锁.
|
| 构造器和说明 |
|---|
BaseWxCpTpServiceImpl() |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
checkSignature(String msgSignature,
String timestamp,
String nonce,
String data)
验证推送过来的消息的正确性
详情请见: https://work.weixin.qq.com/api/doc#90000/90139/90968/消息体签名校验
|
<T,E> T |
execute(RequestExecutor<T,E> executor,
String uri,
E data)
向微信端发送请求,在这里执行的策略是当发生access_token过期时才去刷新,然后重新执行请求,而不是全局定时请求.
|
protected <T,E> T |
executeInternal(RequestExecutor<T,E> executor,
String uri,
E data) |
String |
get(String url,
String queryParam)
当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求.
|
WxAccessToken |
getCorpToken(String authCorpid,
String permanentCode)
获取企业凭证
|
WxCpTpCorp |
getPermanentCode(String authCode)
获取企业永久授权码 .
|
RequestHttp<?,?> |
getRequestHttp()
http请求对象.
|
String |
getSuiteAccessToken()
获取suite_access_token, 不强制刷新suite_access_token
|
String |
getSuiteTicket()
获得suite_ticket,不强制刷新suite_ticket
|
String |
getSuiteTicket(boolean forceRefresh)
获得suite_ticket
由于suite_ticket是微信服务器定时推送(每10分钟),不能主动获取,如果碰到过期只能抛异常
详情请见:https://work.weixin.qq.com/api/doc#90001/90143/90628
|
File |
getTmpDirFile() |
WxCpMaJsCode2SessionResult |
jsCode2Session(String jsCode)
小程序登录凭证校验
|
String |
post(String url,
String postData)
当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的POST请求.
|
void |
setMaxRetryTimes(int maxRetryTimes)
设置当微信系统响应系统繁忙时,最大重试次数.
|
void |
setRetrySleepMillis(int retrySleepMillis)
设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试.
|
void |
setTmpDirFile(File tmpDirFile) |
void |
setWxCpTpConfigStorage(WxCpTpConfigStorage wxConfigProvider)
注入
WxCpTpConfigStorage 的实现. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetSuiteAccessToken, getWxCpTpConfigStorage, initHttpgetRequestHttpClient, getRequestHttpProxy, getRequestTypeprotected final Object globalSuiteAccessTokenRefreshLock
protected final Object globalSuiteTicketRefreshLock
protected WxCpTpConfigStorage configStorage
public boolean checkSignature(String msgSignature, String timestamp, String nonce, String data)
WxCpTpService验证推送过来的消息的正确性 详情请见: https://work.weixin.qq.com/api/doc#90000/90139/90968/消息体签名校验
checkSignature 在接口中 WxCpTpServicemsgSignature - 消息签名timestamp - 时间戳nonce - 随机数data - 微信传输过来的数据,有可能是echoStr,有可能是xml消息public String getSuiteAccessToken() throws WxErrorException
WxCpTpServicegetSuiteAccessToken 在接口中 WxCpTpServiceWxErrorExceptionWxCpTpService.getSuiteAccessToken(boolean)public String getSuiteTicket() throws WxErrorException
WxCpTpServicegetSuiteTicket 在接口中 WxCpTpServiceWxErrorExceptionWxCpTpService.getSuiteTicket(boolean)public String getSuiteTicket(boolean forceRefresh) throws WxErrorException
WxCpTpService获得suite_ticket 由于suite_ticket是微信服务器定时推送(每10分钟),不能主动获取,如果碰到过期只能抛异常 详情请见:https://work.weixin.qq.com/api/doc#90001/90143/90628
getSuiteTicket 在接口中 WxCpTpServiceforceRefresh - 强制刷新WxErrorExceptionpublic WxCpMaJsCode2SessionResult jsCode2Session(String jsCode) throws WxErrorException
WxCpTpServicejsCode2Session 在接口中 WxCpTpServicejsCode - 登录时获取的 codeWxErrorExceptionpublic WxAccessToken getCorpToken(String authCorpid, String permanentCode) throws WxErrorException
WxCpTpServicegetCorpToken 在接口中 WxCpTpServiceauthCorpid - 授权方corpidpermanentCode - 永久授权码,通过get_permanent_code获取WxErrorExceptionpublic WxCpTpCorp getPermanentCode(String authCode) throws WxErrorException
WxCpTpServicegetPermanentCode 在接口中 WxCpTpServiceauthCode - .WxErrorExceptionpublic String get(String url, String queryParam) throws WxErrorException
WxCpTpServiceget 在接口中 WxCpTpServiceurl - 接口地址queryParam - 请求参数WxErrorExceptionpublic String post(String url, String postData) throws WxErrorException
WxCpTpServicepost 在接口中 WxCpTpServiceurl - 接口地址postData - 请求body字符串WxErrorExceptionpublic <T,E> T execute(RequestExecutor<T,E> executor, String uri, E data) throws WxErrorException
execute 在接口中 WxCpTpServiceT - 请求值类型E - 返回值类型executor - 执行器uri - 请求地址data - 参数WxErrorExceptionprotected <T,E> T executeInternal(RequestExecutor<T,E> executor, String uri, E data) throws WxErrorException
WxErrorExceptionpublic void setWxCpTpConfigStorage(WxCpTpConfigStorage wxConfigProvider)
WxCpTpServiceWxCpTpConfigStorage 的实现.setWxCpTpConfigStorage 在接口中 WxCpTpServicewxConfigProvider - 配置对象public void setRetrySleepMillis(int retrySleepMillis)
WxCpTpService设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试. 默认:1000ms
setRetrySleepMillis 在接口中 WxCpTpServiceretrySleepMillis - 重试休息时间public void setMaxRetryTimes(int maxRetryTimes)
WxCpTpService设置当微信系统响应系统繁忙时,最大重试次数. 默认:5次
setMaxRetryTimes 在接口中 WxCpTpServicemaxRetryTimes - 最大重试次数public File getTmpDirFile()
public void setTmpDirFile(File tmpDirFile)
public RequestHttp<?,?> getRequestHttp()
WxCpTpServicegetRequestHttp 在接口中 WxCpTpServiceCopyright © 2019. All rights reserved.