房卡消耗记录

This commit is contained in:
sk 2024-08-28 09:12:01 +08:00
parent 17c0817dab
commit cae5536ed3
5 changed files with 61 additions and 49 deletions

View File

@ -26,6 +26,8 @@ func ItemLogsCollection(plt string) *mongo.Collection {
c_itemlog.EnsureIndex(mgo.Index{Key: []string{"gameid"}, Background: true, Sparse: true})
c_itemlog.EnsureIndex(mgo.Index{Key: []string{"gamefreeid"}, Background: true, Sparse: true})
c_itemlog.EnsureIndex(mgo.Index{Key: []string{"snid", "logtype", "itemid", "typeid"}, Background: true, Sparse: true})
c_itemlog.EnsureIndex(mgo.Index{Key: []string{"roomconfigid"}, Background: true, Sparse: true})
c_itemlog.EnsureIndex(mgo.Index{Key: []string{"typeid", "roomconfigid"}, Background: true, Sparse: true})
}
return c_itemlog
}

View File

@ -95,4 +95,5 @@ type AddItemParam struct {
GameId, GameFreeId int64 // 游戏id,场次id
NoLog bool // 是否不记录日志
LogId string // 撤销的id,道具兑换失败
RoomConfigId int32 // 房间配置id
}

View File

@ -28,6 +28,7 @@ type ItemLog struct {
GameFreeId int32 // 场次id,游戏中获得时有值
Cost []*Item // 消耗的道具
Id string // 撤销的id兑换失败
RoomConfigId int32 // 房间配置id
}
func NewItemLog() *ItemLog {
@ -48,6 +49,7 @@ type ItemParam struct {
GameFreeId int64 // 场次id,游戏中获得时有值
Cost []*Item // 消耗的道具
LogId string // 撤销的id兑换失败
RoomConfigId int32 // 房间配置id
}
func NewItemLogEx(param ItemParam) *ItemLog {
@ -65,6 +67,7 @@ func NewItemLogEx(param ItemParam) *ItemLog {
itemLog.GameFreeId = int32(param.GameFreeId)
itemLog.Cost = param.Cost
itemLog.Id = param.LogId
itemLog.RoomConfigId = param.RoomConfigId
return itemLog
}

View File

@ -157,6 +157,7 @@ type ItemParam struct {
type AddItemParam struct {
Cost []*model.Item // 获得道具时消耗的道具数量
LogId string
RoomConfigId int32
}
func (this *BagMgr) AddItemsV2(args *model.AddItemParam) (*BagInfo, bag.OpResultCode, bool) {
@ -178,6 +179,7 @@ func (this *BagMgr) AddItemsV2(args *model.AddItemParam) (*BagInfo, bag.OpResult
return this.AddItems(p, items, args.Add, args.GainWay, args.Operator, args.Remark, args.GameId, args.GameFreeId, args.NoLog, AddItemParam{
Cost: costs,
LogId: args.LogId,
RoomConfigId: args.RoomConfigId,
})
}
@ -194,9 +196,11 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
gameId, gameFreeId int64, noLog bool, params ...AddItemParam) (*BagInfo, bag.OpResultCode, bool) {
var cost []*model.Item
var id string
var roomConfigId int32
if len(params) > 0 {
cost = params[0].Cost
id = params[0].LogId
roomConfigId = params[0].RoomConfigId
}
var items []*Item
@ -337,6 +341,7 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
GameFreeId: gameFreeId,
Cost: cost,
LogId: id,
RoomConfigId: roomConfigId,
})
if log != nil {
LogChannelSingleton.WriteLog(log)

View File

@ -130,6 +130,7 @@ func (spd *ScenePolicyData) CostPayment(s *Scene, p *Player) bool {
Remark: "竞技馆进房费用",
GameId: int64(s.gameId),
GameFreeId: int64(s.dbGameFree.GetId()),
RoomConfigId: s.RoomConfig.GetId(),
})
})
}