|
@@ -205,24 +205,39 @@ func Register(c *gin.Context) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
user.UserId = req.UserId |
|
|
|
|
|
user.OpenId = req.OpenId |
|
|
|
|
|
user.UnionId = req.UnionId |
|
|
|
|
|
|
|
|
user.UpdateAt = now.Format("2006-01-02 15:04:05") |
|
|
if req.Nickname != "" { |
|
|
if req.Nickname != "" { |
|
|
user.Nickname = req.Nickname |
|
|
user.Nickname = req.Nickname |
|
|
} |
|
|
} |
|
|
if req.Avatar != "" { |
|
|
if req.Avatar != "" { |
|
|
user.Avatar = req.Avatar |
|
|
user.Avatar = req.Avatar |
|
|
} |
|
|
} |
|
|
user.UpdateAt = now.Format("2006-01-02 15:04:05") |
|
|
|
|
|
updateAffected, err1 := userDb.UpdateUser(user, "user_id", "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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if user.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 |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|