public class WeChatMP extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
WECHAT_MP_WEB_LANG_EN |
static String |
WECHAT_MP_WEB_LANG_ZHCN |
static String |
WECHAT_MP_WEB_LANG_ZHTW |
static String |
WECHAT_MP_WEB_SCOPE_BASE |
static String |
WECHAT_MP_WEB_SCOPE_USERINFO |
| Constructor and Description |
|---|
WeChatMP(WeChatMPConfig config,
WeChatMPEventHandler eventHandler,
WeChatMPHttpClient httpClient,
WeChatMPAccessTokenStorage atStorage) |
| Modifier and Type | Method and Description |
|---|---|
String |
getAccessToken() |
WeChatUserInfo |
getUserInfo(String openid) |
String |
incomingMessage(String signature,
int timestamp,
String nonce,
String encryptType,
String msgSignature,
String body)
Call this method when you have a incoming request.
|
boolean |
isEncrypted() |
<T extends PushJSONFormat> |
pushMessage(T message)
Push message to WeChat platform.
|
String |
validate(String signature,
String echostr,
int timestamp,
String nonce)
Call this method when you have incoming validate request.
It is usually GET request for your endpoint. |
String |
webpageAuthorize(String redirectURI,
String scope,
String state)
微信公众号网页授权
http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html
|
String |
webpageProcessCallback(String code,
String state) |
WeChatUserInfo |
webpageUserInfo(String openId,
String lang) |
public static final String WECHAT_MP_WEB_SCOPE_BASE
public static final String WECHAT_MP_WEB_SCOPE_USERINFO
public static final String WECHAT_MP_WEB_LANG_ZHCN
public static final String WECHAT_MP_WEB_LANG_ZHTW
public static final String WECHAT_MP_WEB_LANG_EN
public WeChatMP(WeChatMPConfig config, WeChatMPEventHandler eventHandler, WeChatMPHttpClient httpClient, WeChatMPAccessTokenStorage atStorage)
public boolean isEncrypted()
public String validate(String signature, String echostr, int timestamp, String nonce)
signature - echostr - timestamp - nonce - public String incomingMessage(String signature, int timestamp, String nonce, String encryptType, String msgSignature, String body)
signature - From request query string 'signature'timestamp - From request query string 'timestamp'nonce - From request query string 'nonce'encryptType - From request query string 'encrypt_type'msgSignature - From request query string 'msg_signature'body - From request bodyWeChatException - When there is underlying exception thrown, public String getAccessToken()
public WeChatUserInfo getUserInfo(String openid)
public <T extends PushJSONFormat> void pushMessage(T message)
message - public String webpageAuthorize(String redirectURI, String scope, String state) throws UnsupportedEncodingException
redirectURI - 需要确保域名已经加入到信任列表scope - 请从WECHAT_MP_WEB_SCOPE_BASE和WECHAT_MP_WEB_SCOPE_USERINFO中选择state - UnsupportedEncodingExceptionpublic String webpageProcessCallback(String code, String state)
code - state - public WeChatUserInfo webpageUserInfo(String openId, String lang)
Copyright © 2014. All rights reserved.