public abstract class BaseWxCpServiceImpl<H,P> extends Object implements WxCpService, RequestHttp<H,P>
| 限定符和类型 | 字段和说明 |
|---|---|
protected WxCpConfigStorage |
configStorage |
protected Object |
globalAccessTokenRefreshLock
全局的是否正在刷新access token的锁
|
protected Object |
globalJsapiTicketRefreshLock
全局的是否正在刷新jsapi_ticket的锁
|
protected org.slf4j.Logger |
log |
protected WxSessionManager |
sessionManager |
protected File |
tmpDirFile
临时文件目录
|
| 构造器和说明 |
|---|
BaseWxCpServiceImpl() |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
checkSignature(String msgSignature,
String timestamp,
String nonce,
String data)
验证推送过来的消息的正确性
详情请见: http://mp.weixin.qq.com/wiki/index.php?
|
WxJsapiSignature |
createJsapiSignature(String url)
创建调用jsapi时所需要的签名
详情请见:http://qydev.weixin.qq.com/wiki/index.php?
|
<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请求
|
String |
getAccessToken()
获取access_token, 不强制刷新access_token
|
WxCpAgentService |
getAgentService() |
String[] |
getCallbackIp()
获取微信服务器的ip段
http://qydev.weixin.qq.com/wiki/index.php?
|
WxCpChatService |
getChatService()
获取群聊服务
|
WxCpDepartmentService |
getDepartmentService()
获取部门相关接口的服务类对象
|
String |
getJsapiTicket()
获得jsapi_ticket,不强制刷新jsapi_ticket
|
String |
getJsapiTicket(boolean forceRefresh)
获得jsapi_ticket
获得时会检查jsapiToken是否过期,如果过期了,那么就刷新一下,否则就什么都不干
详情请见:http://qydev.weixin.qq.com/wiki/index.php?
|
WxCpMediaService |
getMediaService()
获取媒体相关接口的服务类对象
|
WxCpMenuService |
getMenuService()
获取菜单相关接口的服务类对象
|
WxCpOAuth2Service |
getOauth2Service()
获取Oauth2相关接口的服务类对象
|
RequestHttp<?,?> |
getRequestHttp()
http请求对象
|
WxSession |
getSession(String id)
获取某个sessionId对应的session,如果sessionId没有对应的session,则新建一个并返回。
|
WxSession |
getSession(String id,
boolean create)
获取某个sessionId对应的session,如果sessionId没有对应的session,若create为true则新建一个,否则返回null。
|
WxCpTagService |
getTagService()
获取标签相关接口的服务类对象
|
String |
getTaskResult(String joinId)
获取异步任务结果
|
File |
getTmpDirFile() |
WxCpUserService |
getUserService()
获取用户相关接口的服务类对象
|
WxCpMessageSendResult |
messageSend(WxCpMessage message)
发送消息
详情请见: http://qydev.weixin.qq.com/wiki/index.php?
|
String |
post(String url,
String postData)
当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的POST请求
|
String |
replaceParty(String mediaId)
上传部门列表覆盖企业号上的部门信息
|
String |
replaceUser(String mediaId)
上传用户列表覆盖企业号上的用户信息
|
void |
setAgentService(WxCpAgentService agentService) |
void |
setDepartmentService(WxCpDepartmentService departmentService) |
void |
setMaxRetryTimes(int maxRetryTimes)
设置当微信系统响应系统繁忙时,最大重试次数
默认:5次
|
void |
setMediaService(WxCpMediaService mediaService) |
void |
setMenuService(WxCpMenuService menuService) |
void |
setOauth2Service(WxCpOAuth2Service oauth2Service) |
void |
setRetrySleepMillis(int retrySleepMillis)
设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试
默认:1000ms
|
void |
setSessionManager(WxSessionManager sessionManager)
设置WxSessionManager,只有当需要使用个性化的WxSessionManager的时候才需要调用此方法,
WxCpService默认使用的是
StandardSessionManager
|
void |
setTagService(WxCpTagService tagService) |
void |
setTmpDirFile(File tmpDirFile) |
void |
setUserService(WxCpUserService userService) |
void |
setWxCpConfigStorage(WxCpConfigStorage wxConfigProvider)
注入
WxCpConfigStorage 的实现 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAccessToken, getWxCpConfigStorage, initHttpgetRequestHttpClient, getRequestHttpProxy, getRequestTypeprotected final org.slf4j.Logger log
protected final Object globalAccessTokenRefreshLock
protected final Object globalJsapiTicketRefreshLock
protected WxCpConfigStorage configStorage
protected WxSessionManager sessionManager
protected File tmpDirFile
public boolean checkSignature(String msgSignature, String timestamp, String nonce, String data)
WxCpService验证推送过来的消息的正确性 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=验证消息真实性
checkSignature 在接口中 WxCpServicemsgSignature - 消息签名timestamp - 时间戳nonce - 随机数data - 微信传输过来的数据,有可能是echoStr,有可能是xml消息public String getAccessToken() throws WxErrorException
WxCpServicegetAccessToken 在接口中 WxCpServiceWxErrorExceptionWxCpService.getAccessToken(boolean)public String getJsapiTicket() throws WxErrorException
WxCpServicegetJsapiTicket 在接口中 WxCpServiceWxErrorExceptionWxCpService.getJsapiTicket(boolean)public String getJsapiTicket(boolean forceRefresh) throws WxErrorException
WxCpService获得jsapi_ticket 获得时会检查jsapiToken是否过期,如果过期了,那么就刷新一下,否则就什么都不干 详情请见:http://qydev.weixin.qq.com/wiki/index.php?title=微信JS接口#.E9.99.84.E5.BD.951-JS-SDK.E4.BD.BF.E7.94.A8.E6.9D.83.E9.99.90.E7.AD.BE.E5.90.8D.E7.AE.97.E6.B3.95
getJsapiTicket 在接口中 WxCpServiceforceRefresh - 强制刷新WxErrorExceptionpublic WxJsapiSignature createJsapiSignature(String url) throws WxErrorException
WxCpService创建调用jsapi时所需要的签名 详情请见:http://qydev.weixin.qq.com/wiki/index.php?title=微信JS接口#.E9.99.84.E5.BD.951-JS-SDK.E4.BD.BF.E7.94.A8.E6.9D.83.E9.99.90.E7.AD.BE.E5.90.8D.E7.AE.97.E6.B3.95
createJsapiSignature 在接口中 WxCpServiceurl - urlWxErrorExceptionpublic WxCpMessageSendResult messageSend(WxCpMessage message) throws WxErrorException
WxCpService发送消息 详情请见: http://qydev.weixin.qq.com/wiki/index.php?title=%E5%8F%91%E9%80%81%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E
messageSend 在接口中 WxCpServicemessage - 要发送的消息对象WxErrorExceptionpublic String[] getCallbackIp() throws WxErrorException
WxCpService获取微信服务器的ip段 http://qydev.weixin.qq.com/wiki/index.php?title=回调模式#.E8.8E.B7.E5.8F.96.E5.BE.AE.E4.BF.A1.E6.9C.8D.E5.8A.A1.E5.99.A8.E7.9A.84ip.E6.AE.B5
getCallbackIp 在接口中 WxCpServiceWxErrorExceptionpublic String get(String url, String queryParam) throws WxErrorException
WxCpServiceget 在接口中 WxCpServiceurl - 接口地址queryParam - 请求参数WxErrorExceptionpublic String post(String url, String postData) throws WxErrorException
WxCpServicepost 在接口中 WxCpServiceurl - 接口地址postData - 请求body字符串WxErrorExceptionpublic <T,E> T execute(RequestExecutor<T,E> executor, String uri, E data) throws WxErrorException
execute 在接口中 WxCpServiceT - 请求值类型E - 返回值类型executor - 执行器uri - 请求地址data - 参数WxErrorExceptionprotected <T,E> T executeInternal(RequestExecutor<T,E> executor, String uri, E data) throws WxErrorException
WxErrorExceptionpublic void setWxCpConfigStorage(WxCpConfigStorage wxConfigProvider)
WxCpServiceWxCpConfigStorage 的实现setWxCpConfigStorage 在接口中 WxCpServicewxConfigProvider - 配置对象public void setRetrySleepMillis(int retrySleepMillis)
WxCpService设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试 默认:1000ms
setRetrySleepMillis 在接口中 WxCpServiceretrySleepMillis - 重试休息时间public void setMaxRetryTimes(int maxRetryTimes)
WxCpService设置当微信系统响应系统繁忙时,最大重试次数 默认:5次
setMaxRetryTimes 在接口中 WxCpServicemaxRetryTimes - 最大重试次数public WxSession getSession(String id)
WxCpServicegetSession 在接口中 WxCpServiceid - id可以为任意字符串,建议使用FromUserName作为idpublic WxSession getSession(String id, boolean create)
WxCpServicegetSession 在接口中 WxCpServiceid - id可以为任意字符串,建议使用FromUserName作为idcreate - 是否新建public void setSessionManager(WxSessionManager sessionManager)
WxCpService
设置WxSessionManager,只有当需要使用个性化的WxSessionManager的时候才需要调用此方法,
WxCpService默认使用的是StandardSessionManager
setSessionManager 在接口中 WxCpServicesessionManager - 会话管理器public String replaceParty(String mediaId) throws WxErrorException
WxCpServicereplaceParty 在接口中 WxCpServicemediaId - 媒体idWxErrorExceptionpublic String replaceUser(String mediaId) throws WxErrorException
WxCpServicereplaceUser 在接口中 WxCpServicemediaId - 媒体idWxErrorExceptionpublic String getTaskResult(String joinId) throws WxErrorException
WxCpServicegetTaskResult 在接口中 WxCpServiceWxErrorExceptionpublic File getTmpDirFile()
public void setTmpDirFile(File tmpDirFile)
public WxCpDepartmentService getDepartmentService()
WxCpServicegetDepartmentService 在接口中 WxCpServicepublic WxCpMediaService getMediaService()
WxCpServicegetMediaService 在接口中 WxCpServicepublic WxCpMenuService getMenuService()
WxCpServicegetMenuService 在接口中 WxCpServicepublic WxCpOAuth2Service getOauth2Service()
WxCpServicegetOauth2Service 在接口中 WxCpServicepublic WxCpTagService getTagService()
WxCpServicegetTagService 在接口中 WxCpServicepublic WxCpUserService getUserService()
WxCpServicegetUserService 在接口中 WxCpServicepublic WxCpChatService getChatService()
WxCpServicegetChatService 在接口中 WxCpServicepublic RequestHttp<?,?> getRequestHttp()
WxCpServicegetRequestHttp 在接口中 WxCpServicepublic void setUserService(WxCpUserService userService)
setUserService 在接口中 WxCpServicepublic void setDepartmentService(WxCpDepartmentService departmentService)
setDepartmentService 在接口中 WxCpServicepublic void setMediaService(WxCpMediaService mediaService)
setMediaService 在接口中 WxCpServicepublic void setMenuService(WxCpMenuService menuService)
setMenuService 在接口中 WxCpServicepublic void setOauth2Service(WxCpOAuth2Service oauth2Service)
setOauth2Service 在接口中 WxCpServicepublic void setTagService(WxCpTagService tagService)
setTagService 在接口中 WxCpServicepublic WxCpAgentService getAgentService()
getAgentService 在接口中 WxCpServicepublic void setAgentService(WxCpAgentService agentService)
Copyright © 2019. All rights reserved.