游戏中不允许接口扣道具

This commit is contained in:
sk 2024-11-01 18:03:11 +08:00
parent e9583d2886
commit 53c94f47fc
1 changed files with 11 additions and 0 deletions

View File

@ -2495,15 +2495,26 @@ func init() {
return common.ResponseTag_ParamError, pack
}
var items []*model.Item
var has bool
for _, info := range msg.ItemInfo {
items = append(items, &model.Item{
ItemId: info.ItemId, // 物品id
ItemNum: info.ItemNum, // 数量
ObtainTime: time.Now().Unix(),
})
if info.ItemNum < 0 {
has = true
}
}
p := PlayerMgrSington.GetPlayerBySnId(msg.GetSnid())
if p != nil {
if p.scene != nil && has {
logger.Logger.Warnf("游戏中不能减道具")
pack.Tag = webapiproto.TagCode_FAILED
pack.Msg = "游戏中不能减道具"
return common.ResponseTag_Ok, pack
}
//获取道具Id
_, _, ok := BagMgrSingleton.AddItems(&model.AddItemParam{
Platform: p.Platform,