public class WxMpServiceImpl extends Object implements WxMpService
限定符和类型 | 字段和说明 |
---|---|
protected org.slf4j.Logger |
log |
protected WxSessionManager |
sessionManager |
SIMPLE_DATE_FORMAT
构造器和说明 |
---|
WxMpServiceImpl() |
限定符和类型 | 方法和说明 |
---|---|
boolean |
checkSignature(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
|
void |
customMessageSend(WxMpCustomMessage message)
发送客服消息
详情请见: http://mp.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
|
String |
getAccessToken(boolean forceRefresh)
获取access_token,本方法线程安全
且在多线程同时刷新时只刷新一次,避免超出2000次/日的调用次数上限
另:本service的所有方法都会在access_token过期是调用此方法
程序员在非必要情况下尽量不要主动调用此方法
详情请见: http://mp.weixin.qq.com/wiki/index.php?
|
String[] |
getCallbackIP()
获取微信服务器IP地址
http://mp.weixin.qq.com/wiki/0/2ad4b6bfd29f30f71d39616c2a0fcedc.html
|
WxMpCardService |
getCardService()
返回卡券相关接口的方法实现类,以方便调用个其各种接口
|
WxMpDataCubeService |
getDataCubeService()
返回数据分析统计相关接口的方法实现类,以方便调用个其各种接口
|
WxMpGroupService |
getGroupService()
返回用户分组相关接口的方法实现类,以方便调用个其各种接口
|
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()
返回二维码相关接口的方法实现类,以方便调用个其各种接口
|
WxMpUserService |
getUserService()
返回用户相关接口的方法实现类,以方便调用个其各种接口
|
WxMpConfigStorage |
getWxMpConfigStorage()
获取WxMpConfigStorage 对象
|
WxMpMassSendResult |
massGroupMessageSend(WxMpMassGroupMessage 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
在接口中 WxMpService
public String getAccessToken() throws WxErrorException
WxMpService
getAccessToken
在接口中 WxMpService
WxErrorException
WxMpService.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
在接口中 WxMpService
forceRefresh
- 强制刷新WxErrorException
public String getJsapiTicket() throws WxErrorException
WxMpService
getJsapiTicket
在接口中 WxMpService
WxErrorException
WxMpService.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
在接口中 WxMpService
forceRefresh
- 强制刷新WxErrorException
public 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
在接口中 WxMpService
WxErrorException
public void customMessageSend(WxMpCustomMessage message) throws WxErrorException
WxMpService
发送客服消息 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=发送客服消息
customMessageSend
在接口中 WxMpService
WxErrorException
public 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(WxMpMassGroupMessage 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
在接口中 WxMpService
WxErrorException
public 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
在接口中 WxMpService
WxErrorException
public 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
在接口中 WxMpService
Exception
public String shortUrl(String long_url) throws WxErrorException
WxMpService
长链接转短链接接口 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=长链接转短链接接口
shortUrl
在接口中 WxMpService
WxErrorException
public String templateSend(WxMpTemplateMessage templateMessage) throws WxErrorException
WxMpService
发送模板消息 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=模板消息接口
templateSend
在接口中 WxMpService
WxErrorException
public 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
在接口中 WxMpService
WxErrorException
public 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
在接口中 WxMpService
WxErrorException
public WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) throws WxErrorException
WxMpService
语义查询接口 详情请见:http://mp.weixin.qq.com/wiki/index.php?title=语义理解
semanticQuery
在接口中 WxMpService
WxErrorException
public String oauth2buildAuthorizationUrl(String redirectURI, String scope, String state)
WxMpService
构造oauth2授权的url连接 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息
oauth2buildAuthorizationUrl
在接口中 WxMpService
redirectURI
- 用户授权完成后的重定向链接,无需urlencode, 方法内会进行encodepublic WxMpOAuth2AccessToken oauth2getAccessToken(String code) throws WxErrorException
WxMpService
用code换取oauth2的access token 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息
oauth2getAccessToken
在接口中 WxMpService
WxErrorException
public WxMpOAuth2AccessToken oauth2refreshAccessToken(String refreshToken) throws WxErrorException
WxMpService
刷新oauth2的access token
oauth2refreshAccessToken
在接口中 WxMpService
WxErrorException
public WxMpUser oauth2getUserInfo(WxMpOAuth2AccessToken oAuth2AccessToken, String lang) throws WxErrorException
WxMpService
用oauth2获取用户信息, 当前面引导授权时的scope是snsapi_userinfo的时候才可以
oauth2getUserInfo
在接口中 WxMpService
lang
- zh_CN, zh_TW, enWxErrorException
public boolean oauth2validateAccessToken(WxMpOAuth2AccessToken oAuth2AccessToken)
WxMpService
验证oauth2的access token是否有效
oauth2validateAccessToken
在接口中 WxMpService
public String[] getCallbackIP() throws WxErrorException
WxMpService
获取微信服务器IP地址 http://mp.weixin.qq.com/wiki/0/2ad4b6bfd29f30f71d39616c2a0fcedc.html
getCallbackIP
在接口中 WxMpService
WxErrorException
public String get(String url, String queryParam) throws WxErrorException
WxMpService
get
在接口中 WxMpService
WxErrorException
public String post(String url, String postData) throws WxErrorException
WxMpService
post
在接口中 WxMpService
WxErrorException
public <T,E> T execute(RequestExecutor<T,E> executor, String uri, E data) throws WxErrorException
execute
在接口中 WxMpService
WxErrorException
protected <T,E> T executeInternal(RequestExecutor<T,E> executor, String uri, E data) throws WxErrorException
WxErrorException
public org.apache.http.HttpHost getHttpProxy()
public org.apache.http.impl.client.CloseableHttpClient getHttpclient()
public void setWxMpConfigStorage(WxMpConfigStorage wxConfigProvider)
WxMpService
WxMpConfigStorage
的实现setWxMpConfigStorage
在接口中 WxMpService
public WxMpConfigStorage getWxMpConfigStorage()
WxMpService
getWxMpConfigStorage
在接口中 WxMpService
public void setRetrySleepMillis(int retrySleepMillis)
WxMpService
设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试 默认:1000ms
setRetrySleepMillis
在接口中 WxMpService
public void setMaxRetryTimes(int maxRetryTimes)
WxMpService
设置当微信系统响应系统繁忙时,最大重试次数 默认:5次
setMaxRetryTimes
在接口中 WxMpService
public WxMpKefuService getKefuService()
WxMpService
getKefuService
在接口中 WxMpService
public WxMpMaterialService getMaterialService()
WxMpService
getMaterialService
在接口中 WxMpService
public WxMpMenuService getMenuService()
WxMpService
getMenuService
在接口中 WxMpService
public WxMpUserService getUserService()
WxMpService
getUserService
在接口中 WxMpService
public WxMpGroupService getGroupService()
WxMpService
getGroupService
在接口中 WxMpService
public WxMpQrcodeService getQrcodeService()
WxMpService
getQrcodeService
在接口中 WxMpService
public WxMpCardService getCardService()
WxMpService
getCardService
在接口中 WxMpService
public WxMpPayService getPayService()
WxMpService
getPayService
在接口中 WxMpService
public WxMpDataCubeService getDataCubeService()
WxMpService
getDataCubeService
在接口中 WxMpService
Copyright © 2016. All rights reserved.