From 9fe1f35fd16e1612a6fb9718cbe9cd312aa26400 Mon Sep 17 00:00:00 2001 From: "1808837298@qq.com" <1808837298@qq.com> Date: Wed, 25 Sep 2024 17:15:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=AC=AC=E4=B8=89=E6=96=B9=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=B3=A8=E9=94=80=20#500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/telegram.go | 8 ++++++++ controller/wechat.go | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/controller/telegram.go b/controller/telegram.go index b5bc0c0..8d07fc9 100644 --- a/controller/telegram.go +++ b/controller/telegram.go @@ -5,6 +5,7 @@ import ( "crypto/sha256" "encoding/hex" "io" + "net/http" "one-api/common" "one-api/model" "sort" @@ -48,6 +49,13 @@ func TelegramBind(c *gin.Context) { }) return } + if user.Id == 0 { + c.JSON(http.StatusOK, gin.H{ + "success": false, + "message": "用户已注销", + }) + return + } user.TelegramId = telegramId if err := user.Update(false); err != nil { c.JSON(200, gin.H{ diff --git a/controller/wechat.go b/controller/wechat.go index ff4c9fb..7f048c9 100644 --- a/controller/wechat.go +++ b/controller/wechat.go @@ -78,6 +78,13 @@ func WeChatAuth(c *gin.Context) { }) return } + if user.Id == 0 { + c.JSON(http.StatusOK, gin.H{ + "success": false, + "message": "用户已注销", + }) + return + } } else { if common.RegisterEnabled { user.Username = "wechat_" + strconv.Itoa(model.GetMaxUserId()+1)