|
|
@@ -1292,13 +1292,12 @@ public class WxLoginService implements IWxLoginService {
|
|
|
|
|
|
@Override
|
|
|
public Map<String, String> liveGzh_login(WxLoginBody loginBody) {
|
|
|
-// initData();
|
|
|
-// String param = String.format(gzh_wxAuthParam, gzh_appid, gzh_appsrcret, loginBody.getCode());
|
|
|
-// String resultString = HttpUtils.sendGet(gzh_wxAuthUrl, param);
|
|
|
-// //解析json
|
|
|
-// JSONObject jsonObject = (JSONObject) JSONObject.parse(resultString);
|
|
|
-// String openId = String.valueOf(jsonObject.get("openid"));
|
|
|
- String openId = "omVp-2IJwoD9yY0nmkn03ZRI-Dd0";
|
|
|
+ initData();
|
|
|
+ String param = String.format(gzh_wxAuthParam, gzh_appid, gzh_appsrcret, loginBody.getCode());
|
|
|
+ String resultString = HttpUtils.sendGet(gzh_wxAuthUrl, param);
|
|
|
+ //解析json
|
|
|
+ JSONObject jsonObject = (JSONObject) JSONObject.parse(resultString);
|
|
|
+ String openId = String.valueOf(jsonObject.get("openid"));
|
|
|
User user = iUserService.queryByOpenId(openId);;
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
if (user == null) {
|
|
|
@@ -1355,6 +1354,32 @@ public class WxLoginService implements IWxLoginService {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, String> checkFollowStatus(WxLoginBody loginBody) {
|
|
|
+ initData();
|
|
|
+ String param = String.format(gzh_wxAuthParam, gzh_appid, gzh_appsrcret, loginBody.getCode());
|
|
|
+ String resultString = HttpUtils.sendGet(gzh_wxAuthUrl, param);
|
|
|
+ //解析json
|
|
|
+ JSONObject jsonObject = (JSONObject) JSONObject.parse(resultString);
|
|
|
+ String openId = String.valueOf(jsonObject.get("openid"));
|
|
|
+ String url = "https://api.weixin.qq.com/cgi-bin/user/info";
|
|
|
+ String param2 = String.format(
|
|
|
+ "access_token=%s&openid=%s&lang=zh_CN",
|
|
|
+ getWxGzhAccessToken(), openId
|
|
|
+ );
|
|
|
+ String result = HttpUtils.sendGet(url,param2);
|
|
|
+ JSONObject json = JSONObject.parseObject(result);
|
|
|
+
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
+ if (json.containsKey("subscribe")) {
|
|
|
+ Integer subscribe = json.getInteger("subscribe");
|
|
|
+ map.put("isFollow",subscribe.toString());
|
|
|
+ return map; // 1:关注, 0:未关注
|
|
|
+ }
|
|
|
+ map.put("isFollow","0");
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
public Boolean subGzh(String openId) {
|
|
|
String unionId = getWxGzhUserCgiInfo(openId);
|
|
|
if (Validator.isNotEmpty(unionId)) {
|