mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-04 18:10:10 +08:00
update 短信验证码
This commit is contained in:
@@ -131,9 +131,9 @@ public class MemberService {
|
||||
public void checkVerificationCode(MemberRegisterAndLoginDTO dto) {
|
||||
// 取出缓存中的验证码进行对比,如果缓存中没有,则超时
|
||||
String captchaCode = redisCache.getCacheObject(CacheConstants.SMS_VERIFICATION_CODE_KEY + dto.getMobileNumber());
|
||||
if (StringUtils.isEmpty(captchaCode)) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_VERIFICATION_CODE_TIMEOUT_ERROR);
|
||||
}
|
||||
// if (StringUtils.isEmpty(captchaCode)) {
|
||||
// throw new BusinessException(ReturnCodeEnum.CODE_VERIFICATION_CODE_TIMEOUT_ERROR);
|
||||
// }
|
||||
// 获取通用验证码
|
||||
String commonCaptchaCode = redisCache.getCacheObject(CacheConstants.SMS_COMMON_VERIFICATION_CODE_KEY + dto.getMobileNumber());
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.jsowell.common.util;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.github.qcloudsms.SmsSingleSender;
|
||||
import com.github.qcloudsms.SmsSingleSenderResult;
|
||||
import com.github.qcloudsms.httpclient.HTTPException;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -15,6 +17,7 @@ import java.io.IOException;
|
||||
/**
|
||||
* 发送短信验证码工具类
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SMSUtil {
|
||||
|
||||
@@ -52,6 +55,7 @@ public class SMSUtil {
|
||||
SmsSingleSenderResult result = ssender.sendWithParam(NATION_CODE, phoneNumber, TEMPLATE_ID, params, SMS_SIGN, "", "");
|
||||
if (result.result != 0) {
|
||||
reStr = "error";
|
||||
log.error("发送验证码失败:{}", JSON.toJSONString(result));
|
||||
} else {
|
||||
// 改为保存redis
|
||||
String redisKey = CacheConstants.SMS_VERIFICATION_CODE_KEY + phoneNumber;
|
||||
|
||||
Reference in New Issue
Block a user