|
@@ -86,6 +86,9 @@ public class PassportController {
|
|
|
return Result.error("请输入密码");
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(phone) && StringUtils.isNotBlank(password)) {
|
|
|
+ if(careMemberInfoService.detailByPhone(phone) != null){
|
|
|
+ return Result.error("该账号已经注册");
|
|
|
+ }
|
|
|
CareMemberInfo careMemberInfo = new CareMemberInfo();
|
|
|
careMemberInfo.setPhone(phone);
|
|
|
careMemberInfo.setPassword(DigestUtils.md5Hex(password));
|
|
@@ -101,11 +104,21 @@ public class PassportController {
|
|
|
@GetMapping("getVCode")
|
|
|
@ApiImplicitParams(value = {
|
|
|
@ApiImplicitParam(paramType = "query", name = "phone", value = "电话号码"),
|
|
|
+ @ApiImplicitParam(paramType = "query", name = "type", value = "类型:1手机号注册,2密码重置,3修改注册手机号"),
|
|
|
})
|
|
|
- public Result<String> getVCode(@RequestParam(value = "phone", required = true) String phone) {
|
|
|
+ public Result<String> getVCode(@RequestParam(value = "phone", required = true) String phone,
|
|
|
+ @RequestParam(value = "type", required = true) String type) {
|
|
|
|
|
|
String vcode = String.format("%04d",new Random().nextInt(9999));
|
|
|
- boolean flag = smsSendService.sendSmsCode4RegisterPhone(phone, vcode);
|
|
|
+ boolean flag = false;
|
|
|
+ if("1".equals(type)){
|
|
|
+ flag = smsSendService.sendSmsCode4RegisterPhone(phone, vcode);
|
|
|
+ } else if("2".equals(type)){
|
|
|
+ flag = smsSendService.sendSmsCode4ModifyPassword(phone, vcode);
|
|
|
+ } else if("3".equals(type)){
|
|
|
+ flag = smsSendService.sendSmsCode4ModifyPhone(phone, vcode);
|
|
|
+ }
|
|
|
+
|
|
|
if (flag) {
|
|
|
smsTimeoutCache.put(phone, vcode);
|
|
|
return Result.success();
|
|
@@ -143,7 +156,7 @@ public class PassportController {
|
|
|
if (StringUtils.isBlank(params.getPasswordAgain())) {
|
|
|
return Result.error("请再次输入密码");
|
|
|
}
|
|
|
- if (!params.getPassword().equals(StringUtils.isBlank(params.getPasswordAgain()))) {
|
|
|
+ if (!params.getPassword().equals(params.getPasswordAgain())) {
|
|
|
return Result.error("两次输入密码不一致");
|
|
|
}
|
|
|
if (StringUtils.isBlank(params.getVcode())) {
|