game_sync/model/customlog.go

88 lines
2.2 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 (
"time"
"mongo.games.com/goserver/core/logger"
)
var (
DbCustomLogDBName = "log"
DbCustomLogCollName = "log_custom"
DbCustomLogAwardDBName = "log"
DbCustomLogAwardCollName = "log_customaward"
)
type PlayerInfo struct {
SnId int32 // 玩家id
Awards []*Item // 奖品
}
type RoundInfo struct {
Round int32 // 第几局
Ts int64 // 结算时间
Score []int64 // 分数
LogId string // 牌局记录id
}
type CustomLog struct {
Platform string `bson:"-"`
CycleId string // 本轮id多局游戏属于同一轮
RoomConfigId int32 // 房间配置id
GameFreeId int32 // 场次id
TotalRound int32 // 总局数
PlayerNum int32 // 最大人数
Password string // 密码
CostType int32 // 付费方式 1AA 2房主
Voice int32 // 是否开启语音 1开启
RoomId int32 // 房间id
Creator int32 // 创建者id
SnId []PlayerInfo // 所有玩家
List []RoundInfo // 对局记录
StartTs, EndTs int64 // 开始,结束时间
State int32 // 0正常结束 1后台中途解散
Price int64 // 奖励价值
}
// CustomLogAward 竞技馆玩家奖励记录
type CustomLogAward struct {
Platform string `bson:"-"`
CycleId string // 本轮id多局游戏属于同一轮
SnId int32
Name string
Awards []*Item
StartTs, EndTs int64 // 开始,结束时间
Price int64
ImageURL string
}
type CustomLogAwardFindReq struct {
Platform string
StartTs int64
EndTs int64
}
type CustomLogAwardFindRes struct {
List []*CustomLogAward
}
func CustomLogAwardFind(plt string, startTs, endTs int64) ([]*CustomLogAward, error) {
if rpcCli == nil {
logger.Logger.Error("model.CustomLogAwardFind rpcCli == nil")
return nil, nil
}
req := &CustomLogAwardFindReq{
Platform: plt,
StartTs: startTs,
EndTs: endTs,
}
res := &CustomLogAwardFindRes{}
if err := rpcCli.CallWithTimeout("DBCustomLogAwardSvc.Find", req, &res, time.Second*30); err != nil {
logger.Logger.Warn("DBCustomLogAwardSvc.Find error:", err)
return nil, err
}
return res.List, nil
}