竞技馆抽奖活动必中玩家开奖

This commit is contained in:
sk 2024-10-23 10:53:57 +08:00
parent 8b1ae79c9b
commit 1171f06cfe
3 changed files with 28 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package model
import ( import (
"encoding/json" "encoding/json"
"os" "os"
"time"
"github.com/globalsign/mgo" "github.com/globalsign/mgo"
"mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/logger"
@ -238,3 +239,11 @@ func InitGameParam() {
GameParamData.AdminPassword = "fjslowopcserg" GameParamData.AdminPassword = "fjslowopcserg"
} }
} }
// BackTimeUnixToLocalTimeUnix 后台时间戳转本地时间戳
func BackTimeUnixToLocalTimeUnix(ts int64) int64 {
_, offset := time.Now().Zone()
backOffset := GameParamData.BackendTimeLocal * 3600
ts += int64(backOffset - offset)
return ts
}

View File

@ -560,6 +560,7 @@ func handlerEvent(ctx context.Context, completeKey string, isInit bool, event *c
return return
} }
config := data.(*webapi.UserLottery) config := data.(*webapi.UserLottery)
config.Time = model.BackTimeUnixToLocalTimeUnix(config.Time)
PlatformMgrSingleton.GetConfig(config.GetPlatform()).LotteryUser[config.GetId()] = config PlatformMgrSingleton.GetConfig(config.GetPlatform()).LotteryUser[config.GetId()] = config
case clientv3.EventTypeDelete: case clientv3.EventTypeDelete:
if plt == "" || len(param) == 0 { if plt == "" || len(param) == 0 {
@ -575,6 +576,7 @@ func handlerEvent(ctx context.Context, completeKey string, isInit bool, event *c
return return
} }
config := data.(*webapi.ShowLottery) config := data.(*webapi.ShowLottery)
config.Time = model.BackTimeUnixToLocalTimeUnix(config.Time)
PlatformMgrSingleton.GetConfig(config.GetPlatform()).LotteryShows[config.GetId()] = config PlatformMgrSingleton.GetConfig(config.GetPlatform()).LotteryShows[config.GetId()] = config
case clientv3.EventTypeDelete: case clientv3.EventTypeDelete:
if plt == "" || len(param) == 0 { if plt == "" || len(param) == 0 {

View File

@ -252,6 +252,12 @@ func (l *LotteryData) Done() {
break break
} }
if awardPlayer == nil {
awardPlayer = &Player{
PlayerData: &model.PlayerData{},
}
}
// 是否必中 // 是否必中
for _, v := range PlatformMgrSingleton.GetConfig(l.Platform).LotteryUser { for _, v := range PlatformMgrSingleton.GetConfig(l.Platform).LotteryUser {
if v.GetOn() != common.On { if v.GetOn() != common.On {
@ -331,6 +337,15 @@ func (l *LotteryData) Done() {
} }
return nil return nil
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) { }), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
if code == nil && isMust {
code = &model.LotteryCode{
Platform: l.Platform,
SnId: awardPlayer.SnId,
CId: l.CId,
StartTs: l.StartTs,
Code: fmt.Sprintf("%d", l.TotalCode),
}
}
if code == nil { if code == nil {
return return
} }