game_sync/model/gameplayerlistlog.go

308 lines
9.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
import (
"errors"
"time"
"github.com/globalsign/mgo/bson"
"mongo.games.com/goserver/core/logger"
)
var (
GamePlayerListLogDBName = "log"
GamePlayerListLogCollName = "log_gameplayerlistlog"
)
type GameTotalRecord struct {
GameTotal int32 //今日牌局数
GameTotalCoin int32 //今日游戏流水
GameWinTotal int32 //今日游戏输赢总额
}
type GamePlayerListLog struct {
LogId bson.ObjectId `bson:"_id"` //记录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打一轮有多局
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 {
Gtr *GameTotalRecord
Gplt GamePlayerListType
}
func InsertGamePlayerListLog(log *GamePlayerListLog) error {
if rpcCli == nil {
logger.Logger.Error("model.InsertGamePlayerListLog rpcCli == nil")
return errors.New("rpcCli == nil")
}
var ret bool
err := rpcCli.CallWithTimeout("GamePlayerListSvc.InsertGamePlayerListLog", log, &ret, time.Second*30)
if err != nil {
logger.Logger.Error("model.InsertGamePlayerListLog is error", err)
return err
}
return nil
}
type NeedGameRecord struct {
LogId bson.ObjectId `bson:"_id"` //记录ID
SnId int32 //用户Id
Username string //三方用户名
ClubId int32 //俱乐部Id
ClubRoom string //俱乐部包间
GameFreeid int32 //游戏类型
TaxCoin int64 //税收
ClubPumpCoin int64 //俱乐部额外抽水
TotalIn int64 //本局投入
TotalOut int64 //本局产出
BetAmount int64 //投注金额(仅在个人中心表现使用,有原始数据加工得到)
WinAmountNoAnyTax int64 //盈利金额,不包含任何税(仅在个人中心表现使用,有原始数据加工得到)
SceneId int32 //场景ID
Ts int32 //记录时间
RoomType int32
GameDetailedLogId string // 游戏记录id
ThirdOrderId string // 三方游戏记录id
IsFree bool //拉霸专用 是否免费
WinSmallGame int64 //拉霸专用 小游戏奖励
WinTotal int64 //拉霸专用 输赢
MatchType int32 //0.普通场 1.锦标赛 2.冠军赛 3.vip专属
}
type RecentGameIDs struct {
GameID int32
}
type GamePlayerListType struct {
PageNo int //当前页码
PageSize int //每页数量
PageSum int //总页码
Data []*NeedGameRecord //当页数据
*GameTotalRecord
}
type TotalCoin struct {
TotalIn int64 //本局投入
TotalOut int64 //本局产出
TaxCoin int64 //税收
ClubPumpCoin int64 //俱乐部额外抽水
}
type GamePlayerListArg struct {
SnId int32
Platform string
StartTime, EndTime int64
ClubId int32
PageNo, PageSize, GameId int
RoomType, GameClass int32
}
type GamePlayerListAPIArg struct {
SnId int32
Platform string
StartTime, EndTime int64
PageNo, PageSize int
}
type GamePlayerExistListArg struct {
SnId int32
Platform string
StartTime int64
DayNum int
}
func GetPlayerCount(SnId int32, platform string, startTime, endTime int64, clubId int32) *GameTotalRecord {
if rpcCli == nil {
logger.Logger.Error("model.GetPlayerCount rpcCli == nil")
return nil
}
if clubId == 0 {
return nil
}
args := &GamePlayerListArg{
SnId: SnId,
Platform: platform,
StartTime: startTime,
EndTime: endTime,
ClubId: clubId,
}
ret := &GamePlayerListRet{}
err := rpcCli.CallWithTimeout("GamePlayerListSvc.GetPlayerCount", args, ret, time.Second*30)
if err != nil {
logger.Logger.Error("model.GetPlayerCount is error", err)
return nil
}
return ret.Gtr
}
func GetPlayerListLog(snId int32, platform string, pageNo, pageSize int, startTime, endTime int64, clubId int32, n int) (gpt GamePlayerListType) {
if rpcCli == nil {
logger.Logger.Error("model.GetPlayerListLog rpcCli == nil")
return
}
if n == 1 {
gpt.GameTotalRecord = GetPlayerCount(snId, platform, startTime, endTime, clubId)
}
if clubId == 0 {
return
}
args := &GamePlayerListArg{
SnId: snId,
Platform: platform,
StartTime: startTime,
EndTime: endTime,
ClubId: clubId,
PageNo: pageNo,
PageSize: pageSize,
}
ret := &GamePlayerListRet{}
err := rpcCli.CallWithTimeout("GamePlayerListSvc.GetPlayerListLog", args, ret, time.Second*30)
if err != nil {
logger.Logger.Error("model.GetPlayerListLog is error", err)
return
}
return ret.Gplt
}
func GetPlayerListByHall(snId int32, platform string, pageNo, pageSize int, startTime, endTime int64, roomType, gameClass int32) (gdt GamePlayerListType) {
if rpcCli == nil {
logger.Logger.Error("model.GetPlayerListByHall rpcCli == nil")
return
}
args := &GamePlayerListArg{
SnId: snId,
Platform: platform,
StartTime: startTime,
EndTime: endTime,
PageNo: pageNo,
PageSize: pageSize,
RoomType: roomType,
GameClass: gameClass,
}
ret := &GamePlayerListRet{}
err := rpcCli.CallWithTimeout("GamePlayerListSvc.GetPlayerListByHall", args, ret, time.Second*30)
if err != nil {
logger.Logger.Error("model.GetPlayerListByHall is error", err)
return
}
return ret.Gplt
}
func GetPlayerListByHallEx(snId int32, platform string, pageNo, pageSize int, startTime, endTime int64, roomType, gameClass int32, gameid int) (gdt GamePlayerListType) {
if rpcCli == nil {
logger.Logger.Error("model.GetPlayerListByHall rpcCli == nil")
return
}
args := &GamePlayerListArg{
SnId: snId,
Platform: platform,
StartTime: startTime,
EndTime: endTime,
PageNo: pageNo,
PageSize: pageSize,
RoomType: roomType,
GameClass: gameClass,
GameId: gameid,
}
ret := &GamePlayerListRet{}
err := rpcCli.CallWithTimeout("GamePlayerListSvc.GetPlayerListByHallEx", args, ret, time.Second*30)
if err != nil {
logger.Logger.Error("model.GetPlayerListByHallEx is error", err)
return
}
return ret.Gplt
}
func GetPlayerListByHallExAPI(snId int32, platform string, startTime, endTime int64, pageno, pagesize int) (gdt GamePlayerListType) {
if rpcCli == nil {
logger.Logger.Error("model.GetPlayerListByHallExAPI rpcCli == nil")
return
}
args := &GamePlayerListAPIArg{
SnId: snId,
Platform: platform,
StartTime: startTime,
EndTime: endTime,
PageNo: pageno,
PageSize: pagesize,
}
ret := &GamePlayerListRet{}
err := rpcCli.CallWithTimeout("GamePlayerListSvc.GetPlayerListByHallExAPI", args, ret, time.Second*30)
if err != nil {
logger.Logger.Error("model.GetPlayerListByHallExAPI is error", err)
return
}
return ret.Gplt
}
func GetPlayerExistListByTs(snId int32, platform string, startTime int64, dayNum int) []int64 {
if rpcCli == nil {
logger.Logger.Error("model.GetPlayerExistListByTs rpcCli == nil")
return nil
}
args := &GamePlayerExistListArg{
SnId: snId,
Platform: platform,
StartTime: startTime,
DayNum: dayNum,
}
var ret []int64
err := rpcCli.CallWithTimeout("GamePlayerListSvc.GetPlayerExistListByTs", args, &ret, time.Second*30)
if err != nil {
logger.Logger.Error("model.GetPlayerExistListByTs is error", err)
return nil
}
return ret
}
type RecentGameReq struct {
Platform string
SnID int32
}
type RecentGameRet struct {
GameID []int32
}
func GetRecentGame(platform string, snid int32) []int32 {
if rpcCli == nil {
logger.Logger.Error("model.GetRecentGame rpcCli == nil")
return nil
}
args := &RecentGameReq{
platform,
snid,
}
ret := &RecentGameRet{}
err := rpcCli.CallWithTimeout("GamePlayerListSvc.GetRecentGame", args, ret, time.Second*30)
if err != nil {
logger.Logger.Error("model.GetRecentGame is error", err)
return nil
}
return ret.GameID
}