游戏记录添加游戏组首次游戏时间和游戏次数
This commit is contained in:
parent
490576b1dc
commit
442801fc9a
|
@ -898,3 +898,7 @@ var GuideIdToGainWay = map[int]int{
|
|||
GuideIdNewPlayer: GainWayGuide,
|
||||
GuideIdCustom: GainWayGuide2,
|
||||
}
|
||||
|
||||
func GetGameDifKey(gamedif string) string {
|
||||
return fmt.Sprintf("gamedif-%v", gamedif)
|
||||
}
|
||||
|
|
|
@ -638,8 +638,8 @@ type ReportGameEventOnly struct {
|
|||
|
||||
func (this *Player) ReportGameEvent(param *ReportGameEventParam) *ReportGameEventOnly {
|
||||
// 记录玩家 首次参与该场次的游戏时间 游戏次数
|
||||
var gameFirstTime, gameFreeFirstTime time.Time
|
||||
var gameTimes, gameFreeTimes int64
|
||||
var gameFirstTime, gameFreeFirstTime, gamedifFirstTime time.Time
|
||||
var gameTimes, gameFreeTimes, gamedifTimes int64
|
||||
data, ok := this.GDatas[this.scene.KeyGamefreeId]
|
||||
if ok {
|
||||
gameFreeFirstTime = data.FirstTime
|
||||
|
@ -669,29 +669,32 @@ 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,
|
||||
OS: this.DeviceOS,
|
||||
GameId: this.scene.GameId,
|
||||
ModeId: this.scene.GameMode,
|
||||
Tax: param.Tax,
|
||||
Amount: param.Change,
|
||||
CreateTime: time.Now().Unix(),
|
||||
CreateDayTime: tCreateDay.Unix(),
|
||||
Out: param.Out,
|
||||
In: param.In,
|
||||
IsNew: isNew,
|
||||
GameFreeID: this.scene.GetGameFreeId(),
|
||||
GamingTime: int32(param.GameTime),
|
||||
FirstTime: gameFreeFirstTime.Unix(),
|
||||
PlayTimes: gameFreeTimes,
|
||||
FirstGameTime: gameFirstTime.Unix(),
|
||||
PlayGameTimes: gameTimes,
|
||||
LastLoginTime: this.LastLoginTime.Unix(),
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
RecordId: this.scene.GetRecordId(),
|
||||
SnId: this.GetSnId(),
|
||||
Channel: this.Channel,
|
||||
Platform: this.Platform,
|
||||
OS: this.DeviceOS,
|
||||
GameId: this.scene.GameId,
|
||||
ModeId: this.scene.GameMode,
|
||||
Tax: param.Tax,
|
||||
Amount: param.Change,
|
||||
CreateTime: time.Now().Unix(),
|
||||
CreateDayTime: tCreateDay.Unix(),
|
||||
Out: param.Out,
|
||||
In: param.In,
|
||||
IsNew: isNew,
|
||||
GameFreeID: this.scene.GetGameFreeId(),
|
||||
GamingTime: int32(param.GameTime),
|
||||
GameDif: this.scene.GetDBGameFree().GetGameDif(),
|
||||
FirstGameDifTime: gamedifFirstTime.Unix(),
|
||||
GameDifTimes: gamedifTimes,
|
||||
FirstTime: gameFreeFirstTime.Unix(),
|
||||
PlayTimes: gameFreeTimes,
|
||||
FirstGameTime: gameFirstTime.Unix(),
|
||||
PlayGameTimes: gameTimes,
|
||||
LastLoginTime: this.LastLoginTime.Unix(),
|
||||
ChannelId: this.ChannelId,
|
||||
}
|
||||
if param.OnlyLog {
|
||||
ret.Log = append(ret.Log, log)
|
||||
|
|
|
@ -2057,6 +2057,7 @@ func (this *Scene) IsControl(hasRobotGaming bool) bool {
|
|||
|
||||
// Statistics 玩家游戏数据统计
|
||||
// 包含水池统计,黑白名单统计,新手调控统计,个人水池统计
|
||||
// 拉霸游戏数据统计,一次下注记录一次 StaticsLaba
|
||||
func (this *Scene) Statistics(param *StaticParam) {
|
||||
if param == nil {
|
||||
return
|
||||
|
@ -2110,6 +2111,7 @@ func (this *Scene) Statistics(param *StaticParam) {
|
|||
var statics []*model.PlayerGameStatics
|
||||
keyGameId := strconv.Itoa(this.GetGameId())
|
||||
keyGameFreeId := strconv.Itoa(int(this.GetGameFreeId()))
|
||||
keyGameDif := common.GetGameDifKey(this.GetDBGameFree().GetGameDif())
|
||||
// 当天数据统计
|
||||
// 按场次分
|
||||
if data, ok := p.TodayGameData.CtrlData[keyGameFreeId]; ok {
|
||||
|
@ -2127,6 +2129,14 @@ func (this *Scene) Statistics(param *StaticParam) {
|
|||
p.TodayGameData.CtrlData[keyGameId] = data
|
||||
statics = append(statics, data)
|
||||
}
|
||||
// 按游戏组分
|
||||
if data, ok := p.TodayGameData.CtrlData[keyGameDif]; ok {
|
||||
statics = append(statics, data)
|
||||
} else {
|
||||
data = model.NewPlayerGameStatics()
|
||||
p.TodayGameData.CtrlData[keyGameDif] = data
|
||||
statics = append(statics, data)
|
||||
}
|
||||
// 按场次分
|
||||
if data, ok := p.GDatas[keyGameFreeId]; ok {
|
||||
if data.FirstTime.IsZero() {
|
||||
|
@ -2149,6 +2159,27 @@ func (this *Scene) Statistics(param *StaticParam) {
|
|||
p.GDatas[keyGameId] = data
|
||||
statics = append(statics, &data.Statics)
|
||||
}
|
||||
//按游戏组分
|
||||
getMinTime := func() time.Time {
|
||||
var minTime = time.Now()
|
||||
for _, v := range srvdata.GameFreeMgr.GetGameId(this.GetDBGameFree().GetGameDif()) {
|
||||
vv := p.GDatas[strconv.Itoa(int(v))]
|
||||
if vv != nil && vv.FirstTime.Before(minTime) {
|
||||
minTime = vv.FirstTime
|
||||
}
|
||||
}
|
||||
return minTime
|
||||
}
|
||||
if data, ok := p.GDatas[keyGameDif]; ok {
|
||||
if data.FirstTime.IsZero() {
|
||||
data.FirstTime = getMinTime()
|
||||
}
|
||||
statics = append(statics, &data.Statics)
|
||||
} else {
|
||||
data = &model.PlayerGameInfo{FirstTime: getMinTime()}
|
||||
p.GDatas[keyGameDif] = data
|
||||
statics = append(statics, &data.Statics)
|
||||
}
|
||||
|
||||
// 新手输赢统计
|
||||
if !model.GameParamData.CloseNovice && !common.InSliceInt(model.GameParamData.CloseNoviceGame, int(this.GameId)) && isControl && wbLevel == 0 && isNovice {
|
||||
|
@ -2319,6 +2350,7 @@ func (this *Scene) StaticsLaba(param *StaticLabaParam) {
|
|||
var statics []*model.PlayerGameStatics
|
||||
keyGameId := strconv.Itoa(this.GetGameId())
|
||||
keyGameFreeId := strconv.Itoa(int(this.GetGameFreeId()))
|
||||
keyGameDif := common.GetGameDifKey(this.GetDBGameFree().GetGameDif())
|
||||
// 当天数据统计
|
||||
// 按场次分
|
||||
if data, ok := p.TodayGameData.CtrlData[keyGameFreeId]; ok {
|
||||
|
@ -2336,6 +2368,14 @@ func (this *Scene) StaticsLaba(param *StaticLabaParam) {
|
|||
p.TodayGameData.CtrlData[keyGameId] = data
|
||||
statics = append(statics, data)
|
||||
}
|
||||
// 按游戏组
|
||||
if data, ok := p.TodayGameData.CtrlData[keyGameDif]; ok {
|
||||
statics = append(statics, data)
|
||||
} else {
|
||||
data = model.NewPlayerGameStatics()
|
||||
p.TodayGameData.CtrlData[keyGameDif] = data
|
||||
statics = append(statics, data)
|
||||
}
|
||||
// 按场次分
|
||||
if data, ok := p.GDatas[keyGameFreeId]; ok {
|
||||
if data.FirstTime.IsZero() {
|
||||
|
@ -2358,6 +2398,27 @@ func (this *Scene) StaticsLaba(param *StaticLabaParam) {
|
|||
p.GDatas[keyGameId] = data
|
||||
statics = append(statics, &data.Statics)
|
||||
}
|
||||
// 按游戏组
|
||||
getMinTime := func() time.Time {
|
||||
var minTime = time.Now()
|
||||
for _, v := range srvdata.GameFreeMgr.GetGameId(this.GetDBGameFree().GetGameDif()) {
|
||||
vv := p.GDatas[strconv.Itoa(int(v))]
|
||||
if vv != nil && vv.FirstTime.Before(minTime) {
|
||||
minTime = vv.FirstTime
|
||||
}
|
||||
}
|
||||
return minTime
|
||||
}
|
||||
if data, ok := p.GDatas[keyGameDif]; ok {
|
||||
if data.FirstTime.IsZero() {
|
||||
data.FirstTime = getMinTime()
|
||||
}
|
||||
statics = append(statics, &data.Statics)
|
||||
} else {
|
||||
data = &model.PlayerGameInfo{FirstTime: getMinTime()}
|
||||
p.GDatas[keyGameDif] = data
|
||||
statics = append(statics, &data.Statics)
|
||||
}
|
||||
|
||||
for _, data := range statics {
|
||||
if data != nil {
|
||||
|
|
Loading…
Reference in New Issue