上传任务修复代码
This commit is contained in:
parent
7004aa13a4
commit
8f0dba9fcd
19
comm/pool.go
19
comm/pool.go
@ -25,25 +25,32 @@ func PuttaskParam(r *TaskParam) {
|
||||
|
||||
var buriedParamPool = &sync.Pool{
|
||||
New: func() interface{} {
|
||||
return &TaskParam{}
|
||||
return &BuriedParam{
|
||||
Value: 0,
|
||||
Filter: make([]int32, 0),
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
//普通任务
|
||||
func GetBuriedParam(t TaskType, vaule int32, p ...int32) *BuriedParam {
|
||||
task := taskParamPool.Get().(*BuriedParam)
|
||||
task := buriedParamPool.Get().(*BuriedParam)
|
||||
task.Btype = t
|
||||
task.Value = vaule
|
||||
task.Filter = append(task.Filter, p...)
|
||||
if len(p) > 0 {
|
||||
task.Filter = append(task.Filter, p...)
|
||||
}
|
||||
return task
|
||||
}
|
||||
|
||||
//统计型任务
|
||||
func GetBuriedParam2(t TaskType, statistics string, p ...int32) *BuriedParam {
|
||||
task := taskParamPool.Get().(*BuriedParam)
|
||||
task := buriedParamPool.Get().(*BuriedParam)
|
||||
task.Btype = t
|
||||
task.Statistics = statistics
|
||||
task.Filter = append(task.Filter, p...)
|
||||
if len(p) > 0 {
|
||||
task.Filter = append(task.Filter, p...)
|
||||
}
|
||||
return task
|
||||
}
|
||||
|
||||
@ -51,5 +58,5 @@ func PutburiedParam(r *BuriedParam) {
|
||||
r.Filter = r.Filter[:0]
|
||||
r.Value = 0
|
||||
r.Statistics = ""
|
||||
taskParamPool.Put(r)
|
||||
buriedParamPool.Put(r)
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ type configureComp struct {
|
||||
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
this.MCompConfigure.Init(service, module, comp, options)
|
||||
this.module = module.(*Buried)
|
||||
this.LoadConfigure(game_buriedtype, cfg.NewGameBuriedType)
|
||||
this.LoadConfigure(game_buriedcondi, cfg.NewGameBuriedCondi)
|
||||
configure.RegisterConfigure(game_buriedcondi, cfg.NewGameBuriedCondi, this.updateconfigure)
|
||||
return
|
||||
|
@ -33,7 +33,7 @@ const (
|
||||
|
||||
//判断埋点数据的有效性
|
||||
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) {
|
||||
log.Error("校验埋点错误!", log.Field{Key: "buried", Value: buried}, log.Field{Key: "conf", Value: conf})
|
||||
return
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ func (this *buriedModel) getUserBurieds(uid string) (results map[int32]*pb.DBBur
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
}
|
||||
results = make(map[int32]*pb.DBBuried)
|
||||
for _, v := range temp {
|
||||
results[v.Btype] = v
|
||||
}
|
||||
|
@ -233,14 +233,14 @@ func (this *Buried) TriggerBuried(uid string, burieds ...*comm.BuriedParam) {
|
||||
this.Error("未找到目标埋点类型配置", log.Field{Key: "type", Value: buried.Btype})
|
||||
continue
|
||||
}
|
||||
if bdata, ok = bdatas[bdata.Btype]; !ok {
|
||||
bdatas[bdata.Btype] = &pb.DBBuried{
|
||||
if bdata, ok = bdatas[int32(buried.Btype)]; !ok {
|
||||
bdatas[int32(buried.Btype)] = &pb.DBBuried{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: uid,
|
||||
Btype: bdata.Btype,
|
||||
Btype: int32(buried.Btype),
|
||||
Items: make(map[int32]*pb.DBBuriedItem),
|
||||
}
|
||||
bdata = bdatas[bdata.Btype]
|
||||
bdata = bdatas[int32(buried.Btype)]
|
||||
}
|
||||
for _, cond := range conds {
|
||||
if cond.Rtype == rtype1 { //创号后入录
|
||||
@ -265,6 +265,7 @@ func (this *Buried) TriggerBuried(uid string, burieds ...*comm.BuriedParam) {
|
||||
|
||||
//通知事件
|
||||
if len(completeConIds) > 0 {
|
||||
this.Debug("条件达成通知", log.Field{Key: "ConIds", Value: completeConIds})
|
||||
event.TriggerEvent(comm.EventBuriedComplete, uid, completeConIds)
|
||||
}
|
||||
}
|
||||
|
@ -181,9 +181,11 @@ func (this *ModelItemsComp) DeleteUserPack(uid string, itmes ...*pb.DB_UserItemD
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if err = this.DelListlds(uid, gridIds); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
if len(gridIds) > 0 {
|
||||
if err = this.DelListlds(uid, gridIds); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user