Compare commits
No commits in common. "6a9c97c77c8e79723a1726db0d0ded6356e8caa9" and "a10ff0ecc778ade57b2ebee3ac83dab02c804f92" have entirely different histories.
6a9c97c77c
...
a10ff0ecc7
|
@ -41,6 +41,8 @@ func init() {
|
||||||
if err = svc.InsertLotteryLogs(log.Platform, log); err != nil {
|
if err = svc.InsertLotteryLogs(log.Platform, log); err != nil {
|
||||||
logger.Logger.Errorf("InsertLotteryLogs error: %v", err)
|
logger.Logger.Errorf("InsertLotteryLogs error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mq.Write(&model.LotteryLog{Platform: log.Platform}, mq.RankLotteryLog)
|
||||||
return
|
return
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -69,8 +69,7 @@ func GetLotteryLogs(plt string, count int) (ret []*model.LotteryLog, err error)
|
||||||
if clog == nil {
|
if clog == nil {
|
||||||
return nil, LotteryLogDBErr
|
return nil, LotteryLogDBErr
|
||||||
}
|
}
|
||||||
now := time.Now().Unix()
|
err = clog.Find(bson.M{"ts": bson.M{"$lt": time.Now().Unix()}}).Sort("-ts").Limit(count).All(&ret)
|
||||||
err = clog.Find(bson.M{"ts": bson.M{"$lt": now}}).Sort("-ts").Limit(count).All(&ret)
|
|
||||||
if err != nil && !errors.Is(err, mgo.ErrNotFound) {
|
if err != nil && !errors.Is(err, mgo.ErrNotFound) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,6 @@ func (l *LotteryData) Reset() {
|
||||||
l.CostCard = 0
|
l.CostCard = 0
|
||||||
l.RobotCodeCount = 0
|
l.RobotCodeCount = 0
|
||||||
l.PlayerNum = 0
|
l.PlayerNum = 0
|
||||||
logger.Logger.Tracef("LotteryData Reset: %v", l.CId)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCode 获取抽奖码
|
// GetCode 获取抽奖码
|
||||||
|
@ -144,8 +143,8 @@ func (l *LotteryData) GetRemainCode() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发奖
|
// 发奖
|
||||||
func (l *LotteryData) sendAward(must bool) {
|
func (l *LotteryData) sendAward() {
|
||||||
if l.isDone || !must {
|
if l.isDone {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +153,6 @@ func (l *LotteryData) sendAward(must bool) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
l.IsSend = true
|
l.IsSend = true
|
||||||
mq.Write(&model.LotteryLog{Platform: l.Platform}, mq.RankLotteryLog)
|
|
||||||
|
|
||||||
var lotteryAward []*welfare.PropInfo
|
var lotteryAward []*welfare.PropInfo
|
||||||
for _, v := range l.Reward {
|
for _, v := range l.Reward {
|
||||||
|
@ -220,7 +218,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,12 +415,11 @@ 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()
|
||||||
}
|
}
|
||||||
})).StartByExecutor(fmt.Sprintf("LotterySendAward_%s_%d", l.Platform, l.CId))
|
}), "LotterySendAward").Start()
|
||||||
}
|
}
|
||||||
|
|
||||||
type LotteryConfig struct {
|
type LotteryConfig struct {
|
||||||
|
@ -467,9 +463,8 @@ func (l *LotteryMgr) Init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LotteryMgr) Update() {
|
func (l *LotteryMgr) Update() {
|
||||||
for i := range l.Data {
|
for _, v := range l.Data {
|
||||||
for k := range l.Data[i] {
|
for _, d := range v {
|
||||||
d := l.Data[i][k]
|
|
||||||
if d == nil {
|
if d == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -480,11 +475,9 @@ 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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue