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