Skip to content

Commit

Permalink
fix(admin):修复登录未更改队伍队长的问题
Browse files Browse the repository at this point in the history
Signed-off-by: Penryn <15158052130@163.com>
  • Loading branch information
Penryn committed Oct 18, 2024
1 parent d8ef908 commit 22ab58f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion controller/register/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion service/teamService/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 22ab58f

Please sign in to comment.