public abstract class BaseWxMpServiceImpl<H,P> extends Object implements WxMpService, RequestHttp<H,P>
| 限定符和类型 | 字段和说明 |
|---|---|
protected WxSessionManager |
sessionManager |
| 构造器和说明 |
|---|
BaseWxMpServiceImpl() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addConfigStorage(String mpId,
WxMpConfigStorage configStorages)
Map 加入新的 WxMpConfigStorage,适用于动态添加新的微信公众号配置 |
String |
buildQrConnectUrl(String redirectURI,
String scope,
String state)
构造第三方使用网站应用授权登录的url.
|
boolean |
checkSignature(String timestamp,
String nonce,
String signature)
验证消息的确来自微信服务器.
|
void |
clearQuota(String appid)
公众号调用或第三方平台帮公众号调用对公众号的所有api调用(包括第三方帮其调用)次数进行清零:
HTTP调用:https://api.weixin.qq.com/cgi-bin/clear_quota?
|
WxJsapiSignature |
createJsapiSignature(String url)
创建调用jsapi时所需要的签名.
|
<T,E> T |
execute(RequestExecutor<T,E> executor,
String uri,
E data)
向微信端发送请求,在这里执行的策略是当发生access_token过期时才去刷新,然后重新执行请求,而不是全局定时请求.
|
<T,E> T |
execute(RequestExecutor<T,E> executor,
WxMpApiUrl url,
E data)
Service没有实现某个API的时候,可以用这个,
比
WxMpService.get(java.lang.String, java.lang.String)和WxMpService.post(java.lang.String, java.lang.String)方法更灵活,可以自己构造RequestExecutor用来处理不同的参数和不同的返回类型。 |
protected <T,E> T |
executeInternal(RequestExecutor<T,E> executor,
String uri,
E data) |
String |
get(String url,
String queryParam)
当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求.
|
String |
get(WxMpApiUrl url,
String queryParam)
当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求.
|
String |
getAccessToken()
获取access_token, 不强制刷新access_token.
|
WxMpAiOpenService |
getAiOpenService()
返回AI开放接口方法的实现类对象,以方便调用其各个接口.
|
WxMpUserBlacklistService |
getBlackListService()
返回用户黑名单管理相关接口方法的实现类对象,以方便调用其各个接口.
|
String[] |
getCallbackIP()
获取微信服务器IP地址
http://mp.weixin.qq.com/wiki/0/2ad4b6bfd29f30f71d39616c2a0fcedc.html
|
WxMpCardService |
getCardService()
返回卡券相关接口方法的实现类对象,以方便调用其各个接口.
|
WxMpCommentService |
getCommentService()
返回评论数据管理接口方法的实现类对象,以方便调用其各个接口.
|
WxMpCurrentAutoReplyInfo |
getCurrentAutoReplyInfo()
获取公众号的自动回复规则.
|
WxMpDataCubeService |
getDataCubeService()
返回数据分析统计相关接口方法的实现类对象,以方便调用其各个接口.
|
WxMpDeviceService |
getDeviceService()
返回硬件平台相关接口方法的实现类对象,以方便调用其各个接口.
|
String |
getJsapiTicket()
获得jsapi_ticket,不强制刷新jsapi_ticket.
|
String |
getJsapiTicket(boolean forceRefresh)
获得jsapi_ticket.
|
WxMpKefuService |
getKefuService()
返回客服接口方法实现类,以方便调用其各个接口.
|
WxMpMarketingService |
getMarketingService()
返回营销相关接口方法的实现类对象,以方便调用其各个接口.
|
WxMpMassMessageService |
getMassMessageService()
返回群发消息相关接口方法的实现类对象,以方便调用其各个接口.
|
WxMpMaterialService |
getMaterialService()
返回素材相关接口方法的实现类对象,以方便调用其各个接口.
|
WxMpMemberCardService |
getMemberCardService()
返回会员卡相关接口方法的实现类对象,以方便调用其各个接口.
|
WxMpMenuService |
getMenuService()
返回菜单相关接口方法的实现类对象,以方便调用其各个接口.
|
WxMpOcrService |
getOcrService()
返回WIFI接口方法的实现类对象,以方便调用其各个接口.
|
WxMpQrcodeService |
getQrcodeService()
返回二维码相关接口方法的实现类对象,以方便调用其各个接口.
|
RequestHttp |
getRequestHttp() |
WxMpShakeService |
getShakeService()
返回摇一摇周边相关接口方法的实现类对象,以方便调用其各个接口.
|
WxMpStoreService |
getStoreService()
返回门店管理相关接口方法的实现类对象,以方便调用其各个接口.
|
WxMpSubscribeMsgService |
getSubscribeMsgService()
返回一次性订阅消息相关接口方法的实现类对象,以方便调用其各个接口.
|
WxMpTemplateMsgService |
getTemplateMsgService()
返回模板消息相关接口方法的实现类对象,以方便调用其各个接口.
|
String |
getTicket(TicketType type)
获得ticket,不强制刷新ticket.
|
String |
getTicket(TicketType type,
boolean forceRefresh)
获得ticket.
|
WxMpUserService |
getUserService()
返回用户相关接口方法的实现类对象,以方便调用其各个接口.
|
WxMpUserTagService |
getUserTagService()
返回用户标签相关接口方法的实现类对象,以方便调用其各个接口.
|
WxMpWifiService |
getWifiService()
返回WIFI接口方法的实现类对象,以方便调用其各个接口.
|
WxMpConfigStorage |
getWxMpConfigStorage()
获取WxMpConfigStorage 对象.
|
String |
oauth2buildAuthorizationUrl(String redirectURI,
String scope,
String state)
构造oauth2授权的url连接.
|
WxMpOAuth2AccessToken |
oauth2getAccessToken(String code)
用code换取oauth2的access token.
|
WxMpUser |
oauth2getUserInfo(WxMpOAuth2AccessToken token,
String lang)
用oauth2获取用户信息, 当前面引导授权时的scope是snsapi_userinfo的时候才可以.
|
WxMpOAuth2AccessToken |
oauth2refreshAccessToken(String refreshToken)
刷新oauth2的access token.
|
boolean |
oauth2validateAccessToken(WxMpOAuth2AccessToken token)
验证oauth2的access token是否有效.
|
String |
post(String url,
String postData)
当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的POST请求.
|
String |
post(WxMpApiUrl url,
String postData)
当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的POST请求.
|
void |
removeConfigStorage(String mpId)
|
WxMpSemanticQueryResult |
semanticQuery(WxMpSemanticQuery semanticQuery)
语义查询接口.
|
void |
setAiOpenService(WxMpAiOpenService aiOpenService) |
void |
setBlackListService(WxMpUserBlacklistService blackListService) |
void |
setCardService(WxMpCardService cardService) |
void |
setCommentService(WxMpCommentService commentService) |
void |
setDataCubeService(WxMpDataCubeService dataCubeService) |
void |
setDeviceService(WxMpDeviceService deviceService) |
void |
setKefuService(WxMpKefuService kefuService) |
void |
setMarketingService(WxMpMarketingService marketingService) |
void |
setMassMessageService(WxMpMassMessageService massMessageService) |
void |
setMaterialService(WxMpMaterialService materialService) |
void |
setMaxRetryTimes(int maxRetryTimes)
设置当微信系统响应系统繁忙时,最大重试次数.
|
void |
setMemberCardService(WxMpMemberCardService memberCardService) |
void |
setMenuService(WxMpMenuService menuService) |
void |
setMultiConfigStorages(Map<String,WxMpConfigStorage> configStorages)
注入多个
WxMpConfigStorage 的实现. |
void |
setMultiConfigStorages(Map<String,WxMpConfigStorage> configStorages,
String defaultMpId)
注入多个
WxMpConfigStorage 的实现. |
void |
setOcrService(WxMpOcrService ocrService) |
void |
setQrCodeService(WxMpQrcodeService qrCodeService) |
void |
setRetrySleepMillis(int retrySleepMillis)
设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试.
|
void |
setShakeService(WxMpShakeService shakeService) |
void |
setStoreService(WxMpStoreService storeService) |
void |
setTagService(WxMpUserTagService tagService) |
void |
setTemplateMsgService(WxMpTemplateMsgService templateMsgService) |
void |
setUserService(WxMpUserService userService) |
void |
setWxMpConfigStorage(WxMpConfigStorage wxConfigProvider)
设置
WxMpConfigStorage 的实现. |
String |
shortUrl(String longUrl)
长链接转短链接接口.
|
boolean |
switchover(String mpId)
进行相应的公众号切换
|
WxMpService |
switchoverTo(String mpId)
进行相应的公众号切换
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAccessToken, initHttpgetRequestHttpClient, getRequestHttpProxy, getRequestTypeprotected WxSessionManager sessionManager
public boolean checkSignature(String timestamp, String nonce, String signature)
WxMpService验证消息的确来自微信服务器. 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421135319&token=&lang=zh_CN
checkSignature 在接口中 WxMpServicepublic String getTicket(TicketType type) throws WxErrorException
WxMpServicegetTicket 在接口中 WxMpServiceWxErrorExceptionWxMpService.getTicket(TicketType, boolean)public String getTicket(TicketType type, boolean forceRefresh) throws WxErrorException
WxMpService获得ticket. 获得时会检查 Token是否过期,如果过期了,那么就刷新一下,否则就什么都不干
getTicket 在接口中 WxMpServiceforceRefresh - 强制刷新WxErrorExceptionpublic String getJsapiTicket() throws WxErrorException
WxMpServicegetJsapiTicket 在接口中 WxMpServiceWxErrorExceptionWxMpService.getJsapiTicket(boolean)public String getJsapiTicket(boolean forceRefresh) throws WxErrorException
WxMpService获得jsapi_ticket. 获得时会检查jsapiToken是否过期,如果过期了,那么就刷新一下,否则就什么都不干 详情请见:http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115&token=&lang=zh_CN
getJsapiTicket 在接口中 WxMpServiceforceRefresh - 强制刷新WxErrorExceptionpublic WxJsapiSignature createJsapiSignature(String url) throws WxErrorException
WxMpService创建调用jsapi时所需要的签名. 详情请见:http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115&token=&lang=zh_CN
createJsapiSignature 在接口中 WxMpServiceWxErrorExceptionpublic String getAccessToken() throws WxErrorException
WxMpServicegetAccessToken 在接口中 WxMpServiceWxErrorExceptionWxMpService.getAccessToken(boolean)public String shortUrl(String longUrl) throws WxErrorException
WxMpService长链接转短链接接口. 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=长链接转短链接接口
shortUrl 在接口中 WxMpServiceWxErrorExceptionpublic WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) throws WxErrorException
WxMpService语义查询接口. 详情请见:http://mp.weixin.qq.com/wiki/index.php?title=语义理解
semanticQuery 在接口中 WxMpServiceWxErrorExceptionpublic String oauth2buildAuthorizationUrl(String redirectURI, String scope, String state)
WxMpService构造oauth2授权的url连接. 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息
oauth2buildAuthorizationUrl 在接口中 WxMpServiceredirectURI - 用户授权完成后的重定向链接,无需urlencode, 方法内会进行encodepublic String buildQrConnectUrl(String redirectURI, String scope, String state)
WxMpService构造第三方使用网站应用授权登录的url. 详情请见: 网站应用微信登录开发指南 URL格式为:https://open.weixin.qq.com/connect/qrconnect?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect
buildQrConnectUrl 在接口中 WxMpServiceredirectURI - 用户授权完成后的重定向链接,无需urlencode, 方法内会进行encodescope - 应用授权作用域,拥有多个作用域用逗号(,)分隔,网页应用目前仅填写snsapi_login即可state - 非必填,用于保持请求和回调的状态,授权请求后原样带回给第三方。该参数可用于防止csrf攻击(跨站请求伪造攻击),建议第三方带上该参数,可设置为简单的随机数加session进行校验public WxMpOAuth2AccessToken oauth2getAccessToken(String code) throws WxErrorException
WxMpService用code换取oauth2的access token. 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息
oauth2getAccessToken 在接口中 WxMpServiceWxErrorExceptionpublic WxMpOAuth2AccessToken oauth2refreshAccessToken(String refreshToken) throws WxErrorException
WxMpService刷新oauth2的access token.
oauth2refreshAccessToken 在接口中 WxMpServiceWxErrorExceptionpublic WxMpUser oauth2getUserInfo(WxMpOAuth2AccessToken token, String lang) throws WxErrorException
WxMpService用oauth2获取用户信息, 当前面引导授权时的scope是snsapi_userinfo的时候才可以.
oauth2getUserInfo 在接口中 WxMpServicelang - zh_CN, zh_TW, enWxErrorExceptionpublic boolean oauth2validateAccessToken(WxMpOAuth2AccessToken token)
WxMpService验证oauth2的access token是否有效.
oauth2validateAccessToken 在接口中 WxMpServicepublic String[] getCallbackIP() throws WxErrorException
WxMpService获取微信服务器IP地址 http://mp.weixin.qq.com/wiki/0/2ad4b6bfd29f30f71d39616c2a0fcedc.html
getCallbackIP 在接口中 WxMpServiceWxErrorExceptionpublic WxMpCurrentAutoReplyInfo getCurrentAutoReplyInfo() throws WxErrorException
WxMpService获取公众号的自动回复规则. http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751299&token=&lang=zh_CN 开发者可以通过该接口,获取公众号当前使用的自动回复规则,包括关注后自动回复、消息自动回复(60分钟内触发一次)、关键词自动回复。 请注意: 1、第三方平台开发者可以通过本接口,在旗下公众号将业务授权给你后,立即通过本接口检测公众号的自动回复配置,并通过接口再次给公众号设置好自动回复规则,以提升公众号运营者的业务体验。 2、本接口仅能获取公众号在公众平台官网的自动回复功能中设置的自动回复规则,若公众号自行开发实现自动回复,或通过第三方平台开发者来实现,则无法获取。 3、认证/未认证的服务号/订阅号,以及接口测试号,均拥有该接口权限。 4、从第三方平台的公众号登录授权机制上来说,该接口从属于消息与菜单权限集。 5、本接口中返回的图片/语音/视频为临时素材(临时素材每次获取都不同,3天内有效,通过素材管理-获取临时素材接口来获取这些素材),本接口返回的图文消息为永久素材素材(通过素材管理-获取永久素材接口来获取这些素材)。 接口调用请求说明 http请求方式: GET(请使用https协议) https://api.weixin.qq.com/cgi-bin/get_current_autoreply_info?access_token=ACCESS_TOKEN
getCurrentAutoReplyInfo 在接口中 WxMpServiceWxErrorExceptionpublic void clearQuota(String appid) throws WxErrorException
WxMpService公众号调用或第三方平台帮公众号调用对公众号的所有api调用(包括第三方帮其调用)次数进行清零: HTTP调用:https://api.weixin.qq.com/cgi-bin/clear_quota?access_token=ACCESS_TOKEN 接口文档地址:https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433744592
clearQuota 在接口中 WxMpServiceappid - 公众号的APPIDWxErrorExceptionpublic String get(String url, String queryParam) throws WxErrorException
WxMpServiceget 在接口中 WxMpServiceurl - 请求接口地址queryParam - 参数WxErrorException - 异常public String get(WxMpApiUrl url, String queryParam) throws WxErrorException
WxMpServiceget 在接口中 WxMpServiceurl - 请求接口地址queryParam - 参数WxErrorException - 异常public String post(String url, String postData) throws WxErrorException
WxMpServicepost 在接口中 WxMpServiceurl - 请求接口地址postData - 请求参数json值WxErrorException - 异常public String post(WxMpApiUrl url, String postData) throws WxErrorException
WxMpServicepost 在接口中 WxMpServiceurl - 请求接口地址postData - 请求参数json值WxErrorException - 异常public <T,E> T execute(RequestExecutor<T,E> executor, WxMpApiUrl url, E data) throws WxErrorException
WxMpServiceService没有实现某个API的时候,可以用这个, 比WxMpService.get(java.lang.String, java.lang.String)和WxMpService.post(java.lang.String, java.lang.String)方法更灵活,可以自己构造RequestExecutor用来处理不同的参数和不同的返回类型。 可以参考,MediaUploadRequestExecutor的实现方法
execute 在接口中 WxMpServiceexecutor - 执行器url - 接口地址data - 参数数据WxErrorException - 异常public <T,E> T execute(RequestExecutor<T,E> executor, String uri, E data) throws WxErrorException
execute 在接口中 WxMpServiceexecutor - 执行器uri - 接口地址data - 参数数据WxErrorException - 异常protected <T,E> T executeInternal(RequestExecutor<T,E> executor, String uri, E data) throws WxErrorException
WxErrorExceptionpublic WxMpConfigStorage getWxMpConfigStorage()
WxMpServicegetWxMpConfigStorage 在接口中 WxMpServicepublic void setWxMpConfigStorage(WxMpConfigStorage wxConfigProvider)
WxMpServiceWxMpConfigStorage 的实现. 兼容老版本setWxMpConfigStorage 在接口中 WxMpServicepublic void setMultiConfigStorages(Map<String,WxMpConfigStorage> configStorages)
WxMpServicesetMultiConfigStorages 在接口中 WxMpServiceconfigStorages - WxMpConfigStorage mappublic void setMultiConfigStorages(Map<String,WxMpConfigStorage> configStorages, String defaultMpId)
WxMpServicesetMultiConfigStorages 在接口中 WxMpServiceconfigStorages - WxMpConfigStorage mapdefaultMpId - 设置一个WxMpConfigStorage 所对应的mpId进行Http初始化public void addConfigStorage(String mpId, WxMpConfigStorage configStorages)
WxMpServiceMap 加入新的 WxMpConfigStorage,适用于动态添加新的微信公众号配置addConfigStorage 在接口中 WxMpServiceconfigStorages - 新的微信配置public void removeConfigStorage(String mpId)
WxMpServiceremoveConfigStorage 在接口中 WxMpServicempId - 对应公众号的标识public WxMpService switchoverTo(String mpId)
WxMpServiceswitchoverTo 在接口中 WxMpServicempId - 公众号标识public boolean switchover(String mpId)
WxMpServiceswitchover 在接口中 WxMpServicempId - 公众号标识public void setRetrySleepMillis(int retrySleepMillis)
WxMpServicesetRetrySleepMillis 在接口中 WxMpServiceretrySleepMillis - 默认:1000mspublic void setMaxRetryTimes(int maxRetryTimes)
WxMpService设置当微信系统响应系统繁忙时,最大重试次数. 默认:5次
setMaxRetryTimes 在接口中 WxMpServicepublic WxMpKefuService getKefuService()
WxMpServicegetKefuService 在接口中 WxMpServicepublic WxMpMaterialService getMaterialService()
WxMpServicegetMaterialService 在接口中 WxMpServicepublic WxMpMenuService getMenuService()
WxMpServicegetMenuService 在接口中 WxMpServicepublic WxMpUserService getUserService()
WxMpServicegetUserService 在接口中 WxMpServicepublic WxMpUserTagService getUserTagService()
WxMpServicegetUserTagService 在接口中 WxMpServicepublic WxMpQrcodeService getQrcodeService()
WxMpServicegetQrcodeService 在接口中 WxMpServicepublic WxMpCardService getCardService()
WxMpServicegetCardService 在接口中 WxMpServicepublic WxMpDataCubeService getDataCubeService()
WxMpServicegetDataCubeService 在接口中 WxMpServicepublic WxMpUserBlacklistService getBlackListService()
WxMpServicegetBlackListService 在接口中 WxMpServicepublic WxMpStoreService getStoreService()
WxMpServicegetStoreService 在接口中 WxMpServicepublic WxMpTemplateMsgService getTemplateMsgService()
WxMpServicegetTemplateMsgService 在接口中 WxMpServicepublic WxMpSubscribeMsgService getSubscribeMsgService()
WxMpServicegetSubscribeMsgService 在接口中 WxMpServicepublic WxMpDeviceService getDeviceService()
WxMpServicegetDeviceService 在接口中 WxMpServicepublic WxMpShakeService getShakeService()
WxMpServicegetShakeService 在接口中 WxMpServicepublic WxMpMemberCardService getMemberCardService()
WxMpServicegetMemberCardService 在接口中 WxMpServicepublic RequestHttp getRequestHttp()
getRequestHttp 在接口中 WxMpServicepublic WxMpMassMessageService getMassMessageService()
WxMpServicegetMassMessageService 在接口中 WxMpServicepublic void setKefuService(WxMpKefuService kefuService)
setKefuService 在接口中 WxMpServicepublic void setMaterialService(WxMpMaterialService materialService)
setMaterialService 在接口中 WxMpServicepublic void setMenuService(WxMpMenuService menuService)
setMenuService 在接口中 WxMpServicepublic void setUserService(WxMpUserService userService)
setUserService 在接口中 WxMpServicepublic void setTagService(WxMpUserTagService tagService)
setTagService 在接口中 WxMpServicepublic void setQrCodeService(WxMpQrcodeService qrCodeService)
setQrCodeService 在接口中 WxMpServicepublic void setCardService(WxMpCardService cardService)
setCardService 在接口中 WxMpServicepublic void setStoreService(WxMpStoreService storeService)
setStoreService 在接口中 WxMpServicepublic void setDataCubeService(WxMpDataCubeService dataCubeService)
setDataCubeService 在接口中 WxMpServicepublic void setBlackListService(WxMpUserBlacklistService blackListService)
setBlackListService 在接口中 WxMpServicepublic void setTemplateMsgService(WxMpTemplateMsgService templateMsgService)
setTemplateMsgService 在接口中 WxMpServicepublic void setDeviceService(WxMpDeviceService deviceService)
setDeviceService 在接口中 WxMpServicepublic void setShakeService(WxMpShakeService shakeService)
setShakeService 在接口中 WxMpServicepublic void setMemberCardService(WxMpMemberCardService memberCardService)
setMemberCardService 在接口中 WxMpServicepublic void setMassMessageService(WxMpMassMessageService massMessageService)
setMassMessageService 在接口中 WxMpServicepublic WxMpAiOpenService getAiOpenService()
WxMpServicegetAiOpenService 在接口中 WxMpServicepublic void setAiOpenService(WxMpAiOpenService aiOpenService)
setAiOpenService 在接口中 WxMpServicepublic WxMpWifiService getWifiService()
WxMpServicegetWifiService 在接口中 WxMpServicepublic WxMpOcrService getOcrService()
WxMpServicegetOcrService 在接口中 WxMpServicepublic WxMpMarketingService getMarketingService()
WxMpServicegetMarketingService 在接口中 WxMpServicepublic void setMarketingService(WxMpMarketingService marketingService)
setMarketingService 在接口中 WxMpServicepublic void setOcrService(WxMpOcrService ocrService)
setOcrService 在接口中 WxMpServicepublic WxMpCommentService getCommentService()
WxMpServicegetCommentService 在接口中 WxMpServicepublic void setCommentService(WxMpCommentService commentService)
setCommentService 在接口中 WxMpServiceCopyright © 2019. All rights reserved.