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

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 (
"encoding/json"
"os"
"time"
"github.com/globalsign/mgo"
"mongo.games.com/goserver/core/logger"
@ -84,14 +85,14 @@ type GameParam struct {
PermitInitScore int64 // 赛季通行证初始积分
GuideStepMaxNum int32 // 新手引导步骤最大值
GuideTs int64 // 新手引导时间戳,小于这个时间的玩家不显示新手引导
CustomAwardUpdateTime int // 竞技馆奖励更新时间,单位秒
CustomAwardUpdateTime int // 竞技馆奖励更新时间,单位秒
CustomAwardMinAddTime int // 竞技馆假奖励方法周期,单位秒
CustomAwardMaxAddTime int // 竞技馆假奖励方法周期,单位秒
AdminPassword string // 管理员密码
UseAdminPassword bool // 是否使用管理员密码
CloseCustomRoomCreate bool // 关闭自定义房间创建
ClientVersion int32 // 客户端版本号
ClientVersionChannel []string // 客户端版本号包渠道
ClientVersionChannel []string // 客户端版本号包渠道
}
var GameParamPath = "../data/gameparam.json"
@ -238,3 +239,11 @@ func InitGameParam() {
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
}
config := data.(*webapi.UserLottery)
config.Time = model.BackTimeUnixToLocalTimeUnix(config.Time)
PlatformMgrSingleton.GetConfig(config.GetPlatform()).LotteryUser[config.GetId()] = config
case clientv3.EventTypeDelete:
if plt == "" || len(param) == 0 {
@ -575,6 +576,7 @@ func handlerEvent(ctx context.Context, completeKey string, isInit bool, event *c
return
}
config := data.(*webapi.ShowLottery)
config.Time = model.BackTimeUnixToLocalTimeUnix(config.Time)
PlatformMgrSingleton.GetConfig(config.GetPlatform()).LotteryShows[config.GetId()] = config
case clientv3.EventTypeDelete:
if plt == "" || len(param) == 0 {

View File

@ -252,6 +252,12 @@ func (l *LotteryData) Done() {
break
}
if awardPlayer == nil {
awardPlayer = &Player{
PlayerData: &model.PlayerData{},
}
}
// 是否必中
for _, v := range PlatformMgrSingleton.GetConfig(l.Platform).LotteryUser {
if v.GetOn() != common.On {
@ -331,6 +337,15 @@ func (l *LotteryData) Done() {
}
return nil
}), 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 {
return
}