|
|
|
|
@ -5,9 +5,15 @@ import com.flossom.common.core.constant.CacheConstants;
|
|
|
|
|
import com.flossom.common.core.constant.UserConstants;
|
|
|
|
|
import com.flossom.common.core.domain.R;
|
|
|
|
|
import com.flossom.common.core.domain.RegisterBody;
|
|
|
|
|
import com.flossom.common.core.domain.entity.WxScriptMessage;
|
|
|
|
|
import com.flossom.common.core.domain.entity.WxUserMember;
|
|
|
|
|
import com.flossom.common.core.domain.entity.WxUserScriptLog;
|
|
|
|
|
import com.flossom.common.core.enums.MessageTypeEnum;
|
|
|
|
|
import com.flossom.common.core.enums.WxUserIntegralMessageTypeEnum;
|
|
|
|
|
import com.flossom.common.core.exception.ServiceException;
|
|
|
|
|
import com.flossom.common.core.mapper.WxScriptMessageMapper;
|
|
|
|
|
import com.flossom.common.core.mapper.WxUserMemberMapper;
|
|
|
|
|
import com.flossom.common.core.mapper.WxUserScriptLogMapper;
|
|
|
|
|
import com.flossom.common.core.utils.DateUtils;
|
|
|
|
|
import com.flossom.common.redis.service.RedisService;
|
|
|
|
|
import com.flossom.common.security.utils.SecurityUtils;
|
|
|
|
|
@ -42,6 +48,12 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private RedisService redisService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private WxScriptMessageMapper wxScriptMessageMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private WxUserScriptLogMapper wxUserScriptLogMapper;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public LoginUserVo login(String code) throws Exception {
|
|
|
|
|
// 1、使用临时凭证 code 获取 appi + appsecret + unionid
|
|
|
|
|
@ -76,6 +88,17 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
|
|
|
|
|
logger.error("测试后台账号失败:{}", registerResult.getMsg());
|
|
|
|
|
throw new ServiceException(registerResult.getMsg());
|
|
|
|
|
}
|
|
|
|
|
// 2.4、用户注册成功发送消息
|
|
|
|
|
WxScriptMessage wxScriptMessage = wxScriptMessageMapper.selectOneByMessageType(MessageTypeEnum.USER_REGISTRATION.getCode());
|
|
|
|
|
WxUserScriptLog wxUserScriptLog = new WxUserScriptLog();
|
|
|
|
|
BeanUtils.copyProperties(wxScriptMessage, wxUserScriptLog);
|
|
|
|
|
wxUserScriptLog.setId(null);
|
|
|
|
|
wxUserScriptLog.setWxUserId(wxUserMember.getId());
|
|
|
|
|
wxUserScriptLog.setMessageType(WxUserIntegralMessageTypeEnum.USER_REGISTRATION.getCode());
|
|
|
|
|
wxUserScriptLog.setIsCustom(0);
|
|
|
|
|
wxUserScriptLog.setTitile(wxScriptMessage.getMessageTitle());
|
|
|
|
|
wxUserScriptLog.setContent(wxScriptMessage.getMessageContent());
|
|
|
|
|
wxUserScriptLogMapper.insertWxUserScriptLog(wxUserScriptLog);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 3、登录请求,获取 token
|
|
|
|
|
@ -137,6 +160,7 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
WxUserMember update = new WxUserMember();
|
|
|
|
|
update.setId(wxUserMember.getId());
|
|
|
|
|
BeanUtils.copyProperties(userMemberUpdateVo, update);
|
|
|
|
|
update.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
wxUserMemberMapper.updateWxUserMember(update);
|
|
|
|
|
|