提交 c8b61054 authored 作者: 000516's avatar 000516 提交者: Coding

促销员注册时,如果是本地或测试环境,则不进行验证码判断

促销员注册时,如果是本地或测试环境,则不进行验证码判断
......@@ -28,5 +28,5 @@ docker run -d -p 8011:8011 --name promotion-service \
-v /var/logs/xxl_job/:/var/logs/xxl_job/ \
--restart=always \
--network host \
--spring.profiles.active=qa \
promotion-service:latest
\ No newline at end of file
promotion-service:latest \
--spring.profiles.active=qa
\ No newline at end of file
package com.wangxiaolu.promotion.controller.activity.temporary;
import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.promotion.common.redis.RedisKeys;
import com.wangxiaolu.promotion.common.redis.service.RedisCache;
import com.wangxiaolu.promotion.enums.activity.TemActApproveStatus;
import com.wangxiaolu.promotion.exception.ParamException;
......@@ -31,8 +29,6 @@ import java.util.Objects;
@RestController
@RequestMapping("/activity/temporary/core")
public class TemporaryActivityCoreController {
@Autowired
private RedisCache redisCache;
@Autowired
private TemporaryActivityCoreService tempActivityCoreService;
@Autowired
......
package com.wangxiaolu.promotion.controller.user.tem;
import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.promotion.common.redis.RedisKeys;
import com.wangxiaolu.promotion.common.redis.service.RedisCache;
import com.wangxiaolu.promotion.common.util.DataUtils;
import com.wangxiaolu.promotion.common.util.EnvUtil;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto;
import com.wangxiaolu.promotion.pojo.user.vo.WxTemporaryEnrollVo;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.wechat.WeChatUserCoreService;
import com.wangxiaolu.promotion.common.util.DataUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
......@@ -31,9 +31,11 @@ import org.springframework.web.bind.annotation.RestController;
public class TemporaryInfoCoreController {
@Autowired
WeChatUserCoreService weChatUserCoreService;
private WeChatUserCoreService weChatUserCoreService;
@Autowired
private RedisCache redisCache;
@Autowired
RedisCache redisCache;
private EnvUtil envUtil;
/**
* 促销员注册信息
......@@ -53,12 +55,14 @@ public class TemporaryInfoCoreController {
/**
* 手机号-验证码 校验
*/
String redisKey = RedisKeys.UserKeys.PHONE_VER_CODE.getKey() + wxTemporaryEnrollVo.getPhone();
String phoneCodeOld = redisCache.get(redisKey);
if (StringUtils.isBlank(phoneCodeOld) || !phoneCodeOld.equals(wxTemporaryEnrollVo.getPhoneCode())) {
throw new ParamException(RCode.TENCENT_SMS_PHONE_CODE_ERROR, null);
if (envUtil.isLive()) {
String redisKey = RedisKeys.UserKeys.PHONE_VER_CODE.getKey() + wxTemporaryEnrollVo.getPhone();
String phoneCodeOld = redisCache.get(redisKey);
if (StringUtils.isBlank(phoneCodeOld) || !phoneCodeOld.equals(wxTemporaryEnrollVo.getPhoneCode())) {
throw new ParamException(RCode.TENCENT_SMS_PHONE_CODE_ERROR, null);
}
redisCache.removeKey(redisKey);
}
redisCache.removeKey(redisKey);
WxTemporaryInfoDto temporaryDto = new WxTemporaryInfoDto();
BeanUtils.copyProperties(wxTemporaryEnrollVo, temporaryDto);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论