游戏记录添加gamedif

This commit is contained in:
sk 2024-12-16 15:39:25 +08:00
parent 2c48adeca7
commit 490576b1dc
25 changed files with 98 additions and 217 deletions

View File

@ -33,6 +33,7 @@ func GameDetailedLogsCollection(plt string) *mongo.Collection {
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"ts", "cycleid"}, Background: true, Sparse: true})
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"time", "cycleid"}, Background: true, Sparse: true})
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"-time", "cycleid"}, Background: true, Sparse: true})
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"gamedif"}, Background: true, Sparse: true})
}
return c_gamedetailed
}

View File

@ -44,6 +44,7 @@ func GamePlayerListLogsCollection(plt string) *mongo.Collection {
c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"-ts", "cycleid"}, Background: true, Sparse: true})
c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"cycleid"}, Background: true, Sparse: true})
c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"ts", "cycleid"}, Background: true, Sparse: true})
c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"gamedif"}, Background: true, Sparse: true})
}
return c_gameplayerlistlog
}

View File

@ -945,8 +945,6 @@ func AvengersCheckAndSaveLog(sceneEx *AvengersSceneData, playerEx *AvengersPlaye
LogId: logid,
Platform: playerEx.Platform,
Snid: playerEx.SnId,
Channel: playerEx.Channel,
ChannelId: playerEx.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: playerEx.taxCoin,

View File

@ -44,13 +44,16 @@ func (this *Scene) SaveGameDetailedLog(param *SaveGameDetailedParam) *SaveGameDe
f := func(plt string) {
log := &model.GameDetailedLog{
Id: bson.NewObjectId(),
LogId: param.LogId,
GameId: this.GameId,
Platform: plt,
LogId: param.LogId,
GameDif: this.GetDBGameFree().GetGameDif(),
GameId: this.GetDBGameFree().GetGameId(),
GameClass: this.GetDBGameFree().GetGameClass(),
GameMode: this.GetDBGameFree().GetGameMode(),
GameType: this.GetDBGameFree().GetGameType(),
GameFreeId: this.GetDBGameFree().GetId(),
MatchId: this.GetMatch().GetMatchSortId(),
SceneId: this.SceneId,
GameMode: this.GameMode,
GameFreeid: this.GetGameFreeId(),
PlayerCount: int32(len(this.Players)),
GameTiming: int32(param.GameTime),
GameBaseBet: this.GetBaseScore(),
@ -98,8 +101,6 @@ type SaveGamePlayerListLogParam struct {
Platform string // 平台
Snid int32 // 玩家id
PlayerName string // 玩家名字
Channel string // 渠道
ChannelId string // 推广渠道
TotalIn int64 // 总投入
TotalOut int64 // 总产出(税前)
TaxCoin int64 // 总税收
@ -155,33 +156,35 @@ func (this *Scene) SaveGamePlayerListLog(param *SaveGamePlayerListLogParam) *Sav
now := time.Now()
log := &model.GamePlayerListLog{
LogId: bson.NewObjectId(),
Platform: param.Platform,
GameDif: this.GetDBGameFree().GetGameDif(),
GameId: this.GetDBGameFree().GetGameId(),
GameClass: this.GetDBGameFree().GetGameClass(),
GameMode: this.GetDBGameFree().GetGameMode(),
GameType: this.GetDBGameFree().GetGameType(),
GameFreeId: this.GetGameFreeId(),
BaseScore: baseScore,
GameDetailedLogId: param.LogId,
Channel: p.Channel,
ChannelId: p.ChannelId,
RoomType: this.SceneMode,
Ts: now.Unix(),
Time: now,
CycleId: this.CycleID,
SnId: p.SnId,
Name: param.PlayerName,
GameId: this.GameId,
BaseScore: baseScore,
TaxCoin: param.TaxCoin,
Platform: param.Platform,
Channel: param.Channel,
SceneId: this.SceneId,
GameMode: this.GameMode,
GameFreeid: this.GetGameFreeId(),
GameDetailedLogId: param.LogId,
IsFirstGame: param.IsFirstGame,
BetAmount: param.BetAmount,
WinAmountNoAnyTax: param.WinAmountNoAnyTax,
TotalIn: param.TotalIn,
TotalOut: param.TotalOut,
Time: now,
RoomType: this.SceneMode,
GameDif: this.GetDBGameFree().GetGameDif(),
GameClass: this.GetDBGameFree().GetGameClass(),
MatchId: this.GetMatch().GetMatchSortId(),
MatchType: int64(this.GetMatch().GetMatchType()),
Ts: now.Unix(),
WinAmountNoAnyTax: param.WinAmountNoAnyTax,
TaxCoin: param.TaxCoin,
BetAmount: param.BetAmount,
IsFirstGame: param.IsFirstGame,
TotalIn: param.TotalIn,
TotalOut: param.TotalOut,
IsFree: param.IsFree,
WinSmallGame: param.WinSmallGame,
WinTotal: param.WinTotal,
CycleId: this.CycleID,
}
if param.OnlyLog {
ret.Log = append(ret.Log, log)

View File

@ -659,7 +659,7 @@ func (this *Player) ReportGameEvent(param *ReportGameEventParam) *ReportGameEven
isNew = 1
}
if param.GameTime < 0 {
if param.GameTime <= 0 {
param.GameTime = int64(time.Now().Sub(this.scene.GameNowTime).Seconds())
}
if param.GameTime < 0 {
@ -669,19 +669,18 @@ func (this *Player) ReportGameEvent(param *ReportGameEventParam) *ReportGameEven
var ret ReportGameEventOnly
ret.Param = param
log := &model.PlayerGameRecEvent{
Id: primitive.NewObjectID().Hex(),
Platform: this.Platform,
RecordId: this.scene.GetRecordId(),
SnId: this.GetSnId(),
Channel: this.Channel,
ChannelId: this.ChannelId,
//City: this.City,
Id: primitive.NewObjectID().Hex(),
Platform: this.Platform,
RecordId: this.scene.GetRecordId(),
SnId: this.GetSnId(),
Channel: this.Channel,
ChannelId: this.ChannelId,
OS: this.DeviceOS,
GameId: this.scene.GameId,
ModeId: this.scene.GameMode,
Tax: param.Tax,
Amount: param.Change,
CreateTime: this.CreateTime.Unix(),
CreateTime: time.Now().Unix(),
CreateDayTime: tCreateDay.Unix(),
Out: param.Out,
In: param.In,
@ -693,7 +692,6 @@ func (this *Player) ReportGameEvent(param *ReportGameEventParam) *ReportGameEven
FirstGameTime: gameFirstTime.Unix(),
PlayGameTimes: gameTimes,
LastLoginTime: this.LastLoginTime.Unix(),
//DeviceId: this.DeviceId,
}
if param.OnlyLog {
ret.Log = append(ret.Log, log)

View File

@ -1035,8 +1035,6 @@ func CaiShenCheckAndSaveLog(sceneEx *CaiShenSceneData, playerEx *CaiShenPlayerDa
Platform: playerEx.Platform,
Snid: playerEx.SnId,
PlayerName: playerEx.Name,
Channel: playerEx.Channel,
ChannelId: playerEx.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: playerEx.taxCoin,

View File

@ -1315,8 +1315,6 @@ func (this *SceneStateBilled) OnEnter(s *base.Scene) {
Platform: o_player.Platform,
Snid: o_player.UserId,
PlayerName: "",
Channel: o_player.Channel,
ChannelId: o_player.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: o_player.GainTaxCoin,

View File

@ -795,8 +795,6 @@ func (this *StateBilled) OnEnter(s *base.Scene) {
Platform: playerEx.Platform,
Snid: playerEx.SnId,
PlayerName: playerEx.Name,
Channel: playerEx.Channel,
ChannelId: playerEx.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: playerEx.taxCoin,

View File

@ -904,8 +904,6 @@ func EasterIslandCheckAndSaveLog(sceneEx *EasterIslandSceneData, playerEx *Easte
Platform: playerEx.Platform,
Snid: playerEx.SnId,
PlayerName: playerEx.Name,
Channel: playerEx.Channel,
ChannelId: playerEx.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: playerEx.taxCoin,

View File

@ -267,8 +267,6 @@ func (this *FishingPlayerData) SaveDetailedLog(s *base.Scene) {
Platform: this.Platform,
Snid: this.SnId,
PlayerName: this.Name,
Channel: this.Channel,
ChannelId: this.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: int64(this.sTaxCoin),

View File

@ -537,8 +537,6 @@ func FortuneDragonAndSaveLog(sceneEx *FortuneDragonSceneData, playerEx *FortuneD
Platform: playerEx.Platform,
Snid: playerEx.SnId,
PlayerName: playerEx.Name,
Channel: playerEx.Channel,
ChannelId: playerEx.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: playerEx.taxCoin,

View File

@ -548,8 +548,6 @@ func FortuneMouseAndSaveLog(sceneEx *FortuneMouseSceneData, playerEx *FortuneMou
Platform: playerEx.Platform,
Snid: playerEx.SnId,
PlayerName: playerEx.Name,
Channel: playerEx.Channel,
ChannelId: playerEx.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: playerEx.taxCoin,

View File

@ -548,8 +548,6 @@ func FortuneOxAndSaveLog(sceneEx *FortuneOxSceneData, playerEx *FortuneOxPlayerD
Platform: playerEx.Platform,
Snid: playerEx.SnId,
PlayerName: playerEx.Name,
Channel: playerEx.Channel,
ChannelId: playerEx.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: playerEx.taxCoin,

View File

@ -535,8 +535,6 @@ func FortuneRabbitAndSaveLog(sceneEx *FortuneRabbitSceneData, playerEx *FortuneR
Platform: playerEx.Platform,
Snid: playerEx.SnId,
PlayerName: playerEx.Name,
Channel: playerEx.Channel,
ChannelId: playerEx.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: playerEx.taxCoin,

View File

@ -548,8 +548,6 @@ func FortuneTigerAndSaveLog(sceneEx *FortuneTigerSceneData, playerEx *FortuneTig
Platform: playerEx.Platform,
Snid: playerEx.SnId,
PlayerName: playerEx.Name,
Channel: playerEx.Channel,
ChannelId: playerEx.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: playerEx.taxCoin,

View File

@ -345,8 +345,6 @@ func (s *FruitsSceneData) SaveLog(p *FruitsPlayerData, isOffline int) {
Platform: p.Platform,
Snid: p.SnId,
PlayerName: p.Name,
Channel: p.Channel,
ChannelId: p.ChannelId,
TotalIn: totalIn,
TotalOut: totalOut,
TaxCoin: p.taxCoin,

View File

@ -954,8 +954,6 @@ func IceAgeCheckAndSaveLog(sceneEx *IceAgeSceneData, playerEx *IceAgePlayerData)
Platform: playerEx.Platform,
Snid: playerEx.SnId,
PlayerName: playerEx.Name,
Channel: playerEx.Channel,
ChannelId: playerEx.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: playerEx.taxCoin,

View File

@ -367,8 +367,6 @@ func (s *RichBlessedSceneData) SaveLog(p *RichBlessedPlayerData, isOffline int)
Platform: p.Platform,
Snid: p.SnId,
PlayerName: p.Name,
Channel: p.Channel,
ChannelId: p.ChannelId,
TotalIn: totalIn,
TotalOut: totalOut,
TaxCoin: p.taxCoin,

View File

@ -1179,8 +1179,6 @@ func (this *StateBilled) OnEnter(s *base.Scene) {
Platform: playerEx.Platform,
Snid: playerEx.SnId,
PlayerName: playerEx.Name,
Channel: playerEx.Channel,
ChannelId: playerEx.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: playerEx.taxCoin,
@ -1258,8 +1256,6 @@ func (this *StateBilled) OnEnter(s *base.Scene) {
Platform: playerEx.Platform,
Snid: playerEx.SnId,
PlayerName: playerEx.Name,
Channel: playerEx.Channel,
ChannelId: playerEx.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: playerEx.taxCoin,

View File

@ -790,8 +790,6 @@ func TamQuocCheckAndSaveLog(sceneEx *TamQuocSceneData, playerEx *TamQuocPlayerDa
Platform: playerEx.Platform,
Snid: playerEx.SnId,
PlayerName: playerEx.Name,
Channel: playerEx.Channel,
ChannelId: playerEx.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: playerEx.taxCoin,

View File

@ -188,8 +188,6 @@ func (this *PolicyThirteen) OnPlayerLeave(s *base.Scene, p *base.Player, reason
Platform: playerEx.Platform,
Snid: playerEx.SnId,
PlayerName: playerEx.Name,
Channel: playerEx.Channel,
ChannelId: playerEx.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: playerEx.taxCoin,
@ -1438,8 +1436,6 @@ func (this *StateBilled) OnEnter(s *base.Scene) {
Platform: o_player.Platform,
Snid: o_player.SnId,
PlayerName: o_player.Name,
Channel: o_player.Channel,
ChannelId: o_player.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: o_player.taxCoin,

View File

@ -2761,8 +2761,6 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
LogId: sceneEx.recordId,
Platform: o_player.Platform,
Snid: o_player.UserId,
Channel: o_player.Channel,
ChannelId: o_player.ChannelId,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: o_player.BillTaxCoin,

View File

@ -263,9 +263,9 @@ type PlayerGameRecEvent struct {
GameFreeID int32 //游戏freeid
GamingTime int32 //游戏开始到玩家结算的时长 单位:秒
GameDif int32 // 游戏分组
FirstGameDifTime int64 // 首次游戏分组时间
GameDifTimes int64 // 游戏分组游戏次数
GameDif string // 游戏分组
FirstGameDifTime int64 // 首次游戏分组时间
GameDifTimes int64 // 游戏分组游戏次数
FirstTime int64 //首次玩该场次游戏时间
PlayTimes int64 //该场次游戏次数

View File

@ -23,9 +23,33 @@ type CoinPoolCtx struct {
Controlled bool //被水池控制了
}
type GameDetailedLogRet struct {
Gplt GameDetailedLogType
type GameDetailedLog struct {
Id bson.ObjectId `bson:"_id"`
Platform string // 平台
LogId string // 记录ID每局游戏唯一
GameDif string // 游戏组
GameId int32 // 游戏id
GameClass int32 // 游戏类型
GameMode int32 // 游戏模式,弃用
GameType int32 // 游戏类型
GameFreeId int32 // 场次id
CycleId string // 房卡场id多轮有相同的id
MatchId int64 // 比赛ID应该用字符串的
SceneId int32 // 房间id会重复
PlayerCount int32 // 玩家数量
GameTiming int32 // 游戏用时,秒
GameBaseBet int32 // 游戏底分
Ts int64 // 时间戳
Time time.Time // 记录时间
GameDetailedNote string // 游戏详情
GameDetailVer int32 // 游戏详情版本
CpCtx CoinPoolCtx // 水池上下文信息
Trend20Lately string // 最近游戏走势
CtrlType int // 1控赢 2控输 0不控
PlayerPool map[int]int // 个人水池分 玩家id:分
}
type GameDetailedLogType struct {
PageNo int //当前页码
PageSize int //每页数量
@ -33,64 +57,8 @@ type GameDetailedLogType struct {
Data []*GameDetailedLog //当页数据
}
type GameDetailedLog struct {
Id bson.ObjectId `bson:"_id"` //记录ID
LogId string //记录ID每局游戏唯一
GameId int32 //游戏id
ClubId int32 //俱乐部Id
ClubRoom string //俱乐部包间
Platform string //平台id
Channel string //渠道
Promoter string //推广员
MatchId int64 //比赛ID应该用字符串的
SceneId int32 //房间id会重复
GameMode int32 //游戏类型
GameFreeid int32 //游戏类型房间号
PlayerCount int32 //玩家数量
GameTiming int32 //本局游戏用时(mm)
GameBaseBet int32 //游戏单位低分
GameDetailedNote string //游戏详情
GameDetailVer int32 //游戏详情版本
CpCtx CoinPoolCtx //水池上下文信息
Time time.Time //记录时间
Trend20Lately string //最近游戏走势
Ts int64 //时间戳
CtrlType int // 1控赢 2控输 0不控
PlayerPool map[int]int // 个人水池分
CycleId string // 本轮id打一轮有多局
}
func NewGameDetailedLog() *GameDetailedLog {
log := &GameDetailedLog{Id: bson.NewObjectId()}
return log
}
func NewGameDetailedLogEx(logid string, gameid, sceneid, gamemode, gamefreeid, playercount, gametiming, gamebasebet int32,
gamedetailednote string, platform string, clubId int32, clubRoom string, cpCtx CoinPoolCtx, ver int32,
trend20Lately string, ctrlType int, playerPool map[int]int, cycleId string) *GameDetailedLog {
cl := NewGameDetailedLog()
cl.LogId = logid
cl.GameId = gameid
cl.ClubId = clubId
cl.ClubRoom = clubRoom
cl.SceneId = sceneid
cl.GameMode = gamemode
cl.GameFreeid = gamefreeid
cl.PlayerCount = playercount
cl.GameTiming = gametiming
cl.GameBaseBet = gamebasebet
cl.GameDetailedNote = gamedetailednote
cl.Platform = platform
tNow := time.Now()
cl.Time = tNow
cl.CpCtx = cpCtx
cl.GameDetailVer = ver
cl.Trend20Lately = trend20Lately
cl.Ts = time.Now().Unix()
cl.CtrlType = ctrlType
cl.PlayerPool = playerPool
cl.CycleId = cycleId
return cl
type GameDetailedLogRet struct {
Gplt GameDetailedLogType
}
func InsertGameDetailedLog(log *GameDetailedLog) (err error) {

View File

@ -21,86 +21,36 @@ type GameTotalRecord struct {
type GamePlayerListLog struct {
LogId bson.ObjectId `bson:"_id"` //记录ID
SnId int32 //用户Id
Name string //名称
GameId int32 //游戏id
BaseScore int32 //游戏底注
ClubId int32 //俱乐部Id
ClubRoom string //俱乐部包间
TaxCoin int64 //税收
ClubPumpCoin int64 //俱乐部额外抽水
Platform string //平台id
Channel string //渠道
Promoter string //推广员
PackageTag string //包标识
SceneId int32 //场景ID
GameMode int32 //游戏类型
GameFreeid int32 //游戏类型房间号
GameDetailedLogId string //游戏记录Id
IsFirstGame bool //是否第一次游戏
//对于拉霸类BetAmount=100 WinAmountNoAnyTax=0 (表示投入多少、收益多少,值>=0
//拉霸类小游戏会是BetAmount=0 WinAmountNoAnyTax=100 投入0、收益多少值>=0
//对战场BetAmount=0 WinAmountNoAnyTax=100 投入会有是0、收益有正负WinAmountNoAnyTax=100则盈利WinAmountNoAnyTax=-100则输100
BetAmount int64 //下注金额
WinAmountNoAnyTax int64 //盈利金额,不包含任何税
TotalIn int64 //本局投入
TotalOut int64 //本局产出
Time time.Time //记录时间
RoomType int32 //房间类型
GameDif string //游戏标识
GameClass int32 //游戏类型 1棋牌 2电子 3百人 4捕鱼 5视讯 6彩票 7体育
MatchId int64
MatchType int64 //0.普通场 1.锦标赛 2.冠军赛 3.vip专属
Ts int64
IsFree bool //拉霸专用 是否免费
WinSmallGame int64 //拉霸专用 小游戏奖励
WinTotal int64 //拉霸专用 输赢
CycleId string // 本轮id打一轮有多局
}
Platform string // 平台
GameDif string // 游戏组
GameId int32 // 游戏id
GameClass int32 // 游戏类型
GameMode int32 // 游戏模式,弃用
GameType int32 // 游戏类型
GameFreeId int32 // 场次id
BaseScore int32 // 游戏底注
GameDetailedLogId string // 游戏记录Id
Channel string // 包类型
ChannelId string // 推广渠道
RoomType int32 // 房间类型
Ts int64 // 记录时间
Time time.Time // 记录时间
CycleId string // 本轮id打一轮有多局
func NewGamePlayerListLog() *GamePlayerListLog {
log := &GamePlayerListLog{LogId: bson.NewObjectId()}
return log
}
func NewGamePlayerListLogEx(snid int32, gamedetailedlogid string, platform, channel, promoter, packageTag string, gameid, baseScore,
sceneid, gamemode, gamefreeid int32, totalin, totalout int64, clubId int32, clubRoom string, taxCoin, pumpCoin int64, roomType int32,
betAmount, winAmountNoAnyTax int64, key, name string, gameClass int32, isFirst bool, matchid, matchType int64,
isFree bool, winSmallGame, winTotal int64, cycleId string) *GamePlayerListLog {
cl := NewGamePlayerListLog()
cl.SnId = snid
cl.GameDetailedLogId = gamedetailedlogid
cl.Platform = platform
cl.Name = name
cl.Channel = channel
cl.Promoter = promoter
cl.PackageTag = packageTag
cl.GameFreeid = gamefreeid
cl.GameId = gameid
cl.BaseScore = baseScore
cl.ClubId = clubId
cl.GameMode = gamemode
cl.SceneId = sceneid
cl.TotalIn = totalin
cl.TotalOut = totalout
cl.ClubRoom = clubRoom
cl.TaxCoin = taxCoin
cl.IsFirstGame = isFirst
cl.ClubPumpCoin = pumpCoin
cl.RoomType = roomType
cl.BetAmount = betAmount
cl.WinAmountNoAnyTax = winAmountNoAnyTax
cl.GameDif = key
cl.GameClass = gameClass
cl.IsFree = isFree
cl.WinSmallGame = winSmallGame
cl.WinTotal = winTotal
tNow := time.Now()
cl.Ts = tNow.Unix()
cl.Time = tNow
cl.MatchId = matchid
cl.MatchType = matchType
cl.CycleId = cycleId
return cl
SnId int32 // 用户Id
Name string // 名称
SceneId int32 // 房间id会重复
MatchId int64 // 比赛ID应该用字符串的
MatchType int64 // 0.普通场 1.锦标赛 2.冠军赛 3.vip专属
WinAmountNoAnyTax int64 // 盈利金额,不包含任何税
TaxCoin int64 // 税收
BetAmount int64 // 下注金额
IsFirstGame bool // 是否第一次游戏
TotalIn int64 // 本局投入
TotalOut int64 // 本局产出
IsFree bool // 拉霸专用 是否免费
WinSmallGame int64 // 拉霸专用 小游戏奖励
WinTotal int64 // 拉霸专用 输赢
}
type GamePlayerListRet struct {