fix: 修复扭蛋道具扣除逻辑
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

This commit is contained in:
xinian
2026-04-14 11:06:04 +08:00
parent 74ac6ce940
commit ddbfe91d8b
4 changed files with 27 additions and 11 deletions

View File

@@ -48,7 +48,11 @@ func init() {
}
havs := itemService.CheakItem(400501)
if havs < int64(count) {
if havs <= int64(count) {
ctx.Send("扭蛋币不足,当前扭蛋币数量:" + gconv.String(havs))
return
}
if err := itemService.UPDATE(400501, -count); err != nil {
ctx.Send("扭蛋币不足,当前扭蛋币数量:" + gconv.String(havs))
return
}
@@ -140,8 +144,6 @@ func init() {
buf.WriteString("恭喜你获得 " + xmlres.ItemsMAP[int(item.ItemId)].Name + ":" + gconv.String(item.ItemCnt) + "\n")
}
itemService.UPDATE(400501, -count)
ctx.SendChain(message.At(ctx.Event.Sender.ID), message.Reply(ctx.Event.MessageID), message.Text(buf.String()))
})
}