You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.3 KiB
52 lines
1.3 KiB
package hall |
|
|
|
import ( |
|
"fmt" |
|
"server/call" |
|
"server/common" |
|
"server/pb" |
|
|
|
"github.com/gogo/protobuf/proto" |
|
"github.com/liangdas/mqant/gate" |
|
"github.com/liangdas/mqant/log" |
|
) |
|
|
|
type player struct { |
|
session gate.Session |
|
token string |
|
db common.PlayerDBInfo |
|
lastLogin int64 // 最近一次登录时间 |
|
isRecharge bool // 是否充值 |
|
} |
|
|
|
func (p *player) PushRedPoint() { |
|
call.PushRed(p.db.Id, pb.RedPointModule_RedPointFreeCash, uint32(1)) |
|
call.CheckTask(call.Task{Uid: p.db.Id}, true) |
|
call.CheckLuckyWheel(p.db.Id) |
|
call.CheckPdd(p.db.Id) |
|
call.PushMailRed(p.db.Id) |
|
call.PushVipRed(p.db.Id) |
|
call.PushWeekCard(p.db.Id) |
|
} |
|
|
|
// func (p *player) Send(topic string, data proto.Message) { |
|
// call.SendSS(p.session, topic, data) |
|
// } |
|
|
|
func (p *player) PushBroadcast() { |
|
all := call.GetConfigBroadcast() |
|
for _, v := range all { |
|
if v.Open == 0 || v.TargetID != common.BrocastIDAll { |
|
continue |
|
} |
|
msg := &pb.BroadcastMsg{ |
|
Content: v.Content, |
|
Priority: uint32(v.Priority), |
|
Loop: int64(v.LoopFrequency), |
|
Interval: int64(v.Interval), |
|
} |
|
send, _ := proto.Marshal(msg) |
|
log.Debug("broadcast:%v", msg.Content) |
|
p.session.Send(fmt.Sprintf("%v:%v", int(pb.ServerType_ServerTypeCommon), int(pb.ServerCommonResp_CommonBroadcastResp)), send) |
|
} |
|
}
|
|
|