抽奖活动日志
This commit is contained in:
parent
6a9c97c77c
commit
3e02f7ba03
|
|
@ -29,7 +29,7 @@ var LotteryMgrInst = &LotteryMgr{
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
module.RegisteModule(LotteryMgrInst, time.Minute, 0)
|
module.RegisteModule(LotteryMgrInst, time.Second*10, 0)
|
||||||
common.RegisterClockFunc(&common.ClockFunc{
|
common.RegisterClockFunc(&common.ClockFunc{
|
||||||
OnDayTimerFunc: func() {
|
OnDayTimerFunc: func() {
|
||||||
for _, v := range LotteryMgrInst.PlatformConfig {
|
for _, v := range LotteryMgrInst.PlatformConfig {
|
||||||
|
|
@ -145,8 +145,10 @@ func (l *LotteryData) GetRemainCode() int {
|
||||||
|
|
||||||
// 发奖
|
// 发奖
|
||||||
func (l *LotteryData) sendAward(must bool) {
|
func (l *LotteryData) sendAward(must bool) {
|
||||||
if l.isDone || !must {
|
if !must {
|
||||||
return
|
if l.isDone {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
@ -180,7 +182,7 @@ func (l *LotteryData) sendAward(must bool) {
|
||||||
|
|
||||||
// 广播中奖结果
|
// 广播中奖结果
|
||||||
PlayerMgrSington.BroadcastMessageToPlatform(l.Platform, int(welfare.SPacketID_PACKET_NotifyLotteryAward), pack)
|
PlayerMgrSington.BroadcastMessageToPlatform(l.Platform, int(welfare.SPacketID_PACKET_NotifyLotteryAward), pack)
|
||||||
logger.Logger.Tracef("NotifyLotteryAward: %v", pack)
|
logger.Logger.Tracef("广播中奖信息: %v", pack)
|
||||||
|
|
||||||
if l.IsRobot {
|
if l.IsRobot {
|
||||||
return
|
return
|
||||||
|
|
@ -220,7 +222,6 @@ func (l *LotteryData) Done() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
l.isDone = true
|
l.isDone = true
|
||||||
logger.Logger.Tracef("LotteryData Done1: cid:%v wincode:%v snid:%v", l.CId, l.WinCode, l.SnId)
|
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
if l.EndTs <= 0 || l.EndTs >= now.Unix() || l.SnId > 0 || now.Unix()-l.EndTs > 5*60 {
|
if l.EndTs <= 0 || l.EndTs >= now.Unix() || l.SnId > 0 || now.Unix()-l.EndTs > 5*60 {
|
||||||
|
|
@ -418,8 +419,7 @@ func (l *LotteryData) Done() {
|
||||||
Ts: l.WinTs,
|
Ts: l.WinTs,
|
||||||
}
|
}
|
||||||
mq.Write(lotteryLog)
|
mq.Write(lotteryLog)
|
||||||
logger.Logger.Tracef("LotteryData 抽奖中奖记录: %+v %p", *lotteryLog, l)
|
logger.Logger.Tracef("LotteryData 抽奖中奖记录: %v", lotteryLog)
|
||||||
logger.Logger.Tracef("LotteryData Done2: cid:%v wincode:%v snid:%v", l.CId, l.WinCode, l.SnId)
|
|
||||||
// 开始发奖
|
// 开始发奖
|
||||||
l.sendAward(true)
|
l.sendAward(true)
|
||||||
}
|
}
|
||||||
|
|
@ -480,9 +480,7 @@ func (l *LotteryMgr) Update() {
|
||||||
// 随机给机器人发放抽奖码
|
// 随机给机器人发放抽奖码
|
||||||
d.sendRobotCode(1, 5)
|
d.sendRobotCode(1, 5)
|
||||||
// 活动结束,开始抽奖
|
// 活动结束,开始抽奖
|
||||||
logger.Logger.Tracef("Done1 cid:%v wincode:%v %p", d.CId, d.WinCode, d)
|
|
||||||
d.Done()
|
d.Done()
|
||||||
logger.Logger.Tracef("Done2 cid:%v wincode:%v %p", d.CId, d.WinCode, d)
|
|
||||||
// 开始发奖
|
// 开始发奖
|
||||||
d.sendAward(false)
|
d.sendAward(false)
|
||||||
}
|
}
|
||||||
|
|
@ -546,7 +544,7 @@ func (l *LotteryMgr) UpdateConfig(conf *webapi.LotteryConfig) {
|
||||||
v.TotalCode = 1
|
v.TotalCode = 1
|
||||||
}
|
}
|
||||||
data := l.GetData(conf.GetPlatform(), v.GetId())
|
data := l.GetData(conf.GetPlatform(), v.GetId())
|
||||||
if data.EndTs > 0 && (data.EndTs < now.Unix() || data.StartTs <= now.Unix()) {
|
if data.EndTs > 0 && (data.WinTs <= now.Unix() || data.StartTs <= now.Unix()) {
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
data.Reset()
|
data.Reset()
|
||||||
|
|
@ -658,10 +656,10 @@ func (l *LotteryMgr) GetList(plt string) []*welfare.LotteryInfo {
|
||||||
|
|
||||||
if d.WinTs > 0 && d.WinTs > now.Unix() {
|
if d.WinTs > 0 && d.WinTs > now.Unix() {
|
||||||
// 隐藏未发奖的中奖信息
|
// 隐藏未发奖的中奖信息
|
||||||
d.WinCode = ""
|
info.WinCode = ""
|
||||||
d.SnId = 0
|
info.SnId = 0
|
||||||
d.Name = ""
|
info.Name = ""
|
||||||
d.RoleId = 0
|
info.RoleId = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = append(ret, info)
|
ret = append(ret, info)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue