上传埋点 重置接口

This commit is contained in:
liwei 2023-06-29 14:42:54 +08:00
parent a90d952d07
commit ef2fcfd842
7 changed files with 73 additions and 30 deletions

View File

@ -20,7 +20,7 @@ type (
}
//功能开启通知
IOpenCmdNotice interface {
OpenCmdNotice(session IUserSession, key string)
OpenCmdNotice(session IUserSession, keys ...string)
}
)
@ -392,6 +392,7 @@ type (
}
// 世界任务
IWorldtask interface {
IOpenCmdNotice
// bingo任务
BingoJumpTask(session IUserSession, groupId, rtaskId int32) error
// 通过任务ID bingo
@ -515,6 +516,8 @@ type (
ActiveCondition(uid string, condiIds ...int32) (err error)
//完成任务并校验接口
FinishConditionAndCheck(uid string, finishcondiIds []int32, condiIds ...int32) (condis []*pb.ConIProgress, err error)
//重置埋点 按类型
ResetBuriedByType(uid string, types ...TaskType) (err error)
}
//红点模块接口
IReddot interface {

View File

@ -416,11 +416,6 @@ func (this *modelArena) recoverTicket(session comm.IUserSession, info *pb.DBAren
)
if ticketitem = this.module.ModuleTools.GetGlobalConf().ArenaTicketCos; ticketitem == nil {
// code = pb.ErrorCode_ConfigNoFound
// data = &pb.ErrorData{
// Title: code.ToString(),
// Message: comm.NewNotFoundConfErr(moduleName, "global.json", "ArenaTicketCos").Error(),
// }
this.module.Error("竞技场配置未找到!", log.Field{Key: "key", Value: "ArenaTicketCos"})
return
}
@ -435,10 +430,6 @@ func (this *modelArena) recoverTicket(session comm.IUserSession, info *pb.DBAren
ticketNum = global.ArenaTicketMax - ticket
}
this.module.DispenseRes(session, []*cfg.Gameatn{{A: ticketitem.A, T: ticketitem.T, N: ticketNum}}, true)
// info.Ticket += ticketNum
// if info.Ticket > global.ArenaTicketMax {
// info.Ticket = global.ArenaTicketMax
// }
info.Lastrtickettime = time.Unix(info.Lastrtickettime, 0).Add(time.Duration(ticketNum) * time.Minute).Unix()
}
}

View File

@ -143,6 +143,46 @@ func (this *Buried) ActiveCondition(uid string, condiIds ...int32) (err error) {
return
}
// 重置所有对应的子任务 按埋点类型
func (this *Buried) ResetBuriedByType(uid string, types ...comm.TaskType) (err error) {
var (
bdatas *pb.DBBuried
model *buriedModel
bdata *pb.DBBuriedItem
ok bool
chanage bool
)
if model, err = this.modelBuried.getburiedModel(uid); err != nil {
return
}
this.Debug("激活埋点类型!", log.Field{Key: "types", Value: types})
lock, _ := this.modelBuried.userlock(uid)
err = lock.Lock()
if err != nil {
this.Error("埋点分布式锁失效 err!", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err.Error()})
return
}
defer lock.Unlock()
if bdatas, err = model.getUserBurieds(uid); err != nil {
return
}
for _, v := range types {
if bdata, ok = bdatas.Items[int32(v)]; ok {
for _, v1 := range bdata.Condi {
v1.Value = 0
v1.Statistics = make([]string, 0)
v1.Timestamp = time.Now().Unix()
v1.State = pb.BuriedItemState_Activated
chanage = true
}
}
}
if chanage {
err = model.updateUserBurieds(uid, bdatas)
}
return
}
// 激活数据采集点
func (this *Buried) CheckCondition(uid string, condiIds ...int32) (condis []*pb.ConIProgress, err error) {
var (

View File

@ -201,21 +201,26 @@ func (this *Practice) TaskComplete(session comm.IUserSession, taskid int32) {
// }
}
func (this *Practice) OpenCmdNotice(session comm.IUserSession, key string) {
func (this *Practice) OpenCmdNotice(session comm.IUserSession, keys ...string) {
this.Debug("OpenCmdNotice",
log.Field{Key: "session", Value: session.GetUserId()},
log.Field{Key: "key", Value: key},
log.Field{Key: "key", Value: keys},
)
if !this.IsCross() {
for _, v := range keys {
err := this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(),
comm.Service_Worker, string(comm.RPC_ModulePracticeUnLockPillar),
&pb.RPCGeneralReqA2{Param1: session.GetUserId(), Param2: key}, &pb.EmptyResp{})
&pb.RPCGeneralReqA2{Param1: session.GetUserId(), Param2: v}, &pb.EmptyResp{})
if err != nil {
this.Errorln(err)
return
}
}
} else {
this.RPC_ModulePracticeUnLockPillar(context.Background(), &pb.RPCGeneralReqA2{Param1: session.GetUserId(), Param2: key}, &pb.EmptyResp{})
for _, v := range keys {
this.RPC_ModulePracticeUnLockPillar(context.Background(), &pb.RPCGeneralReqA2{Param1: session.GetUserId(), Param2: v}, &pb.EmptyResp{})
}
}
}

View File

@ -7,8 +7,8 @@ import (
)
/*
模块名:web
描述:提供管理员相关的http接口
模块名:资源版本管理记录
描述:提供客户端查询版本接口 内部使用
开发:李伟
*/
func NewModule() core.IModule {

View File

@ -8,7 +8,6 @@ import (
type (
Options struct {
modules.Options
WebDir string
Port int
Key string
}

View File

@ -61,6 +61,11 @@ func (this *Worldtask) Start() (err error) {
return
}
// 功能开启
func (this *Worldtask) OpenCmdNotice(session comm.IUserSession, keys ...string) {
}
var errs []string
// 配置文件校验