From a98cdb0cac4324739dafe740df0a439292127c8f Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 10 Jul 2026 14:22:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A6=81=E6=AD=A2=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E9=80=9A=E8=BF=87=20UpdateUser=20=E7=A6=81=E7=94=A8?= =?UTF-8?q?=E8=87=AA=E5=B7=B1=E7=9A=84=E8=B4=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/handler/user.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/handler/user.go b/internal/handler/user.go index 680afe1..166273c 100644 --- a/internal/handler/user.go +++ b/internal/handler/user.go @@ -144,6 +144,10 @@ func UpdateUser(c *gin.Context) { updates := map[string]interface{}{} if req.Status != nil { + if user.ID == currentUserID.(uint) && *req.Status != 1 { + c.JSON(http.StatusBadRequest, gin.H{"error": "不能禁用自己的账号"}) + return + } updates["status"] = *req.Status }