From 8e880d65b12ec192619272ee31f6811c0eba85be Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Fri, 19 Jul 2024 10:21:12 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=93=E5=85=B7=E5=85=91=E6=8D=A2=E6=92=A4?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/itemdatalog.go | 3 +++ worldsrv/bagmgr.go | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/model/itemdatalog.go b/model/itemdatalog.go index f19c122..62d58b6 100644 --- a/model/itemdatalog.go +++ b/model/itemdatalog.go @@ -27,6 +27,7 @@ type ItemLog struct { GameId int32 // 游戏id,游戏中获得时有值 GameFreeId int32 // 场次id,游戏中获得时有值 Cost []*ItemInfo // 消耗的道具 + Id string // 撤销的id,兑换失败 } func NewItemLog() *ItemLog { @@ -46,6 +47,7 @@ type ItemParam struct { GameId int64 // 游戏id,游戏中获得时有值 GameFreeId int64 // 场次id,游戏中获得时有值 Cost []*ItemInfo // 消耗的道具 + LogId string // 撤销的id,兑换失败 } func NewItemLogEx(param ItemParam) *ItemLog { @@ -62,6 +64,7 @@ func NewItemLogEx(param ItemParam) *ItemLog { itemLog.GameId = int32(param.GameId) itemLog.GameFreeId = int32(param.GameFreeId) itemLog.Cost = param.Cost + itemLog.Id = param.LogId return itemLog } diff --git a/worldsrv/bagmgr.go b/worldsrv/bagmgr.go index 23bad9e..cb37e6d 100644 --- a/worldsrv/bagmgr.go +++ b/worldsrv/bagmgr.go @@ -150,16 +150,18 @@ type ItemParam struct { Operator, Remark string // 操作人,备注 gameId, gameFreeId int64 // 游戏id,场次id noLog bool // 是否不记录日志 - LogId string + LogId string // 撤销的id,道具兑换失败 } type AddItemParam struct { - Cost []*model.ItemInfo // 获得道具时消耗的道具数量 + Cost []*model.ItemInfo // 获得道具时消耗的道具数量 + LogId string } func (this *BagMgr) AddItemsV2(args *ItemParam) (*BagInfo, bag.OpResultCode, bool) { return this.AddItems(args.P, args.Change, args.Add, args.GainWay, args.Operator, args.Remark, args.gameId, args.gameFreeId, args.noLog, AddItemParam{ - Cost: args.Cost, + Cost: args.Cost, + LogId: args.LogId, }) } @@ -175,8 +177,10 @@ func (this *BagMgr) AddItemsV2(args *ItemParam) (*BagInfo, bag.OpResultCode, boo func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int32, operator, remark string, gameId, gameFreeId int64, noLog bool, params ...AddItemParam) (*BagInfo, bag.OpResultCode, bool) { var cost []*model.ItemInfo + var id string if len(params) > 0 { cost = params[0].Cost + id = params[0].LogId } var items []*Item @@ -313,6 +317,7 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int GameId: gameId, GameFreeId: gameFreeId, Cost: cost, + LogId: id, }) if log != nil { LogChannelSingleton.WriteLog(log)