上传埋点 重置接口
This commit is contained in:
parent
a90d952d07
commit
ef2fcfd842
@ -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 {
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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 (
|
||||
|
@ -44,12 +44,12 @@ type Practice struct {
|
||||
modelQiecuo *modelQiecuo
|
||||
}
|
||||
|
||||
//模块名
|
||||
// 模块名
|
||||
func (this *Practice) GetType() core.M_Modules {
|
||||
return comm.ModulePractice
|
||||
}
|
||||
|
||||
//模块初始化接口 注册用户创建角色事件
|
||||
// 模块初始化接口 注册用户创建角色事件
|
||||
func (this *Practice) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
err = this.ModuleBase.Init(service, module, options)
|
||||
this.service = service.(base.IRPCXService)
|
||||
@ -89,7 +89,7 @@ func (this *Practice) Start() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
//装备组件
|
||||
// 装备组件
|
||||
func (this *Practice) OnInstallComp() {
|
||||
this.ModuleBase.OnInstallComp()
|
||||
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||
@ -98,7 +98,7 @@ func (this *Practice) OnInstallComp() {
|
||||
this.modelQiecuo = this.RegisterComp(new(modelQiecuo)).(*modelQiecuo)
|
||||
}
|
||||
|
||||
//添加武馆资源
|
||||
// 添加武馆资源
|
||||
func (this *Practice) AddItems(session comm.IUserSession, items map[string]int32, bPush bool) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
err error
|
||||
@ -182,7 +182,7 @@ func (this *Practice) AddItems(session comm.IUserSession, items map[string]int32
|
||||
return
|
||||
}
|
||||
|
||||
//完成世界任务
|
||||
// 完成世界任务
|
||||
func (this *Practice) TaskComplete(session comm.IUserSession, taskid int32) {
|
||||
this.Debug("TaskComplete",
|
||||
log.Field{Key: "session", Value: session.GetUserId()},
|
||||
@ -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() {
|
||||
err := this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(),
|
||||
comm.Service_Worker, string(comm.RPC_ModulePracticeUnLockPillar),
|
||||
&pb.RPCGeneralReqA2{Param1: session.GetUserId(), Param2: key}, &pb.EmptyResp{})
|
||||
if err != nil {
|
||||
this.Errorln(err)
|
||||
return
|
||||
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: 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{})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -323,7 +328,7 @@ func (this *Practice) ChallengeResults(bid, red, bule string, winSide int32) {
|
||||
})
|
||||
}
|
||||
|
||||
//解锁武馆柱子
|
||||
// 解锁武馆柱子
|
||||
func (this *Practice) RPC_ModulePracticeUnLockPillar(ctx context.Context, args *pb.RPCGeneralReqA2, reply *pb.EmptyResp) (err error) {
|
||||
this.Debug("RPC_ModulePracticeUnLockPillar",
|
||||
log.Field{Key: "uid", Value: args.Param1},
|
||||
|
@ -7,8 +7,8 @@ import (
|
||||
)
|
||||
|
||||
/*
|
||||
模块名:web
|
||||
描述:提供管理员相关的http接口
|
||||
模块名:资源版本管理记录
|
||||
描述:提供客户端查询版本接口 内部使用
|
||||
开发:李伟
|
||||
*/
|
||||
func NewModule() core.IModule {
|
||||
|
@ -8,9 +8,8 @@ import (
|
||||
type (
|
||||
Options struct {
|
||||
modules.Options
|
||||
WebDir string
|
||||
Port int
|
||||
Key string
|
||||
Port int
|
||||
Key string
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -61,6 +61,11 @@ func (this *Worldtask) Start() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// 功能开启
|
||||
func (this *Worldtask) OpenCmdNotice(session comm.IUserSession, keys ...string) {
|
||||
|
||||
}
|
||||
|
||||
var errs []string
|
||||
|
||||
// 配置文件校验
|
||||
|
Loading…
Reference in New Issue
Block a user