防止重复发奖

This commit is contained in:
sk 2024-10-29 14:14:59 +08:00
parent 30cd6ef592
commit 13040896b9
1 changed files with 7 additions and 5 deletions

View File

@ -214,14 +214,21 @@ func (l *LotteryData) sendRobotCode(a, b int) {
// Done 抽奖
func (l *LotteryData) Done() {
if l.isDone {
return
}
l.isDone = true
now := time.Now()
if l.EndTs <= 0 || l.EndTs >= now.Unix() || l.SnId > 0 || now.Unix()-l.EndTs > 5*60 {
l.isDone = false
return
}
sTs := common.GetDayStartTs(now.Unix())
eTs := sTs + int64(time.Hour.Seconds()*24)
if l.StartTs < sTs || l.StartTs >= eTs {
l.isDone = false
return
}
@ -292,11 +299,6 @@ func (l *LotteryData) Done() {
value, tp, index, l.RobotIndex, l.Code, l.PlayerIndex, l.CId)
}
if l.isDone {
return
}
l.isDone = true
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
// 查询参与人数
joinNum, err = model.GetLotteryCodeJoinNum(l.Platform, l.CId, l.StartTs)