From b4151b62ebfb069686f918829425a6befdc5c0eb Mon Sep 17 00:00:00 2001 From: aqiangaqiang <11317238+aqiangaqiang@user.noreply.gitee.com> Date: Fri, 10 May 2024 00:59:31 +0000 Subject: [PATCH] =?UTF-8?q?=E3=80=90System=E6=A8=A1=E5=9D=97=E3=80=91?= =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E9=AA=8C=E8=AF=81=E7=A0=81=E5=89=8D=E7=BD=AE?= =?UTF-8?q?=E8=A1=A5=E9=9B=B6=E5=AF=B9=E5=85=B6endCode=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: aqiangaqiang <11317238+aqiangaqiang@user.noreply.gitee.com> --- .../yudao/module/system/service/sms/SmsCodeServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsCodeServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsCodeServiceImpl.java index 79162c623..de84605ef 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsCodeServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsCodeServiceImpl.java @@ -67,7 +67,8 @@ public class SmsCodeServiceImpl implements SmsCodeService { } // 创建验证码记录 - String code = String.valueOf(randomInt(smsCodeProperties.getBeginCode(), smsCodeProperties.getEndCode() + 1)); + String code = String.format("%0" + smsCodeProperties.getEndCode().toString().length() + "d", + randomInt(smsCodeProperties.getBeginCode(), smsCodeProperties.getEndCode() + 1)); SmsCodeDO newSmsCode = SmsCodeDO.builder().mobile(mobile).code(code).scene(scene) .todayIndex(lastSmsCode != null && isToday(lastSmsCode.getCreateTime()) ? lastSmsCode.getTodayIndex() + 1 : 1) .createIp(ip).used(false).build();