Просмотр исходного кода

Merge remote-tracking branch 'origin/developerA' into developerB

zhijiezhao 3 лет назад
Родитель
Сommit
4acce22a87
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      src/main/java/com/caimei365/user/service/impl/HeHeServiceImpl.java

+ 7 - 0
src/main/java/com/caimei365/user/service/impl/HeHeServiceImpl.java

@@ -13,6 +13,7 @@ import com.caimei365.user.utils.AliyunSmsUtil;
 import com.caimei365.user.utils.CodeUtil;
 import com.caimei365.user.utils.CodeUtil;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpHeaders;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
@@ -37,6 +38,8 @@ public class HeHeServiceImpl implements HeHeService {
     private WeChatService weChatService;
     private WeChatService weChatService;
     @Resource
     @Resource
     private RedisService redisService;
     private RedisService redisService;
+    @Value("${spring.cloud.config.profile}")
+    private String active;
 
 
     @Override
     @Override
     public ResponseJson<HeHeUserVo> authorization(String code, HttpHeaders headers) {
     public ResponseJson<HeHeUserVo> authorization(String code, HttpHeaders headers) {
@@ -62,6 +65,10 @@ public class HeHeServiceImpl implements HeHeService {
         Date date = new Date();
         Date date = new Date();
         String currentTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
         String currentTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
         String redisSmsCode = (String) redisService.get("heCode:" + heHeUserDto.getMobile());
         String redisSmsCode = (String) redisService.get("heCode:" + heHeUserDto.getMobile());
+        if (!"prod".equals(active)) {
+            // 本地和测试环境默认验证码为666666
+            redisSmsCode = "666666";
+        }
         if (null != redisSmsCode && !"null".equals(redisSmsCode)) {
         if (null != redisSmsCode && !"null".equals(redisSmsCode)) {
             if (redisSmsCode.equals(heHeUserDto.getVerificationCode())) {
             if (redisSmsCode.equals(heHeUserDto.getVerificationCode())) {
                 HeHeUserVo heHeUser = heHeMapper.findHeHeUserByMobile(heHeUserDto.getMobile());
                 HeHeUserVo heHeUser = heHeMapper.findHeHeUserByMobile(heHeUserDto.getMobile());