瀏覽代碼

fix(绑定用户):用户关系与新用户关系绑定逻辑调整

Roc 4 年之前
父節點
當前提交
487eac5684
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      services/user.go

+ 4 - 3
services/user.go

@@ -179,7 +179,7 @@ func BindWxUser(openid,mobile,email string) (wxUser *models.WxUserItem,err error
 	var userId int
 	//如果查询出来的用户是nil,那么需要新增用户
 	if wxUser == nil{
-		wxUser := &models.WxUser{
+		user := &models.WxUser{
 			CompanyId:1,
 			CreatedTime:time.Now(),
 			FirstLogin:1,
@@ -189,13 +189,14 @@ func BindWxUser(openid,mobile,email string) (wxUser *models.WxUserItem,err error
 			Mobile: mobile,
 			Email: email,
 		}
-		tmpUserId, addUserErr := models.AddWxUser(wxUser)
+		tmpUserId, addUserErr := models.AddWxUser(user)
 		if err != nil{
 			err = addUserErr
 			return
 		}
-		wxUser.UserId = int(tmpUserId)
+		user.UserId = int(tmpUserId)
 		userId = int(tmpUserId)
+		wxUser,err  = models.GetWxUserItemByUserId(userId)
 	}else{
 		userId = wxUser.UserId
 	}