维京赛季结束发奖优化处理
This commit is contained in:
parent
583975ff70
commit
00553c7a41
@ -534,6 +534,8 @@ const ( //Rpc
|
|||||||
|
|
||||||
Rpc_AccountBan core.Rpc_Key = "Rpc_AccountBan" // 账号状态
|
Rpc_AccountBan core.Rpc_Key = "Rpc_AccountBan" // 账号状态
|
||||||
RPC_GameinviteOffline core.Rpc_Key = "RPC_GameinviteOffline" // 游戏邀请离线通知
|
RPC_GameinviteOffline core.Rpc_Key = "RPC_GameinviteOffline" // 游戏邀请离线通知
|
||||||
|
|
||||||
|
Rpc_ModuleVikingFigthEnd core.Rpc_Key = "Rpc_ModuleVikingFigthEnd" //维京远征结算
|
||||||
)
|
)
|
||||||
|
|
||||||
// 事件类型定义处
|
// 事件类型定义处
|
||||||
@ -1019,6 +1021,7 @@ const (
|
|||||||
MaxRankList = 50 // 赛季塔 排行榜人数
|
MaxRankList = 50 // 赛季塔 排行榜人数
|
||||||
MaxMailCount = 50 // 当前邮件最大数量
|
MaxMailCount = 50 // 当前邮件最大数量
|
||||||
MaxRankNum = 3
|
MaxRankNum = 3
|
||||||
|
MinRankList = 10 // 排行榜人数
|
||||||
)
|
)
|
||||||
|
|
||||||
// /聊天消息公告类型
|
// /聊天消息公告类型
|
||||||
|
67
modules/timer/vikingrank.go
Normal file
67
modules/timer/vikingrank.go
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
package timer
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego/base"
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/lego/core/cbase"
|
||||||
|
"go_dreamfactory/lego/sys/cron"
|
||||||
|
"go_dreamfactory/lego/sys/timewheel"
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/sys/configure"
|
||||||
|
"go_dreamfactory/sys/db"
|
||||||
|
"go_dreamfactory/utils"
|
||||||
|
)
|
||||||
|
|
||||||
|
type VikingRank struct {
|
||||||
|
cbase.ModuleBase
|
||||||
|
modules.MCompModel
|
||||||
|
service base.IRPCXService
|
||||||
|
module *Timer
|
||||||
|
cTimerObj *timewheel.Task
|
||||||
|
}
|
||||||
|
|
||||||
|
//组件初始化接口
|
||||||
|
func (this *VikingRank) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
|
|
||||||
|
this.TableName = comm.TableViking
|
||||||
|
this.MCompModel.Init(service, module, comp, options)
|
||||||
|
this.module = module.(*Timer)
|
||||||
|
this.service = service.(base.IRPCXService)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *VikingRank) Start() (err error) {
|
||||||
|
if !db.IsCross() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = this.MCompModel.Start()
|
||||||
|
opentime := this.service.GetOpentime().Unix()
|
||||||
|
if configure.Now().Unix() < opentime { // 开服时间是未来可能存在问题
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 0 0 0 ? * MON // 每周一零点
|
||||||
|
cron.AddFunc("0 0 0 ? * MON", this.TimerSeason)
|
||||||
|
|
||||||
|
this.TimerSeason()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *VikingRank) TimerSeason() {
|
||||||
|
endTime := utils.WeekIntervalTime()
|
||||||
|
this.module.Debugf("TimerSeason end: %d,cur time:%d", endTime, configure.Now().Unix())
|
||||||
|
|
||||||
|
if err := this.service.RpcCall(
|
||||||
|
context.Background(),
|
||||||
|
comm.Service_Worker,
|
||||||
|
string(comm.Rpc_ModuleVikingFigthEnd),
|
||||||
|
pb.EmptyReq{},
|
||||||
|
nil,
|
||||||
|
); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -4,6 +4,7 @@ import (
|
|||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/db"
|
"go_dreamfactory/sys/db"
|
||||||
|
"go_dreamfactory/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
//参数校验
|
//参数校验
|
||||||
@ -23,23 +24,15 @@ func (this *apiComp) SeasonRank(session comm.IUserSession, req *pb.VikingSeasonR
|
|||||||
err error
|
err error
|
||||||
ranks []*pb.DBVSeasonRecord
|
ranks []*pb.DBVSeasonRecord
|
||||||
players []*pb.DBVikingSRank
|
players []*pb.DBVikingSRank
|
||||||
|
conn_ *db.DBConn
|
||||||
)
|
)
|
||||||
if errdata = this.SeasonRankCheck(session, req); errdata != nil {
|
if errdata = this.SeasonRankCheck(session, req); errdata != nil {
|
||||||
return // 参数校验失败直接返回
|
return // 参数校验失败直接返回
|
||||||
}
|
}
|
||||||
var (
|
|
||||||
conn_ *db.DBConn
|
conn_, err = db.Cross()
|
||||||
)
|
if err != nil {
|
||||||
if bcross, _ := this.module.CheckCurSeasonData(); bcross {
|
return
|
||||||
conn_, err = db.Local() // 获取跨服数据库对象
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else { //数据记录在本服
|
|
||||||
conn_, err = db.Cross()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if uids, err = this.module.modelsrank.querySRankUser(int(req.BoosType), conn_); err != nil {
|
if uids, err = this.module.modelsrank.querySRankUser(int(req.BoosType), conn_); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
@ -68,8 +61,10 @@ func (this *apiComp) SeasonRank(session comm.IUserSession, req *pb.VikingSeasonR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, etime := utils.GetMonthStartEnd()
|
||||||
session.SendMsg(string(this.module.GetType()), VikingSeasonRankReq, &pb.VikingSeasonRankResp{
|
session.SendMsg(string(this.module.GetType()), VikingSeasonRankReq, &pb.VikingSeasonRankResp{
|
||||||
Ranks: players,
|
Ranks: players,
|
||||||
|
Etime: etime,
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ var moduleName = "viking"
|
|||||||
const (
|
const (
|
||||||
game_vikingboss = "game_vikingboss.json"
|
game_vikingboss = "game_vikingboss.json"
|
||||||
// game_challenge = "game_vikingchallenge.json"
|
// game_challenge = "game_vikingchallenge.json"
|
||||||
|
viking_reward = "game_vikingreward.json" //全局配置表
|
||||||
)
|
)
|
||||||
|
|
||||||
///配置管理基础组件
|
///配置管理基础组件
|
||||||
@ -28,8 +29,9 @@ type configureComp struct {
|
|||||||
//组件初始化接口
|
//组件初始化接口
|
||||||
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
err = this.MCompConfigure.Init(service, module, comp, options)
|
err = this.MCompConfigure.Init(service, module, comp, options)
|
||||||
|
err = this.LoadConfigure(viking_reward, cfg.NewGameVikingReward)
|
||||||
this._vikingMap = make(map[int64]*cfg.GameVikingBossData, 0)
|
this._vikingMap = make(map[int64]*cfg.GameVikingBossData, 0)
|
||||||
|
|
||||||
configure.RegisterConfigure(game_vikingboss, cfg.NewGameVikingBoss, func() {
|
configure.RegisterConfigure(game_vikingboss, cfg.NewGameVikingBoss, func() {
|
||||||
if v, err := this.GetConfigure(game_vikingboss); err == nil {
|
if v, err := this.GetConfigure(game_vikingboss); err == nil {
|
||||||
if configure, ok := v.(*cfg.GameVikingBoss); ok {
|
if configure, ok := v.(*cfg.GameVikingBoss); ok {
|
||||||
@ -45,6 +47,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
|||||||
return
|
return
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.GetVikingRewardConf()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,3 +117,35 @@ func (this *configureComp) GetVikingBossAllData() (data map[int32]int32) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
func (this *configureComp) GetVikingRewardConf() (conf []*cfg.GameVikingRewardData) {
|
||||||
|
|
||||||
|
if v, err := this.GetConfigure(viking_reward); err == nil {
|
||||||
|
if configure, ok := v.(*cfg.GameVikingReward); ok {
|
||||||
|
szReward := configure.GetDataList()
|
||||||
|
var (
|
||||||
|
pos int32
|
||||||
|
rankid int32
|
||||||
|
uids []string // 玩家发奖
|
||||||
|
)
|
||||||
|
for i := 0; i < 50; i++ {
|
||||||
|
rankid = int32(i) + 1 // 排名id
|
||||||
|
if szReward[pos].RankLow <= rankid && szReward[pos].RankUp >= rankid {
|
||||||
|
uids = append(uids, "1")
|
||||||
|
} else {
|
||||||
|
// this.moduleViking.mail.SendNewMail(&pb.DBMailData{
|
||||||
|
// Cid: "SeasonViking1Reward",
|
||||||
|
// Param: []string{fmt.Sprintf("%d-%d", szReward[pos].RankLow, szReward[pos].RankUp)},
|
||||||
|
// CreateTime: uint64(configure.Now().Unix()),
|
||||||
|
// Items: Items,
|
||||||
|
// }, uids...)
|
||||||
|
fmt.Printf("%v,%v", uids, szReward[pos])
|
||||||
|
uids = []string{}
|
||||||
|
pos += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -58,7 +58,7 @@ func (this *ModelRank) querySRankUser(bossid int) (ranks []string, err error) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
tableName := this.TableName + strconv.Itoa(int(bossid))
|
tableName := this.TableName + strconv.Itoa(int(bossid))
|
||||||
if result, err = this.Redis.ZRevRange(tableName, 0, 50).Result(); err != nil {
|
if result, err = this.Redis.ZRevRange(tableName, 0, comm.MinRankList).Result(); err != nil {
|
||||||
//this.module.Errorln(err)
|
//this.module.Errorln(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -137,6 +137,13 @@ func (this *ModelRank) CheckRank(uid string, boosID int32, difficulty int32, lin
|
|||||||
}
|
}
|
||||||
update := make(map[string]interface{}, 0)
|
update := make(map[string]interface{}, 0)
|
||||||
update["uinfo"] = record.Uinfo
|
update["uinfo"] = record.Uinfo
|
||||||
|
if _, ok := record.Data[boosID]; !ok {
|
||||||
|
record.Data[boosID] = &pb.ScoreData{
|
||||||
|
Costime: map[int32]int32{},
|
||||||
|
Maxnandu: 0,
|
||||||
|
Line: map[int32]*pb.LineData{},
|
||||||
|
}
|
||||||
|
}
|
||||||
if record.Data[boosID] == nil {
|
if record.Data[boosID] == nil {
|
||||||
record.Data[boosID].Costime = make(map[int32]int32, 0)
|
record.Data[boosID].Costime = make(map[int32]int32, 0)
|
||||||
record.Data[boosID].Line = make(map[int32]*pb.LineData, 0)
|
record.Data[boosID].Line = make(map[int32]*pb.LineData, 0)
|
||||||
|
@ -2,6 +2,7 @@ package viking
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/sys/mgo"
|
"go_dreamfactory/lego/sys/mgo"
|
||||||
@ -9,6 +10,7 @@ import (
|
|||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
"go_dreamfactory/sys/db"
|
"go_dreamfactory/sys/db"
|
||||||
"go_dreamfactory/utils"
|
"go_dreamfactory/utils"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -35,6 +37,7 @@ func (this *ModelSRank) Init(service core.IService, module core.IModule, comp co
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 批量查询
|
||||||
func (this *ModelSRank) queryPlayers(uIds []string, conn_ *db.DBConn) (result []*pb.DBVSeasonRecord, err error) {
|
func (this *ModelSRank) queryPlayers(uIds []string, conn_ *db.DBConn) (result []*pb.DBVSeasonRecord, err error) {
|
||||||
result = make([]*pb.DBVSeasonRecord, 0)
|
result = make([]*pb.DBVSeasonRecord, 0)
|
||||||
model := db.NewDBModelByExpired(comm.TableVikingSRank, conn_)
|
model := db.NewDBModelByExpired(comm.TableVikingSRank, conn_)
|
||||||
@ -99,23 +102,14 @@ func (this *ModelSRank) CheckSeasonRank(uid string, boosID int32, difficulty int
|
|||||||
var (
|
var (
|
||||||
conn_ *db.DBConn
|
conn_ *db.DBConn
|
||||||
err error
|
err error
|
||||||
bcross bool
|
|
||||||
record *pb.DBVSeasonRecord
|
record *pb.DBVSeasonRecord
|
||||||
update map[string]interface{}
|
update map[string]interface{}
|
||||||
)
|
)
|
||||||
update = make(map[string]interface{}, 0)
|
update = make(map[string]interface{}, 0)
|
||||||
bcross, _ = this.CheckCurSeasonData()
|
|
||||||
|
|
||||||
if bcross {
|
conn_, err = db.Cross()
|
||||||
conn_, err = db.Local() // 获取跨服数据库对象
|
if err != nil {
|
||||||
if err != nil {
|
return
|
||||||
return
|
|
||||||
}
|
|
||||||
} else { //数据记录在本服
|
|
||||||
conn_, err = db.Cross()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
user, err := this.moduleViking.ModuleUser.GetUser(uid)
|
user, err := this.moduleViking.ModuleUser.GetUser(uid)
|
||||||
@ -178,7 +172,9 @@ func (this *ModelSRank) CheckSeasonRank(uid string, boosID int32, difficulty int
|
|||||||
update["uinfo"] = record.Uinfo
|
update["uinfo"] = record.Uinfo
|
||||||
if record.Data[boosID] == nil {
|
if record.Data[boosID] == nil {
|
||||||
record.Data[boosID].Huihe = make(map[int32]int32, 0)
|
record.Data[boosID].Huihe = make(map[int32]int32, 0)
|
||||||
|
record.Data[boosID].Line = make(map[int32]*pb.LineData, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if record.Data[boosID].Maxnandu < difficulty {
|
if record.Data[boosID].Maxnandu < difficulty {
|
||||||
record.Data[boosID].Maxnandu = difficulty
|
record.Data[boosID].Maxnandu = difficulty
|
||||||
} else {
|
} else {
|
||||||
@ -220,7 +216,7 @@ func (this *ModelSRank) querySRankUser(bossid int, conn_ *db.DBConn) (ranks []st
|
|||||||
)
|
)
|
||||||
|
|
||||||
tableName := this.TableName + strconv.Itoa(int(bossid))
|
tableName := this.TableName + strconv.Itoa(int(bossid))
|
||||||
if result, err = conn_.Redis.ZRevRange(tableName, 0, 50).Result(); err != nil {
|
if result, err = conn_.Redis.ZRevRange(tableName, 0, comm.MinRankList).Result(); err != nil {
|
||||||
//this.module.Errorln(err)
|
//this.module.Errorln(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -230,3 +226,50 @@ func (this *ModelSRank) querySRankUser(bossid int, conn_ *db.DBConn) (ranks []st
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
func (this *ModelSRank) raceSettlement() {
|
||||||
|
var (
|
||||||
|
result []string
|
||||||
|
Items []*pb.UserAssets
|
||||||
|
err error
|
||||||
|
szReward []*cfg.GameVikingRewardData
|
||||||
|
uids []string // 玩家发奖
|
||||||
|
)
|
||||||
|
tableName := this.TableName + "1" //strconv.Itoa(int(bossid))
|
||||||
|
szReward = this.moduleViking.configure.GetVikingRewardConf()
|
||||||
|
|
||||||
|
if result, err = this.DBModel.Redis.ZRevRange(tableName, 0, comm.MaxRankList).Result(); err != nil {
|
||||||
|
this.moduleViking.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.moduleViking.Debugf("uid:%v", uids)
|
||||||
|
var (
|
||||||
|
pos int32
|
||||||
|
rankid int32
|
||||||
|
)
|
||||||
|
// 1-1 2-2 3-3 4-10
|
||||||
|
for i := 0; i < len(result); i++ {
|
||||||
|
|
||||||
|
rankid = int32(i) + 1 // 排名id
|
||||||
|
if szReward[pos].RankLow <= rankid && szReward[pos].RankUp >= rankid {
|
||||||
|
uids = append(uids, result[i])
|
||||||
|
} else {
|
||||||
|
this.moduleViking.mail.SendNewMail(&pb.DBMailData{
|
||||||
|
Cid: "SeasonViking1Reward",
|
||||||
|
Param: []string{fmt.Sprintf("%d-%d", szReward[pos].RankLow, szReward[pos].RankUp)},
|
||||||
|
CreateTime: uint64(configure.Now().Unix()),
|
||||||
|
Items: Items,
|
||||||
|
}, uids...)
|
||||||
|
|
||||||
|
uids = []string{}
|
||||||
|
pos += 1
|
||||||
|
}
|
||||||
|
// uids = append(uids, result[i])
|
||||||
|
// //发邮件
|
||||||
|
// this.moduleViking.mail.SendNewMail(&pb.DBMailData{
|
||||||
|
// Cid: "SeasonViking1Reward",
|
||||||
|
// Param: []string{fmt.Sprintf("%d-%d", szReward[i].RankLow, szReward[i].RankUp)},
|
||||||
|
// CreateTime: uint64(configure.Now().Unix()),
|
||||||
|
// Items: Items,
|
||||||
|
// }, result[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
package viking
|
package viking
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/base"
|
"go_dreamfactory/lego/base"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/utils"
|
"go_dreamfactory/lego/sys/log"
|
||||||
|
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Viking struct {
|
type Viking struct {
|
||||||
@ -25,6 +25,7 @@ type Viking struct {
|
|||||||
battle comm.IBattle
|
battle comm.IBattle
|
||||||
service base.IRPCXService
|
service base.IRPCXService
|
||||||
modelsrank *ModelSRank
|
modelsrank *ModelSRank
|
||||||
|
mail comm.Imail
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -73,16 +74,29 @@ func (this *Viking) Start() (err error) {
|
|||||||
if err = this.ModuleBase.Start(); err != nil {
|
if err = this.ModuleBase.Start(); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.service.RegisterFunctionName(string(comm.Rpc_ModuleVikingFigthEnd), this.Rpc_ModuleVikingFigthEnd)
|
||||||
var module core.IModule
|
var module core.IModule
|
||||||
if module, err = this.service.GetModule(comm.ModuleBattle); err != nil {
|
if module, err = this.service.GetModule(comm.ModuleBattle); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.battle = module.(comm.IBattle)
|
this.battle = module.(comm.IBattle)
|
||||||
this.CheckCurSeasonData()
|
|
||||||
|
if module, err = this.service.GetModule(comm.ModuleMail); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mail = module.(comm.Imail)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
func (this *Viking) Rpc_ModuleVikingFigthEnd(ctx context.Context, args *pb.EmptyReq, reply *pb.EmptyResp) (err error) {
|
||||||
|
this.Debug("Rpc_ModuleVikingFigthEnd",
|
||||||
|
log.Field{Key: "args", Value: args.String()},
|
||||||
|
)
|
||||||
|
this.modelsrank.raceSettlement()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Viking) CheckUserBaseVikingInfo(uid string) (data []*pb.DBVikingRank) {
|
func (this *Viking) CheckUserBaseVikingInfo(uid string) (data []*pb.DBVikingRank) {
|
||||||
|
|
||||||
if d := this.modulerank.getVikingRank(uid); d.Id != "" {
|
if d := this.modulerank.getVikingRank(uid); d.Id != "" {
|
||||||
@ -146,58 +160,3 @@ func (this *Viking) CompleteAllLevel(session comm.IUserSession) (errdata *pb.Err
|
|||||||
session.SendMsg(string(this.GetType()), VikingGetListResp, &pb.VikingGetListResp{Data: list})
|
session.SendMsg(string(this.GetType()), VikingGetListResp, &pb.VikingGetListResp{Data: list})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查当前赛季是在本服还是在跨服
|
|
||||||
func (this *Viking) CheckCurSeasonData() (bLocal bool, endSeasonTime int64) {
|
|
||||||
var subTime int64
|
|
||||||
var oneSeason int64
|
|
||||||
openTime := this.service.GetOpentime().Unix()
|
|
||||||
this.Debugf("%d", openTime)
|
|
||||||
// 获取第一个赛季结束的时间
|
|
||||||
oneSeason = utils.GetTodayZeroTime(openTime) //+ int64((6-d)*3600*24)
|
|
||||||
this.Debugf("%d", oneSeason)
|
|
||||||
|
|
||||||
var c int32
|
|
||||||
if Continued%Cycle == 0 {
|
|
||||||
c = Continued / Cycle
|
|
||||||
} else {
|
|
||||||
c = Continued/Cycle + 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if configure.Now().Unix() > oneSeason {
|
|
||||||
subTime = configure.Now().Unix() - oneSeason
|
|
||||||
subTime = subTime/(14*3600*24) + 1
|
|
||||||
}
|
|
||||||
// 只需判断当前时间是否大于第c个赛季即可
|
|
||||||
endSeasonTime = oneSeason
|
|
||||||
endSeasonTime += 14 * 3600 * 24 * int64(c)
|
|
||||||
if endSeasonTime <= configure.Now().Unix() {
|
|
||||||
endSeasonTime = oneSeason + subTime*14*3600*24
|
|
||||||
return false, endSeasonTime
|
|
||||||
}
|
|
||||||
endSeasonTime = oneSeason + subTime*14*3600*24
|
|
||||||
return true, endSeasonTime
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查上一个赛季实在本服还是在跨服
|
|
||||||
func (this *Viking) CheckPreSeasonData() (bLocal bool) {
|
|
||||||
openTime := this.service.GetOpentime().Unix()
|
|
||||||
this.Debugf("%d", openTime)
|
|
||||||
// 获取第一个赛季结束的时间
|
|
||||||
endSeasonTime := utils.GetTodayZeroTime(openTime) //+ int64((6-d)*3600*24)
|
|
||||||
this.Debugf("%d", endSeasonTime)
|
|
||||||
|
|
||||||
var c int32
|
|
||||||
if Continued%Cycle == 0 {
|
|
||||||
c = Continued / Cycle
|
|
||||||
} else {
|
|
||||||
c = Continued/Cycle + 1
|
|
||||||
}
|
|
||||||
|
|
||||||
// 只需判断当前时间是否大于第c个赛季即可
|
|
||||||
endSeasonTime += 3600 * 24 * int64(Cycle*c)
|
|
||||||
if endSeasonTime <= configure.Now().Unix()-int64(Cycle*3600*24) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user