短信验证码

This commit is contained in:
18792927508
2023-10-17 21:07:53 +08:00
parent 5d2fdedfcf
commit 305529fefc
3 changed files with 6 additions and 5 deletions
@@ -37,7 +37,7 @@ public class WeChatUserController extends BaseController {
if(StrUtil.isEmpty(userVO.getPhone())){ if(StrUtil.isEmpty(userVO.getPhone())){
return warn("手机号不能为空"); return warn("手机号不能为空");
} }
return success(weChatUserService.sendCode(userVO)); return weChatUserService.sendCode(userVO);
} }
/** /**
* 小程序注册 * 小程序注册
@@ -11,7 +11,7 @@ import com.ruoyi.wisdomarbitrate.domain.vo.WeChatUserVO;
public interface WeChatUserService { public interface WeChatUserService {
String sendCode(WeChatUserVO userVO); AjaxResult sendCode(WeChatUserVO userVO);
AjaxResult registerUser(IdentityAuthentication ientityAuthentication); AjaxResult registerUser(IdentityAuthentication ientityAuthentication);
@@ -53,7 +53,7 @@ public class WeChatUserServiceImpl implements WeChatUserService {
private IdentityAuthenticationMapper identityAuthenticationMapper; private IdentityAuthenticationMapper identityAuthenticationMapper;
@Override @Override
public String sendCode(WeChatUserVO userVO) { public AjaxResult sendCode(WeChatUserVO userVO) {
Random random = new Random(); Random random = new Random();
String code = ""; String code = "";
@@ -69,9 +69,10 @@ public class WeChatUserServiceImpl implements WeChatUserService {
Boolean flag = SmsUtils.sendSms(request); Boolean flag = SmsUtils.sendSms(request);
if(flag){ if(flag){
setCodeCache(userVO.getPhone(),code); setCodeCache(userVO.getPhone(),code);
return "短信发送成功"; return AjaxResult.success("短信发送成功");
}else {
return AjaxResult.warn("短信发送失败");
} }
return "短信发送失败";
} }
/** /**
* 设置验证码缓存 * 设置验证码缓存