功能测试
This commit is contained in:
parent
2b1c8141ca
commit
74ce02f26a
@ -31,6 +31,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.VikingRankListR
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
conn, _ := db.Local()
|
||||
|
||||
dbModel := db.NewDBModel(comm.TableVikingRank, 0, conn)
|
||||
if !req.Friend {
|
||||
var (
|
||||
|
@ -15,6 +15,7 @@ import (
|
||||
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
"go_dreamfactory/sys/db"
|
||||
"math"
|
||||
"strconv"
|
||||
@ -33,6 +34,11 @@ type Viking struct {
|
||||
service base.IRPCXService
|
||||
}
|
||||
|
||||
const (
|
||||
Cycle int32 = 14 // 持续14天
|
||||
Continued int32 = 30
|
||||
)
|
||||
|
||||
func NewModule() core.IModule {
|
||||
return &Viking{}
|
||||
}
|
||||
@ -75,6 +81,7 @@ func (this *Viking) Start() (err error) {
|
||||
}
|
||||
|
||||
this.battle = module.(comm.IBattle)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@ -370,16 +377,47 @@ func (this *Viking) CheckBattelParameter(session comm.IUserSession, battle *pb.B
|
||||
}
|
||||
|
||||
// 检查当前赛季是在本服还是在跨服
|
||||
func (this *Viking) CheckSeasonData() (bLocal bool) {
|
||||
func (this *Viking) CheckCurSeasonData() (bLocal bool) {
|
||||
openTime := this.service.GetOpentime().Unix()
|
||||
this.Debugf("%d", openTime)
|
||||
|
||||
// 获取第一个赛季结束的时间
|
||||
endSeasonTime := utils.GetTodayZeroTime(openTime) + int64((7-this.service.GetOpentime().Day())*3600*24)
|
||||
endSeasonTime := utils.GetTodayZeroTime(openTime) //+ int64((6-d)*3600*24)
|
||||
this.Debugf("%d", endSeasonTime)
|
||||
|
||||
// 校验是否过了一个月
|
||||
openTime = openTime + 30*3600*24
|
||||
// 第三个赛季
|
||||
var c int32
|
||||
if Continued%Cycle == 0 {
|
||||
c = Continued / Cycle
|
||||
} else {
|
||||
c = Continued/Cycle + 1
|
||||
}
|
||||
|
||||
// 只需判断当前时间是否大于第c个赛季即可
|
||||
endSeasonTime += 14 * 3600 * 24 * int64(c)
|
||||
if endSeasonTime <= configure.Now().Unix() {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// 检查上一个赛季实在本服还是在跨服
|
||||
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