public interface WxMpService
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addConfigStorage(String mpId,
WxMpConfigStorage configStorage)
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 url,
E data)
Service没有实现某个API的时候,可以用这个,
比
get(java.lang.String, java.lang.String)和post(java.lang.String, java.lang.String)方法更灵活,可以自己构造RequestExecutor用来处理不同的参数和不同的返回类型。 |
<T,E> T |
execute(RequestExecutor<T,E> executor,
WxMpApiUrl url,
E data)
Service没有实现某个API的时候,可以用这个,
比
get(java.lang.String, java.lang.String)和post(java.lang.String, java.lang.String)方法更灵活,可以自己构造RequestExecutor用来处理不同的参数和不同的返回类型。 |
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.
|
String |
getAccessToken(boolean forceRefresh)
获取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()
返回硬件平台相关接口方法的实现类对象,以方便调用其各个接口.
|
WxMpImgProcService |
getImgProcService()
返回图像处理接口的实现类对象,以方便调用其各个接口.
|
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()
获取RequestHttp对象.
|
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 对象.
|
void |
initHttp()
初始化http请求对象.
|
WxNetCheckResult |
netCheck(String action,
String operator)
网络检测
https://mp.weixin.qq.com/wiki?
|
String |
oauth2buildAuthorizationUrl(String redirectURI,
String scope,
String state)
构造oauth2授权的url连接.
|
WxMpOAuth2AccessToken |
oauth2getAccessToken(String code)
用code换取oauth2的access token.
|
WxMpUser |
oauth2getUserInfo(WxMpOAuth2AccessToken oAuth2AccessToken,
String lang)
用oauth2获取用户信息, 当前面引导授权时的scope是snsapi_userinfo的时候才可以.
|
WxMpOAuth2AccessToken |
oauth2refreshAccessToken(String refreshToken)
刷新oauth2的access token.
|
boolean |
oauth2validateAccessToken(WxMpOAuth2AccessToken oAuth2AccessToken)
验证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)
从 Map中 移除
mpId 所对应的 WxMpConfigStorage,适用于动态移除微信公众号配置. |
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 |
setImgProcService(WxMpImgProcService imgProcService)
.
|
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)
进行相应的公众号切换.
|
boolean checkSignature(String timestamp, String nonce, String signature)
验证消息的确来自微信服务器. 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421135319&token=&lang=zh_CN
String getAccessToken() throws WxErrorException
WxErrorExceptiongetAccessToken(boolean)String getAccessToken(boolean forceRefresh) throws WxErrorException
获取access_token,本方法线程安全. 且在多线程同时刷新时只刷新一次,避免超出2000次/日的调用次数上限 另:本service的所有方法都会在access_token过期时调用此方法 程序员在非必要情况下尽量不要主动调用此方法 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140183&token=&lang=zh_CN
forceRefresh - 强制刷新WxErrorExceptionString getTicket(TicketType type) throws WxErrorException
String getTicket(TicketType type, boolean forceRefresh) throws WxErrorException
获得ticket. 获得时会检查 Token是否过期,如果过期了,那么就刷新一下,否则就什么都不干
forceRefresh - 强制刷新WxErrorExceptionString getJsapiTicket() throws WxErrorException
WxErrorExceptiongetJsapiTicket(boolean)String getJsapiTicket(boolean forceRefresh) throws WxErrorException
获得jsapi_ticket. 获得时会检查jsapiToken是否过期,如果过期了,那么就刷新一下,否则就什么都不干 详情请见:http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115&token=&lang=zh_CN
forceRefresh - 强制刷新WxErrorExceptionWxJsapiSignature createJsapiSignature(String url) throws WxErrorException
创建调用jsapi时所需要的签名. 详情请见:http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115&token=&lang=zh_CN
WxErrorExceptionString shortUrl(String longUrl) throws WxErrorException
长链接转短链接接口. 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=长链接转短链接接口
WxErrorExceptionWxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) throws WxErrorException
语义查询接口. 详情请见:http://mp.weixin.qq.com/wiki/index.php?title=语义理解
WxErrorExceptionString buildQrConnectUrl(String redirectURI, String scope, String state)
构造第三方使用网站应用授权登录的url. 详情请见: 网站应用微信登录开发指南 URL格式为:https://open.weixin.qq.com/connect/qrconnect?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect
redirectURI - 用户授权完成后的重定向链接,无需urlencode, 方法内会进行encodescope - 应用授权作用域,拥有多个作用域用逗号(,)分隔,网页应用目前仅填写snsapi_login即可state - 非必填,用于保持请求和回调的状态,授权请求后原样带回给第三方。该参数可用于防止csrf攻击(跨站请求伪造攻击),建议第三方带上该参数,可设置为简单的随机数加session进行校验String oauth2buildAuthorizationUrl(String redirectURI, String scope, String state)
构造oauth2授权的url连接. 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息
redirectURI - 用户授权完成后的重定向链接,无需urlencode, 方法内会进行encodeWxMpOAuth2AccessToken oauth2getAccessToken(String code) throws WxErrorException
用code换取oauth2的access token. 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息
WxErrorExceptionWxMpOAuth2AccessToken oauth2refreshAccessToken(String refreshToken) throws WxErrorException
刷新oauth2的access token.
WxErrorExceptionWxMpUser oauth2getUserInfo(WxMpOAuth2AccessToken oAuth2AccessToken, String lang) throws WxErrorException
用oauth2获取用户信息, 当前面引导授权时的scope是snsapi_userinfo的时候才可以.
lang - zh_CN, zh_TW, enWxErrorExceptionboolean oauth2validateAccessToken(WxMpOAuth2AccessToken oAuth2AccessToken)
验证oauth2的access token是否有效.
String[] getCallbackIP() throws WxErrorException
获取微信服务器IP地址 http://mp.weixin.qq.com/wiki/0/2ad4b6bfd29f30f71d39616c2a0fcedc.html
WxErrorExceptionWxNetCheckResult netCheck(String action, String operator) throws WxErrorException
网络检测 https://mp.weixin.qq.com/wiki?t=resource/res_main&id=21541575776DtsuT 为了帮助开发者排查回调连接失败的问题,提供这个网络检测的API。它可以对开发者URL做域名解析,然后对所有IP进行一次ping操作,得到丢包率和耗时。
action - 执行的检测动作operator - 指定平台从某个运营商进行检测WxErrorException - .WxMpCurrentAutoReplyInfo getCurrentAutoReplyInfo() throws WxErrorException
获取公众号的自动回复规则. 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
WxErrorExceptionvoid clearQuota(String appid) throws WxErrorException
公众号调用或第三方平台帮公众号调用对公众号的所有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
appid - 公众号的APPIDWxErrorExceptionString get(String url, String queryParam) throws WxErrorException
queryParam - 参数url - 请求接口地址WxErrorException - 异常String post(String url, String postData) throws WxErrorException
postData - 请求参数json值url - 请求接口地址WxErrorException - 异常<T,E> T execute(RequestExecutor<T,E> executor, String url, E data) throws WxErrorException
Service没有实现某个API的时候,可以用这个, 比get(java.lang.String, java.lang.String)和post(java.lang.String, java.lang.String)方法更灵活,可以自己构造RequestExecutor用来处理不同的参数和不同的返回类型。 可以参考,MediaUploadRequestExecutor的实现方法
data - 参数数据executor - 执行器url - 接口地址WxErrorException - 异常String get(WxMpApiUrl url, String queryParam) throws WxErrorException
queryParam - 参数url - 请求接口地址WxErrorException - 异常String post(WxMpApiUrl url, String postData) throws WxErrorException
postData - 请求参数json值url - 请求接口地址WxErrorException - 异常<T,E> T execute(RequestExecutor<T,E> executor, WxMpApiUrl url, E data) throws WxErrorException
Service没有实现某个API的时候,可以用这个, 比get(java.lang.String, java.lang.String)和post(java.lang.String, java.lang.String)方法更灵活,可以自己构造RequestExecutor用来处理不同的参数和不同的返回类型。 可以参考,MediaUploadRequestExecutor的实现方法
data - 参数数据executor - 执行器url - 接口地址WxErrorException - 异常void setRetrySleepMillis(int retrySleepMillis)
retrySleepMillis - 默认:1000msvoid setMaxRetryTimes(int maxRetryTimes)
设置当微信系统响应系统繁忙时,最大重试次数. 默认:5次
maxRetryTimes - 最大重试次数WxMpConfigStorage getWxMpConfigStorage()
void setWxMpConfigStorage(WxMpConfigStorage wxConfigProvider)
WxMpConfigStorage 的实现. 兼容老版本wxConfigProvider - .void addConfigStorage(String mpId, WxMpConfigStorage configStorage)
WxMpConfigStorage,适用于动态添加新的微信公众号配置.mpId - 公众号idconfigStorage - 新的微信配置void removeConfigStorage(String mpId)
mpId 所对应的 WxMpConfigStorage,适用于动态移除微信公众号配置.mpId - 对应公众号的标识void setMultiConfigStorages(Map<String,WxMpConfigStorage> configStorages)
configStorages - WxMpConfigStorage mapvoid setMultiConfigStorages(Map<String,WxMpConfigStorage> configStorages, String defaultMpId)
configStorages - WxMpConfigStorage mapdefaultMpId - 设置一个WxMpConfigStorage 所对应的mpId进行Http初始化boolean switchover(String mpId)
mpId - 公众号标识WxMpService switchoverTo(String mpId)
mpId - 公众号标识WxMpKefuService getKefuService()
WxMpMaterialService getMaterialService()
WxMpMenuService getMenuService()
WxMpUserService getUserService()
WxMpUserTagService getUserTagService()
WxMpQrcodeService getQrcodeService()
WxMpCardService getCardService()
WxMpDataCubeService getDataCubeService()
WxMpUserBlacklistService getBlackListService()
WxMpStoreService getStoreService()
WxMpTemplateMsgService getTemplateMsgService()
WxMpSubscribeMsgService getSubscribeMsgService()
WxMpDeviceService getDeviceService()
WxMpShakeService getShakeService()
WxMpMemberCardService getMemberCardService()
WxMpMarketingService getMarketingService()
void initHttp()
RequestHttp getRequestHttp()
WxMpMassMessageService getMassMessageService()
WxMpAiOpenService getAiOpenService()
WxMpWifiService getWifiService()
WxMpOcrService getOcrService()
WxMpImgProcService getImgProcService()
void setKefuService(WxMpKefuService kefuService)
kefuService - .void setMaterialService(WxMpMaterialService materialService)
materialService - .void setMenuService(WxMpMenuService menuService)
menuService - .void setUserService(WxMpUserService userService)
userService - .void setTagService(WxMpUserTagService tagService)
tagService - .void setQrCodeService(WxMpQrcodeService qrCodeService)
qrCodeService - .void setCardService(WxMpCardService cardService)
cardService - .void setStoreService(WxMpStoreService storeService)
storeService - .void setDataCubeService(WxMpDataCubeService dataCubeService)
dataCubeService - .void setBlackListService(WxMpUserBlacklistService blackListService)
blackListService - .void setTemplateMsgService(WxMpTemplateMsgService templateMsgService)
templateMsgService - .void setDeviceService(WxMpDeviceService deviceService)
deviceService - .void setShakeService(WxMpShakeService shakeService)
shakeService - .void setMemberCardService(WxMpMemberCardService memberCardService)
memberCardService - .void setMassMessageService(WxMpMassMessageService massMessageService)
massMessageService - .void setAiOpenService(WxMpAiOpenService aiOpenService)
aiOpenService - .void setMarketingService(WxMpMarketingService marketingService)
marketingService - .void setOcrService(WxMpOcrService ocrService)
ocrService - .void setImgProcService(WxMpImgProcService imgProcService)
imgProcService - .WxMpCommentService getCommentService()
void setCommentService(WxMpCommentService commentService)
commentService - .Copyright © 2019. All rights reserved.