Browse Source

fix(联系人绑定):新增缓存机制,避免手机号多次提交(加上缓存5s,用于测试)

Roc 3 years ago
parent
commit
a57954abe9
2 changed files with 2 additions and 1 deletions
  1. 1 1
      controllers/user.go
  2. 1 0
      services/user.go

+ 1 - 1
controllers/user.go

@@ -331,7 +331,7 @@ func (this *UserNotAuthController) Login() {
 	user, err = services.BindWxUser(openId, req.Mobile, req.Email, 1)
 	userId := user.UserId
 	if err != nil && err.Error() != utils.ErrNoRow() {
-		br.Msg = "登录失败"
+		br.Msg = "登录失败,系统处理中,请稍后重试"
 		br.ErrMsg = "登录失败:" + err.Error()
 		return
 	}

+ 1 - 0
services/user.go

@@ -203,6 +203,7 @@ func BindWxUser(openid, mobile, email string, registerPlatform int) (wxUser *mod
 			return
 		}
 		utils.Rc.SetNX(key, "ok", time.Second*300)
+		time.Sleep(time.Second * 5)
 		user := &models.WxUser{
 			CompanyId:        1,
 			CreatedTime:      time.Now(),