public class WxMpServiceImpl extends Object implements WxMpService
| 限定符和类型 | 字段和说明 |
|---|---|
protected org.slf4j.Logger |
log |
protected WxSessionManager |
sessionManager |
| 构造器和说明 |
|---|
WxMpServiceImpl() |
| 限定符和类型 | 方法和说明 | ||
|---|---|---|---|
String |
buildQrConnectUrl(String redirectURI,
String scope,
String state)
构造第三方使用网站应用授权登录的url
详情请见:
booleancheckSignature(String timestamp,
String nonce,
String signature)
验证推送过来的消息的正确性
详情请见: http://mp.weixin.qq.com/wiki/index.php?
| ||
WxJsapiSignature |
createJsapiSignature(String url)
创建调用jsapi时所需要的签名
详情请见:http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html#.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
|
||
<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
|
||
String |
getAccessToken(boolean forceRefresh)
获取access_token,本方法线程安全
且在多线程同时刷新时只刷新一次,避免超出2000次/日的调用次数上限
另:本service的所有方法都会在access_token过期是调用此方法
程序员在非必要情况下尽量不要主动调用此方法
详情请见: http://mp.weixin.qq.com/wiki/index.php?
|
||
WxMpUserBlacklistService |
getBlackListService()
返回用户黑名单管理相关接口方法的实现类对象,以方便调用其各种接口
|
||
String[] |
getCallbackIP()
获取微信服务器IP地址
http://mp.weixin.qq.com/wiki/0/2ad4b6bfd29f30f71d39616c2a0fcedc.html
|
||
WxMpCardService |
getCardService()
返回卡券相关接口方法的实现类对象,以方便调用个其各种接口
|
||
WxMpDataCubeService |
getDataCubeService()
返回数据分析统计相关接口方法的实现类对象,以方便调用个其各种接口
|
||
org.apache.http.impl.client.CloseableHttpClient |
getHttpclient() |
||
org.apache.http.HttpHost |
getHttpProxy() |
||
WxMpIndustry |
getIndustry()
获取设置的行业信息
详情请见:http://mp.weixin.qq.com/wiki/5/6dde9eaa909f83354e0094dc3ad99e05.html#.E8.AE.BE.E7.BD.AE.E6.89.80.E5.B1.9E.E8.A1.8C.E4.B8.9A
|
||
String |
getJsapiTicket()
获得jsapi_ticket,不强制刷新jsapi_ticket
|
||
String |
getJsapiTicket(boolean forceRefresh)
获得jsapi_ticket
获得时会检查jsapiToken是否过期,如果过期了,那么就刷新一下,否则就什么都不干
详情请见:http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html#.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
|
||
WxMpKefuService |
getKefuService()
返回客服接口方法实现类,以方便调用个其各种接口
|
||
WxMpMaterialService |
getMaterialService()
返回素材相关接口方法的实现类对象,以方便调用个其各种接口
|
||
WxMpMenuService |
getMenuService()
返回菜单相关接口方法的实现类对象,以方便调用个其各种接口
|
||
WxMpPayService |
getPayService()
返回微信支付相关接口方法的实现类对象,以方便调用个其各种接口
|
||
WxMpQrcodeService |
getQrcodeService()
返回二维码相关接口方法的实现类对象,以方便调用个其各种接口
|
||
WxMpStoreService |
getStoreService()
返回门店管理相关接口方法的实现类对象,以方便调用其各种接口
|
||
WxMpUserService |
getUserService()
返回用户相关接口方法的实现类对象,以方便调用个其各种接口
|
||
WxMpUserTagService |
getUserTagService()
返回用户标签相关接口方法的实现类对象,以方便调用个其各种接口
|
||
WxMpConfigStorage |
getWxMpConfigStorage()
获取WxMpConfigStorage 对象
|
||
WxMpMassSendResult |
massGroupMessageSend(WxMpMassTagMessage message)
分组群发消息
如果发送图文消息,必须先使用
WxMpService.massNewsUpload(me.chanjar.weixin.mp.bean.WxMpMassNews) 获得media_id,然后再发送
如果发送视频消息,必须先使用 WxMpService.massVideoUpload(me.chanjar.weixin.mp.bean.WxMpMassVideo) 获得media_id,然后再发送
详情请见: http://mp.weixin.qq.com/wiki/index.php? |
||
WxMpMassSendResult |
massMessagePreview(WxMpMassPreviewMessage wxMpMassPreviewMessage)
预览接口
详情请见:http://mp.weixin.qq.com/wiki/15/40b6865b893947b764e2de8e4a1fb55f.html#.E9.A2.84.E8.A7.88.E6.8E.A5.E5.8F.A3.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91
|
||
WxMpMassUploadResult |
massNewsUpload(WxMpMassNews news)
上传群发用的图文消息,上传后才能群发图文消息
详情请见: http://mp.weixin.qq.com/wiki/index.php?
|
||
WxMpMassSendResult |
massOpenIdsMessageSend(WxMpMassOpenIdsMessage message)
按openId列表群发消息
如果发送图文消息,必须先使用
WxMpService.massNewsUpload(me.chanjar.weixin.mp.bean.WxMpMassNews) 获得media_id,然后再发送
如果发送视频消息,必须先使用 WxMpService.massVideoUpload(me.chanjar.weixin.mp.bean.WxMpMassVideo) 获得media_id,然后再发送
详情请见: http://mp.weixin.qq.com/wiki/index.php? |
||
WxMpMassUploadResult |
massVideoUpload(WxMpMassVideo video)
上传群发用的视频,上传后才能群发视频消息
详情请见: http://mp.weixin.qq.com/wiki/index.php?
|
||
String |
oauth2buildAuthorizationUrl(String redirectURI,
String scope,
String state)
构造oauth2授权的url连接
详情请见: http://mp.weixin.qq.com/wiki/index.php?
|
||
WxMpOAuth2AccessToken |
oauth2getAccessToken(String code)
用code换取oauth2的access token
详情请见: http://mp.weixin.qq.com/wiki/index.php?
|
||
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请求
|
||
WxMpSemanticQueryResult |
semanticQuery(WxMpSemanticQuery semanticQuery)
语义查询接口
详情请见:http://mp.weixin.qq.com/wiki/index.php?
|
||
String |
setIndustry(WxMpIndustry wxMpIndustry)
设置所属行业
官方文档中暂未告知响应内容
详情请见:http://mp.weixin.qq.com/wiki/5/6dde9eaa909f83354e0094dc3ad99e05.html#.E8.AE.BE.E7.BD.AE.E6.89.80.E5.B1.9E.E8.A1.8C.E4.B8.9A
|
||
void |
setMaxRetryTimes(int maxRetryTimes)
设置当微信系统响应系统繁忙时,最大重试次数
默认:5次
|
||
void |
setRetrySleepMillis(int retrySleepMillis)
设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试
默认:1000ms
|
||
void |
setWxMpConfigStorage(WxMpConfigStorage wxConfigProvider)
注入
WxMpConfigStorage 的实现 |
||
String |
shortUrl(String long_url)
长链接转短链接接口
详情请见: http://mp.weixin.qq.com/wiki/index.php?
|
||
String |
templateSend(WxMpTemplateMessage templateMessage)
发送模板消息
详情请见: http://mp.weixin.qq.com/wiki/index.php?
|
protected final org.slf4j.Logger log
protected WxSessionManager sessionManager
public boolean checkSignature(String timestamp, String nonce, String signature)
WxMpService验证推送过来的消息的正确性 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=验证消息真实性
checkSignature 在接口中 WxMpServicepublic String getAccessToken() throws WxErrorException
WxMpServicegetAccessToken 在接口中 WxMpServiceWxErrorExceptionWxMpService.getAccessToken(boolean)public String getAccessToken(boolean forceRefresh) throws WxErrorException
WxMpService获取access_token,本方法线程安全 且在多线程同时刷新时只刷新一次,避免超出2000次/日的调用次数上限 另:本service的所有方法都会在access_token过期是调用此方法 程序员在非必要情况下尽量不要主动调用此方法 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=获取access_token
getAccessToken 在接口中 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/7/aaa137b55fb2e0456bf8dd9148dd613f.html#.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 在接口中 WxMpServiceforceRefresh - 强制刷新WxErrorExceptionpublic WxJsapiSignature createJsapiSignature(String url) throws WxErrorException
WxMpService创建调用jsapi时所需要的签名 详情请见:http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html#.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 在接口中 WxMpServiceWxErrorExceptionpublic WxMpMassUploadResult massNewsUpload(WxMpMassNews news) throws WxErrorException
WxMpService上传群发用的图文消息,上传后才能群发图文消息 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=高级群发接口
public WxMpMassUploadResult massVideoUpload(WxMpMassVideo video) throws WxErrorException
WxMpService上传群发用的视频,上传后才能群发视频消息 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=高级群发接口
public WxMpMassSendResult massGroupMessageSend(WxMpMassTagMessage message) throws WxErrorException
WxMpService分组群发消息 如果发送图文消息,必须先使用WxMpService.massNewsUpload(me.chanjar.weixin.mp.bean.WxMpMassNews)获得media_id,然后再发送 如果发送视频消息,必须先使用WxMpService.massVideoUpload(me.chanjar.weixin.mp.bean.WxMpMassVideo)获得media_id,然后再发送 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=高级群发接口
massGroupMessageSend 在接口中 WxMpServiceWxErrorExceptionpublic WxMpMassSendResult massOpenIdsMessageSend(WxMpMassOpenIdsMessage message) throws WxErrorException
WxMpService按openId列表群发消息 如果发送图文消息,必须先使用WxMpService.massNewsUpload(me.chanjar.weixin.mp.bean.WxMpMassNews)获得media_id,然后再发送 如果发送视频消息,必须先使用WxMpService.massVideoUpload(me.chanjar.weixin.mp.bean.WxMpMassVideo)获得media_id,然后再发送 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=高级群发接口
massOpenIdsMessageSend 在接口中 WxMpServiceWxErrorExceptionpublic WxMpMassSendResult massMessagePreview(WxMpMassPreviewMessage wxMpMassPreviewMessage) throws Exception
WxMpService预览接口 详情请见:http://mp.weixin.qq.com/wiki/15/40b6865b893947b764e2de8e4a1fb55f.html#.E9.A2.84.E8.A7.88.E6.8E.A5.E5.8F.A3.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91
massMessagePreview 在接口中 WxMpServiceExceptionpublic String shortUrl(String long_url) throws WxErrorException
WxMpService长链接转短链接接口 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=长链接转短链接接口
shortUrl 在接口中 WxMpServiceWxErrorExceptionpublic String templateSend(WxMpTemplateMessage templateMessage) throws WxErrorException
WxMpService发送模板消息 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=模板消息接口
templateSend 在接口中 WxMpServiceWxErrorExceptionpublic String setIndustry(WxMpIndustry wxMpIndustry) throws WxErrorException
WxMpService设置所属行业 官方文档中暂未告知响应内容 详情请见:http://mp.weixin.qq.com/wiki/5/6dde9eaa909f83354e0094dc3ad99e05.html#.E8.AE.BE.E7.BD.AE.E6.89.80.E5.B1.9E.E8.A1.8C.E4.B8.9A
setIndustry 在接口中 WxMpServiceWxErrorExceptionpublic WxMpIndustry getIndustry() throws WxErrorException
WxMpService获取设置的行业信息 详情请见:http://mp.weixin.qq.com/wiki/5/6dde9eaa909f83354e0094dc3ad99e05.html#.E8.AE.BE.E7.BD.AE.E6.89.80.E5.B1.9E.E8.A1.8C.E4.B8.9A
getIndustry 在接口中 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 oAuth2AccessToken, String lang) throws WxErrorException
WxMpService用oauth2获取用户信息, 当前面引导授权时的scope是snsapi_userinfo的时候才可以
oauth2getUserInfo 在接口中 WxMpServicelang - zh_CN, zh_TW, enWxErrorExceptionpublic boolean oauth2validateAccessToken(WxMpOAuth2AccessToken oAuth2AccessToken)
WxMpService验证oauth2的access token是否有效
oauth2validateAccessToken 在接口中 WxMpServicepublic String[] getCallbackIP() throws WxErrorException
WxMpService获取微信服务器IP地址 http://mp.weixin.qq.com/wiki/0/2ad4b6bfd29f30f71d39616c2a0fcedc.html
getCallbackIP 在接口中 WxMpServiceWxErrorExceptionpublic String get(String url, String queryParam) throws WxErrorException
WxMpServiceget 在接口中 WxMpServiceWxErrorExceptionpublic String post(String url, String postData) throws WxErrorException
WxMpServicepost 在接口中 WxMpServiceWxErrorExceptionpublic <T,E> T execute(RequestExecutor<T,E> executor, String uri, E data) throws WxErrorException
execute 在接口中 WxMpServiceWxErrorExceptionprotected <T,E> T executeInternal(RequestExecutor<T,E> executor, String uri, E data) throws WxErrorException
WxErrorExceptionpublic org.apache.http.HttpHost getHttpProxy()
public org.apache.http.impl.client.CloseableHttpClient getHttpclient()
public void setWxMpConfigStorage(WxMpConfigStorage wxConfigProvider)
WxMpServiceWxMpConfigStorage 的实现setWxMpConfigStorage 在接口中 WxMpServicepublic WxMpConfigStorage getWxMpConfigStorage()
WxMpServicegetWxMpConfigStorage 在接口中 WxMpServicepublic void setRetrySleepMillis(int retrySleepMillis)
WxMpService设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试 默认:1000ms
setRetrySleepMillis 在接口中 WxMpServicepublic 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 WxMpPayService getPayService()
WxMpServicegetPayService 在接口中 WxMpServicepublic WxMpDataCubeService getDataCubeService()
WxMpServicegetDataCubeService 在接口中 WxMpServicepublic WxMpUserBlacklistService getBlackListService()
WxMpServicegetBlackListService 在接口中 WxMpServicepublic WxMpStoreService getStoreService()
WxMpServicegetStoreService 在接口中 WxMpServiceCopyright © 2016. All rights reserved.