赛季通行证重置
This commit is contained in:
parent
5eb468c7ff
commit
cc656a5bbc
Binary file not shown.
BIN
data/DB_Task.dat
BIN
data/DB_Task.dat
Binary file not shown.
|
@ -53,6 +53,16 @@ func (svc *GameKVDataSvc) UptGameKVData(args *model.GameKVData, ret *bool) error
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (svc *GameKVDataSvc) GetGameKVData(args *model.GameKVData, ret *model.GameKVData) error {
|
||||||
|
c := GameKVDatasCollection()
|
||||||
|
if c != nil {
|
||||||
|
err := c.Find(bson.M{"key": args.Key}).One(ret)
|
||||||
|
logger.Logger.Tracef("GetGameKVData: %#v %v", ret, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var _GameKVDataSvc = &GameKVDataSvc{}
|
var _GameKVDataSvc = &GameKVDataSvc{}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
|
@ -63,6 +63,23 @@ func GetStrKVGameData(key string) string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetStrKVGameDataDB(key string) (string, error) {
|
||||||
|
if rpcCli == nil {
|
||||||
|
logger.Logger.Error("model.GetStrKVGameDataDB rpcCli == nil")
|
||||||
|
return "", ErrRPClientNoConn
|
||||||
|
}
|
||||||
|
req := &GameKVData{
|
||||||
|
Key: key,
|
||||||
|
}
|
||||||
|
ret := &GameKVData{}
|
||||||
|
err := rpcCli.CallWithTimeout("GameKVDataSvc.GetGameKVData", req, ret, time.Second*30)
|
||||||
|
if err != nil {
|
||||||
|
logger.Logger.Error("model.GetStrKVGameDataDB err:", err, key)
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return ret.StrVal, err
|
||||||
|
}
|
||||||
|
|
||||||
func GetFloatKVGameData(key string) float64 {
|
func GetFloatKVGameData(key string) float64 {
|
||||||
if val, exist := gameKVDatas.Load(key); exist {
|
if val, exist := gameKVDatas.Load(key); exist {
|
||||||
if data, ok := val.(*GameKVData); ok {
|
if data, ok := val.(*GameKVData); ok {
|
||||||
|
|
|
@ -16,7 +16,10 @@ var RankPermitMgrInstance = com.NewListMgr[*model.PermitScore](
|
||||||
func(platform string, index int32) ([]*model.PermitScore, error) {
|
func(platform string, index int32) ([]*model.PermitScore, error) {
|
||||||
logger.Logger.Tracef("load rank permit platform:%s rankType:%d", platform, index)
|
logger.Logger.Tracef("load rank permit platform:%s rankType:%d", platform, index)
|
||||||
se := new(model.PermitStartTs)
|
se := new(model.PermitStartTs)
|
||||||
b := model.GetStrKVGameData(common.PermitStartTsKey + platform)
|
b, err := model.GetStrKVGameDataDB(common.PermitStartTsKey + platform)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
json.Unmarshal([]byte(b), se)
|
json.Unmarshal([]byte(b), se)
|
||||||
seasonList, err := model.FindPlayerPermitList(&model.FindPlayerPermitListArgs{
|
seasonList, err := model.FindPlayerPermitList(&model.FindPlayerPermitListArgs{
|
||||||
Platform: platform,
|
Platform: platform,
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"go.etcd.io/etcd/client/v3"
|
"go.etcd.io/etcd/client/v3"
|
||||||
"mongo.games.com/goserver/core/basic"
|
"mongo.games.com/goserver/core/basic"
|
||||||
|
@ -230,30 +231,37 @@ func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, e
|
||||||
PlatformMgrSingleton.GetConfig(config.Platform).PermitStartTs = startTs
|
PlatformMgrSingleton.GetConfig(config.Platform).PermitStartTs = startTs
|
||||||
PlatformMgrSingleton.GetConfig(config.Platform).PermitEndTs = endTs
|
PlatformMgrSingleton.GetConfig(config.Platform).PermitEndTs = endTs
|
||||||
}
|
}
|
||||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
f := func() {
|
||||||
if st.StartTs <= 0 || st.EndTs <= 0 {
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
return nil
|
if st.StartTs <= 0 || st.EndTs <= 0 {
|
||||||
}
|
return nil
|
||||||
b, err := json.Marshal(st)
|
|
||||||
if err != nil {
|
|
||||||
logger.Logger.Errorf("permit startts save error: %v", err)
|
|
||||||
} else {
|
|
||||||
logger.Logger.Infof("update permit startts: %v %v", st.StartTs, st.EndTs)
|
|
||||||
err := model.UptStrKVGameData(common.PermitStartTsKey+config.Platform, string(b))
|
|
||||||
if err != nil {
|
|
||||||
logger.Logger.Errorf("permit startts update error:%v", err)
|
|
||||||
}
|
}
|
||||||
}
|
b, err := json.Marshal(st)
|
||||||
return nil
|
if err != nil {
|
||||||
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
|
logger.Logger.Errorf("permit startts save error: %v", err)
|
||||||
if st.StartTs > 0 {
|
} else {
|
||||||
LogChannelSingleton.WriteLog(&model.BackendPermitCycle{
|
logger.Logger.Infof("update permit startts: %v %v", st.StartTs, st.EndTs)
|
||||||
Platform: config.Platform,
|
err := model.UptStrKVGameData(common.PermitStartTsKey+config.Platform, string(b))
|
||||||
StartTs: st.StartTs,
|
if err != nil {
|
||||||
EndTs: st.EndTs,
|
logger.Logger.Errorf("permit startts update error:%v", err)
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
})).StartByExecutor("permit_start_ts")
|
return nil
|
||||||
|
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
|
||||||
|
if st.StartTs > 0 {
|
||||||
|
LogChannelSingleton.WriteLog(&model.BackendPermitCycle{
|
||||||
|
Platform: config.Platform,
|
||||||
|
StartTs: st.StartTs,
|
||||||
|
EndTs: st.EndTs,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})).StartByExecutor("permit_start_ts")
|
||||||
|
}
|
||||||
|
if isInit {
|
||||||
|
time.AfterFunc(time.Second*5, f) //todo 优化
|
||||||
|
} else {
|
||||||
|
f()
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
logger.Logger.Errorf("etcd completeKey:%s, Not processed", completeKey)
|
logger.Logger.Errorf("etcd completeKey:%s, Not processed", completeKey)
|
||||||
|
|
|
@ -155,6 +155,9 @@ func (r *PermitMgr) OnDayTimer() {
|
||||||
}
|
}
|
||||||
PlatformMgrSingleton.GetConfig(platform).PermitStartTs = se.StartTs
|
PlatformMgrSingleton.GetConfig(platform).PermitStartTs = se.StartTs
|
||||||
PlatformMgrSingleton.GetConfig(platform).PermitEndTs = se.EndTs
|
PlatformMgrSingleton.GetConfig(platform).PermitEndTs = se.EndTs
|
||||||
|
for _, v := range PlayerMgrSington.playerOfPlatform[platform] {
|
||||||
|
v.ResetPermit()
|
||||||
|
}
|
||||||
b, err := json.Marshal(se)
|
b, err := json.Marshal(se)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Errorf("(this *PermitMgr) OnDayTimer json.Marshal err:%v", err)
|
logger.Logger.Errorf("(this *PermitMgr) OnDayTimer json.Marshal err:%v", err)
|
||||||
|
|
|
@ -1548,8 +1548,10 @@ func (this *Tournament) MakeMatchLog(platform string, tmId int32, sortId int64)
|
||||||
})
|
})
|
||||||
if rankId >= 1 && rankId <= 10 {
|
if rankId >= 1 && rankId <= 10 {
|
||||||
TaskSubjectSingleton.Touch(common.TaskTypeMatchRank10, &TaskData{
|
TaskSubjectSingleton.Touch(common.TaskTypeMatchRank10, &TaskData{
|
||||||
SnId: v.p.SnId,
|
GameID: int(v.tm.dbGameFree.GetGameId()),
|
||||||
Num: 1,
|
GameFreeID: v.tm.dbGameFree.GetId(),
|
||||||
|
SnId: v.p.SnId,
|
||||||
|
Num: 1,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue