|
|
@@ -5,11 +5,13 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.cyksj.common.constant.Constant;
|
|
|
import com.cyksj.common.util.Codec;
|
|
|
+import com.cyksj.common.util.Jsons;
|
|
|
import com.cyksj.config.WeChatConfig;
|
|
|
import com.cyksj.mapper.UserMapper;
|
|
|
import com.cyksj.mapper.WxAppMapper;
|
|
|
import com.cyksj.mapper.WxSyncLogMapper;
|
|
|
import com.cyksj.mapper.gzh.UserGzhRelationMapper;
|
|
|
+import com.cyksj.model.dto.GzhBodyDto;
|
|
|
import com.cyksj.model.dto.GzhUnionidUserinfo;
|
|
|
import com.cyksj.model.dto.MsgEvent;
|
|
|
import com.cyksj.model.entity.User;
|
|
|
@@ -115,10 +117,19 @@ public class EventMsgService implements GzhMsgService {
|
|
|
user.setUnionid(info.getUnionid());
|
|
|
userMapper.insert(user);
|
|
|
|
|
|
- Object sharedIdObj = redisService.get(RedisService.key.WX_GZH_QRCODE_SHARED_LOGIN.getNameFormat(sceneKey));
|
|
|
- if (sharedIdObj != null) {
|
|
|
- Long sharedId = Long.parseLong(sharedIdObj.toString());
|
|
|
- distributeService.saveDistributionInvitation(sharedId, user.getId());
|
|
|
+ Object gzhDtoObj = redisService.get(RedisService.key.WX_GZH_QRCODE_SHARED_LOGIN.getNameFormat(sceneKey));
|
|
|
+ if (gzhDtoObj != null) {
|
|
|
+ GzhBodyDto gzhBodyDto = Jsons.parseObject(gzhDtoObj, GzhBodyDto.class);
|
|
|
+ Long sharedId = gzhBodyDto.getSharedId();
|
|
|
+ if (sharedId != null) {
|
|
|
+ distributeService.saveDistributionInvitation(sharedId, user.getId());
|
|
|
+ }
|
|
|
+ Long popularizeId = gzhBodyDto.getPopularizeId();
|
|
|
+ if (popularizeId != null) {
|
|
|
+ userMapper.update(null, Wrappers.lambdaUpdate(User.class)
|
|
|
+ .eq(User::getId, user.getId())
|
|
|
+ .set(User::getPopularizeId, popularizeId));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
saveGzhUserRelation(msgEvent, user.getId(), openId, info.getUnionid(), sceneKey);
|