game_sync/model/lotterylog.go

65 lines
1.4 KiB
Go

package model
import (
"time"
)
// 中奖记录
var (
LotteryLogDBName = "log"
LotteryLogCollName = "log_lottery"
)
type LotteryAward struct {
Id int64 // 奖品Id
N int64 // 奖品数量
}
type LotteryLog struct {
Platform string `bson:"-"`
CId int64 // 抽奖配置Id
CTime time.Time // 开始时间
Num int32 // 期数
SnId int32 // 中奖玩家
Name string // 中奖玩家昵称
PlayerNum int64 // 参与人数
Code string // 中奖码
CostCard int64 // 消耗房卡
IsRobot bool // 是否机器人
Award []*LotteryAward // 奖品
Price int64 // 奖品价值
IsMust bool // 是否必中
ImageURL string // 图片地址
Ts int64 // 发奖时间
}
type GetLotteryLogReq struct {
Platform string
Num int
}
type GetLotteryLogResp struct {
LotteryLog []*LotteryLog
}
func GetLotteryLogs(plt string, count int) ([]*LotteryLog, error) {
if rpcCli == nil {
return nil, ErrRPClientNoConn
}
req := &GetLotteryLogReq{
Platform: plt,
Num: count,
}
ret := &GetLotteryLogResp{
LotteryLog: []*LotteryLog{},
}
err := rpcCli.CallWithTimeout("LotteryLogSvc.GetLotteryLogs", req, ret, time.Second*30)
if err != nil {
return nil, err
}
return ret.LotteryLog, nil
}