From ec72efa18de6106f5d2a9db2c858950e82809236 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Tue, 10 Oct 2023 10:17:48 +0800 Subject: [PATCH] update --- app/customer/hdl/hdl_login.go | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/app/customer/hdl/hdl_login.go b/app/customer/hdl/hdl_login.go index 3d221ee..503e363 100644 --- a/app/customer/hdl/hdl_login.go +++ b/app/customer/hdl/hdl_login.go @@ -213,31 +213,22 @@ func Register(c *gin.Context) { user.Avatar = req.Avatar } - if user.UserId != "" { + if 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 { //微信 user.OpenId = req.OpenId 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()) return } + e.OutSuc(c, md.LoginResponse{ Token: token, }, nil)