Browse Source

update

add_mode
DengBiao 1 year ago
parent
commit
ec72efa18d
1 changed files with 11 additions and 19 deletions
  1. +11
    -19
      app/customer/hdl/hdl_login.go

+ 11
- 19
app/customer/hdl/hdl_login.go View File

@@ -213,31 +213,22 @@ func Register(c *gin.Context) {
user.Avatar = req.Avatar user.Avatar = req.Avatar
} }


if user.UserId != "" {
if req.UserId != "" {
//支付宝 //支付宝
user.UserId = req.UserId user.UserId = req.UserId
updateAffected, err1 := userDb.UpdateUser(user, "user_id", "nickname", "avatar", "update_at")
if err1 != nil {
e.OutErr(c, e.ERR_DB_ORM, err1)
return
}
if updateAffected <= 0 {
e.OutErr(c, e.ERR_DB_ORM, "更新用户数据失败")
return
}
} else { } else {
//微信 //微信
user.OpenId = req.OpenId user.OpenId = req.OpenId
user.UnionId = req.UnionId user.UnionId = req.UnionId
updateAffected, err1 := userDb.UpdateUser(user, "nickname", "avatar", "update_at", "union_id", "open_id")
if err1 != nil {
e.OutErr(c, e.ERR_DB_ORM, err1)
return
}
if updateAffected <= 0 {
e.OutErr(c, e.ERR_DB_ORM, "更新用户数据失败")
return
}
}
updateAffected, err1 := userDb.UpdateUser(user)
if err1 != nil {
e.OutErr(c, e.ERR_DB_ORM, err1)
return
}
if updateAffected <= 0 {
e.OutErr(c, e.ERR_DB_ORM, "更新用户数据失败")
return
} }
} }


@@ -248,6 +239,7 @@ func Register(c *gin.Context) {
e.OutErr(c, e.ERR, err.Error()) e.OutErr(c, e.ERR, err.Error())
return return
} }

e.OutSuc(c, md.LoginResponse{ e.OutSuc(c, md.LoginResponse{
Token: token, Token: token,
}, nil) }, nil)


Loading…
Cancel
Save