|
@@ -119,8 +119,8 @@ public class WxGzhServiceImpl implements IWxGzhService {
|
|
|
// 区分消息类型
|
|
|
String msgType = jsonObjectData.getStr("MsgType");
|
|
|
//获取用户信息
|
|
|
-// String userInfoResult = wxSendService.userInfo(this.getGzhToken(), fromUserName, "zh_CN");
|
|
|
-// JSONObject jsonObj = JSONObject.parseObject(userInfoResult);
|
|
|
+ String userInfoResult = wxSendService.userInfo(this.getGzhToken(), fromUserName, "zh_CN");
|
|
|
+ JSONObject jsonObj = JSONObject.parseObject(userInfoResult);
|
|
|
|
|
|
// 普通消息
|
|
|
if (MessageUtil.MESSAGE_TEXT.equals(msgType)) { // 文本消息
|
|
@@ -136,7 +136,12 @@ public class WxGzhServiceImpl implements IWxGzhService {
|
|
|
if (MessageUtil.MESSAGE_SUBSCRIBE.equals(event)) { // 关注事件 或 扫描二维码关注事件
|
|
|
log.info("3.1...");
|
|
|
String res = wxSendService.userInfo( this.getGzhToken(), fromUserName, "zh_CN");
|
|
|
-
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
+ String unionId = jsonObject.getString("unionid");
|
|
|
+ UserInfo user = userService.getStudentByUnionid(unionId);
|
|
|
+ UserInfo userInfo = new UserInfo();
|
|
|
+ userInfo.setGzhOpenid(fromUserName);
|
|
|
+ userInfo.setUnionId(unionId);
|
|
|
//存在Ticket为扫码关注
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(jsonObjectData.getStr("Ticket"))){
|
|
|
log.info("3.1.2..");
|