xingzai před 7 měsíci
rodič
revize
e7a2f9fe84
2 změnil soubory, kde provedl 23 přidání a 11 odebrání
  1. 22 11
      controllers/user.go
  2. 1 0
      models/user.go

+ 22 - 11
controllers/user.go

@@ -41,6 +41,7 @@ func (this *UserCommonController) Login() {
 		br.ErrMsg = "参数解析失败,Err:" + err.Error()
 		return
 	}
+	resp := new(models.LoginResp)
 	mobile := req.Mobile
 	req.Mobile = strings.Trim(req.Mobile, " ")
 	if req.Mobile == "" {
@@ -61,16 +62,6 @@ func (this *UserCommonController) Login() {
 			br.ErrMsg = "Password 为空"
 			return
 		}
-
-		total, err := models.GetCygxUserPasswordCountByMobileAdnPss(mobile, password)
-		if err != nil {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "获取信息失败 GetCygxUserPasswordCountByMobileAdnPss err" + err.Error()
-		}
-		if total == 0 {
-			br.Msg = "密码错误,请重新输入"
-			return
-		}
 		userByps, err := models.GetWxUserItemByUserMobile(mobile)
 		if err != nil {
 			br.Msg = "获取信息失败"
@@ -84,6 +75,27 @@ func (this *UserCommonController) Login() {
 			return
 		}
 
+		//专栏作者,但是还没设置登录密码,弹窗提示如下:
+		isSetPassword := services.GetIsSetPassword(mobile)
+		if !isSetPassword {
+			resp.LoginErrCode = 1
+			br.Ret = 200
+			br.Success = true
+			br.Msg = "获取成功"
+			br.Data = resp
+			return
+		}
+
+		total, err := models.GetCygxUserPasswordCountByMobileAdnPss(mobile, password)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取信息失败 GetCygxUserPasswordCountByMobileAdnPss err" + err.Error()
+		}
+		if total == 0 {
+			br.Msg = "密码错误,请重新输入"
+			return
+		}
+
 	} else {
 		code := req.VCode
 		if code == "" {
@@ -165,7 +177,6 @@ func (this *UserCommonController) Login() {
 		services.AddInviteCompany(user) //记录通过三方合作机构过来的公司
 	}
 
-	resp := new(models.LoginResp)
 	resp.UserId = user.UserId
 	resp.Headimgurl = user.Headimgurl
 	resp.Mobile = user.Mobile

+ 1 - 0
models/user.go

@@ -137,6 +137,7 @@ type LoginResp struct {
 	Mobile        string `description:"手机号"`
 	Email         string `description:"邮箱"`
 	CompanyName   string `description:"客户名称"`
+	LoginErrCode  int    `description:"错误状态自定义,1:是专栏作者,但是还没设置登录密码"`
 }
 
 type UserDetailResp struct {