Skip to content

Commit b37175f

Browse files
committed
fix:替换掉postgresql不支持sql语法
1 parent d558664 commit b37175f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

plugin/fortune/fortune.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ var (
3939
cacheImg = images + "cache/"
4040
pluginName = "每日运势"
4141
// 底图类型列表
42-
table = [...]string{"车万", "DC4", "爱因斯坦", "星空列车", "樱云之恋", "富婆妹", "李清歌", "公主连结", "原神", "明日方舟", "碧蓝航线", "碧蓝幻想", "战双", "阴阳师", "赛马娘", "东方归言录", "奇异恩典", "夏日口袋", "ASoul", "Hololive"}
42+
table = [...]string{"车万", "DC4", "爱因斯坦", "星空列车", "樱云之恋", "富婆妹",
43+
"李清歌", "公主连结", "原神", "明日方舟", "碧蓝航线", "碧蓝幻想",
44+
"战双", "阴阳师", "赛马娘", "东方归言录", "奇异恩典", "夏日口袋", "ASoul", "Hololive"}
4345
// 映射底图与 index
4446
index = make(map[string]uint8)
4547
// 签文
@@ -95,7 +97,8 @@ func init() {
9597
BotID: ctx.Event.SelfID,
9698
Value: ctx.State["regex_matched"].([]string)[1],
9799
}
98-
if row := db.Clauses(clause.Insert{Modifier: "IGNORE"}).Create(&fortuneInfo).RowsAffected; row == 0 {
100+
// 如果发生冲突则什么都不做
101+
if row := db.Clauses(clause.OnConflict{DoNothing: true}).Create(&fortuneInfo).RowsAffected; row == 0 {
99102
err := db.Model(&fortune{}).Where("gid = ? AND bid = ?", gid, ctx.Event.SelfID).
100103
Update("value", fortuneInfo.Value).Error
101104
if err != nil {

0 commit comments

Comments
 (0)