上传埋点同步信息
This commit is contained in:
parent
49931d1dc9
commit
f4caf2d0c9
11
comm/pool.go
11
comm/pool.go
@ -2,6 +2,7 @@ package comm
|
||||
|
||||
import (
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@ -50,15 +51,21 @@ var buriedConIProgressPool = &sync.Pool{
|
||||
}
|
||||
|
||||
// 普通任务
|
||||
func GetBuriedConIProgress(btype int32, item *pb.DBBuriedConItem) *pb.ConIProgress {
|
||||
func GetBuriedConIProgress(conf *cfg.GameBuriedCondiData, item *pb.DBBuriedConItem) *pb.ConIProgress {
|
||||
progress := buriedConIProgressPool.Get().(*pb.ConIProgress)
|
||||
progress.Btype = btype
|
||||
progress.Btype = conf.Ctype
|
||||
progress.Conid = item.Conid
|
||||
progress.Target = conf.Value
|
||||
progress.Value = item.Value
|
||||
progress.State = item.Finish
|
||||
return progress
|
||||
}
|
||||
|
||||
// 普通任务
|
||||
func GetBuriedConIProgress2() *pb.ConIProgress {
|
||||
progress := buriedConIProgressPool.Get().(*pb.ConIProgress)
|
||||
return progress
|
||||
}
|
||||
func PutburiedConIProgress(r *pb.ConIProgress) {
|
||||
buriedConIProgressPool.Put(r)
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
@ -16,6 +17,7 @@ func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.BuriedInfoReq)
|
||||
func (this *apiComp) Info(session comm.IUserSession, req *pb.BuriedInfoReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
buried *pb.DBBuried
|
||||
conf *cfg.GameBuriedCondiData
|
||||
conditions []*pb.ConIProgress
|
||||
err error
|
||||
)
|
||||
@ -35,7 +37,10 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.BuriedInfoReq) (err
|
||||
conditions = make([]*pb.ConIProgress, 0)
|
||||
for _, items := range buried.Items {
|
||||
for _, v := range items.Condi {
|
||||
conditions = append(conditions, comm.GetBuriedConIProgress(items.Btype, v))
|
||||
if conf, err = this.module.configure.getburiedcondidata(v.Conid); err != nil {
|
||||
return
|
||||
}
|
||||
conditions = append(conditions, comm.GetBuriedConIProgress(conf, v))
|
||||
}
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "info", &pb.BuriedInfoResp{Conitems: conditions})
|
||||
|
@ -656,13 +656,13 @@ func (this *Buried) trigger(session comm.IUserSession, burieds ...*pb.BuriedPara
|
||||
continue
|
||||
}
|
||||
if change, bitem, err = this.updateAndCheckBuried(bconf, bdata, buried, cond, autoActivated); change {
|
||||
cp := &pb.ConIProgress{
|
||||
Btype: bdata.Btype,
|
||||
Conid: cond.Id,
|
||||
Value: bitem.Value,
|
||||
Target: cond.Value,
|
||||
State: bitem.Finish,
|
||||
}
|
||||
cp := comm.GetBuriedConIProgress2()
|
||||
cp.Btype = bdata.Btype
|
||||
cp.Conid = cond.Id
|
||||
cp.Value = bitem.Value
|
||||
cp.Target = cond.Value
|
||||
cp.State = bitem.Finish
|
||||
|
||||
changes = append(changes, cp)
|
||||
if len(cond.Notify) > 0 {
|
||||
for _, mname := range cond.Notify {
|
||||
@ -704,6 +704,11 @@ func (this *Buried) trigger(session comm.IUserSession, burieds ...*pb.BuriedPara
|
||||
}
|
||||
}
|
||||
|
||||
//回收
|
||||
for _, v := range changes {
|
||||
comm.PutburiedConIProgress(v)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 更新并校验完成
|
||||
|
Loading…
Reference in New Issue
Block a user