Compare commits

..

No commits in common. "4b8093d09e76573d6d080aa25a8fe327c26ec3b1" and "9ef70ecc23aa266bb171fb63e1857db96747d2e9" have entirely different histories.

19 changed files with 710 additions and 774 deletions

View File

@ -231,7 +231,6 @@ type LabaLog struct {
PlayerListLog *SaveGamePlayerListLogCopy PlayerListLog *SaveGamePlayerListLogCopy
GameDetailLog *SaveGameDetailedCopy GameDetailLog *SaveGameDetailedCopy
CacheTime time.Time // 缓存时间 CacheTime time.Time // 缓存时间
noEmpty bool
} }
// Cache 临时缓存 // Cache 临时缓存
@ -239,30 +238,17 @@ func (l *LabaLog) Cache(s *Scene, detailLog *SaveGameDetailedParam, playerListLo
if s == nil { if s == nil {
return return
} }
l.Save(2) // 如果没有收到结束消息算2秒游戏时长
detailLog.OnlyLog = true detailLog.OnlyLog = true
playerListLog.OnlyLog = true playerListLog.OnlyLog = true
l.GameDetailLog = s.SaveGameDetailedLog(detailLog) l.GameDetailLog = s.SaveGameDetailedLog(detailLog)
l.PlayerListLog = s.SaveGamePlayerListLog(playerListLog) l.PlayerListLog = s.SaveGamePlayerListLog(playerListLog)
l.CacheTime = time.Now() l.CacheTime = time.Now()
l.noEmpty = true
} }
// Save 保存 // Save 保存
// second 为0时自动计算时间,从开始转动计时
func (l *LabaLog) Save(second int32) { func (l *LabaLog) Save(second int32) {
if !l.noEmpty {
return
}
if second <= 0 { if second <= 0 {
sub := time.Now().Sub(l.CacheTime).Milliseconds() second = int32(time.Now().Sub(l.CacheTime).Seconds())
if sub <= 1000 {
second = 1
} else {
second = int32(sub / 1000)
}
} }
if l.PlayerListLog != nil { if l.PlayerListLog != nil {
@ -286,7 +272,6 @@ func (l *LabaLog) Save(second int32) {
// Clear 清空 // Clear 清空
func (l *LabaLog) Clear() { func (l *LabaLog) Clear() {
l.noEmpty = false
l.PlayerListLog = nil l.PlayerListLog = nil
l.GameDetailLog = nil l.GameDetailLog = nil
l.CacheTime = time.Time{} l.CacheTime = time.Time{}

View File

@ -8,7 +8,6 @@ import (
type FortuneDragonPlayerData struct { type FortuneDragonPlayerData struct {
*base.Player *base.Player
base.LabaLog
leaveTime int32 //离开时间 leaveTime int32 //离开时间
SlotsSession *base.SlotsSession SlotsSession *base.SlotsSession
@ -32,7 +31,6 @@ func (p *FortuneDragonPlayerData) Clear() {
p.taxCoin = 0 p.taxCoin = 0
p.winCoin = 0 p.winCoin = 0
p.currentLogId = "" p.currentLogId = ""
p.LabaLog.Clear()
} }
// 需要带到world上进行数据处理 // 需要带到world上进行数据处理

View File

@ -112,7 +112,6 @@ func (this *ScenePolicyFortuneDragon) OnPlayerLeave(s *base.Scene, p *base.Playe
} }
logger.Logger.Trace("(this *ScenePolicyFortuneDragon) OnPlayerLeave, sceneId=", s.GetSceneId(), " player=", p.SnId) logger.Logger.Trace("(this *ScenePolicyFortuneDragon) OnPlayerLeave, sceneId=", s.GetSceneId(), " player=", p.SnId)
if playerEx, ok := p.ExtraData.(*FortuneDragonPlayerData); ok { if playerEx, ok := p.ExtraData.(*FortuneDragonPlayerData); ok {
playerEx.Save(2)
m := playerEx.PushPlayer() m := playerEx.PushPlayer()
if m != nil && len(m) > 0 { if m != nil && len(m) > 0 {
b, err := json.Marshal(m) b, err := json.Marshal(m)
@ -477,8 +476,6 @@ func (this *SceneStateStartFortuneDragon) OnPlayerOp(s *base.Scene, p *base.Play
// 记录本次操作 // 记录本次操作
FortuneDragonAndSaveLog(sceneEx, playerEx, data) FortuneDragonAndSaveLog(sceneEx, playerEx, data)
case 1000:
playerEx.Save(0)
} }
} }
} }
@ -523,6 +520,11 @@ func FortuneDragonAndSaveLog(sceneEx *FortuneDragonSceneData, playerEx *FortuneD
if err == nil { if err == nil {
logid, _ := model.AutoIncGameLogId() logid, _ := model.AutoIncGameLogId()
playerEx.currentLogId = logid playerEx.currentLogId = logid
sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{
LogId: logid,
Detail: info,
GameTime: 2,
})
var totalin, totalout int64 var totalin, totalout int64
if data.Results[0].FreeStatus == 1 || data.Results[0].FreeNumMax == 0 { if data.Results[0].FreeStatus == 1 || data.Results[0].FreeNumMax == 0 {
totalin = playerEx.totalBet totalin = playerEx.totalBet
@ -530,10 +532,7 @@ func FortuneDragonAndSaveLog(sceneEx *FortuneDragonSceneData, playerEx *FortuneD
if data.Results[0].FreeStatus == 3 || data.Results[0].FreeNumMax == 0 { if data.Results[0].FreeStatus == 3 || data.Results[0].FreeNumMax == 0 {
totalout = int64(data.RoundReward) + playerEx.taxCoin totalout = int64(data.RoundReward) + playerEx.taxCoin
} }
playerEx.Cache(sceneEx.Scene, &base.SaveGameDetailedParam{ sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{
LogId: logid,
Detail: info,
}, &base.SaveGamePlayerListLogParam{
LogId: logid, LogId: logid,
Platform: playerEx.Platform, Platform: playerEx.Platform,
Snid: playerEx.SnId, Snid: playerEx.SnId,
@ -545,6 +544,7 @@ func FortuneDragonAndSaveLog(sceneEx *FortuneDragonSceneData, playerEx *FortuneD
WinAmountNoAnyTax: totalout - totalin - playerEx.taxCoin, WinAmountNoAnyTax: totalout - totalin - playerEx.taxCoin,
IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player), IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player),
IsFree: playerEx.isFree, IsFree: playerEx.isFree,
GameTime: 2,
}) })
} }
} }

View File

@ -8,7 +8,6 @@ import (
type FortuneMousePlayerData struct { type FortuneMousePlayerData struct {
*base.Player *base.Player
base.LabaLog
leaveTime int32 //离开时间 leaveTime int32 //离开时间
SlotsSession *base.SlotsSession SlotsSession *base.SlotsSession
@ -38,7 +37,6 @@ func (p *FortuneMousePlayerData) Clear() {
p.taxCoin = 0 p.taxCoin = 0
p.winCoin = 0 p.winCoin = 0
p.currentLogId = "" p.currentLogId = ""
p.LabaLog.Clear()
} }
// 需要带到world上进行数据处理 // 需要带到world上进行数据处理

View File

@ -111,7 +111,6 @@ func (this *ScenePolicyFortuneMouse) OnPlayerLeave(s *base.Scene, p *base.Player
} }
logger.Logger.Trace("(this *ScenePolicyFortuneMouse) OnPlayerLeave, sceneId=", s.GetSceneId(), " player=", p.SnId) logger.Logger.Trace("(this *ScenePolicyFortuneMouse) OnPlayerLeave, sceneId=", s.GetSceneId(), " player=", p.SnId)
if playerEx, ok := p.ExtraData.(*FortuneMousePlayerData); ok { if playerEx, ok := p.ExtraData.(*FortuneMousePlayerData); ok {
playerEx.Save(2)
m := playerEx.PushPlayer() m := playerEx.PushPlayer()
if m != nil && len(m) > 0 { if m != nil && len(m) > 0 {
b, err := json.Marshal(m) b, err := json.Marshal(m)
@ -481,8 +480,6 @@ func (this *SceneStateStartFortuneMouse) OnPlayerOp(s *base.Scene, p *base.Playe
// 记录本次操作 // 记录本次操作
FortuneMouseAndSaveLog(sceneEx, playerEx, data) FortuneMouseAndSaveLog(sceneEx, playerEx, data)
case 1000:
playerEx.Save(0)
} }
} }
} }
@ -534,6 +531,11 @@ func FortuneMouseAndSaveLog(sceneEx *FortuneMouseSceneData, playerEx *FortuneMou
if err == nil { if err == nil {
logid, _ := model.AutoIncGameLogId() logid, _ := model.AutoIncGameLogId()
playerEx.currentLogId = logid playerEx.currentLogId = logid
sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{
LogId: logid,
Detail: info,
GameTime: 2,
})
var totalin, totalout int64 var totalin, totalout int64
if respinStatus == 0 || respinStatus == 1 { if respinStatus == 0 || respinStatus == 1 {
totalin = playerEx.totalBet totalin = playerEx.totalBet
@ -541,10 +543,7 @@ func FortuneMouseAndSaveLog(sceneEx *FortuneMouseSceneData, playerEx *FortuneMou
if respinStatus == 0 || respinStatus == 3 { if respinStatus == 0 || respinStatus == 3 {
totalout = int64(data.RoundReward) + playerEx.taxCoin totalout = int64(data.RoundReward) + playerEx.taxCoin
} }
playerEx.Cache(sceneEx.Scene, &base.SaveGameDetailedParam{ sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{
LogId: logid,
Detail: info,
}, &base.SaveGamePlayerListLogParam{
LogId: logid, LogId: logid,
Platform: playerEx.Platform, Platform: playerEx.Platform,
Snid: playerEx.SnId, Snid: playerEx.SnId,
@ -552,10 +551,11 @@ func FortuneMouseAndSaveLog(sceneEx *FortuneMouseSceneData, playerEx *FortuneMou
TotalIn: totalin, TotalIn: totalin,
TotalOut: totalout, TotalOut: totalout,
TaxCoin: playerEx.taxCoin, TaxCoin: playerEx.taxCoin,
BetAmount: totalin, BetAmount: playerEx.totalBet,
WinAmountNoAnyTax: totalout - totalin - playerEx.taxCoin, WinAmountNoAnyTax: totalout - totalin - playerEx.taxCoin,
IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player), IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player),
IsFree: totalin == 0, IsFree: totalin == 0,
GameTime: 2,
}) })
} }
} }

View File

@ -8,7 +8,6 @@ import (
type FortuneOxPlayerData struct { type FortuneOxPlayerData struct {
*base.Player *base.Player
base.LabaLog
leaveTime int32 //离开时间 leaveTime int32 //离开时间
SlotsSession *base.SlotsSession SlotsSession *base.SlotsSession
@ -38,7 +37,6 @@ func (p *FortuneOxPlayerData) Clear() {
p.taxCoin = 0 p.taxCoin = 0
p.winCoin = 0 p.winCoin = 0
p.currentLogId = "" p.currentLogId = ""
p.LabaLog.Clear()
} }
// 需要带到world上进行数据处理 // 需要带到world上进行数据处理

View File

@ -111,7 +111,6 @@ func (this *ScenePolicyFortuneOx) OnPlayerLeave(s *base.Scene, p *base.Player, r
} }
logger.Logger.Trace("(this *ScenePolicyFortuneOx) OnPlayerLeave, sceneId=", s.GetSceneId(), " player=", p.SnId) logger.Logger.Trace("(this *ScenePolicyFortuneOx) OnPlayerLeave, sceneId=", s.GetSceneId(), " player=", p.SnId)
if playerEx, ok := p.ExtraData.(*FortuneOxPlayerData); ok { if playerEx, ok := p.ExtraData.(*FortuneOxPlayerData); ok {
playerEx.Save(2)
m := playerEx.PushPlayer() m := playerEx.PushPlayer()
if m != nil && len(m) > 0 { if m != nil && len(m) > 0 {
b, err := json.Marshal(m) b, err := json.Marshal(m)
@ -481,8 +480,6 @@ func (this *SceneStateStartFortuneOx) OnPlayerOp(s *base.Scene, p *base.Player,
// 记录本次操作 // 记录本次操作
FortuneOxAndSaveLog(sceneEx, playerEx, data) FortuneOxAndSaveLog(sceneEx, playerEx, data)
case 1000:
playerEx.Save(0)
} }
} }
} }
@ -534,6 +531,11 @@ func FortuneOxAndSaveLog(sceneEx *FortuneOxSceneData, playerEx *FortuneOxPlayerD
if err == nil { if err == nil {
logid, _ := model.AutoIncGameLogId() logid, _ := model.AutoIncGameLogId()
playerEx.currentLogId = logid playerEx.currentLogId = logid
sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{
LogId: logid,
Detail: info,
GameTime: 2,
})
var totalin, totalout int64 var totalin, totalout int64
if respinStatus == 0 || respinStatus == 1 { if respinStatus == 0 || respinStatus == 1 {
totalin = playerEx.totalBet totalin = playerEx.totalBet
@ -541,10 +543,7 @@ func FortuneOxAndSaveLog(sceneEx *FortuneOxSceneData, playerEx *FortuneOxPlayerD
if respinStatus == 0 || respinStatus == 3 { if respinStatus == 0 || respinStatus == 3 {
totalout = int64(data.RoundReward) + playerEx.taxCoin totalout = int64(data.RoundReward) + playerEx.taxCoin
} }
playerEx.Cache(sceneEx.Scene, &base.SaveGameDetailedParam{ sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{
LogId: logid,
Detail: info,
}, &base.SaveGamePlayerListLogParam{
LogId: logid, LogId: logid,
Platform: playerEx.Platform, Platform: playerEx.Platform,
Snid: playerEx.SnId, Snid: playerEx.SnId,
@ -556,6 +555,7 @@ func FortuneOxAndSaveLog(sceneEx *FortuneOxSceneData, playerEx *FortuneOxPlayerD
WinAmountNoAnyTax: totalout - totalin - playerEx.taxCoin, WinAmountNoAnyTax: totalout - totalin - playerEx.taxCoin,
IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player), IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player),
IsFree: totalin == 0, IsFree: totalin == 0,
GameTime: 2,
}) })
} }
} }

View File

@ -8,7 +8,6 @@ import (
type FortuneRabbitPlayerData struct { type FortuneRabbitPlayerData struct {
*base.Player *base.Player
base.LabaLog
leaveTime int32 //离开时间 leaveTime int32 //离开时间
SlotsSession *base.SlotsSession SlotsSession *base.SlotsSession
@ -32,7 +31,6 @@ func (p *FortuneRabbitPlayerData) Clear() {
p.taxCoin = 0 p.taxCoin = 0
p.winCoin = 0 p.winCoin = 0
p.currentLogId = "" p.currentLogId = ""
p.LabaLog.Clear()
} }
// 需要带到world上进行数据处理 // 需要带到world上进行数据处理

View File

@ -111,7 +111,6 @@ func (this *ScenePolicyFortuneRabbit) OnPlayerLeave(s *base.Scene, p *base.Playe
} }
logger.Logger.Trace("(this *ScenePolicyFortuneRabbit) OnPlayerLeave, sceneId=", s.GetSceneId(), " player=", p.SnId) logger.Logger.Trace("(this *ScenePolicyFortuneRabbit) OnPlayerLeave, sceneId=", s.GetSceneId(), " player=", p.SnId)
if playerEx, ok := p.ExtraData.(*FortuneRabbitPlayerData); ok { if playerEx, ok := p.ExtraData.(*FortuneRabbitPlayerData); ok {
playerEx.LabaLog.Save(2) // 没有收到结束消息算2秒游戏时长
m := playerEx.PushPlayer() m := playerEx.PushPlayer()
if m != nil && len(m) > 0 { if m != nil && len(m) > 0 {
b, err := json.Marshal(m) b, err := json.Marshal(m)
@ -475,9 +474,6 @@ func (this *SceneStateStartFortuneRabbit) OnPlayerOp(s *base.Scene, p *base.Play
// 记录本次操作 // 记录本次操作
FortuneRabbitAndSaveLog(sceneEx, playerEx, data) FortuneRabbitAndSaveLog(sceneEx, playerEx, data)
case 1000:
playerEx.Save(0)
} }
} }
} }
@ -522,6 +518,11 @@ func FortuneRabbitAndSaveLog(sceneEx *FortuneRabbitSceneData, playerEx *FortuneR
if err == nil { if err == nil {
logid, _ := model.AutoIncGameLogId() logid, _ := model.AutoIncGameLogId()
playerEx.currentLogId = logid playerEx.currentLogId = logid
sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{
LogId: logid,
Detail: info,
GameTime: 2,
})
var totalin, totalout int64 var totalin, totalout int64
if data.Results[0].FreeStatus == 1 || data.Results[0].FreeNumMax == 0 { if data.Results[0].FreeStatus == 1 || data.Results[0].FreeNumMax == 0 {
totalin = playerEx.totalBet totalin = playerEx.totalBet
@ -529,10 +530,7 @@ func FortuneRabbitAndSaveLog(sceneEx *FortuneRabbitSceneData, playerEx *FortuneR
if data.Results[0].FreeStatus == 3 || data.Results[0].FreeNumMax == 0 { if data.Results[0].FreeStatus == 3 || data.Results[0].FreeNumMax == 0 {
totalout = int64(data.RoundReward) + playerEx.taxCoin totalout = int64(data.RoundReward) + playerEx.taxCoin
} }
playerEx.Cache(sceneEx.Scene, &base.SaveGameDetailedParam{ sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{
LogId: logid,
Detail: info,
}, &base.SaveGamePlayerListLogParam{
LogId: logid, LogId: logid,
Platform: playerEx.Platform, Platform: playerEx.Platform,
Snid: playerEx.SnId, Snid: playerEx.SnId,
@ -544,6 +542,7 @@ func FortuneRabbitAndSaveLog(sceneEx *FortuneRabbitSceneData, playerEx *FortuneR
WinAmountNoAnyTax: totalout - totalin - playerEx.taxCoin, WinAmountNoAnyTax: totalout - totalin - playerEx.taxCoin,
IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player), IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player),
IsFree: playerEx.isFree, IsFree: playerEx.isFree,
GameTime: 2,
}) })
} }
} }

View File

@ -8,7 +8,6 @@ import (
type FortuneTigerPlayerData struct { type FortuneTigerPlayerData struct {
*base.Player *base.Player
base.LabaLog
leaveTime int32 //离开时间 leaveTime int32 //离开时间
SlotsSession *base.SlotsSession SlotsSession *base.SlotsSession
@ -41,7 +40,6 @@ func (p *FortuneTigerPlayerData) Clear() {
p.taxCoin = 0 p.taxCoin = 0
p.winCoin = 0 p.winCoin = 0
p.currentLogId = "" p.currentLogId = ""
p.LabaLog.Clear()
} }
// 需要带到world上进行数据处理 // 需要带到world上进行数据处理

View File

@ -111,7 +111,6 @@ func (this *ScenePolicyFortuneTiger) OnPlayerLeave(s *base.Scene, p *base.Player
} }
logger.Logger.Trace("(this *ScenePolicyFortuneTiger) OnPlayerLeave, sceneId=", s.GetSceneId(), " player=", p.SnId) logger.Logger.Trace("(this *ScenePolicyFortuneTiger) OnPlayerLeave, sceneId=", s.GetSceneId(), " player=", p.SnId)
if playerEx, ok := p.ExtraData.(*FortuneTigerPlayerData); ok { if playerEx, ok := p.ExtraData.(*FortuneTigerPlayerData); ok {
playerEx.LabaLog.Save(2) // 没有收到结束消息算2秒游戏时长
m := playerEx.PushPlayer() m := playerEx.PushPlayer()
if m != nil && len(m) > 0 { if m != nil && len(m) > 0 {
b, err := json.Marshal(m) b, err := json.Marshal(m)
@ -481,9 +480,6 @@ func (this *SceneStateStartFortuneTiger) OnPlayerOp(s *base.Scene, p *base.Playe
// 记录本次操作 // 记录本次操作
FortuneTigerAndSaveLog(sceneEx, playerEx, data) FortuneTigerAndSaveLog(sceneEx, playerEx, data)
case 1000:
playerEx.Save(0)
} }
} }
} }
@ -535,6 +531,11 @@ func FortuneTigerAndSaveLog(sceneEx *FortuneTigerSceneData, playerEx *FortuneTig
if err == nil { if err == nil {
logid, _ := model.AutoIncGameLogId() logid, _ := model.AutoIncGameLogId()
playerEx.currentLogId = logid playerEx.currentLogId = logid
sceneEx.SaveGameDetailedLog(&base.SaveGameDetailedParam{
LogId: logid,
Detail: info,
GameTime: 2,
})
var totalin, totalout int64 var totalin, totalout int64
if data.Results[0].FreeStatus == 1 || data.Results[0].FreeNumMax == 0 { if data.Results[0].FreeStatus == 1 || data.Results[0].FreeNumMax == 0 {
totalin = playerEx.totalBet totalin = playerEx.totalBet
@ -542,10 +543,7 @@ func FortuneTigerAndSaveLog(sceneEx *FortuneTigerSceneData, playerEx *FortuneTig
if data.Results[0].FreeStatus == 3 || data.Results[0].FreeNumMax == 0 { if data.Results[0].FreeStatus == 3 || data.Results[0].FreeNumMax == 0 {
totalout = int64(data.RoundReward) + playerEx.taxCoin totalout = int64(data.RoundReward) + playerEx.taxCoin
} }
playerEx.Cache(sceneEx.Scene, &base.SaveGameDetailedParam{ sceneEx.SaveGamePlayerListLog(&base.SaveGamePlayerListLogParam{
LogId: logid,
Detail: info,
}, &base.SaveGamePlayerListLogParam{
LogId: logid, LogId: logid,
Platform: playerEx.Platform, Platform: playerEx.Platform,
Snid: playerEx.SnId, Snid: playerEx.SnId,
@ -557,6 +555,7 @@ func FortuneTigerAndSaveLog(sceneEx *FortuneTigerSceneData, playerEx *FortuneTig
WinAmountNoAnyTax: totalout - totalin - playerEx.taxCoin, WinAmountNoAnyTax: totalout - totalin - playerEx.taxCoin,
IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player), IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player),
IsFree: totalin == 0, IsFree: totalin == 0,
GameTime: 2,
}) })
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -513,8 +513,6 @@ message ASQueryOnlineReportList{
int32 OrderType = 6;// 0, 1 int32 OrderType = 6;// 0, 1
int32 GameFreeId = 7; int32 GameFreeId = 7;
string Channel = 8; string Channel = 8;
string GameDif = 9; //
string ChannelId = 10; // 广ID
} }
message SAQueryOnlineReportList{ message SAQueryOnlineReportList{
TagCode Tag = 1; // TagCode Tag = 1; //

View File

@ -9,13 +9,13 @@ const (
) )
type LogLogin struct { type LogLogin struct {
ID uint `gorm:"primaryKey"` ID uint `gorm:"primaryKey"`
Snid int `gorm:"index"` Snid int `gorm:"index"`
OnlineType int `gorm:"index"` OnlineType int `gorm:"index"`
OnlineTs int64 `gorm:"index"` //OnlineTs int `gorm:"index"`
OnlineTime time.Time `gorm:"index"` OnlineTime time.Time `gorm:"index"`
OfflineType int `gorm:"index"` OfflineType int `gorm:"index"`
OfflineTs int64 `gorm:"index"` //OfflineTs int `gorm:"index"`
OfflineTime time.Time `gorm:"index"` OfflineTime time.Time `gorm:"index"`
ChannelId string `gorm:"index"` // 推广渠道 ChannelId string `gorm:"index"` // 推广渠道

View File

@ -8,8 +8,8 @@ var Tables = []interface{}{
&LogLogin{}, &LogLogin{},
&LogLoginMid{}, &LogLoginMid{},
&UserAccount{}, &UserAccount{},
//&UserLogin{}, &UserLogin{},
//&UserID{}, &UserID{},
&LogInviteScoreMid{}, &LogInviteScoreMid{},
&LogInviteScore{}, &LogInviteScore{},
&LogInviteUser{}, &LogInviteUser{},

View File

@ -8,7 +8,6 @@ type UserAccount struct {
Snid int `gorm:"index"` Snid int `gorm:"index"`
//RegisterTs int `gorm:"index"` //RegisterTs int `gorm:"index"`
RegisterTime time.Time `gorm:"index"` RegisterTime time.Time `gorm:"index"`
RegisterTs int64 `gorm:"index"`
ChannelId string `gorm:"index"` // 推广渠道 ChannelId string `gorm:"index"` // 推广渠道
DeviceName string `gorm:"index"` DeviceName string `gorm:"index"`

View File

@ -91,12 +91,12 @@ func LogLogin(platform string, batchSize int) ([]*mysqlmodel.LogLogin, error) {
if n == 0 { if n == 0 {
e = &mysqlmodel.LogLogin{ e = &mysqlmodel.LogLogin{
Snid: int(v.SnId), Snid: int(v.SnId),
OnlineType: onlineType, OnlineType: onlineType,
OnlineTs: v.Time.Unix(), //OnlineTs: int(v.Ts),
OnlineTime: v.Time, OnlineTime: v.Time,
OfflineType: 0, OfflineType: 0,
OfflineTs: 0, //OfflineTs: 0,
OfflineTime: v.Time, OfflineTime: v.Time,
DeviceName: v.DeviceName, DeviceName: v.DeviceName,
AppVersion: v.AppVersion, AppVersion: v.AppVersion,
@ -132,7 +132,7 @@ func LogLogin(platform string, batchSize int) ([]*mysqlmodel.LogLogin, error) {
} }
e.OfflineType = mysqlmodel.LogTypeOffline e.OfflineType = mysqlmodel.LogTypeOffline
e.OfflineTs = v.Time.Unix() //e.OfflineTs = int(v.Ts)
e.OfflineTime = v.Time e.OfflineTime = v.Time
if err = db.Model(e).Select("OfflineType", "OfflineTime").Updates(e).Error; err != nil { if err = db.Model(e).Select("OfflineType", "OfflineTime").Updates(e).Error; err != nil {
logger.Logger.Errorf("mysql: SyncLogLogin failed to update log_login: %v", err) logger.Logger.Errorf("mysql: SyncLogLogin failed to update log_login: %v", err)

View File

@ -68,9 +68,9 @@ func UserAccount(platform string, batchSize int) ([]*mysqlmodel.UserAccount, err
for _, v := range accounts { for _, v := range accounts {
logger.Logger.Tracef("mongo account: %+v", *v) logger.Logger.Tracef("mongo account: %+v", *v)
a := &mysqlmodel.UserAccount{ a := &mysqlmodel.UserAccount{
MID: v.AccountId.Hex(), MID: v.AccountId.Hex(),
Snid: int(v.SnId), Snid: int(v.SnId),
RegisterTs: v.RegisteTime.Unix(), //RegisterTs: int(v.RegisterTs),
RegisterTime: v.RegisteTime, RegisterTime: v.RegisteTime,
Tel: v.Tel, Tel: v.Tel,
ChannelId: v.ChannelId, ChannelId: v.ChannelId,
@ -81,17 +81,17 @@ func UserAccount(platform string, batchSize int) ([]*mysqlmodel.UserAccount, err
return err return err
} }
//if err = tx.First(&mysqlmodel.UserID{}, "snid = ?", v.SnId).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { if err = tx.First(&mysqlmodel.UserID{}, "snid = ?", v.SnId).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
// logger.Logger.Errorf("mysql: UserAccount failed to find user_id: %v", err) logger.Logger.Errorf("mysql: UserAccount failed to find user_id: %v", err)
// return err return err
//} }
//
//if errors.Is(err, gorm.ErrRecordNotFound) { if errors.Is(err, gorm.ErrRecordNotFound) {
// if err = tx.Create(&mysqlmodel.UserID{Snid: int(v.SnId)}).Error; err != nil { if err = tx.Create(&mysqlmodel.UserID{Snid: int(v.SnId)}).Error; err != nil {
// logger.Logger.Errorf("mysql: UserAccount failed to create user_id: %v", err) logger.Logger.Errorf("mysql: UserAccount failed to create user_id: %v", err)
// return err return err
// } }
//} }
as = append(as, a) as = append(as, a)
} }

View File

@ -1113,10 +1113,12 @@ func init() {
pack.Msg = "数据序列化失败" + err.Error() pack.Msg = "数据序列化失败" + err.Error()
return common.ResponseTag_ParamError, pack return common.ResponseTag_ParamError, pack
} }
platform := msg.Platform
pageNo := msg.PageNo pageNo := msg.PageNo
pageSize := msg.PageSize pageSize := msg.PageSize
orderColumn := msg.OrderColumn orderColumn := msg.OrderColumn
orderType := msg.OrderType orderType := msg.OrderType
channel := msg.Channel
start := (pageNo - 1) * pageSize start := (pageNo - 1) * pageSize
end := pageNo * pageSize end := pageNo * pageSize
@ -1130,37 +1132,21 @@ func init() {
if !p.IsOnLine() { if !p.IsOnLine() {
continue continue
} }
if msg.GameDif != "" { if msg.GameFreeId == 0 {
if p.scene == nil || p.scene.dbGameFree.GetGameDif() != msg.GameDif { if msg.GameId != 0 && (p.scene == nil || p.scene.gameId != int(msg.GameId)) {
continue
}
} else {
if p.scene == nil || p.scene.dbGameFree.GetId() != msg.GameFreeId {
continue continue
} }
} }
if msg.ChannelId != "" { if platform != DefaultPlatform && p.Platform != platform {
if p.ChannelId != msg.ChannelId { continue
continue }
} if channel != "" && p.Channel != channel {
}
if msg.GameFreeId > 0 {
if p.scene == nil || p.scene.GetGameFreeId() != msg.GameFreeId {
continue
}
}
if msg.GameId > 0 {
if p.scene == nil || p.scene.gameId != int(msg.GameId) {
continue
}
}
if msg.Platform != DefaultPlatform && msg.Platform != "" {
if p.Platform != msg.Platform {
continue
}
}
if msg.Channel != "" && p.Channel != msg.Channel {
continue continue
} }
players = append(players, p) players = append(players, p)
} }
// 排序 // 排序