|
|
|
@ -53,7 +53,6 @@ public class AppServiceImpl implements AppService {
@@ -53,7 +53,6 @@ public class AppServiceImpl implements AppService {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 发送手机验证码 |
|
|
|
|
* 网关调用短信发送验证码返回前端 |
|
|
|
|
* @param phone 手机号 |
|
|
|
|
* @return code |
|
|
|
|
*/ |
|
|
|
@ -64,15 +63,10 @@ public class AppServiceImpl implements AppService {
@@ -64,15 +63,10 @@ public class AppServiceImpl implements AppService {
|
|
|
|
|
log.info("手机号验证码未过期:{},{}", phone, codeObj); |
|
|
|
|
return R.ok(Boolean.FALSE, "验证码发送过频繁"); |
|
|
|
|
} |
|
|
|
|
String code = RandomUtil.randomNumbers(Integer.parseInt(SecurityConstants.PHONE_CODE_SIZE)); |
|
|
|
|
int code = smsClient.sendVerificationCode("ali-code", phone); |
|
|
|
|
log.info("手机号生成验证码成功:{},{}", phone, code); |
|
|
|
|
redisTemplate.opsForValue().set(CacheConstants.VERIFICATION_CODE + phone, code, SecurityConstants.CODE_TIME, TimeUnit.SECONDS); |
|
|
|
|
smsClient.send(SmsTemplate.builder() |
|
|
|
|
.templateCode(code) |
|
|
|
|
.phoneNumbers(ListUtil.of(phone)) |
|
|
|
|
.signName("长沙康来") |
|
|
|
|
.build()); |
|
|
|
|
return R.ok(Boolean.TRUE, code); |
|
|
|
|
redisTemplate.opsForValue().set(CacheConstants.VERIFICATION_CODE + phone, String.valueOf(code), SecurityConstants.CODE_TIME, TimeUnit.SECONDS); |
|
|
|
|
return R.ok(Boolean.TRUE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|