[dish] fix: 关键词搜寻功能 (#904)

* [dish] 修复关键词搜寻功能

* [dish] 增加关键词未搜索到的提示
This commit is contained in:
昔音幻离 2024-05-11 23:00:19 +08:00 committed by GitHub
parent a9dfbdb54b
commit e62c86a740
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -77,7 +77,8 @@ func init() {
}
var d dish
if err := db.Find("dish", &d, fmt.Sprintf("WHERE name like %%%s%%", dishName)); err != nil {
if err := db.Find("dish", &d, fmt.Sprintf("WHERE name like '%%%s%%'", dishName)); err != nil {
ctx.SendChain(message.Text("客官,本店没有" + dishName))
return
}
@ -86,7 +87,7 @@ func init() {
"原材料:%s\n"+
"步骤:\n"+
"%s",
name, dishName, d.Materials, d.Steps),
name, d.Name, d.Materials, d.Steps),
))
})