From 22ab58fb20e06cc51242fdc01f5aa89cea6610d4 Mon Sep 17 00:00:00 2001 From: Penryn <15158052130@163.com> Date: Fri, 18 Oct 2024 13:31:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(admin):=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=9C=AA=E6=9B=B4=E6=94=B9=E9=98=9F=E4=BC=8D=E9=98=9F=E9=95=BF?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Penryn <15158052130@163.com> --- controller/register/login.go | 2 +- service/teamService/update.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/controller/register/login.go b/controller/register/login.go index 81e48f6..6c8f2f9 100644 --- a/controller/register/login.go +++ b/controller/register/login.go @@ -40,7 +40,7 @@ func Login(context *gin.Context) { return } if user.Status == 2 { - err = teamService.UpdateCaptain(user.TeamId, user.OpenId) + err = teamService.UpdateCaptain(user.TeamId, jwtData.OpenID) if err != nil { utility.ResponseError(context, "更新队长失败") return diff --git a/service/teamService/update.go b/service/teamService/update.go index e8c959d..2c2b523 100644 --- a/service/teamService/update.go +++ b/service/teamService/update.go @@ -18,5 +18,5 @@ func Create(a model.Team) { } func UpdateCaptain(teamID int, openID string) error { - return global.DB.Exec("UPDATE teams SET captain = ? WHERE id = ?", openID, teamID).Error + return global.DB.Model(&model.Team{}).Where("id = ?", teamID).Update("captain", openID).Error }