211 lines
4.8 KiB
Go
211 lines
4.8 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"mongo.games.com/goserver/core/logger"
|
|
)
|
|
|
|
const (
|
|
MQRankSeason = "log_rankplayerscore"
|
|
MQRankPlayerCoin = "log_rankplayercoin"
|
|
MQRankPlayerInvite = "log_rankplayerinvite"
|
|
)
|
|
|
|
type PlayerRankScore struct {
|
|
//Id bson.ObjectId `bson:"_id"`
|
|
Platform string
|
|
SnId int32
|
|
RankType int32 // 排位类型
|
|
SeasonId int32 // 赛季id
|
|
Lv int32 // 段位
|
|
Score int64 // 排位积分
|
|
Name string
|
|
Sex int32
|
|
HeadUrl string
|
|
Coin int64
|
|
IsRobot bool
|
|
UpdateTs int64
|
|
ModId int32
|
|
}
|
|
|
|
func UpsertPlayerRankSeasonList(args *PlayerRankScore) bool {
|
|
if rpcCli == nil {
|
|
logger.Logger.Error("model.UpsertPlayerRankSeason rpcCli == nil")
|
|
return false
|
|
}
|
|
|
|
var ret bool
|
|
args.UpdateTs = time.Now().Unix()
|
|
err := rpcCli.CallWithTimeout("RankSeasonSvc.Upsert", args, &ret, time.Second*30)
|
|
if err != nil {
|
|
logger.Logger.Error("UpsertPlayerRankSeasonList error:", err)
|
|
return false
|
|
}
|
|
return ret
|
|
}
|
|
|
|
type FindPlayerRankSeasonListArgs struct {
|
|
Platform string
|
|
RankType int32 // 排位类型
|
|
//SeasonId int32 // 赛季id
|
|
}
|
|
|
|
type FindPlayerRankSeasonListReply struct {
|
|
List []*PlayerRankScore
|
|
}
|
|
|
|
func FindPlayerRankSeasonList(args *FindPlayerRankSeasonListArgs) (*FindPlayerRankSeasonListReply, error) {
|
|
if rpcCli == nil {
|
|
logger.Logger.Error("model.FindPlayerRankSeasonList rpcCli == nil")
|
|
return nil, nil
|
|
}
|
|
|
|
ret := new(FindPlayerRankSeasonListReply)
|
|
err := rpcCli.CallWithTimeout("RankSeasonSvc.FindRankSeason", args, ret, time.Second*30)
|
|
if err != nil {
|
|
logger.Logger.Error("FindPlayerRankSeasonList error:", err)
|
|
return ret, err
|
|
}
|
|
return ret, nil
|
|
}
|
|
|
|
type RankPlayerCoin struct {
|
|
Platform string
|
|
SnId int32
|
|
Name string
|
|
Sex int32
|
|
HeadUrl string
|
|
Coin int64
|
|
UpdateTs int64
|
|
ModId int32
|
|
}
|
|
|
|
func UpsertRankPlayerCoin(args *RankPlayerCoin) bool {
|
|
if rpcCli == nil {
|
|
logger.Logger.Error("model.UpsertRankPlayerCoin rpcCli == nil")
|
|
return false
|
|
}
|
|
|
|
var ret bool
|
|
err := rpcCli.CallWithTimeout("RankPlayerCoinSvc.Upsert", args, &ret, time.Second*30)
|
|
if err != nil {
|
|
logger.Logger.Error("UpsertRankPlayerCoin error:", err)
|
|
return false
|
|
}
|
|
return ret
|
|
}
|
|
|
|
type FindPlayerCoinListArgs struct {
|
|
Platform string
|
|
}
|
|
|
|
type FindPlayerCoinListReply struct {
|
|
List []*RankPlayerCoin
|
|
}
|
|
|
|
func FindPlayerCoinList(args *FindPlayerCoinListArgs) (*FindPlayerCoinListReply, error) {
|
|
if rpcCli == nil {
|
|
logger.Logger.Error("model.FindPlayerCoinList rpcCli == nil")
|
|
return nil, nil
|
|
}
|
|
|
|
ret := new(FindPlayerCoinListReply)
|
|
err := rpcCli.CallWithTimeout("RankPlayerCoinSvc.Find", args, ret, time.Second*30)
|
|
if err != nil {
|
|
logger.Logger.Error("FindPlayerCoinList error:", err)
|
|
return ret, err
|
|
}
|
|
return ret, nil
|
|
}
|
|
|
|
type PlayerRankInvite struct {
|
|
//Id bson.ObjectId `bson:"_id"`
|
|
SnId int32
|
|
Score int64 // 邀请积分
|
|
InviteNum int32 // 邀请人数
|
|
Name string // 玩家名字
|
|
ModId int32 // 头像ID
|
|
}
|
|
|
|
type FindPlayerRankInviteListArgs struct {
|
|
Platform string
|
|
RankType int32 // 邀请榜时间类型: 总榜 周榜 月榜
|
|
}
|
|
|
|
type FindPlayerRankInviteListReply struct {
|
|
RankType int32 // 邀请榜时间类型: 总榜 周榜 月榜
|
|
List []*PlayerRankInvite
|
|
}
|
|
|
|
func FindPlayerRankInviteList(args *FindPlayerRankInviteListArgs) (*FindPlayerRankInviteListReply, error) {
|
|
if rpcCli == nil {
|
|
logger.Logger.Error("model.FindPlayerRankInviteList rpcCli == nil")
|
|
return nil, nil
|
|
}
|
|
|
|
ret := new(FindPlayerRankInviteListReply)
|
|
err := rpcCli.CallWithTimeout("BindScoreSvc.GetInviteRankList", args, ret, time.Second*30)
|
|
if err != nil {
|
|
logger.Logger.Error("FindPlayerRankInviteList error:", err)
|
|
return ret, err
|
|
}
|
|
return ret, nil
|
|
}
|
|
|
|
type WinCoinInfo struct {
|
|
SnId int32
|
|
Name string
|
|
Coin int64
|
|
ModId int32
|
|
}
|
|
|
|
type FindWinCoinListArgs struct {
|
|
Platform string
|
|
StartTs, EndTs int64
|
|
}
|
|
|
|
type FindWinCoinListReply struct {
|
|
List []*WinCoinInfo
|
|
}
|
|
|
|
func FindWinCoinListTienlen(args *FindWinCoinListArgs) (*FindWinCoinListReply, error) {
|
|
if rpcCli == nil {
|
|
logger.Logger.Error("model.FindWinCoinListTienlen rpcCli == nil")
|
|
return nil, nil
|
|
}
|
|
|
|
ret := new(FindWinCoinListReply)
|
|
err := rpcCli.CallWithTimeout("GamePlayerListSvc.GetWinCoinListTienlen", args, ret, time.Second*30)
|
|
if err != nil {
|
|
logger.Logger.Error("FindWinCoinList error:", err)
|
|
return ret, err
|
|
}
|
|
return ret, nil
|
|
}
|
|
|
|
type FindWinCoinArgs struct {
|
|
Platform string
|
|
StartTs, EndTs int64
|
|
SnId int32
|
|
}
|
|
|
|
type FindWinCoinReply struct {
|
|
List *WinCoinInfo
|
|
}
|
|
|
|
func FindWinCoinTienlen(args *FindWinCoinArgs) (*FindWinCoinReply, error) {
|
|
if rpcCli == nil {
|
|
logger.Logger.Error("model.FindWinCoinTienlen rpcCli == nil")
|
|
return nil, nil
|
|
}
|
|
|
|
ret := new(FindWinCoinReply)
|
|
err := rpcCli.CallWithTimeout("GamePlayerListSvc.GetWinCoinTienlen", args, ret, time.Second*30)
|
|
if err != nil {
|
|
logger.Logger.Error("FindWinCoinTienlen error:", err)
|
|
return ret, err
|
|
}
|
|
return ret, nil
|
|
}
|