소스 검색

fix: 验证码

shc 2 년 전
부모
커밋
c1e0ca814d
1개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 4
      hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/MobileServiceImpl.java

+ 4 - 4
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/MobileServiceImpl.java

@@ -261,16 +261,16 @@ public class MobileServiceImpl implements MobileService {
 		final String key = CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.SMS.getType() + StringPool.AT + mobile + "@fina";
 		Object code = redisTemplate.opsForValue().get(key);
 
-		code = Objects.isNull(code) ? (need ? RandomUtil.randomNumbers(Integer.parseInt(SecurityConstants.CODE_SIZE)) : "5657") : code;
+		final String codeStr = Objects.isNull(code) ? (need ? RandomUtil.randomNumbers(Integer.parseInt(SecurityConstants.CODE_SIZE)) : "5657") : code.toString();
 
 		boolean res = false;
 		try {
 			if (need) {
-				res = SendSms.sendSmsCode1(mobile, code);
+				res = SendSms.sendSmsCode1(mobile, codeStr);
 			}
-			log.debug("手机号生成验证码成功:{},{}", mobile, code);
+			log.debug("手机号生成验证码成功:{},{}", mobile, codeStr);
 
-			redisTemplate.opsForValue().set(key, code, SecurityConstants.CODE_TIME, TimeUnit.SECONDS);
+			redisTemplate.opsForValue().set(key, codeStr, SecurityConstants.CODE_TIME, TimeUnit.SECONDS);
 		} catch (ClientException | InterruptedException e) {
 			log.error("手机号生成验证码失败", e);
 		}