提交 416c68b9 authored 作者: 李秋林's avatar 李秋林

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

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