cloudroam
2025-03-31 f060439c675cb9185252cfc8f034853290863c62
src/main/java/com/mzl/flower/service/register/SmsService.java
@@ -50,7 +50,8 @@
        if(existsCode(dto.getTel())){
            throw new ValidationException("短信验证码已发送,请勿频繁发送");
        }
        String smsCode = generateSmsCode();
//        String smsCode = generateSmsCode();
        String smsCode ="888888";
        String key;
        if(Constants.USER_TYPE.admin.name().equals(dto.getUserType())){
            key = SMS_CODE_KEY + SEPARATOR + Constants.USER_TYPE.admin.name() + SEPARATOR + dto.getTel();
@@ -66,13 +67,14 @@
        Map<String, String> paramMap = new HashMap<>();
        paramMap.put("code", smsCode);
        try {
            SmsUtil.sendSms(dto.getTel(),smsProperties.getVerificationCode(),paramMap);
            stringCacheClient.set(SMS_CODE_KEY + SEPARATOR + SEPARATOR + dto.getTel(),smsCode,60);
            stringCacheClient.set(key,smsCode,600);
        } catch (ClientException e) {
            throw new RuntimeException("短信发送失败");
        }
//        try {
//            //暂时不实际发送验证码
//            SmsUtil.sendSms(dto.getTel(),smsProperties.getVerificationCode(),paramMap);
        stringCacheClient.set(SMS_CODE_KEY + SEPARATOR + SEPARATOR + dto.getTel(),smsCode,60);
        stringCacheClient.set(key,smsCode,600);
//        } catch (ClientException e) {
//            throw new RuntimeException("短信发送失败");
//        }
        //todo 发送短信
    }