From d89b8033bdebf816978d064b743b6427d0743903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AF=BB=E6=AC=A2?= Date: Mon, 15 Jul 2024 15:07:53 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/plugins/welconenew.go | 2 +- service/friend.go | 2 +- tasks/friends/friends.go | 8 +------- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/plugin/plugins/welconenew.go b/plugin/plugins/welconenew.go index d5f80a6..b086541 100644 --- a/plugin/plugins/welconenew.go +++ b/plugin/plugins/welconenew.go @@ -14,7 +14,7 @@ import ( func WelcomeNew(m *plugin.MessageContext) { // 判断是否开启迎新 var count int64 - client.MySQL.Model(&entity.Friend{}).Where("enable_welcome IS TRUE").Where("wxid = ?", m.FromUser).Count(&count) + client.MySQL.Model(&entity.Friend{}).Where("enable_welcome IS TRUE").Where("is_ok IS TRUE").Where("is_ok IS TRUE").Where("wxid = ?", m.FromUser).Count(&count) if count < 1 { return } diff --git a/service/friend.go b/service/friend.go index 93a6773..d02b2ee 100644 --- a/service/friend.go +++ b/service/friend.go @@ -51,7 +51,7 @@ func GetFriendInfoById(wxId string) (ent entity.Friend, err error) { // @description: 取出所有启用了AI的好友或群组 // @return []entity.Friend func GetAllEnableAI() (records []entity.Friend, err error) { - err = client.MySQL.Where("enable_ai = ?", 1).Find(&records).Error + err = client.MySQL.Where("enable_ai = ?", 1).Where("is_ok IS TRUE").Find(&records).Error return } diff --git a/tasks/friends/friends.go b/tasks/friends/friends.go index 6afbf03..6496aba 100644 --- a/tasks/friends/friends.go +++ b/tasks/friends/friends.go @@ -136,13 +136,7 @@ func Sync() { // 清理不在列表中的好友 clearPm := map[string]any{ - "is_ok": false, - "enable_chat_rank": false, - "enable_welcome": false, - "enable_summary": false, - "enable_news": false, - "clear_member": false, - "enable_ai": false, + "is_ok": false, } err = tx.Model(&entity.Friend{}).Where("wxid NOT IN (?)", nowIds).Updates(clearPm).Error if err != nil {