public interface WxCpTpService
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
checkSignature(String msgSignature,
String timestamp,
String nonce,
String data)
验证推送过来的消息的正确性
详情请见: https://work.weixin.qq.com/api/doc#90000/90139/90968/消息体签名校验
|
WxJsapiSignature |
createAuthCorpJsApiTicketSignature(String url,
String authCorpId)
创建机构级jsApiTicket签名
详情参见企业微信第三方应用开发文档:https://work.weixin.qq.com/api/doc/90001/90144/90539
|
WxJsapiSignature |
createSuiteJsApiTicketSignature(String url,
String authCorpId)
创建应用级jsapiTicket签名
详情参见企业微信第三方应用开发文档:https://work.weixin.qq.com/api/doc/90001/90144/90539
|
<T,E> T |
execute(RequestExecutor<T,E> executor,
String uri,
E data)
Service没有实现某个API的时候,可以用这个,
比
get(java.lang.String, java.lang.String)和post(java.lang.String, java.lang.String)方法更灵活,可以自己构造RequestExecutor用来处理不同的参数和不同的返回类型。 |
void |
expireAccessToken(String authCorpId)
使机构accessToken缓存失效
|
void |
expireAuthCorpJsApiTicket(String authCorpId)
使机构jsapiticket缓存失效
|
void |
expireAuthSuiteJsApiTicket(String authCorpId)
使应用jsapiticket失效
|
void |
expireProviderToken()
使供应商accessToken失效
|
void |
expireSuiteAccessToken()
使套件accessToken缓存失效
|
String |
get(String url,
String queryParam)
当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求.
|
String |
get(String url,
String queryParam,
boolean withoutSuiteAccessToken)
当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求.
|
WxCpTpAdmin |
getAdminList(String authCorpId,
Integer agentId)
获取应用的管理员列表
|
String |
getAuthCorpJsApiTicket(String authCorpId)
获取授权企业的 jsapi ticket
|
String |
getAuthCorpJsApiTicket(String authCorpId,
boolean forceRefresh)
获取授权企业的 jsapi ticket, 支持强制刷新
|
WxCpTpAuthInfo |
getAuthInfo(String authCorpId,
String permanentCode)
获取企业的授权信息
|
WxAccessToken |
getCorpToken(String authCorpId,
String permanentCode)
获取企业凭证
|
WxAccessToken |
getCorpToken(String authCorpId,
String permanentCode,
boolean forceRefresh)
获取企业凭证, 支持强制刷新
|
WxTpLoginInfo |
getLoginInfo(String authCode)
获取登录用户信息
文档地址:https://work.weixin.qq.com/api/doc/90001/90143/91125
|
WxCpTpCorp |
getPermanentCode(String authCode)
已过时。
|
WxCpTpPermanentCodeInfo |
getPermanentCodeInfo(String authCode)
获取企业永久授权码信息
原来的方法实现不全
|
String |
getPreAuthUrl(String redirectUri,
String state)
获取预授权链接
|
String |
getPreAuthUrl(String redirectUri,
String state,
int authType)
获取预授权链接,测试环境下使用
|
RequestHttp<?,?> |
getRequestHttp()
http请求对象.
|
WxSessionManager |
getSessionManager()
获取WxSessionManager 对象
|
String |
getSuiteAccessToken()
获取suite_access_token, 不强制刷新suite_access_token
|
String |
getSuiteAccessToken(boolean forceRefresh)
获取suite_access_token,本方法线程安全
且在多线程同时刷新时只刷新一次,避免超出2000次/日的调用次数上限
另:本service的所有方法都会在suite_access_token过期是调用此方法
程序员在非必要情况下尽量不要主动调用此方法
详情请见: https://work.weixin.qq.com/api/doc#90001/90143/90600
|
WxAccessToken |
getSuiteAccessTokenEntity()
获取suite_access_token和剩余过期时间, 不强制刷新suite_access_token
|
WxAccessToken |
getSuiteAccessTokenEntity(boolean forceRefresh)
获取suite_access_token和剩余过期时间, 支持强制刷新suite_access_token
|
String |
getSuiteJsApiTicket(String authCorpId)
获取应用的 jsapi ticket
|
String |
getSuiteJsApiTicket(String authCorpId,
boolean forceRefresh)
获取应用的 jsapi ticket, 支持强制刷新
|
String |
getSuiteTicket()
获得suite_ticket,不强制刷新suite_ticket
|
String |
getSuiteTicket(boolean forceRefresh)
已过时。
由于无法主动刷新 ,所以这个接口实际已经没有意义,需要在接收企业微信的主动推送后,保存这个ticket
|
WxCpTpUserDetail |
getUserDetail3rd(String userTicket)
获取访问用户敏感信息
|
WxCpTpUserInfo |
getUserInfo3rd(String code)
获取访问用户身份
|
String |
getWxCpProviderToken()
获取服务商providerToken
|
WxCpProviderToken |
getWxCpProviderTokenEntity()
获取服务商providerToken和剩余过期时间
|
WxCpProviderToken |
getWxCpProviderTokenEntity(boolean forceRefresh)
获取服务商providerToken和剩余过期时间,支持强制刷新
|
WxCpTpConfigStorage |
getWxCpTpConfigStorage()
已过时。
storage应该在service内部使用 ,提供这个接口,容易破坏这个封装
|
WxCpTpContactService |
getWxCpTpContactService()
get contact service
|
WxCpTpDepartmentService |
getWxCpTpDepartmentService()
get department service
|
WxCpTpEditionService |
getWxCpTpEditionService()
获取应用版本付费版本相关接口服务
|
WxCpTpMediaService |
getWxCpTpMediaService()
get media service
|
WxCpTpOAService |
getWxCpTpOAService()
get oa service
|
WxCpTpOrderService |
getWxCpTpOrderService()
获取应用版本付费订单相关接口服务
|
WxCpTpUserService |
getWxCpTpUserService()
get user service
|
void |
initHttp()
初始化http请求对象
|
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 |
setSuiteTicket(String suiteTicket)
保存企业微信定时推送的suite_ticket,(每10分钟)
详情请见:https://work.weixin.qq.com/api/doc#90001/90143/90628
注意:微信不是固定10分钟推送suite_ticket的, 且suite_ticket的有效期为30分钟
https://work.weixin.qq.com/api/doc/10975#%E8%8E%B7%E5%8F%96%E7%AC%AC%E4%B8%89%E6%96%B9%E5%BA%94%E7%94%A8%E5%87%AD%E8%AF%81
|
void |
setSuiteTicket(String suiteTicket,
int expiresInSeconds)
保存企业微信定时推送的suite_ticket,(每10分钟)
详情请见:https://work.weixin.qq.com/api/doc#90001/90143/90628
注意:微信不是固定10分钟推送suite_ticket的, 且suite_ticket的有效期为30分钟
https://work.weixin.qq.com/api/doc/10975#%E8%8E%B7%E5%8F%96%E7%AC%AC%E4%B8%89%E6%96%B9%E5%BA%94%E7%94%A8%E5%87%AD%E8%AF%81
|
void |
setWxCpTpConfigStorage(WxCpTpConfigStorage wxConfigProvider)
注入
WxCpTpConfigStorage 的实现. |
void |
setWxCpTpContactService(WxCpTpContactService wxCpTpContactService)
set contact service
|
void |
setWxCpTpDepartmentService(WxCpTpDepartmentService wxCpTpDepartmentService)
set department service
|
void |
setWxCpTpMediaService(WxCpTpMediaService wxCpTpMediaService)
set media service
|
void |
setWxCpTpOAService(WxCpTpOAService wxCpTpOAService)
set oa service
|
void |
setWxCpTpOrderService(WxCpTpEditionService wxCpTpEditionService)
设置应用版本付费版本相关接口服务
|
void |
setWxCpTpOrderService(WxCpTpOrderService wxCpTpOrderService)
设置应用版本付费订单相关接口服务
|
void |
setWxCpTpUserService(WxCpTpUserService wxCpTpUserService)
set user service
|
boolean checkSignature(String msgSignature, String timestamp, String nonce, String data)
验证推送过来的消息的正确性 详情请见: https://work.weixin.qq.com/api/doc#90000/90139/90968/消息体签名校验
msgSignature - 消息签名timestamp - 时间戳nonce - 随机数data - 微信传输过来的数据,有可能是echoStr,有可能是xml消息String getSuiteAccessToken() throws WxErrorException
WxErrorException - the wx error exception#getSuiteAccessToken(boolean)#getSuiteAccessToken(boolean)String getSuiteAccessToken(boolean forceRefresh) throws WxErrorException
获取suite_access_token,本方法线程安全 且在多线程同时刷新时只刷新一次,避免超出2000次/日的调用次数上限 另:本service的所有方法都会在suite_access_token过期是调用此方法 程序员在非必要情况下尽量不要主动调用此方法 详情请见: https://work.weixin.qq.com/api/doc#90001/90143/90600
forceRefresh - 强制刷新WxErrorException - the wx error exceptionWxAccessToken getSuiteAccessTokenEntity() throws WxErrorException
WxErrorExceptionWxAccessToken getSuiteAccessTokenEntity(boolean forceRefresh) throws WxErrorException
forceRefresh - 是否调用微信服务器强制刷新tokenWxErrorExceptionString getSuiteTicket() throws WxErrorException
WxErrorException - the wx error exception#getSuiteTicket(boolean)#getSuiteTicket(boolean)void setSuiteTicket(String suiteTicket)
保存企业微信定时推送的suite_ticket,(每10分钟) 详情请见:https://work.weixin.qq.com/api/doc#90001/90143/90628 注意:微信不是固定10分钟推送suite_ticket的, 且suite_ticket的有效期为30分钟 https://work.weixin.qq.com/api/doc/10975#%E8%8E%B7%E5%8F%96%E7%AC%AC%E4%B8%89%E6%96%B9%E5%BA%94%E7%94%A8%E5%87%AD%E8%AF%81
suiteTicket - the suite ticket@Deprecated String getSuiteTicket(boolean forceRefresh) throws WxErrorException
获得suite_ticket 由于suite_ticket是微信服务器定时推送(每10分钟),不能主动获取,如果碰到过期只能抛异常 详情请见:https://work.weixin.qq.com/api/doc#90001/90143/90628
forceRefresh - 强制刷新WxErrorException - the wx error exception#setSuiteTicket(String)void setSuiteTicket(String suiteTicket, int expiresInSeconds)
保存企业微信定时推送的suite_ticket,(每10分钟) 详情请见:https://work.weixin.qq.com/api/doc#90001/90143/90628 注意:微信不是固定10分钟推送suite_ticket的, 且suite_ticket的有效期为30分钟 https://work.weixin.qq.com/api/doc/10975#%E8%8E%B7%E5%8F%96%E7%AC%AC%E4%B8%89%E6%96%B9%E5%BA%94%E7%94%A8%E5%87%AD%E8%AF%81
suiteTicket - the suite ticketexpiresInSeconds - the expires in secondsString getSuiteJsApiTicket(String authCorpId) throws WxErrorException
authCorpId - 授权企业的cropIdWxErrorException - the wx error exceptionString getSuiteJsApiTicket(String authCorpId, boolean forceRefresh) throws WxErrorException
authCorpId - forceRefresh - WxErrorExceptionWxCpMaJsCode2SessionResult jsCode2Session(String jsCode) throws WxErrorException
jsCode - 登录时获取的 codeWxErrorException - the wx error exceptionWxAccessToken getCorpToken(String authCorpId, String permanentCode) throws WxErrorException
authCorpId - 授权方corpidpermanentCode - 永久授权码,通过get_permanent_code获取WxErrorException - the wx error exceptionWxAccessToken getCorpToken(String authCorpId, String permanentCode, boolean forceRefresh) throws WxErrorException
authCorpId - permanentCode - forceRefresh - WxErrorException@Deprecated WxCpTpCorp getPermanentCode(String authCode) throws WxErrorException
authCode - .WxErrorException - the wx error exceptionWxCpTpPermanentCodeInfo getPermanentCodeInfo(String authCode) throws WxErrorException
原来的方法实现不全
authCode - the auth codeWxErrorException - the wx error exceptionString getPreAuthUrl(String redirectUri, String state) throws WxErrorException
获取预授权链接
redirectUri - 授权完成后的回调网址state - a-zA-Z0-9的参数值(不超过128个字节),用于第三方自行校验session,防止跨域攻击WxErrorException - the wx error exceptionString getPreAuthUrl(String redirectUri, String state, int authType) throws WxErrorException
获取预授权链接,测试环境下使用
redirectUri - 授权完成后的回调网址state - a-zA-Z0-9的参数值(不超过128个字节),用于第三方自行校验session,防止跨域攻击authType - 授权类型:0 正式授权, 1 测试授权。WxErrorException - the wx error exceptionWxCpTpAuthInfo getAuthInfo(String authCorpId, String permanentCode) throws WxErrorException
authCorpId - 授权企业的corpIdpermanentCode - 授权企业的永久授权码WxErrorException - the wx error exceptionString getAuthCorpJsApiTicket(String authCorpId) throws WxErrorException
authCorpId - 授权企业的cropIdWxErrorException - the wx error exceptionString getAuthCorpJsApiTicket(String authCorpId, boolean forceRefresh) throws WxErrorException
authCorpId - forceRefresh - WxErrorExceptionString get(String url, String queryParam) throws WxErrorException
url - 接口地址queryParam - 请求参数WxErrorException - the wx error exceptionString get(String url, String queryParam, boolean withoutSuiteAccessToken) throws WxErrorException
url - 接口地址queryParam - 请求参数withoutSuiteAccessToken - 请求是否忽略SuiteAccessToken 默认不忽略-falseWxErrorException - the wx error exceptionString post(String url, String postData) throws WxErrorException
url - 接口地址postData - 请求body字符串WxErrorException - the wx error exception<T,E> T execute(RequestExecutor<T,E> executor, String uri, E data) throws WxErrorException
Service没有实现某个API的时候,可以用这个, 比get(java.lang.String, java.lang.String)和post(java.lang.String, java.lang.String)方法更灵活,可以自己构造RequestExecutor用来处理不同的参数和不同的返回类型。 可以参考,MediaUploadRequestExecutor的实现方法
T - 请求值类型E - 返回值类型executor - 执行器uri - 请求地址data - 参数WxErrorException - the wx error exceptionvoid setRetrySleepMillis(int retrySleepMillis)
设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试. 默认:1000ms
retrySleepMillis - 重试休息时间void setMaxRetryTimes(int maxRetryTimes)
设置当微信系统响应系统繁忙时,最大重试次数. 默认:5次
maxRetryTimes - 最大重试次数void initHttp()
@Deprecated WxCpTpConfigStorage getWxCpTpConfigStorage()
void setWxCpTpConfigStorage(WxCpTpConfigStorage wxConfigProvider)
WxCpTpConfigStorage 的实现.wxConfigProvider - 配置对象RequestHttp<?,?> getRequestHttp()
WxSessionManager getSessionManager()
WxCpTpUserInfo getUserInfo3rd(String code) throws WxErrorException
获取访问用户身份
code - the codeWxErrorException - the wx error exceptionWxCpTpUserDetail getUserDetail3rd(String userTicket) throws WxErrorException
获取访问用户敏感信息
userTicket - the user ticketWxErrorException - the wx error exceptionWxTpLoginInfo getLoginInfo(String authCode) throws WxErrorException
文档地址:https://work.weixin.qq.com/api/doc/90001/90143/91125
authCode - the auth codeWxErrorException - the wx error exceptionString getWxCpProviderToken() throws WxErrorException
WxErrorException - the wx error exceptionWxCpProviderToken getWxCpProviderTokenEntity() throws WxErrorException
WxErrorExceptionWxCpProviderToken getWxCpProviderTokenEntity(boolean forceRefresh) throws WxErrorException
forceRefresh - WxErrorExceptionWxCpTpContactService getWxCpTpContactService()
void setWxCpTpContactService(WxCpTpContactService wxCpTpContactService)
wxCpTpContactService - the contact serviceWxCpTpDepartmentService getWxCpTpDepartmentService()
void setWxCpTpDepartmentService(WxCpTpDepartmentService wxCpTpDepartmentService)
wxCpTpDepartmentService - the department serviceWxCpTpMediaService getWxCpTpMediaService()
void setWxCpTpMediaService(WxCpTpMediaService wxCpTpMediaService)
wxCpTpMediaService - the media serviceWxCpTpOAService getWxCpTpOAService()
void setWxCpTpOAService(WxCpTpOAService wxCpTpOAService)
wxCpTpOAService - the oa serviceWxCpTpUserService getWxCpTpUserService()
void setWxCpTpUserService(WxCpTpUserService wxCpTpUserService)
wxCpTpUserService - the set user serviceWxCpTpAdmin getAdminList(String authCorpId, Integer agentId) throws WxErrorException
authCorpId - the auth corp idagentId - the agent idWxErrorException - the wx error exceptionWxJsapiSignature createAuthCorpJsApiTicketSignature(String url, String authCorpId) throws WxErrorException
url - 调用JS接口页面的完整URLauthCorpId - WxErrorExceptionWxJsapiSignature createSuiteJsApiTicketSignature(String url, String authCorpId) throws WxErrorException
url - 调用JS接口页面的完整URLauthCorpId - WxErrorExceptionvoid expireSuiteAccessToken()
void expireAccessToken(String authCorpId)
authCorpId - 机构idvoid expireAuthCorpJsApiTicket(String authCorpId)
authCorpId - 机构idvoid expireAuthSuiteJsApiTicket(String authCorpId)
authCorpId - 机构idvoid expireProviderToken()
WxCpTpOrderService getWxCpTpOrderService()
void setWxCpTpOrderService(WxCpTpOrderService wxCpTpOrderService)
wxCpTpOrderService - the wx cp tp order serviceWxCpTpEditionService getWxCpTpEditionService()
void setWxCpTpOrderService(WxCpTpEditionService wxCpTpEditionService)
wxCpTpEditionService - the wx cp tp edition serviceCopyright © 2022. All rights reserved.