|
@@ -82,6 +82,42 @@ public class AppUserInfoController {
|
|
|
return AesDecryptUtil.decryptEncryptedData(jsonObject.get("encryptedData").toString(), jsonObject.get("sessionKey").toString(), jsonObject.get("iv").toString(), "UTF-8").toString();
|
|
|
}
|
|
|
|
|
|
+ //判断使用小程序支付的用户是否关注公众号
|
|
|
+ @RequestMapping(value = "/whetherFollowGzh", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public String whetherFollowGzh(@RequestParam String unionId, Integer stationId){
|
|
|
+ Gson gson =new Gson();
|
|
|
+ //返回结果集
|
|
|
+ ResultData resultData = null;
|
|
|
+ if (unionId !=null){
|
|
|
+ Map<String, String> param = new HashMap<>();
|
|
|
+ param.put("unionId", unionId);
|
|
|
+ param.put("userType", "1");
|
|
|
+ String openId = appUserInfoService.whetherFollowGzh(param);
|
|
|
+ if(openId !=null){
|
|
|
+ Map<String, String> m = stationService.getStationAppIdAndAppSecret(stationId);
|
|
|
+ String gzhAppId ="";
|
|
|
+ String gzhAppSecret ="";
|
|
|
+ String accessToken ="";
|
|
|
+ if(m !=null && m.containsKey("gzhAppId") && m.containsKey("gzhAppSecret")){
|
|
|
+ gzhAppId = m.get("gzhAppId");
|
|
|
+ gzhAppSecret = m.get("gzhAppSecret");
|
|
|
+ accessToken = this.getTokenByRedisCache(gzhAppId, gzhAppSecret);
|
|
|
+ net.sf.json.JSONObject unionIdInfo = WeiXinUserUtil.getUnionIdInfo(accessToken, openId);
|
|
|
+ if(unionIdInfo.containsKey("subscribe") && unionIdInfo.get("subscribe").equals("1")){
|
|
|
+ resultData = ResultData.success(CodeMsg.SUCCESS);
|
|
|
+ }else {
|
|
|
+ resultData = ResultData.error(CodeMsg.NO_FollowGzh);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ resultData = ResultData.error(CodeMsg.USERGZHINFO_EXSIST);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return gson.toJson(resultData);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//获取公众号信息
|
|
|
@RequestMapping(value = "/getGzhUserInfo", method = RequestMethod.GET)
|
|
|
@ResponseBody
|