chore: adjust grom find 1 sql

This commit is contained in:
engigu
2026-03-23 12:04:29 +08:00
parent ec2cd7d116
commit d396e1629f
20 changed files with 87 additions and 52 deletions
+2 -1
View File
@@ -65,7 +65,8 @@ func (sc *SettingsController) ChangePassword(c *gin.Context) {
userID := c.GetString("userID")
var user *models.User
if err := database.DB.Where("id = ?", userID).First(&user).Error; err != nil {
res := database.DB.Where("id = ?", userID).Limit(1).Find(&user)
if res.Error != nil || res.RowsAffected == 0 {
utils.NotFound(c, "用户不存在")
return
}