道具兑换撤单

This commit is contained in:
sk 2024-07-19 10:21:12 +08:00
parent f637724a61
commit 8e880d65b1
2 changed files with 11 additions and 3 deletions

View File

@ -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
}

View File

@ -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 // 获得道具时消耗的道具数量
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,
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)