上传任务代码

This commit is contained in:
liwei1dao 2023-05-30 13:49:39 +08:00
parent 7fb6fd8432
commit 935423bf0b
4 changed files with 51 additions and 6 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/sys/configure" "go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
@ -33,6 +34,46 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
return return
} }
func (this *configureComp) Start() (err error) {
err = this.MCompConfigure.Start()
err = this.checkconfig()
return
}
//校验配置异常
func (this *configureComp) checkconfig() (err error) {
var (
v interface{}
ok bool
vtype *cfg.GameBuriedType
vt *cfg.GameBuriedTypeData
)
if v, err = this.GetConfigure(game_buriedtype); err != nil {
this.module.Errorf("err:%v", err)
return
}
vtype = v.(*cfg.GameBuriedType)
for k, conids := range this.group {
if vt, ok = vtype.GetDataMap()[int32(k)]; ok {
for _, cond := range conids {
if len(vt.Filter) != len(cond.Filter) {
this.module.Error("埋点中心配置错误!",
log.Field{Key: "vtype", Value: int32(k)},
log.Field{Key: "cond", Value: cond.Id},
log.Field{Key: "vtype_filter", Value: vt.Filter},
log.Field{Key: "cond_filter", Value: cond.Filter},
)
}
}
} else {
this.module.Error("未配置埋点类型!",
log.Field{Key: "vtype", Value: int32(k)},
)
}
}
return
}
//读取埋点配置数据 //读取埋点配置数据
func (this *configureComp) getburiedtypedata(tt comm.TaskType) (result *cfg.GameBuriedTypeData, err error) { func (this *configureComp) getburiedtypedata(tt comm.TaskType) (result *cfg.GameBuriedTypeData, err error) {
var ( var (

View File

@ -33,7 +33,7 @@ const (
//判断埋点数据的有效性 //判断埋点数据的有效性
func checkburied(buried *comm.BuriedParam, bconf *cfg.GameBuriedTypeData, conf *cfg.GameBuriedCondiData) (efficient bool) { func checkburied(buried *comm.BuriedParam, bconf *cfg.GameBuriedTypeData, conf *cfg.GameBuriedCondiData) (efficient bool) {
if len(buried.Filter) != len(conf.Filter) { if !(len(buried.Filter) == len(conf.Filter) && len(bconf.Filter) == len(conf.Filter)) {
log.Error("校验埋点错误!", log.Field{Key: "buried", Value: buried}, log.Field{Key: "conf", Value: conf}) log.Error("校验埋点错误!", log.Field{Key: "buried", Value: buried}, log.Field{Key: "conf", Value: conf})
return return
} }

View File

@ -201,6 +201,8 @@ func (this *Buried) TriggerBuried(uid string, burieds ...*comm.BuriedParam) {
completeConIds []int32 //完成id列表 completeConIds []int32 //完成id列表
err error err error
) )
this.Debug("触发埋点!", log.Field{Key: "burieds", Value: burieds})
if model, err = this.modelBuried.getburiedModel(uid); err != nil { if model, err = this.modelBuried.getburiedModel(uid); err != nil {
this.Error("获取用户埋点数据模型对象失败!", log.Field{Key: "err", Value: err.Error()}) this.Error("获取用户埋点数据模型对象失败!", log.Field{Key: "err", Value: err.Error()})
return return

View File

@ -167,19 +167,21 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
} }
} }
if hero.SuiteId != 0 { if conf.Pos < 4 && hero.SuiteId != 0 {
hero.Suite1Lv = suite1Lv hero.Suite1Lv = suite1Lv
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv) tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype43, equipment.Id, equipment.Lv))
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype45, equipment.Id, conf.Star, hero.SuiteExtId, hero.Suite2Lv))
} }
if hero.SuiteExtId != 0 { if conf.Pos >= 4 && conf.Pos < 6 && hero.SuiteExtId != 0 {
hero.Suite2Lv = suite2Lv
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv) tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype45, equipment.Id, conf.Star, hero.SuiteExtId, hero.Suite2Lv))
} }
code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments) code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments)
} }
//随机任务触发 //随机任务触发
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype43, 1, equipment.Lv)) tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype43, equipment.Id, equipment.Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype44, 1, equipment.Lv)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype44, 1, equipment.Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype47, 1)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype47, 1))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype43, 1, equipment.Lv) // this.module.ModuleRtask.SendToRtask(session, comm.Rtype43, 1, equipment.Lv)