|
@@ -102,13 +102,17 @@ public class TMessageCodeController {
|
|
@ApiOperation(value = "发送忘记密码验证码")
|
|
@ApiOperation(value = "发送忘记密码验证码")
|
|
@PostMapping("/sentForgetCode")
|
|
@PostMapping("/sentForgetCode")
|
|
public ResponseModel<?> sentForgetCode(String ifForeign, String username, String phoneOrEmail) {
|
|
public ResponseModel<?> sentForgetCode(String ifForeign, String username, String phoneOrEmail) {
|
|
|
|
+
|
|
if (StringUtils.isEmpty(username)) {
|
|
if (StringUtils.isEmpty(username)) {
|
|
return R.fail(ResponseCodesEnum.A0100, "用户名为空!");
|
|
return R.fail(ResponseCodesEnum.A0100, "用户名为空!");
|
|
}
|
|
}
|
|
|
|
+ if (ifForeign.equals("2")) {
|
|
|
|
+ ifForeign = "0";
|
|
|
|
+ }
|
|
// 如果是国内
|
|
// 如果是国内
|
|
if (ifForeign.equals("0")) {
|
|
if (ifForeign.equals("0")) {
|
|
if (StringUtils.isEmpty(phoneOrEmail)) {
|
|
if (StringUtils.isEmpty(phoneOrEmail)) {
|
|
- return R.fail(ResponseCodesEnum.A0100, "手机号为空!");
|
|
|
|
|
|
+ return R.fail(ResponseCodesEnum.A0100, "手机号或邮箱为空!");
|
|
}
|
|
}
|
|
// 定义国内手机号和邮箱的正则表达式
|
|
// 定义国内手机号和邮箱的正则表达式
|
|
String phoneReg = "^1[3-9]\\d{9}$";
|
|
String phoneReg = "^1[3-9]\\d{9}$";
|
|
@@ -138,7 +142,7 @@ public class TMessageCodeController {
|
|
if (list.size() <= 0) { // 邮箱未注册
|
|
if (list.size() <= 0) { // 邮箱未注册
|
|
return R.fail(ResponseCodesEnum.A0001, "登录名或邮箱出错");
|
|
return R.fail(ResponseCodesEnum.A0001, "登录名或邮箱出错");
|
|
}
|
|
}
|
|
- //国外发邮件
|
|
|
|
|
|
+ //国内发邮件
|
|
String result = tMessageCodeService.sentEmail("1", phoneOrEmail);
|
|
String result = tMessageCodeService.sentEmail("1", phoneOrEmail);
|
|
return R.ok(result);
|
|
return R.ok(result);
|
|
} else {
|
|
} else {
|
|
@@ -157,7 +161,7 @@ public class TMessageCodeController {
|
|
if (list.size() <= 0) {
|
|
if (list.size() <= 0) {
|
|
return R.fail(ResponseCodesEnum.A0001, "登录名或邮箱出错");
|
|
return R.fail(ResponseCodesEnum.A0001, "登录名或邮箱出错");
|
|
}
|
|
}
|
|
- //国外发邮件
|
|
|
|
|
|
+ //海外发邮件
|
|
String result = tMessageCodeService.sentEmail("1", phoneOrEmail);
|
|
String result = tMessageCodeService.sentEmail("1", phoneOrEmail);
|
|
return R.ok(result);
|
|
return R.ok(result);
|
|
}
|
|
}
|
|
@@ -170,6 +174,9 @@ public class TMessageCodeController {
|
|
if (StringUtils.isEmpty(code)) {
|
|
if (StringUtils.isEmpty(code)) {
|
|
return R.fail(ResponseCodesEnum.A0100, "验证码为空!");
|
|
return R.fail(ResponseCodesEnum.A0100, "验证码为空!");
|
|
}
|
|
}
|
|
|
|
+ if (ifForeign.equals("2")) {
|
|
|
|
+ ifForeign = "0";
|
|
|
|
+ }
|
|
LambdaQueryWrapper<TMessageCode> query2 = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<TMessageCode> query2 = Wrappers.lambdaQuery();
|
|
if (ifForeign.equals("0")) {
|
|
if (ifForeign.equals("0")) {
|
|
query2.eq(TMessageCode::getPhone, phoneOrEmail);
|
|
query2.eq(TMessageCode::getPhone, phoneOrEmail);
|