上传退出公会埋点

This commit is contained in:
liwei1dao 2024-01-25 10:49:18 +08:00
parent afa1ca9a9f
commit d37c24e66b
7 changed files with 30 additions and 4 deletions

View File

@ -1013,6 +1013,7 @@ const (
Rtype250 TaskType = 250 //在{0}回合内完成维京1key值 Rtype250 TaskType = 250 //在{0}回合内完成维京1key值
Rtype251 TaskType = 251 //在{0}回合内完成狩猎内1key值 Rtype251 TaskType = 251 //在{0}回合内完成狩猎内1key值
Rtype252 TaskType = 252 //完成指定世界任务 Rtype252 TaskType = 252 //完成指定世界任务
Rtype253 TaskType = 253 //退出公会
) )
const ( const (
MailLineEasy int32 = 1 // 简单 MailLineEasy int32 = 1 // 简单

View File

@ -77,6 +77,7 @@ type IUserSession interface {
GetServiecTag() string GetServiecTag() string
GetGatewayServiceId() string GetGatewayServiceId() string
IsLogin() bool IsLogin() bool
IsOnline() bool
Bind(uid string, wokerId string) (err error) Bind(uid string, wokerId string) (err error)
UnBind() (err error) UnBind() (err error)
SendMsg(mainType, subType string, msg proto.Message) (err error) SendMsg(mainType, subType string, msg proto.Message) (err error)

View File

@ -31,6 +31,7 @@ type UserSession struct {
GatewayServiceId string //用户所在网关服务 GatewayServiceId string //用户所在网关服务
UserId string UserId string
Group int32 //用户分组 Group int32 //用户分组
Online bool
service IService service IService
msgqueue []*pb.UserMessage msgqueue []*pb.UserMessage
lock sync.RWMutex lock sync.RWMutex
@ -47,6 +48,9 @@ func (this *UserSession) SetSession(ip, sessionId, stag, sid, uid string, group
this.Group = group this.Group = group
this.msgqueue = this.msgqueue[:0] this.msgqueue = this.msgqueue[:0]
this.mate = make(map[string]interface{}) this.mate = make(map[string]interface{})
if sessionId != "" {
this.Online = true
}
} }
// 重置 // 重置
@ -55,6 +59,7 @@ func (this *UserSession) Reset() {
this.SessionId = "" this.SessionId = ""
this.GatewayServiceId = "" this.GatewayServiceId = ""
this.UserId = "" this.UserId = ""
this.Online = false
this.msgqueue = this.msgqueue[:0] this.msgqueue = this.msgqueue[:0]
this.mate = make(map[string]interface{}) this.mate = make(map[string]interface{})
} }
@ -94,6 +99,10 @@ func (this *UserSession) IsLogin() bool {
return this.UserId != "" return this.UserId != ""
} }
func (this *UserSession) IsOnline() bool {
return this.Online
}
// /绑定uid 登录后操作 // /绑定uid 登录后操作
// /uid 用户id // /uid 用户id
// /wokerId 用户绑定worker服务id // /wokerId 用户绑定worker服务id

View File

@ -98,7 +98,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha
if enchant.BossTime[key] > req.Report.Costtime || enchant.BossTime[key] == 0 { if enchant.BossTime[key] > req.Report.Costtime || enchant.BossTime[key] == 0 {
enchant.BossTime[key] = req.Report.Costtime enchant.BossTime[key] = req.Report.Costtime
mapData["bossTime"] = enchant.BossTime // 更新时间 mapData["bossTime"] = enchant.BossTime // 更新时间
this.module.CheckRank(session.GetUserId(), req.BossType, req.Report, userinfo, req.Score) this.module.CheckRank(session.GetUserId(), req.BossType, req.Report, userinfo, req.Score)
} }

View File

@ -993,7 +993,9 @@ func (this *ModuleBase) AsynHandleSession(session comm.IUserSession, handle func
} }
}() }()
handle(session) handle(session)
session.Push() if session.IsOnline() {
session.Push()
}
this.PutUserSession(session) this.PutUserSession(session)
} }

View File

@ -21,6 +21,9 @@ func (this *apiComp) DischargeCheck(session comm.IUserSession, req *pb.SociatyDi
} }
func (this *apiComp) Discharge(session comm.IUserSession, req *pb.SociatyDischargeReq) (errdata *pb.ErrorData) { func (this *apiComp) Discharge(session comm.IUserSession, req *pb.SociatyDischargeReq) (errdata *pb.ErrorData) {
var (
tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0)
)
if errdata = this.DischargeCheck(session, req); errdata != nil { if errdata = this.DischargeCheck(session, req); errdata != nil {
return return
} }
@ -113,7 +116,7 @@ func (this *apiComp) Discharge(session comm.IUserSession, req *pb.SociatyDischar
log.Field{Key: "err", Value: err.Error()}, log.Field{Key: "err", Value: err.Error()},
) )
} }
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype253, 1))
rsp := &pb.SociatyDischargeResp{ rsp := &pb.SociatyDischargeResp{
TargetId: req.TargetId, TargetId: req.TargetId,
SociatyId: sociaty.Id, SociatyId: sociaty.Id,
@ -122,5 +125,10 @@ func (this *apiComp) Discharge(session comm.IUserSession, req *pb.SociatyDischar
session.SendMsg(string(this.module.GetType()), SociatySubTypeDischarge, rsp) session.SendMsg(string(this.module.GetType()), SociatySubTypeDischarge, rsp)
this.module.SendMsgToUser(string(this.module.GetType()), "pdischange", &pb.SociatyPDischangePush{Uid: req.TargetId, SociatyId: sociaty.Id}, req.TargetId) this.module.SendMsgToUser(string(this.module.GetType()), "pdischange", &pb.SociatyPDischangePush{Uid: req.TargetId, SociatyId: sociaty.Id}, req.TargetId)
tsession, _ := this.module.GetUserSession(req.TargetId)
go this.module.AsynHandleSession(tsession, func(session comm.IUserSession) {
this.module.ModuleBuried.TriggerBuried(session, tasks...)
})
return return
} }

View File

@ -14,7 +14,9 @@ func (this *apiComp) QuitCheck(session comm.IUserSession, req *pb.SociatyQuitReq
} }
func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (errdata *pb.ErrorData) { func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (errdata *pb.ErrorData) {
var (
tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0)
)
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty == nil { if sociaty == nil {
@ -78,6 +80,10 @@ func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (er
SociatyId: sociaty.Id, SociatyId: sociaty.Id,
SociatyCD: cd, SociatyCD: cd,
} }
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype253, 1))
session.SendMsg(string(this.module.GetType()), SociatySubTypeQuit, rsp) session.SendMsg(string(this.module.GetType()), SociatySubTypeQuit, rsp)
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.ModuleBuried.TriggerBuried(session, tasks...)
})
return return
} }