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"` // 消耗房卡
|
CostRoomCard int64 `protobuf:"varint,17,opt,name=CostRoomCard,proto3" json:"CostRoomCard,omitempty"` // 消耗房卡
|
||||||
Codes []string `protobuf:"bytes,18,rep,name=Codes,proto3" json:"Codes,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() {
|
func (x *LotteryInfo) Reset() {
|
||||||
|
@ -4346,6 +4347,13 @@ func (x *LotteryInfo) GetCodes() []string {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *LotteryInfo) GetRemainTime() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.RemainTime
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
//PACKET_SCLotteryInfo
|
//PACKET_SCLotteryInfo
|
||||||
type SCLotteryInfo struct {
|
type SCLotteryInfo struct {
|
||||||
state protoimpl.MessageState
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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; // 消耗房卡
|
int64 CostRoomCard = 17; // 消耗房卡
|
||||||
repeated string Codes = 18; // 本期获得号码
|
repeated string Codes = 18; // 本期获得号码
|
||||||
|
int64 RemainTime = 19; // 剩余时间,单位秒
|
||||||
}
|
}
|
||||||
|
|
||||||
//PACKET_SCLotteryInfo
|
//PACKET_SCLotteryInfo
|
||||||
|
|
|
@ -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,10 +222,9 @@ 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.WinCode != "" || now.Unix()-l.EndTs > 5*60 {
|
||||||
l.isDone = false
|
l.isDone = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -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()
|
||||||
|
@ -628,6 +626,7 @@ func (l *LotteryMgr) GetList(plt string) []*welfare.LotteryInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
state := 1
|
state := 1
|
||||||
|
remainTime := int64(0)
|
||||||
switch {
|
switch {
|
||||||
case d.WinTs <= now.Unix():
|
case d.WinTs <= now.Unix():
|
||||||
state = common.LotteryStateOver // 已结束
|
state = common.LotteryStateOver // 已结束
|
||||||
|
@ -635,6 +634,7 @@ func (l *LotteryMgr) GetList(plt string) []*welfare.LotteryInfo {
|
||||||
state = common.LotteryStateNoStart // 未开始
|
state = common.LotteryStateNoStart // 未开始
|
||||||
default:
|
default:
|
||||||
state = common.LotteryStateRun // 进行中
|
state = common.LotteryStateRun // 进行中
|
||||||
|
remainTime = d.WinTs - now.Unix()
|
||||||
}
|
}
|
||||||
|
|
||||||
info := &welfare.LotteryInfo{
|
info := &welfare.LotteryInfo{
|
||||||
|
@ -654,14 +654,15 @@ func (l *LotteryMgr) GetList(plt string) []*welfare.LotteryInfo {
|
||||||
Price: d.Price,
|
Price: d.Price,
|
||||||
NeedRoomCard: LotteryRoomCard,
|
NeedRoomCard: LotteryRoomCard,
|
||||||
ImageURL: d.ImageURL,
|
ImageURL: d.ImageURL,
|
||||||
|
RemainTime: remainTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -1531,7 +1531,6 @@ func (this *WelfareMgr) ContinuousPayInfo(p *Player) {
|
||||||
pack.Day = day
|
pack.Day = day
|
||||||
pack.Cycle = continuousPay.Cycle
|
pack.Cycle = continuousPay.Cycle
|
||||||
for _, v := range continuousPay.List {
|
for _, v := range continuousPay.List {
|
||||||
|
|
||||||
data := &welfare.WelfareSpree{
|
data := &welfare.WelfareSpree{
|
||||||
Day: v.Day,
|
Day: v.Day,
|
||||||
// VIPEX: v.VIPEX,
|
// VIPEX: v.VIPEX,
|
||||||
|
|
Loading…
Reference in New Issue