|
|
@@ -2,6 +2,7 @@ package com.mrxu.framework.common.weixin.api;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.mrxu.framework.common.weixin.base.WxHttp;
|
|
|
+import com.mrxu.framework.common.weixin.bean.AuthorizationInfo;
|
|
|
import com.mrxu.framework.common.weixin.bean.ComponentToken;
|
|
|
import com.mrxu.framework.common.weixin.bean.Preauthcode;
|
|
|
|
|
|
@@ -11,6 +12,8 @@ public class ComponentTokenApi {
|
|
|
|
|
|
private static String createPreauthcode = "https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=";
|
|
|
|
|
|
+ private static String query_auth = "https://api.weixin.qq.com/cgi-bin/component/api_query_auth?component_access_token=";
|
|
|
+
|
|
|
// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/token/component_access_token.html
|
|
|
public static ComponentToken getToken(String componentAppid, String componentAppsecret,String componentVerifyTicket) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
@@ -32,4 +35,17 @@ public class ComponentTokenApi {
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/token/authorization_info.html
|
|
|
+ * 使用授权码获取授权信息
|
|
|
+ */
|
|
|
+ public static AuthorizationInfo queryAuth(String componentAppid, String componentAccessToken, String authorizationCode) {
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ json.put("component_appid", componentAppid);
|
|
|
+ json.put("authorization_code", authorizationCode);
|
|
|
+ AuthorizationInfo rs = WxHttp.post(AuthorizationInfo.class,createPreauthcode+componentAccessToken,json);
|
|
|
+ return rs;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|