diff --git a/gamesrv/avengers/scenepolicy_avengers.go b/gamesrv/avengers/scenepolicy_avengers.go index b73f65c..c9334c3 100644 --- a/gamesrv/avengers/scenepolicy_avengers.go +++ b/gamesrv/avengers/scenepolicy_avengers.go @@ -934,31 +934,30 @@ func AvengersCheckAndSaveLog(sceneEx *AvengersSceneData, playerEx *AvengersPlaye if err == nil { logid, _ := model.AutoIncGameLogId() playerEx.currentLogId = logid - sceneEx.SaveGameDetailedLog(logid, info, &base.GameDetailedParam{}) + sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: logid, + Detail: info, + GameTime: 1, + }) totalin := int64(playerEx.RollGameType.BaseResult.TotalBet) totalout := playerEx.RollGameType.BaseResult.ChangeCoin + playerEx.taxCoin + totalin - validFlow := totalin + totalout - validBet := common.AbsI64(totalin - totalout) - logParam := &base.SaveGamePlayerListLogParam{ - Platform: playerEx.Platform, - Channel: playerEx.Channel, - Promoter: playerEx.BeUnderAgentCode, - PackageTag: playerEx.PackageID, - InviterId: playerEx.InviterId, + sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ LogId: logid, + Platform: playerEx.Platform, + Snid: playerEx.SnId, + Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, TotalIn: totalin, TotalOut: totalout, TaxCoin: playerEx.taxCoin, BetAmount: int64(playerEx.RollGameType.BaseResult.TotalBet), WinAmountNoAnyTax: playerEx.RollGameType.BaseResult.ChangeCoin, - ValidBet: validBet, - ValidFlow: validFlow, - IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player), + IsFirstGame: false, IsFree: playerEx.RollGameType.BaseResult.IsFree, WinSmallGame: playerEx.RollGameType.BaseResult.WinSmallGame, WinTotal: playerEx.RollGameType.BaseResult.WinTotal, - } - sceneEx.SaveGamePlayerListLog(playerEx.SnId, logParam) + GameTime: 1, + }) } } } diff --git a/gamesrv/base/player.go b/gamesrv/base/player.go index 53d263d..5f47a55 100644 --- a/gamesrv/base/player.go +++ b/gamesrv/base/player.go @@ -2,6 +2,7 @@ package base import ( "fmt" + "github.com/jinzhu/now" "math" "math/rand" "time" @@ -621,7 +622,14 @@ func (this *Player) AddRankScore(rankType int32, num int64) { } } -func (this *Player) ReportGameEvent(tax, taxex, changeCoin, validbet, validFlow, in, out int64) { +type ReportGameEventParam struct { + Tax int64 // 税收 + Change int64 // 净输赢,正负值,不带税收 + In, Out int64 // 投入,产出(税前) + GameTime int64 // 游戏时长,秒 +} + +func (this *Player) ReportGameEvent(param *ReportGameEventParam) { // 记录玩家 首次参与该场次的游戏时间 游戏次数 var gameFirstTime, gameFreeFirstTime time.Time var gameTimes, gameFreeTimes int64 @@ -638,12 +646,46 @@ func (this *Player) ReportGameEvent(tax, taxex, changeCoin, validbet, validFlow, gameFreeTimes = dataGame.Statics.GameTimes } - gamingTime := int32(time.Now().Sub(this.scene.GameNowTime).Seconds()) - mq.Write(model.CreatePlayerGameRecEvent(this.SnId, tax, taxex, changeCoin, validbet, validFlow, in, out, - this.scene.GameId, this.scene.GetGameFreeId(), int32(this.scene.GameMode), - this.scene.GetRecordId(), this.Channel, this.ChannelId, this.BeUnderAgentCode, this.Platform, this.City, this.DeviceOS, - this.CreateTime, gamingTime, gameFirstTime, gameFreeFirstTime, gameTimes, gameFreeTimes, this.LastLoginTime, - this.TelephonePromoter, this.DeviceId), mq.BackGameRecord) + isNew := int32(0) + tCreateDay := now.New(this.CreateTime.Local()).BeginningOfDay() + if now.BeginningOfDay().Equal(tCreateDay) { + isNew = 1 + } + + if param.GameTime < 0 { + param.GameTime = int64(time.Now().Sub(this.scene.GameNowTime).Seconds()) + } + if param.GameTime < 0 { + param.GameTime = 0 + } + + log := &model.PlayerGameRecEvent{ + Platform: this.Platform, + RecordId: this.scene.GetRecordId(), + SnId: this.GetSnId(), + Channel: this.Channel, + ChannelId: this.ChannelId, + City: this.City, + OS: this.DeviceOS, + GameId: this.scene.GameId, + ModeId: this.scene.GameMode, + Tax: param.Tax, + Amount: param.Change, + CreateTime: this.CreateTime.Unix(), + CreateDayTime: tCreateDay.Unix(), + Out: param.Out, + In: param.In, + IsNew: isNew, + GameFreeID: this.scene.GetGameFreeId(), + GamingTime: int32(param.GameTime), + FirstTime: gameFirstTime.Unix(), + PlayTimes: gameTimes, + FirstGameTime: gameFreeFirstTime.Unix(), + PlayGameTimes: gameFreeTimes, + LastLoginTime: this.LastLoginTime.Unix(), + DeviceId: this.DeviceId, + } + mq.Write(log, mq.BackGameRecord) } // 汇总玩家该次游戏总产生的税收 diff --git a/gamesrv/base/scene.go b/gamesrv/base/scene.go index a0ca96f..cb10fac 100644 --- a/gamesrv/base/scene.go +++ b/gamesrv/base/scene.go @@ -2,6 +2,7 @@ package base import ( "fmt" + "github.com/globalsign/mgo/bson" "math" "math/rand" "strconv" @@ -87,7 +88,8 @@ type Scene struct { SystemCoinOut int64 //本局游戏机器人营收 机器人赢:正值 机器人输:负值 ChessRank []int32 RealCtrl bool - CycleID string + CycleID string // 房卡场多轮对局id + LogId string // 游戏每局id } func NewScene(args *CreateSceneParam) *Scene { @@ -160,75 +162,104 @@ func (this *Scene) GetGameFreeId() int32 { func (this *Scene) GetKeyGameId() string { return this.KeyGameId } + func (this *Scene) SetKeyGameId(keyGameId string) { this.KeyGameId = keyGameId } + func (this *Scene) GetSceneId() int { return int(this.SceneId) } + func (this *Scene) SetSceneId(sceneId int) { this.SceneId = int32(sceneId) } + func (this *Scene) GetGroupId() int32 { return this.GroupId } + func (this *Scene) SetGroupId(groupId int32) { this.GroupId = groupId } + func (this *Scene) GetExtraData() interface{} { return this.ExtraData } + func (this *Scene) SetExtraData(data interface{}) { this.ExtraData = data } + func (this *Scene) GetSceneState() SceneState { return this.SceneState } + func (this *Scene) SetSceneState(state SceneState) { this.SceneState = state } + func (this *Scene) GetGameId() int { return int(this.GameId) } + func (this *Scene) SetGameId(gameId int) { this.GameId = int32(gameId) } + func (this *Scene) GetPlayerNum() int { - return int(this.WGCreateScene.GetPlayerNum()) + n := this.WGCreateScene.GetPlayerNum() + if n > 0 { + return int(n) + } + return int(this.PlayerNum) } + func (this *Scene) SetPlayerNum(playerNum int) { + this.WGCreateScene.PlayerNum = int32(playerNum) this.PlayerNum = int32(playerNum) } + func (this *Scene) GetGameMode() int { return int(this.GameMode) } + func (this *Scene) SetGameMode(gameMode int) { this.GameMode = int32(gameMode) } + func (this *Scene) GetGaming() bool { return this.Gaming } + func (this *Scene) SetGaming(gaming bool) { this.Gaming = gaming } + func (this *Scene) GetTesting() bool { return this.Testing } + func (this *Scene) SetTesting(testing bool) { this.Testing = testing } + func (this *Scene) GetCreator() int32 { return this.Creator } + func (this *Scene) SetCreator(creator int32) { this.Creator = creator } + func (this *Scene) GetSceneMode() int { return int(this.SceneMode) } + func (this *Scene) SetSceneMode(sceneMode int) { this.SceneMode = int32(sceneMode) } + func (this *Scene) GetParams() []int64 { return this.Params } @@ -236,42 +267,55 @@ func (this *Scene) GetParams() []int64 { func (this *Scene) GetStateStartTime() time.Time { return this.StateStartTime } + func (this *Scene) SetStateStartTime(stateStartTime time.Time) { this.StateStartTime = stateStartTime } + func (this *Scene) GetGameStartTime() time.Time { return this.GameStartTime } + func (this *Scene) SetGameStartTime(gameStartTime time.Time) { this.GameStartTime = gameStartTime } + func (this *Scene) GetGameNowTime() time.Time { return this.GameNowTime } + func (this *Scene) SetGameNowTime(gameNowTime time.Time) { this.GameNowTime = gameNowTime } + func (this *Scene) GetNumOfGames() int { return this.NumOfGames } + func (this *Scene) SetNumOfGames(numOfGames int) { this.NumOfGames = numOfGames } + func (this *Scene) GetCpCtx() model.CoinPoolCtx { return this.CpCtx } + func (this *Scene) SetCpCtx(cpCtx model.CoinPoolCtx) { this.CpCtx = cpCtx } + func (this *Scene) GetAudiences() map[int32]*Player { return this.audiences } + func (this *Scene) GetDisbandGen() int { return this.disbandGen } + func (this *Scene) SetDisbandGen(disbandGen int) { this.disbandGen = disbandGen } + func (this *Scene) GetScenePolicy() ScenePolicy { return this.sp } @@ -1403,112 +1447,6 @@ func (this *Scene) ClearAutoPlayer() { } } -type GameDetailedParam struct { - Trend20Lately string //最近20局开奖结果 - CtrlType int - PlayerPool map[int]int - CycleId string -} - -// 保存详细游戏日志 -func (this *Scene) SaveGameDetailedLog(logid string, gamedetailednote string, gameDetailedParam *GameDetailedParam) { - if this != nil { - if !this.Testing { //测试场屏蔽掉 - trend20Lately := gameDetailedParam.Trend20Lately - baseScore := this.GetDBGameFree().GetBaseScore() - if common.IsLocalGame(int(this.GameId)) { - baseScore = this.BaseScore - } - if this.IsCoinScene() { - mapPlatform := make(map[string]bool) - for _, p := range this.Players { - if _, ok := mapPlatform[p.Platform]; !ok { - mapPlatform[p.Platform] = true - log := model.NewGameDetailedLogEx(logid, int32(this.GameId), int32(this.SceneId), - this.GetDBGameFree().GetGameMode(), this.GetDBGameFree().Id, int32(len(this.Players)), - int32(time.Now().Unix()-this.GameNowTime.Unix()), baseScore, - gamedetailednote, p.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[int(this.GameId)], trend20Lately, - gameDetailedParam.CtrlType, gameDetailedParam.PlayerPool, gameDetailedParam.CycleId) - if log != nil { - if this.IsMatchScene() { - log.MatchId = this.GetMatch().GetMatchSortId() - } - if this.IsCustom() { - log.CycleId = this.CycleID - } - mq.Write(log) - } - } - } - } else { - log := model.NewGameDetailedLogEx(logid, int32(this.GameId), int32(this.SceneId), - this.GetDBGameFree().GetGameMode(), this.GetDBGameFree().Id, int32(len(this.Players)), - int32(time.Now().Unix()-this.GameNowTime.Unix()), baseScore, - gamedetailednote, this.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[int(this.GameId)], trend20Lately, - gameDetailedParam.CtrlType, gameDetailedParam.PlayerPool, gameDetailedParam.CycleId) - if log != nil { - if this.IsMatchScene() { - log.MatchId = this.GetMatch().GetMatchSortId() - } - if this.IsCustom() { - log.CycleId = this.CycleID - } - newLog := new(model.GameDetailedLog) - *newLog = *log - mq.Write(log) - } - } - } - } -} - -type SaveGamePlayerListLogParam struct { - Platform string //平台 - Channel string //渠道 - Promoter string //推广员 - PackageTag string //包标识 - InviterId int32 //邀请人 - LogId string //日志id - TotalIn int64 //总投入 - TotalOut int64 //总产出 - TaxCoin int64 //总税收 - ClubPumpCoin int64 //俱乐部抽水 - BetAmount int64 //下注量 - WinAmountNoAnyTax int64 //税后赢取额(净利润,正负值) - ValidBet int64 //有效下注 - ValidFlow int64 //有效流水 - IsFirstGame bool //是否第一次游戏 - IsLeave bool //是否中途离开,用于金花,德州可以中途离开游戏使用 - IsFree bool //拉霸专用 是否免费 - WinSmallGame int64 //拉霸专用 小游戏奖励 - WinTotal int64 //拉霸专用 本局输赢 - PlayerName string //玩家名字 - CycleId string // 房卡场对局id -} - -func GetSaveGamePlayerListLogParam(platform, channel, promoter, packageTag, logid string, - inviterId int32, totalin, totalout, taxCoin, clubPumpCoin, betAmount, winAmountNoAnyTax, validBet, validFlow int64, - isFirstGame, isLeave bool) *SaveGamePlayerListLogParam { - return &SaveGamePlayerListLogParam{ - Platform: platform, - Channel: channel, - Promoter: promoter, - PackageTag: packageTag, - InviterId: inviterId, - LogId: logid, - TotalIn: totalin, - TotalOut: totalout, - TaxCoin: taxCoin, - ClubPumpCoin: clubPumpCoin, - BetAmount: betAmount, - WinAmountNoAnyTax: winAmountNoAnyTax, - ValidBet: validBet, - ValidFlow: validFlow, - IsFirstGame: isFirstGame, - IsLeave: isLeave, - } -} - func (this *Scene) SaveFriendRecord(snid int32, isWin int32, billCoin int64, baseScore int32) { if this.SceneMode == common.SceneModePrivate { return @@ -1519,55 +1457,160 @@ func (this *Scene) SaveFriendRecord(snid int32, isWin int32, billCoin int64, bas } } -// 保存玩家和GameDetailedLog的映射表 -func (this *Scene) SaveGamePlayerListLog(snid int32, param *SaveGamePlayerListLogParam) { - if this != nil { - if !this.Testing { //测试场屏蔽掉 龙虎两边都压,totalin和totalout都=0,这个条件去掉 - //统计流水值 - playerEx := this.GetPlayer(snid) - //有些结算的时候,玩家已经退场,不要用是否在游戏,0709,修改为扣税后数值 - if playerEx != nil && !param.IsLeave && !playerEx.IsRob && (param.IsFree || param.TotalIn != 0 || param.TotalOut != 0) { - totalFlow := param.ValidFlow * int64(this.GetDBGameFree().GetBetWaterRate()) / 100 - playerEx.TotalConvertibleFlow += totalFlow - playerEx.TotalFlow += totalFlow - playerEx.ValidCacheBetTotal += param.ValidBet - //报表统计 - //playerEx.SaveReportForm(int(this.GetDBGameFree().GetGameClass()), this.SceneMode, this.KeyGameId, - // param.WinAmountNoAnyTax, totalFlow, param.ValidBet) - //分配利润 - ProfitDistribution(playerEx, param.TaxCoin, param.ClubPumpCoin, totalFlow) - //上报游戏事件 - playerEx.ReportGameEvent(param.TaxCoin, param.ClubPumpCoin, param.WinAmountNoAnyTax, param.ValidBet, totalFlow, param.TotalIn, param.TotalOut) - } +type SaveGameDetailedParam struct { + LogId string // 日志id + Detail string // 游戏详细信息 + GameTime int64 // 游戏时长 + Trend20Lately string // 最近20局开奖结果 + CtrlType int // 调控类型 1控赢 2控输 + PlayerPool map[int]int // 个人水池分 +} - roomType := int32(this.SceneMode) - if this.GameId == common.GameId_Avengers || - this.GameId == common.GameId_CaiShen || - this.GameId == common.GameId_EasterIsland || - this.GameId == common.GameId_IceAge || - this.GameId == common.GameId_TamQuoc { //复仇者联盟强制为0,所有场次操作记录放一起 - roomType = 0 - } - baseScore := this.GetDBGameFree().GetBaseScore() - if common.IsLocalGame(int(this.GameId)) { - baseScore = this.BaseScore - } - - Name := param.PlayerName - if playerEx != nil { - Name = param.PlayerName - } - - log := model.NewGamePlayerListLogEx(snid, param.LogId, param.Platform, param.Channel, param.Promoter, param.PackageTag, - this.GameId, baseScore, this.SceneId, int32(this.GetGameMode()), - this.GetGameFreeId(), param.TotalIn, param.TotalOut, this.ClubId, this.RoomId, param.TaxCoin, param.ClubPumpCoin, roomType, - param.BetAmount, param.WinAmountNoAnyTax, this.KeyGameId, Name, this.GetDBGameFree().GetGameClass(), - param.IsFirstGame, this.GetMatch().GetMatchSortId(), int64(this.GetMatch().GetMatchType()), param.IsFree, param.WinSmallGame, param.WinTotal, param.CycleId) - if log != nil { - mq.Write(log) - } - } +func (this *Scene) SaveGameDetailedLog(param *SaveGameDetailedParam) { + if this == nil || param == nil { + return } + + if param.GameTime < 0 { + param.GameTime = int64(time.Now().Sub(this.GameNowTime).Seconds()) + } + + if param.GameTime < 0 { + param.GameTime = 0 + } + + now := time.Now() + + f := func(plt string) { + log := &model.GameDetailedLog{ + Id: bson.NewObjectId(), + LogId: param.LogId, + GameId: this.GameId, + Platform: plt, + 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(), + GameDetailedNote: param.Detail, + GameDetailVer: GameDetailedVer[int(this.GameId)], + CpCtx: this.CpCtx, + Time: now, + Trend20Lately: param.Trend20Lately, + Ts: now.Unix(), + CtrlType: param.CtrlType, + PlayerPool: make(map[int]int), + CycleId: this.CycleID, + } + for k, v := range param.PlayerPool { + log.PlayerPool[k] = v + } + mq.Write(log) + } + + switch { + case this.IsCoinScene(): + mapPlatform := make(map[string]bool) + for _, v := range this.Players { + if v == nil { + continue + } + if _, ok := mapPlatform[v.Platform]; ok { + continue + } + mapPlatform[v.Platform] = true + f(v.Platform) + } + default: + f(this.Platform) + } +} + +type SaveGamePlayerListLogParam struct { + LogId string // 详情日志id + Platform string // 平台 + Snid int32 // 玩家id + PlayerName string // 玩家名字 + Channel string // 渠道 + ChannelId string // 推广渠道 + TotalIn int64 // 总投入 + TotalOut int64 // 总产出(税前) + TaxCoin int64 // 总税收 + BetAmount int64 // 下注量 + WinAmountNoAnyTax int64 // 税后赢取额(净利润,正负值) + IsFirstGame bool // 是否第一次游戏 + IsFree bool // 拉霸专用 是否免费 + WinSmallGame int64 // 拉霸专用 小游戏奖励 + WinTotal int64 // 拉霸专用 本局输赢 + GameTime int64 // 游戏时长 +} + +// SaveGamePlayerListLog 保存玩家对局记录 +func (this *Scene) SaveGamePlayerListLog(param *SaveGamePlayerListLogParam) { + if this == nil { + return + } + if param == nil { + return + } + + p := this.GetPlayer(param.Snid) + if p == nil { + return + } + + if param.PlayerName == "" { + param.PlayerName = p.Name + } + + baseScore := this.GetBaseScore() + + // 上报玩家游戏记录 + if !p.IsRob && (param.IsFree || param.TotalIn != 0 || param.TotalOut != 0) { + p.ReportGameEvent(&ReportGameEventParam{ + Tax: param.TaxCoin, + Change: param.WinAmountNoAnyTax, + In: param.TotalIn, + Out: param.TotalOut, + GameTime: param.GameTime, + }) + } + + // 保存玩家游戏日志 + now := time.Now() + log := &model.GamePlayerListLog{ + LogId: bson.NewObjectId(), + 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(), + IsFree: param.IsFree, + WinSmallGame: param.WinSmallGame, + WinTotal: param.WinTotal, + CycleId: this.CycleID, + } + mq.Write(log) } func (this *Scene) IsPlayerFirst(p *Player) bool { diff --git a/gamesrv/caishen/scenepolicy_caishen.go b/gamesrv/caishen/scenepolicy_caishen.go index cf4ba08..aa21249 100644 --- a/gamesrv/caishen/scenepolicy_caishen.go +++ b/gamesrv/caishen/scenepolicy_caishen.go @@ -1023,31 +1023,31 @@ func CaiShenCheckAndSaveLog(sceneEx *CaiShenSceneData, playerEx *CaiShenPlayerDa if err == nil { logid, _ := model.AutoIncGameLogId() playerEx.currentLogId = logid - sceneEx.SaveGameDetailedLog(logid, info, &base.GameDetailedParam{}) + sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: logid, + Detail: info, + GameTime: 1, + }) totalin := int64(playerEx.RollGameType.BaseResult.TotalBet) totalout := playerEx.RollGameType.BaseResult.ChangeCoin + playerEx.taxCoin + totalin - validFlow := totalin + totalout - validBet := common.AbsI64(totalin - totalout) - logParam := &base.SaveGamePlayerListLogParam{ - Platform: playerEx.Platform, - Channel: playerEx.Channel, - Promoter: playerEx.BeUnderAgentCode, - PackageTag: playerEx.PackageID, - InviterId: playerEx.InviterId, + sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ LogId: logid, + Platform: playerEx.Platform, + Snid: playerEx.SnId, + PlayerName: playerEx.Name, + Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, TotalIn: totalin, TotalOut: totalout, TaxCoin: playerEx.taxCoin, BetAmount: int64(playerEx.RollGameType.BaseResult.TotalBet), WinAmountNoAnyTax: playerEx.RollGameType.BaseResult.ChangeCoin, - ValidBet: validBet, - ValidFlow: validFlow, IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player), IsFree: playerEx.RollGameType.BaseResult.IsFree, WinSmallGame: playerEx.RollGameType.BaseResult.WinSmallGame, WinTotal: playerEx.RollGameType.BaseResult.WinTotal, - } - sceneEx.SaveGamePlayerListLog(playerEx.SnId, logParam) + GameTime: 1, + }) } } } diff --git a/gamesrv/chess/scene.go b/gamesrv/chess/scene.go index ad40fdf..00ba0dc 100644 --- a/gamesrv/chess/scene.go +++ b/gamesrv/chess/scene.go @@ -767,6 +767,7 @@ func (e *SceneEx) ToBilled(p1, p2 *PlayerEx, isWin int) (*chesstitians.Chesstiti UserIcon: p1.Head, Platform: p1.Platform, Channel: p1.Channel, + ChannelId: p1.ChannelId, Promoter: p1.BeUnderAgentCode, PackageTag: p1.PackageID, InviterId: p1.InviterId, diff --git a/gamesrv/chess/scenepolicy.go b/gamesrv/chess/scenepolicy.go index 95084c5..116ecdd 100644 --- a/gamesrv/chess/scenepolicy.go +++ b/gamesrv/chess/scenepolicy.go @@ -1298,9 +1298,6 @@ func (this *SceneStateBilled) OnEnter(s *base.Scene) { } else { totalout += (o_player.GainCoin + o_player.GainTaxCoin) } - - validFlow := totalin + totalout - validBet := common.AbsI64(totalin - totalout) sceneEx.SaveFriendRecord(o_player.UserId, o_player.IsWin, o_player.GainCoin, sceneEx.GetBaseScore()) // 游戏数据统计 @@ -1313,16 +1310,29 @@ func (this *SceneStateBilled) OnEnter(s *base.Scene) { }) // 玩家游戏记录 - sceneEx.SaveGamePlayerListLog(o_player.UserId, - base.GetSaveGamePlayerListLogParam(o_player.Platform, o_player.Channel, o_player.Promoter, - o_player.PackageTag, logid, o_player.InviterId, totalin, totalout, o_player.GainTaxCoin, - 0, 0, o_player.GainCoin, validBet, validFlow, o_player.IsFirst, o_player.IsLeave)) + sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ + LogId: logid, + 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, + BetAmount: 0, + WinAmountNoAnyTax: o_player.GainCoin, + IsFirstGame: o_player.IsFirst, + }) isSave = true } } if isSave { // 牌局记录 - sceneEx.SaveGameDetailedLog(logid, info, &base.GameDetailedParam{}) + sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: logid, + Detail: info, + }) } } sceneEx.NotifySceneRoundPause() diff --git a/gamesrv/clawdoll/scenepolicy_clawdoll.go b/gamesrv/clawdoll/scenepolicy_clawdoll.go index 6b2d895..ce712e3 100644 --- a/gamesrv/clawdoll/scenepolicy_clawdoll.go +++ b/gamesrv/clawdoll/scenepolicy_clawdoll.go @@ -781,34 +781,28 @@ func (this *StateBilled) OnEnter(s *base.Scene) { sceneEx.logid, _ = model.AutoIncGameLogId() info, err := model.MarshalGameNoteByHUNDRED(LogBaseResult) if err == nil { - sceneEx.SaveGameDetailedLog(sceneEx.logid, info, &base.GameDetailedParam{}) + sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: sceneEx.logid, + Detail: info, + }) } TotalBetValue := 0 totalin := int64(TotalBetValue) totalout := playerEx.gainCoin - validFlow := totalin + totalout - validBet := common.AbsI64(totalin - totalout) - logParam := &base.SaveGamePlayerListLogParam{ - Platform: playerEx.Platform, - Channel: playerEx.Channel, - Promoter: playerEx.BeUnderAgentCode, - PackageTag: playerEx.PackageID, - InviterId: playerEx.InviterId, - LogId: sceneEx.logid, - TotalIn: totalin, - TotalOut: totalout, - TaxCoin: playerEx.taxCoin, - BetAmount: int64(TotalBetValue), - WinAmountNoAnyTax: playerEx.gainCoin, - ValidBet: validBet, - ValidFlow: validFlow, - IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player), - IsFree: false, - WinSmallGame: 0, - WinTotal: 0, - } - sceneEx.SaveGamePlayerListLog(playerEx.SnId, logParam) + sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ + LogId: sceneEx.logid, + Platform: playerEx.Platform, + Snid: playerEx.SnId, + PlayerName: playerEx.Name, + Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, + TotalIn: totalin, + TotalOut: totalout, + TaxCoin: playerEx.taxCoin, + BetAmount: int64(TotalBetValue), + IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player), + }) } playerEx.lastIsWin = playerEx.IsWin diff --git a/gamesrv/easterisland/scenepolicy_easterisland.go b/gamesrv/easterisland/scenepolicy_easterisland.go index 2474ad4..677d88b 100644 --- a/gamesrv/easterisland/scenepolicy_easterisland.go +++ b/gamesrv/easterisland/scenepolicy_easterisland.go @@ -892,31 +892,31 @@ func EasterIslandCheckAndSaveLog(sceneEx *EasterIslandSceneData, playerEx *Easte if err == nil { logid, _ := model.AutoIncGameLogId() playerEx.currentLogId = logid - sceneEx.SaveGameDetailedLog(logid, info, &base.GameDetailedParam{}) + sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: logid, + Detail: info, + GameTime: 1, + }) totalin := int64(playerEx.RollGameType.BaseResult.TotalBet) totalout := playerEx.RollGameType.BaseResult.ChangeCoin + playerEx.taxCoin + totalin - validFlow := totalin + totalout - validBet := common.AbsI64(totalin - totalout) - logParam := &base.SaveGamePlayerListLogParam{ - Platform: playerEx.Platform, - Channel: playerEx.Channel, - Promoter: playerEx.BeUnderAgentCode, - PackageTag: playerEx.PackageID, - InviterId: playerEx.InviterId, + sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ LogId: logid, + Platform: playerEx.Platform, + Snid: playerEx.SnId, + PlayerName: playerEx.Name, + Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, TotalIn: totalin, TotalOut: totalout, TaxCoin: playerEx.taxCoin, BetAmount: int64(playerEx.RollGameType.BaseResult.TotalBet), WinAmountNoAnyTax: playerEx.RollGameType.BaseResult.ChangeCoin, - ValidBet: validBet, - ValidFlow: validFlow, IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player), IsFree: playerEx.RollGameType.BaseResult.IsFree, WinSmallGame: playerEx.RollGameType.BaseResult.WinSmallGame, WinTotal: playerEx.RollGameType.BaseResult.WinTotal, - } - sceneEx.SaveGamePlayerListLog(playerEx.SnId, logParam) + GameTime: 1, + }) } } } diff --git a/gamesrv/fishing/playerdata_fishing.go b/gamesrv/fishing/playerdata_fishing.go index cad0291..8e244fa 100644 --- a/gamesrv/fishing/playerdata_fishing.go +++ b/gamesrv/fishing/playerdata_fishing.go @@ -262,13 +262,24 @@ func (this *FishingPlayerData) SaveDetailedLog(s *base.Scene) { info, err := model.MarshalGameNoteByFISH(&fd) if err == nil { logid, _ := model.AutoIncGameLogId() - validFlow := totalin + totalout - validBet := common.AbsI64(totalin - totalout) - param := base.GetSaveGamePlayerListLogParam(this.Platform, this.Channel, this.BeUnderAgentCode, this.PackageID, logid, - this.InviterId, totalin, totalout, int64(this.sTaxCoin), 0, totalin, - totalout, validFlow, validBet, sceneEx.IsPlayerFirst(this.Player), false) - sceneEx.SaveGamePlayerListLog(this.SnId, param) - sceneEx.SaveGameDetailedLog(logid, info, &base.GameDetailedParam{}) + sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ + LogId: logid, + Platform: this.Platform, + Snid: this.SnId, + PlayerName: this.Name, + Channel: this.Channel, + ChannelId: this.ChannelId, + TotalIn: totalin, + TotalOut: totalout, + TaxCoin: int64(this.sTaxCoin), + BetAmount: totalin, + WinAmountNoAnyTax: totalout, + IsFirstGame: sceneEx.IsPlayerFirst(this.Player), + }) + sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: logid, + Detail: info, + }) } pack := &server_proto.GWFishRecord{ diff --git a/gamesrv/fortunedragon/scenepolicy_fortunedragon.go b/gamesrv/fortunedragon/scenepolicy_fortunedragon.go index c5fc2d8..cea24a8 100644 --- a/gamesrv/fortunedragon/scenepolicy_fortunedragon.go +++ b/gamesrv/fortunedragon/scenepolicy_fortunedragon.go @@ -512,7 +512,11 @@ func FortuneDragonAndSaveLog(sceneEx *FortuneDragonSceneData, playerEx *FortuneD if err == nil { logid, _ := model.AutoIncGameLogId() playerEx.currentLogId = logid - sceneEx.SaveGameDetailedLog(logid, info, &base.GameDetailedParam{}) + sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: logid, + Detail: info, + GameTime: 1, + }) var totalin, totalout int64 if data.Results[0].FreeStatus == 1 || data.Results[0].FreeNumMax == 0 { totalin = playerEx.totalBet @@ -520,25 +524,22 @@ func FortuneDragonAndSaveLog(sceneEx *FortuneDragonSceneData, playerEx *FortuneD if data.Results[0].FreeStatus == 3 || data.Results[0].FreeNumMax == 0 { totalout = int64(data.RoundReward) + playerEx.taxCoin } - validFlow := totalin + totalout - validBet := common.AbsI64(totalin - totalout) - logParam := &base.SaveGamePlayerListLogParam{ - Platform: playerEx.Platform, - Channel: playerEx.Channel, - Promoter: playerEx.BeUnderAgentCode, - PackageTag: playerEx.PackageID, - InviterId: playerEx.InviterId, + sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ LogId: logid, + Platform: playerEx.Platform, + Snid: playerEx.SnId, + PlayerName: playerEx.Name, + Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, TotalIn: totalin, TotalOut: totalout, TaxCoin: playerEx.taxCoin, BetAmount: totalin, WinAmountNoAnyTax: totalout - totalin - playerEx.taxCoin, - ValidBet: validBet, - ValidFlow: validFlow, IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player), - } - sceneEx.SaveGamePlayerListLog(playerEx.SnId, logParam) + IsFree: playerEx.isFree, + GameTime: 1, + }) } } diff --git a/gamesrv/fortuneox/scenepolicy_fortuneox.go b/gamesrv/fortuneox/scenepolicy_fortuneox.go index 1e05719..f204c1c 100644 --- a/gamesrv/fortuneox/scenepolicy_fortuneox.go +++ b/gamesrv/fortuneox/scenepolicy_fortuneox.go @@ -517,7 +517,11 @@ func FortuneOxAndSaveLog(sceneEx *FortuneOxSceneData, playerEx *FortuneOxPlayerD if err == nil { logid, _ := model.AutoIncGameLogId() playerEx.currentLogId = logid - sceneEx.SaveGameDetailedLog(logid, info, &base.GameDetailedParam{}) + sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: logid, + Detail: info, + GameTime: 1, + }) var totalin, totalout int64 if data.Results[0].FreeStatus == 1 || data.Results[0].FreeNumMax == 0 { totalin = playerEx.totalBet @@ -525,25 +529,22 @@ func FortuneOxAndSaveLog(sceneEx *FortuneOxSceneData, playerEx *FortuneOxPlayerD if data.Results[0].FreeStatus == 3 || data.Results[0].FreeNumMax == 0 { totalout = int64(data.RoundReward) + playerEx.taxCoin } - validFlow := totalin + totalout - validBet := common.AbsI64(totalin - totalout) - logParam := &base.SaveGamePlayerListLogParam{ - Platform: playerEx.Platform, - Channel: playerEx.Channel, - Promoter: playerEx.BeUnderAgentCode, - PackageTag: playerEx.PackageID, - InviterId: playerEx.InviterId, + sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ LogId: logid, + Platform: playerEx.Platform, + Snid: playerEx.SnId, + PlayerName: playerEx.Name, + Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, TotalIn: totalin, TotalOut: totalout, TaxCoin: playerEx.taxCoin, - BetAmount: playerEx.totalBet, + BetAmount: totalin, WinAmountNoAnyTax: totalout - totalin - playerEx.taxCoin, - ValidBet: validBet, - ValidFlow: validFlow, IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player), - } - sceneEx.SaveGamePlayerListLog(playerEx.SnId, logParam) + IsFree: totalin == 0, + GameTime: 1, + }) } } diff --git a/gamesrv/fortunerabbit/scenepolicy_fortunerabbit.go b/gamesrv/fortunerabbit/scenepolicy_fortunerabbit.go index 13e788c..738ba3b 100644 --- a/gamesrv/fortunerabbit/scenepolicy_fortunerabbit.go +++ b/gamesrv/fortunerabbit/scenepolicy_fortunerabbit.go @@ -511,7 +511,11 @@ func FortuneRabbitAndSaveLog(sceneEx *FortuneRabbitSceneData, playerEx *FortuneR if err == nil { logid, _ := model.AutoIncGameLogId() playerEx.currentLogId = logid - sceneEx.SaveGameDetailedLog(logid, info, &base.GameDetailedParam{}) + sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: logid, + Detail: info, + GameTime: 1, + }) var totalin, totalout int64 if data.Results[0].FreeStatus == 1 || data.Results[0].FreeNumMax == 0 { totalin = playerEx.totalBet @@ -519,25 +523,22 @@ func FortuneRabbitAndSaveLog(sceneEx *FortuneRabbitSceneData, playerEx *FortuneR if data.Results[0].FreeStatus == 3 || data.Results[0].FreeNumMax == 0 { totalout = int64(data.RoundReward) + playerEx.taxCoin } - validFlow := totalin + totalout - validBet := common.AbsI64(totalin - totalout) - logParam := &base.SaveGamePlayerListLogParam{ - Platform: playerEx.Platform, - Channel: playerEx.Channel, - Promoter: playerEx.BeUnderAgentCode, - PackageTag: playerEx.PackageID, - InviterId: playerEx.InviterId, + sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ LogId: logid, + Platform: playerEx.Platform, + Snid: playerEx.SnId, + PlayerName: playerEx.Name, + Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, TotalIn: totalin, TotalOut: totalout, TaxCoin: playerEx.taxCoin, - BetAmount: playerEx.totalBet, + BetAmount: totalin, WinAmountNoAnyTax: totalout - totalin - playerEx.taxCoin, - ValidBet: validBet, - ValidFlow: validFlow, IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player), - } - sceneEx.SaveGamePlayerListLog(playerEx.SnId, logParam) + IsFree: playerEx.isFree, + GameTime: 1, + }) } } diff --git a/gamesrv/fortunetiger/scenepolicy_fortunetiger.go b/gamesrv/fortunetiger/scenepolicy_fortunetiger.go index 9edc6be..2c5c11d 100644 --- a/gamesrv/fortunetiger/scenepolicy_fortunetiger.go +++ b/gamesrv/fortunetiger/scenepolicy_fortunetiger.go @@ -514,7 +514,11 @@ func FortuneTigerAndSaveLog(sceneEx *FortuneTigerSceneData, playerEx *FortuneTig if err == nil { logid, _ := model.AutoIncGameLogId() playerEx.currentLogId = logid - sceneEx.SaveGameDetailedLog(logid, info, &base.GameDetailedParam{}) + sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: logid, + Detail: info, + GameTime: 1, + }) var totalin, totalout int64 if data.Results[0].FreeStatus == 1 || data.Results[0].FreeNumMax == 0 { totalin = playerEx.totalBet @@ -522,25 +526,22 @@ func FortuneTigerAndSaveLog(sceneEx *FortuneTigerSceneData, playerEx *FortuneTig if data.Results[0].FreeStatus == 3 || data.Results[0].FreeNumMax == 0 { totalout = int64(data.RoundReward) + playerEx.taxCoin } - validFlow := totalin + totalout - validBet := common.AbsI64(totalin - totalout) - logParam := &base.SaveGamePlayerListLogParam{ - Platform: playerEx.Platform, - Channel: playerEx.Channel, - Promoter: playerEx.BeUnderAgentCode, - PackageTag: playerEx.PackageID, - InviterId: playerEx.InviterId, + sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ LogId: logid, + Platform: playerEx.Platform, + Snid: playerEx.SnId, + PlayerName: playerEx.Name, + Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, TotalIn: totalin, TotalOut: totalout, TaxCoin: playerEx.taxCoin, - BetAmount: playerEx.totalBet, + BetAmount: totalin, WinAmountNoAnyTax: totalout - totalin - playerEx.taxCoin, - ValidBet: validBet, - ValidFlow: validFlow, IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player), - } - sceneEx.SaveGamePlayerListLog(playerEx.SnId, logParam) + IsFree: totalin == 0, + GameTime: 1, + }) } } diff --git a/gamesrv/fruits/scenedata_fruits.go b/gamesrv/fruits/scenedata_fruits.go index 94f20de..8280e92 100644 --- a/gamesrv/fruits/scenedata_fruits.go +++ b/gamesrv/fruits/scenedata_fruits.go @@ -326,7 +326,11 @@ func (s *FruitsSceneData) SaveLog(p *FruitsPlayerData, isOffline int) { info, err := model.MarshalGameNoteByROLL(&FruitsType) if err == nil { logId, _ := model.AutoIncGameLogId() - s.SaveGameDetailedLog(logId, info, &base.GameDetailedParam{}) + s.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: logId, + Detail: info, + GameTime: 1, + }) //水池上下文环境s s.CpCtx = p.cpCtx var totalIn, totalOut int64 @@ -336,22 +340,22 @@ func (s *FruitsSceneData) SaveLog(p *FruitsPlayerData, isOffline int) { if nowGetCoin > 0 && isF { totalOut = p.Coin - p.startCoin + betCoin /*+ p.taxCoin*/ } - s.SaveGamePlayerListLog(p.SnId, - &base.SaveGamePlayerListLogParam{ - Platform: p.Platform, - Channel: p.Channel, - Promoter: p.BeUnderAgentCode, - PackageTag: p.PackageID, - InviterId: p.InviterId, - LogId: logId, - TotalIn: totalIn, - TotalOut: totalOut, - TaxCoin: p.taxCoin, - ClubPumpCoin: 0, - BetAmount: totalIn, - WinAmountNoAnyTax: p.Coin - p.startCoin, - IsFirstGame: s.IsPlayerFirst(p.Player), - }) + s.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ + LogId: logId, + Platform: p.Platform, + Snid: p.SnId, + PlayerName: p.Name, + Channel: p.Channel, + ChannelId: p.ChannelId, + TotalIn: totalIn, + TotalOut: totalOut, + TaxCoin: p.taxCoin, + BetAmount: totalIn, + WinAmountNoAnyTax: p.Coin - p.startCoin, + IsFirstGame: s.IsPlayerFirst(p.Player), + IsFree: totalIn == 0, + GameTime: 1, + }) } s.GameNowTime = time.Now() if s.CheckNeedDestroy() && p.freeTimes == 0 && p.maryFreeTimes == 0 { diff --git a/gamesrv/iceage/scenepolicy_iceage.go b/gamesrv/iceage/scenepolicy_iceage.go index be0ebff..787d74f 100644 --- a/gamesrv/iceage/scenepolicy_iceage.go +++ b/gamesrv/iceage/scenepolicy_iceage.go @@ -942,31 +942,31 @@ func IceAgeCheckAndSaveLog(sceneEx *IceAgeSceneData, playerEx *IceAgePlayerData) if err == nil { logid, _ := model.AutoIncGameLogId() playerEx.currentLogId = logid - sceneEx.SaveGameDetailedLog(logid, info, &base.GameDetailedParam{}) + sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: logid, + Detail: info, + GameTime: 1, + }) totalin := int64(playerEx.RollGameType.BaseResult.TotalBet) totalout := playerEx.RollGameType.BaseResult.ChangeCoin + playerEx.taxCoin + totalin - validFlow := totalin + totalout - validBet := common.AbsI64(totalin - totalout) - logParam := &base.SaveGamePlayerListLogParam{ - Platform: playerEx.Platform, - Channel: playerEx.Channel, - Promoter: playerEx.BeUnderAgentCode, - PackageTag: playerEx.PackageID, - InviterId: playerEx.InviterId, + sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ LogId: logid, + Platform: playerEx.Platform, + Snid: playerEx.SnId, + PlayerName: playerEx.Name, + Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, TotalIn: totalin, TotalOut: totalout, TaxCoin: playerEx.taxCoin, BetAmount: int64(playerEx.RollGameType.BaseResult.TotalBet), WinAmountNoAnyTax: playerEx.RollGameType.BaseResult.ChangeCoin, - ValidBet: validBet, - ValidFlow: validFlow, IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player), IsFree: playerEx.RollGameType.BaseResult.IsFree, WinSmallGame: playerEx.RollGameType.BaseResult.WinSmallGame, WinTotal: playerEx.RollGameType.BaseResult.WinTotal, - } - sceneEx.SaveGamePlayerListLog(playerEx.SnId, logParam) + GameTime: 1, + }) } } } diff --git a/gamesrv/richblessed/scenedata_richblessed.go b/gamesrv/richblessed/scenedata_richblessed.go index 9d31d45..957fc1c 100644 --- a/gamesrv/richblessed/scenedata_richblessed.go +++ b/gamesrv/richblessed/scenedata_richblessed.go @@ -348,7 +348,11 @@ func (s *RichBlessedSceneData) SaveLog(p *RichBlessedPlayerData, isOffline int) info, err := model.MarshalGameNoteByROLL(&RichBlessed) if err == nil { logId, _ := model.AutoIncGameLogId() - s.SaveGameDetailedLog(logId, info, &base.GameDetailedParam{}) + s.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: logId, + Detail: info, + GameTime: 1, + }) //水池上下文环境s s.CpCtx = p.cpCtx var totalIn, totalOut int64 @@ -358,22 +362,22 @@ func (s *RichBlessedSceneData) SaveLog(p *RichBlessedPlayerData, isOffline int) if nowGetCoin > 0 { totalOut = p.Coin - p.startCoin + betCoin /*+ p.taxCoin*/ } - s.SaveGamePlayerListLog(p.SnId, - &base.SaveGamePlayerListLogParam{ - Platform: p.Platform, - Channel: p.Channel, - Promoter: p.BeUnderAgentCode, - PackageTag: p.PackageID, - InviterId: p.InviterId, - LogId: logId, - TotalIn: totalIn, - TotalOut: totalOut, - TaxCoin: p.taxCoin, - ClubPumpCoin: 0, - BetAmount: totalIn, - WinAmountNoAnyTax: p.Coin - p.startCoin, - IsFirstGame: s.IsPlayerFirst(p.Player), - }) + s.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ + LogId: logId, + Platform: p.Platform, + Snid: p.SnId, + PlayerName: p.Name, + Channel: p.Channel, + ChannelId: p.ChannelId, + TotalIn: totalIn, + TotalOut: totalOut, + TaxCoin: p.taxCoin, + BetAmount: totalIn, + WinAmountNoAnyTax: p.Coin - p.startCoin, + IsFirstGame: s.IsPlayerFirst(p.Player), + IsFree: totalIn == 0, + GameTime: 1, + }) } s.GameNowTime = time.Now() if s.CheckNeedDestroy() && p.freeTimes == 0 { diff --git a/gamesrv/smallrocket/scene.go b/gamesrv/smallrocket/scene.go index d7fec18..d329343 100644 --- a/gamesrv/smallrocket/scene.go +++ b/gamesrv/smallrocket/scene.go @@ -33,6 +33,7 @@ type PlayerData struct { Platform string //平台 Channel string //渠道信息 + ChannelId string PackageID string //推广包标识 对应客户端的packagetag flag int } @@ -333,6 +334,7 @@ func (this *SceneEx) BackupPlayer(p *PlayerEx, isBilled bool) { flag: p.GetFlag(), Platform: p.Platform, Channel: p.Channel, + ChannelId: p.ChannelId, PackageID: p.PackageID, CurIsWin: p.CurIsWin, Name: p.Name, diff --git a/gamesrv/smallrocket/scenepolicy.go b/gamesrv/smallrocket/scenepolicy.go index d690fda..cfe3367 100644 --- a/gamesrv/smallrocket/scenepolicy.go +++ b/gamesrv/smallrocket/scenepolicy.go @@ -1166,33 +1166,28 @@ func (this *StateBilled) OnEnter(s *base.Scene) { if !playerEx.IsRob { info, err := model.MarshalGameNoteByHUNDRED(LogBaseResult) if err == nil { - sceneEx.SaveGameDetailedLog(sceneEx.logid, info, &base.GameDetailedParam{}) + sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: sceneEx.logid, + Detail: info, + }) } totalin := int64(TotalBetValue) totalout := playerEx.gainCoin - validFlow := totalin + totalout - validBet := common.AbsI64(totalin - totalout) - logParam := &base.SaveGamePlayerListLogParam{ - Platform: playerEx.Platform, - Channel: playerEx.Channel, - Promoter: playerEx.BeUnderAgentCode, - PackageTag: playerEx.PackageID, - InviterId: playerEx.InviterId, + sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ LogId: sceneEx.logid, + Platform: playerEx.Platform, + Snid: playerEx.SnId, + PlayerName: playerEx.Name, + Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, TotalIn: totalin, TotalOut: totalout, TaxCoin: playerEx.taxCoin, BetAmount: int64(TotalBetValue), WinAmountNoAnyTax: playerEx.gainCoin, - ValidBet: validBet, - ValidFlow: validFlow, - IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player), - IsFree: false, - WinSmallGame: 0, - WinTotal: 0, - } - sceneEx.SaveGamePlayerListLog(playerEx.SnId, logParam) + IsFirstGame: s.IsPlayerFirst(playerEx.Player), + }) } } @@ -1248,34 +1243,30 @@ func (this *StateBilled) OnEnter(s *base.Scene) { if !playerEx.IsRob { info, err := model.MarshalGameNoteByHUNDRED(LogBaseResult) if err == nil { - sceneEx.SaveGameDetailedLog(sceneEx.logid, info, &base.GameDetailedParam{}) + sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: sceneEx.logid, + Detail: info, + }) } totalin := int64(TotalBetValue) totalout := playerEx.gainCoin - validFlow := totalin + totalout - validBet := common.AbsI64(totalin - totalout) - logParam := &base.SaveGamePlayerListLogParam{ - Platform: playerEx.Platform, - Channel: playerEx.Channel, - Promoter: playerEx.BeUnderAgentCode, - PackageTag: playerEx.PackageID, - InviterId: playerEx.InviterId, + //validFlow := totalin + totalout + //validBet := common.AbsI64(totalin - totalout) + sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ LogId: sceneEx.logid, + Platform: playerEx.Platform, + Snid: playerEx.SnId, + PlayerName: playerEx.Name, + Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, TotalIn: totalin, TotalOut: totalout, TaxCoin: playerEx.taxCoin, BetAmount: int64(TotalBetValue), WinAmountNoAnyTax: playerEx.gainCoin, - ValidBet: validBet, - ValidFlow: validFlow, IsFirstGame: playerEx.IsPlayerFirst, - IsFree: false, - WinSmallGame: 0, - WinTotal: 0, - PlayerName: playerEx.Name, - } - sceneEx.SaveGamePlayerListLog(playerEx.SnId, logParam) + }) } } } diff --git a/gamesrv/tamquoc/scenepolicy_tamquoc.go b/gamesrv/tamquoc/scenepolicy_tamquoc.go index a3495d7..2a57d3b 100644 --- a/gamesrv/tamquoc/scenepolicy_tamquoc.go +++ b/gamesrv/tamquoc/scenepolicy_tamquoc.go @@ -778,31 +778,31 @@ func TamQuocCheckAndSaveLog(sceneEx *TamQuocSceneData, playerEx *TamQuocPlayerDa if err == nil { logid, _ := model.AutoIncGameLogId() playerEx.currentLogId = logid - sceneEx.SaveGameDetailedLog(logid, info, &base.GameDetailedParam{}) + sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: logid, + Detail: info, + GameTime: 1, + }) totalin := int64(playerEx.RollGameType.BaseResult.TotalBet) totalout := playerEx.RollGameType.BaseResult.ChangeCoin + playerEx.taxCoin + totalin - validFlow := totalin + totalout - validBet := common.AbsI64(totalin - totalout) - logParam := &base.SaveGamePlayerListLogParam{ - Platform: playerEx.Platform, - Channel: playerEx.Channel, - Promoter: playerEx.BeUnderAgentCode, - PackageTag: playerEx.PackageID, - InviterId: playerEx.InviterId, + sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ LogId: logid, + Platform: playerEx.Platform, + Snid: playerEx.SnId, + PlayerName: playerEx.Name, + Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, TotalIn: totalin, TotalOut: totalout, TaxCoin: playerEx.taxCoin, BetAmount: int64(playerEx.RollGameType.BaseResult.TotalBet), WinAmountNoAnyTax: playerEx.RollGameType.BaseResult.ChangeCoin, - ValidBet: validBet, - ValidFlow: validFlow, IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player), IsFree: playerEx.RollGameType.BaseResult.IsFree, WinSmallGame: playerEx.RollGameType.BaseResult.WinSmallGame, WinTotal: playerEx.RollGameType.BaseResult.WinTotal, - } - sceneEx.SaveGamePlayerListLog(playerEx.SnId, logParam) + GameTime: 1, + }) } } } diff --git a/gamesrv/thirteen/scenepolicy.go b/gamesrv/thirteen/scenepolicy.go index 775faa0..b7a3fd9 100644 --- a/gamesrv/thirteen/scenepolicy.go +++ b/gamesrv/thirteen/scenepolicy.go @@ -181,11 +181,22 @@ func (this *PolicyThirteen) OnPlayerLeave(s *base.Scene, p *base.Player, reason } else { totalin -= playerEx.gainCoin } - validFlow := totalin + totalout - validBet := common.AbsI64(totalin - totalout) - sceneEx.SaveGamePlayerListLog(playerEx.SnId, base.GetSaveGamePlayerListLogParam(playerEx.Platform, playerEx.Channel, playerEx.BeUnderAgentCode, - playerEx.PackageID, sceneEx.logid, playerEx.InviterId, totalin, totalout, playerEx.taxCoin, - 0, 0, playerEx.gainCoin, validBet, validFlow, sceneEx.IsPlayerFirst(sceneEx.GetPlayer(playerEx.SnId)), false)) + //validFlow := totalin + totalout + //validBet := common.AbsI64(totalin - totalout) + sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ + LogId: sceneEx.logid, + Platform: playerEx.Platform, + Snid: playerEx.SnId, + PlayerName: playerEx.Name, + Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, + TotalIn: totalin, + TotalOut: totalout, + TaxCoin: playerEx.taxCoin, + BetAmount: 0, + WinAmountNoAnyTax: playerEx.gainCoin, + IsFirstGame: sceneEx.IsPlayerFirst(sceneEx.GetPlayer(playerEx.SnId)), + }) sceneEx.Statistics(&base.StaticParam{ SnId: playerEx.SnId, @@ -1390,11 +1401,20 @@ func (this *StateBilled) OnEnter(s *base.Scene) { } else { totalin -= o_player.gainCoin } - validFlow := totalin + totalout - validBet := common.AbsI64(totalin - totalout) - sceneEx.SaveGamePlayerListLog(o_player.SnId, base.GetSaveGamePlayerListLogParam(o_player.Platform, o_player.Channel, o_player.BeUnderAgentCode, - o_player.PackageID, sceneEx.logid, o_player.InviterId, totalin, totalout, o_player.taxCoin, - 0, 0, o_player.gainCoin, validBet, validFlow, p.IsFirst, false)) + sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ + LogId: sceneEx.logid, + 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, + BetAmount: 0, + WinAmountNoAnyTax: o_player.gainCoin, + IsFirstGame: p.IsFirst, + }) } } } @@ -1453,10 +1473,11 @@ func (this *StateBilled) OnEnter(s *base.Scene) { thirteenWaterType.PlayerCount = len(person) info, err := model.MarshalGameNoteByFIGHT(&thirteenWaterType) if err == nil { - sceneEx.SaveGameDetailedLog(sceneEx.logid, info, &base.GameDetailedParam{ - Trend20Lately: "", - CtrlType: sceneEx.ctrlType, - PlayerPool: playerPool, + sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: sceneEx.logid, + Detail: info, + CtrlType: sceneEx.ctrlType, + PlayerPool: playerPool, }) } } diff --git a/gamesrv/tienlen/scenepolicy_tienlen.go b/gamesrv/tienlen/scenepolicy_tienlen.go index 5a249ae..2f29da4 100644 --- a/gamesrv/tienlen/scenepolicy_tienlen.go +++ b/gamesrv/tienlen/scenepolicy_tienlen.go @@ -1737,6 +1737,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { UserIcon: playerEx.Head, Platform: playerEx.Platform, Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, Promoter: playerEx.BeUnderAgentCode, PackageTag: playerEx.PackageID, InviterId: playerEx.InviterId, @@ -1888,6 +1889,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { UserIcon: losePlayer.Head, Platform: losePlayer.Platform, Channel: losePlayer.Channel, + ChannelId: losePlayer.ChannelId, Promoter: losePlayer.BeUnderAgentCode, PackageTag: losePlayer.PackageID, InviterId: losePlayer.InviterId, @@ -2030,6 +2032,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { UserIcon: lastWinPlayer.Head, Platform: lastWinPlayer.Platform, Channel: lastWinPlayer.Channel, + ChannelId: lastWinPlayer.ChannelId, Promoter: lastWinPlayer.BeUnderAgentCode, PackageTag: lastWinPlayer.PackageID, InviterId: lastWinPlayer.InviterId, @@ -2141,6 +2144,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { UserIcon: playerEx.Head, Platform: playerEx.Platform, Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, Promoter: playerEx.BeUnderAgentCode, PackageTag: playerEx.PackageID, InviterId: playerEx.InviterId, @@ -2246,6 +2250,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { UserIcon: playerEx.Head, Platform: playerEx.Platform, Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, Promoter: playerEx.BeUnderAgentCode, PackageTag: playerEx.PackageID, InviterId: playerEx.InviterId, @@ -2397,6 +2402,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { UserIcon: playerEx.Head, Platform: playerEx.Platform, Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, Promoter: playerEx.BeUnderAgentCode, PackageTag: playerEx.PackageID, InviterId: playerEx.InviterId, @@ -2527,6 +2533,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { UserIcon: playerEx.Head, Platform: playerEx.Platform, Channel: playerEx.Channel, + ChannelId: playerEx.ChannelId, Promoter: playerEx.BeUnderAgentCode, PackageTag: playerEx.PackageID, InviterId: playerEx.InviterId, @@ -2729,8 +2736,6 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { playerEx.UpdatePigBankCoin(o_player.GainCoin) } - validFlow := totalin + totalout - validBet := common.AbsI64(totalin - totalout) sceneEx.SaveFriendRecord(o_player.UserId, o_player.IsWin, o_player.BillCoin, sceneEx.GetBaseScore()) // 玩家数据统计 @@ -2752,20 +2757,29 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { }) // 保存玩家游戏记录 - param := base.GetSaveGamePlayerListLogParam(o_player.Platform, o_player.Channel, o_player.Promoter, - o_player.PackageTag, sceneEx.recordId, o_player.InviterId, totalin, totalout, o_player.BillTaxCoin, - 0, 0, o_player.GainCoin+o_player.BombCoin, validBet, validFlow, o_player.IsFirst, o_player.IsLeave) - param.CycleId = sceneEx.CycleID - sceneEx.SaveGamePlayerListLog(o_player.UserId, param) + sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{ + 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, + BetAmount: 0, + WinAmountNoAnyTax: o_player.GainCoin + o_player.BombCoin, + IsFirstGame: o_player.IsFirst, + }) } } if isSave { // 牌局记录 - sceneEx.SaveGameDetailedLog(sceneEx.recordId, info, &base.GameDetailedParam{ + sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{ + LogId: sceneEx.recordId, + Detail: info, Trend20Lately: "", CtrlType: sceneEx.ctrlType, PlayerPool: tienlenType.PlayerPool, - CycleId: sceneEx.CycleID, }) } } diff --git a/model/dataevent.go b/model/dataevent.go index 3cb9070..b3d138f 100644 --- a/model/dataevent.go +++ b/model/dataevent.go @@ -275,49 +275,6 @@ type PlayerGameRecEvent struct { ChannelId string //推广渠道id } -func CreatePlayerGameRecEvent(snid int32, tax, taxex, amount, validbet, validflow, in, out int64, gameid, gameFreeId, modeid int32, recordId, channel, channelId, promoter, - platform, city, os string, createDayTime time.Time, gamingTime int32, firstGameFreeTime, firstGameTime time.Time, - playGameFreeTimes, playerGameTimes int64, lastLoginTime time.Time, teleponePromoter int32, deviceId string) *PlayerGameRecEvent { - isNewbie := int32(0) - tCreateDay := now.New(createDayTime).BeginningOfDay() - if now.BeginningOfDay().Equal(tCreateDay) { - isNewbie = 1 - } - if gamingTime < 0 { - gamingTime = 0 - } - return &PlayerGameRecEvent{RecordId: recordId, - SnId: snid, - Channel: channel, - Promoter: promoter, - TelephonePromoter: teleponePromoter, - Platform: platform, - City: city, - OS: os, - GameId: gameid, - ModeId: modeid, - Tax: tax, - //Taxex: taxex, - Amount: amount, - ValidBet: validbet, - ValidFlow: validflow, - In: in, - Out: out, - CreateTime: time.Now().Local().Unix(), - CreateDayTime: tCreateDay.Local().Unix(), - IsNew: isNewbie, - GameFreeID: gameFreeId, - GamingTime: gamingTime, - FirstTime: firstGameFreeTime.Unix(), - FirstGameTime: firstGameTime.Unix(), - PlayTimes: playGameFreeTimes, - PlayGameTimes: playerGameTimes, - LastLoginTime: lastLoginTime.Unix(), - DeviceId: deviceId, - ChannelId: channelId, - } -} - // 玩家游戏记录 //type PlayerGameRecPayEvent struct { // SnId int32 //用户ID diff --git a/model/gamelogtype.go b/model/gamelogtype.go index 0d9b998..4ca1a01 100644 --- a/model/gamelogtype.go +++ b/model/gamelogtype.go @@ -1536,6 +1536,7 @@ type TienLenPerson struct { UserIcon int32 //玩家头像 Platform string `json:"-"` Channel string `json:"-"` + ChannelId string `json:"-"` Promoter string `json:"-"` PackageTag string `json:"-"` InviterId int32 `json:"-"` @@ -1581,6 +1582,7 @@ type ChesstitiansPerson struct { UserIcon int32 //玩家头像 Platform string `json:"-"` Channel string `json:"-"` + ChannelId string `json:"-"` Promoter string `json:"-"` PackageTag string `json:"-"` InviterId int32 `json:"-"` diff --git a/model/gameplayerlistlog.go b/model/gameplayerlistlog.go index 4441b2d..9d06b23 100644 --- a/model/gameplayerlistlog.go +++ b/model/gameplayerlistlog.go @@ -51,7 +51,7 @@ type GamePlayerListLog struct { GameClass int32 //游戏类型 1棋牌 2电子 3百人 4捕鱼 5视讯 6彩票 7体育 MatchId int64 MatchType int64 //0.普通场 1.锦标赛 2.冠军赛 3.vip专属 - Ts int32 + Ts int64 IsFree bool //拉霸专用 是否免费 WinSmallGame int64 //拉霸专用 小游戏奖励 WinTotal int64 //拉霸专用 输赢 @@ -95,7 +95,7 @@ func NewGamePlayerListLogEx(snid int32, gamedetailedlogid string, platform, chan cl.WinSmallGame = winSmallGame cl.WinTotal = winTotal tNow := time.Now() - cl.Ts = int32(tNow.Unix()) + cl.Ts = tNow.Unix() cl.Time = tNow cl.MatchId = matchid cl.MatchType = matchType