🎨 逻辑优化 #80

Merged
李寻欢 merged 1 commits from hotfix into main 2024-07-15 15:09:32 +08:00
3 changed files with 3 additions and 9 deletions
Showing only changes of commit d89b8033bd - Show all commits

View File

@ -14,7 +14,7 @@ import (
func WelcomeNew(m *plugin.MessageContext) { func WelcomeNew(m *plugin.MessageContext) {
// 判断是否开启迎新 // 判断是否开启迎新
var count int64 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 { if count < 1 {
return return
} }

View File

@ -51,7 +51,7 @@ func GetFriendInfoById(wxId string) (ent entity.Friend, err error) {
// @description: 取出所有启用了AI的好友或群组 // @description: 取出所有启用了AI的好友或群组
// @return []entity.Friend // @return []entity.Friend
func GetAllEnableAI() (records []entity.Friend, err error) { 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 return
} }

View File

@ -136,13 +136,7 @@ func Sync() {
// 清理不在列表中的好友 // 清理不在列表中的好友
clearPm := map[string]any{ clearPm := map[string]any{
"is_ok": false, "is_ok": false,
"enable_chat_rank": false,
"enable_welcome": false,
"enable_summary": false,
"enable_news": false,
"clear_member": false,
"enable_ai": false,
} }
err = tx.Model(&entity.Friend{}).Where("wxid NOT IN (?)", nowIds).Updates(clearPm).Error err = tx.Model(&entity.Friend{}).Where("wxid NOT IN (?)", nowIds).Updates(clearPm).Error
if err != nil { if err != nil {