Compare commits
3 Commits
6a9c97c77c
...
4082fc11f2
Author | SHA1 | Date |
---|---|---|
|
4082fc11f2 | |
|
5747ad0380 | |
|
3e02f7ba03 |
|
@ -4186,6 +4186,7 @@ type LotteryInfo struct {
|
|||
// 玩家数据
|
||||
CostRoomCard int64 `protobuf:"varint,17,opt,name=CostRoomCard,proto3" json:"CostRoomCard,omitempty"` // 消耗房卡
|
||||
Codes []string `protobuf:"bytes,18,rep,name=Codes,proto3" json:"Codes,omitempty"` // 本期获得号码
|
||||
RemainTime int64 `protobuf:"varint,19,opt,name=RemainTime,proto3" json:"RemainTime,omitempty"` // 剩余时间,单位秒
|
||||
}
|
||||
|
||||
func (x *LotteryInfo) Reset() {
|
||||
|
@ -4346,6 +4347,13 @@ func (x *LotteryInfo) GetCodes() []string {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *LotteryInfo) GetRemainTime() int64 {
|
||||
if x != nil {
|
||||
return x.RemainTime
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
//PACKET_SCLotteryInfo
|
||||
type SCLotteryInfo struct {
|
||||
state protoimpl.MessageState
|
||||
|
@ -4918,7 +4926,7 @@ var file_welfare_proto_rawDesc = []byte{
|
|||
0x75, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x43, 0x6f, 0x6e, 0x73, 0x75,
|
||||
0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x43, 0x53, 0x4c, 0x6f,
|
||||
0x74, 0x74, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0xe0, 0x03, 0x0a, 0x0b, 0x4c, 0x6f,
|
||||
0x74, 0x74, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x80, 0x04, 0x0a, 0x0b, 0x4c, 0x6f,
|
||||
0x74, 0x74, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x74, 0x61,
|
||||
0x72, 0x74, 0x54, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x53, 0x74, 0x61, 0x72,
|
||||
|
@ -4948,7 +4956,9 @@ var file_welfare_proto_rawDesc = []byte{
|
|||
0x52, 0x4c, 0x12, 0x22, 0x0a, 0x0c, 0x43, 0x6f, 0x73, 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x43, 0x61,
|
||||
0x72, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x43, 0x6f, 0x73, 0x74, 0x52, 0x6f,
|
||||
0x6f, 0x6d, 0x43, 0x61, 0x72, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x18,
|
||||
0x12, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x63, 0x0a, 0x0d,
|
||||
0x12, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a,
|
||||
0x52, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x03,
|
||||
0x52, 0x0a, 0x52, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x63, 0x0a, 0x0d,
|
||||
0x53, 0x43, 0x4c, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x28, 0x0a,
|
||||
0x04, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x77, 0x65,
|
||||
0x6c, 0x66, 0x61, 0x72, 0x65, 0x2e, 0x4c, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x66,
|
||||
|
|
|
@ -530,6 +530,7 @@ message LotteryInfo {
|
|||
// 玩家数据
|
||||
int64 CostRoomCard = 17; // 消耗房卡
|
||||
repeated string Codes = 18; // 本期获得号码
|
||||
int64 RemainTime = 19; // 剩余时间,单位秒
|
||||
}
|
||||
|
||||
//PACKET_SCLotteryInfo
|
||||
|
|
|
@ -29,7 +29,7 @@ var LotteryMgrInst = &LotteryMgr{
|
|||
}
|
||||
|
||||
func init() {
|
||||
module.RegisteModule(LotteryMgrInst, time.Minute, 0)
|
||||
module.RegisteModule(LotteryMgrInst, time.Second*10, 0)
|
||||
common.RegisterClockFunc(&common.ClockFunc{
|
||||
OnDayTimerFunc: func() {
|
||||
for _, v := range LotteryMgrInst.PlatformConfig {
|
||||
|
@ -145,9 +145,11 @@ func (l *LotteryData) GetRemainCode() int {
|
|||
|
||||
// 发奖
|
||||
func (l *LotteryData) sendAward(must bool) {
|
||||
if l.isDone || !must {
|
||||
if !must {
|
||||
if l.isDone {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
if l.WinTs <= 0 || l.WinTs >= now.Unix() || l.IsSend || l.WinCode == "" || l.SnId == 0 || now.Unix()-l.WinTs > 5*60 {
|
||||
|
@ -180,7 +182,7 @@ func (l *LotteryData) sendAward(must bool) {
|
|||
|
||||
// 广播中奖结果
|
||||
PlayerMgrSington.BroadcastMessageToPlatform(l.Platform, int(welfare.SPacketID_PACKET_NotifyLotteryAward), pack)
|
||||
logger.Logger.Tracef("NotifyLotteryAward: %v", pack)
|
||||
logger.Logger.Tracef("广播中奖信息: %v", pack)
|
||||
|
||||
if l.IsRobot {
|
||||
return
|
||||
|
@ -220,10 +222,9 @@ func (l *LotteryData) Done() {
|
|||
return
|
||||
}
|
||||
l.isDone = true
|
||||
logger.Logger.Tracef("LotteryData Done1: cid:%v wincode:%v snid:%v", l.CId, l.WinCode, l.SnId)
|
||||
|
||||
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.WinCode != "" || now.Unix()-l.EndTs > 5*60 {
|
||||
l.isDone = false
|
||||
return
|
||||
}
|
||||
|
@ -418,8 +419,7 @@ func (l *LotteryData) Done() {
|
|||
Ts: l.WinTs,
|
||||
}
|
||||
mq.Write(lotteryLog)
|
||||
logger.Logger.Tracef("LotteryData 抽奖中奖记录: %+v %p", *lotteryLog, l)
|
||||
logger.Logger.Tracef("LotteryData Done2: cid:%v wincode:%v snid:%v", l.CId, l.WinCode, l.SnId)
|
||||
logger.Logger.Tracef("LotteryData 抽奖中奖记录: %v", lotteryLog)
|
||||
// 开始发奖
|
||||
l.sendAward(true)
|
||||
}
|
||||
|
@ -480,9 +480,7 @@ func (l *LotteryMgr) Update() {
|
|||
// 随机给机器人发放抽奖码
|
||||
d.sendRobotCode(1, 5)
|
||||
// 活动结束,开始抽奖
|
||||
logger.Logger.Tracef("Done1 cid:%v wincode:%v %p", d.CId, d.WinCode, d)
|
||||
d.Done()
|
||||
logger.Logger.Tracef("Done2 cid:%v wincode:%v %p", d.CId, d.WinCode, d)
|
||||
// 开始发奖
|
||||
d.sendAward(false)
|
||||
}
|
||||
|
@ -546,7 +544,7 @@ func (l *LotteryMgr) UpdateConfig(conf *webapi.LotteryConfig) {
|
|||
v.TotalCode = 1
|
||||
}
|
||||
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
|
||||
} else {
|
||||
data.Reset()
|
||||
|
@ -628,6 +626,7 @@ func (l *LotteryMgr) GetList(plt string) []*welfare.LotteryInfo {
|
|||
}
|
||||
|
||||
state := 1
|
||||
remainTime := int64(0)
|
||||
switch {
|
||||
case d.WinTs <= now.Unix():
|
||||
state = common.LotteryStateOver // 已结束
|
||||
|
@ -635,6 +634,7 @@ func (l *LotteryMgr) GetList(plt string) []*welfare.LotteryInfo {
|
|||
state = common.LotteryStateNoStart // 未开始
|
||||
default:
|
||||
state = common.LotteryStateRun // 进行中
|
||||
remainTime = d.WinTs - now.Unix()
|
||||
}
|
||||
|
||||
info := &welfare.LotteryInfo{
|
||||
|
@ -654,14 +654,15 @@ func (l *LotteryMgr) GetList(plt string) []*welfare.LotteryInfo {
|
|||
Price: d.Price,
|
||||
NeedRoomCard: LotteryRoomCard,
|
||||
ImageURL: d.ImageURL,
|
||||
RemainTime: remainTime,
|
||||
}
|
||||
|
||||
if d.WinTs > 0 && d.WinTs > now.Unix() {
|
||||
// 隐藏未发奖的中奖信息
|
||||
d.WinCode = ""
|
||||
d.SnId = 0
|
||||
d.Name = ""
|
||||
d.RoleId = 0
|
||||
info.WinCode = ""
|
||||
info.SnId = 0
|
||||
info.Name = ""
|
||||
info.RoleId = 0
|
||||
}
|
||||
|
||||
ret = append(ret, info)
|
||||
|
|
|
@ -1531,7 +1531,6 @@ func (this *WelfareMgr) ContinuousPayInfo(p *Player) {
|
|||
pack.Day = day
|
||||
pack.Cycle = continuousPay.Cycle
|
||||
for _, v := range continuousPay.List {
|
||||
|
||||
data := &welfare.WelfareSpree{
|
||||
Day: v.Day,
|
||||
// VIPEX: v.VIPEX,
|
||||
|
|
Loading…
Reference in New Issue