"fix(logic): 增加道具购买价格校验,防止封包领取道具漏洞"

This commit is contained in:
1
2025-12-21 18:17:25 +00:00
parent edee754a22
commit 38f51a5111

View File

@@ -10,6 +10,9 @@ import (
"github.com/gogf/gf/v2/util/gconv"
)
// 防止封包通过领取来获取道具
// 领取道具包校验价格
func (h Controller) BuyItem(data *item.BuyInboundInfo, c *player.Player) (result *item.BuyOutboundInfo, err errorcode.ErrorCode) {
tt, ok := xmlres.ItemsMAP[int(data.ItemId)]
if ok && tt.Price != 0 && c.UseCoins(data.Count*uint32(tt.Price)) {