Ver código fonte

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

chao 3 anos atrás
pai
commit
4c1596afe2

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