fuwencai 4 years ago
parent
commit
b43be2ac90
1 changed files with 9 additions and 8 deletions
  1. 9 8
      src/github.com/baiy/Cadmin-server-go/system/user/user.go

+ 9 - 8
src/github.com/baiy/Cadmin-server-go/system/user/user.go

@@ -82,15 +82,16 @@ func Save(context *admin.Context) (interface{}, error) {
 	if param.Password != "" {
 		password = string(admin.Passworder.Hash([]byte(param.Password)))
 	}
-	if param.LoginType == "2" { //点击发送手机验证码
-		phoneExist, _ := thisModel.GetByPhone(param.Phone)
-		if phoneExist.Id > 0 {
-			if phoneExist.Id != param.Id {
-				return nil, errors.New("手机号已绑定其他账号")
-			} else {
-				return nil, errors.New("手机号与原手机号一致")
-			}
+	phoneExist, _ := thisModel.GetByPhone(param.Phone)
+	if phoneExist.Id > 0 {
+		if phoneExist.Id != param.Id {
+			return nil, errors.New("手机号已绑定其他账号")
+		} else {
+			return nil, errors.New("手机号与原手机号一致")
 		}
+	}
+	if param.LoginType == "2" { //点击发送手机验证码
+
 		if SendPhoneIdentCode(context, param.Phone) {
 			return map[string]interface{}{"status": 3}, nil
 		} else {