From 52e3539686dfac23132cf15a789f6c72f4060e05 Mon Sep 17 00:00:00 2001 From: RicheyJang <773602577@qq.com> Date: Fri, 25 Feb 2022 10:46:01 +0800 Subject: [PATCH] fix: SQLite can not delete dialogue --- go.mod | 18 +++++++++--------- plugins/chat/set.go | 7 ++----- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/go.mod b/go.mod index 7cdf781..f76c97d 100644 --- a/go.mod +++ b/go.mod @@ -20,10 +20,10 @@ require ( github.com/wcharczuk/go-chart/v2 v2.1.0 github.com/wdvxdr1123/ZeroBot v1.4.1 golang.org/x/time v0.0.0-20191024005414-555d28b269f0 - gorm.io/driver/mysql v1.2.0 - gorm.io/driver/postgres v1.2.2 - gorm.io/driver/sqlite v1.2.6 - gorm.io/gorm v1.22.3 + gorm.io/driver/mysql v1.3.2 + gorm.io/driver/postgres v1.3.1 + gorm.io/driver/sqlite v1.3.1 + gorm.io/gorm v1.23.1 ) require ( @@ -40,15 +40,15 @@ require ( github.com/gorilla/websocket v1.4.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect - github.com/jackc/pgconn v1.10.0 // indirect + github.com/jackc/pgconn v1.10.1 // indirect github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect - github.com/jackc/pgproto3/v2 v2.1.1 // indirect + github.com/jackc/pgproto3/v2 v2.2.0 // indirect github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect - github.com/jackc/pgtype v1.8.1 // indirect - github.com/jackc/pgx/v4 v4.13.0 // indirect + github.com/jackc/pgtype v1.9.1 // indirect + github.com/jackc/pgx/v4 v4.14.1 // indirect github.com/jinzhu/inflection v1.0.0 // indirect - github.com/jinzhu/now v1.1.2 // indirect + github.com/jinzhu/now v1.1.4 // indirect github.com/jonboulle/clockwork v0.2.2 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/lestrrat-go/strftime v1.0.5 // indirect diff --git a/plugins/chat/set.go b/plugins/chat/set.go index f294217..dc13de5 100644 --- a/plugins/chat/set.go +++ b/plugins/chat/set.go @@ -23,11 +23,8 @@ func SetDialogue(groupID int64, question string, answer message.Message) error { // DeleteDialogue 根据问题删除一个问答 func DeleteDialogue(groupID int64, question string) error { - groupD := GroupChatDialogue{ - GroupID: groupID, - Question: question, - } - return proxy.GetDB().Delete(&groupD).Error + return proxy.GetDB(). + Where("group_id = ? AND question = ?", groupID, question).Delete(&GroupChatDialogue{}).Error } // GetDialogue 根据群号和问题获取answer消息