上传重置埋点接口

This commit is contained in:
liwei 2023-06-29 14:56:02 +08:00
parent cc6feb9dda
commit 79245aacef
2 changed files with 25 additions and 6 deletions

View File

@ -148,3 +148,20 @@ func (this *configureComp) getCondiDatas(tt int32) (result []*cfg.GameBuriedCond
this.lock.RUnlock()
return
}
// 读取埋点条件配置
func (this *configureComp) getCondiData(id int32) (result *cfg.GameBuriedCondiData, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_buriedcondi); err != nil {
return
} else {
if result, ok = v.(*cfg.GameBuriedCondi).GetDataMap()[id]; !ok {
err = comm.NewNotFoundConfErr(moduleName, game_buriedcondi, id)
return
}
}
return
}

View File

@ -155,7 +155,7 @@ func (this *Buried) ResetBuriedByType(uid string, types ...comm.TaskType) (err e
if model, err = this.modelBuried.getburiedModel(uid); err != nil {
return
}
this.Debug("激活埋点类型!", log.Field{Key: "types", Value: types})
this.Debug("重置埋点!", log.Field{Key: "types", Value: types})
lock, _ := this.modelBuried.userlock(uid)
err = lock.Lock()
if err != nil {
@ -169,6 +169,7 @@ func (this *Buried) ResetBuriedByType(uid string, types ...comm.TaskType) (err e
for _, v := range types {
if bdata, ok = bdatas.Items[int32(v)]; ok {
for _, v1 := range bdata.Condi {
if v1.Value != 0 && v1.Finish != pb.BuriedItemFinishState_buried_finish {
v1.Value = 0
v1.Statistics = make([]string, 0)
v1.Timestamp = time.Now().Unix()
@ -177,6 +178,7 @@ func (this *Buried) ResetBuriedByType(uid string, types ...comm.TaskType) (err e
}
}
}
}
if chanage {
err = model.updateUserBurieds(uid, bdatas)
}