上传埋点同步信息
This commit is contained in:
parent
49931d1dc9
commit
f4caf2d0c9
11
comm/pool.go
11
comm/pool.go
@ -2,6 +2,7 @@ package comm
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
"sync"
|
"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 := buriedConIProgressPool.Get().(*pb.ConIProgress)
|
||||||
progress.Btype = btype
|
progress.Btype = conf.Ctype
|
||||||
progress.Conid = item.Conid
|
progress.Conid = item.Conid
|
||||||
|
progress.Target = conf.Value
|
||||||
progress.Value = item.Value
|
progress.Value = item.Value
|
||||||
progress.State = item.Finish
|
progress.State = item.Finish
|
||||||
return progress
|
return progress
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 普通任务
|
||||||
|
func GetBuriedConIProgress2() *pb.ConIProgress {
|
||||||
|
progress := buriedConIProgressPool.Get().(*pb.ConIProgress)
|
||||||
|
return progress
|
||||||
|
}
|
||||||
func PutburiedConIProgress(r *pb.ConIProgress) {
|
func PutburiedConIProgress(r *pb.ConIProgress) {
|
||||||
buriedConIProgressPool.Put(r)
|
buriedConIProgressPool.Put(r)
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/pb"
|
"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) {
|
func (this *apiComp) Info(session comm.IUserSession, req *pb.BuriedInfoReq) (errdata *pb.ErrorData) {
|
||||||
var (
|
var (
|
||||||
buried *pb.DBBuried
|
buried *pb.DBBuried
|
||||||
|
conf *cfg.GameBuriedCondiData
|
||||||
conditions []*pb.ConIProgress
|
conditions []*pb.ConIProgress
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
@ -35,7 +37,10 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.BuriedInfoReq) (err
|
|||||||
conditions = make([]*pb.ConIProgress, 0)
|
conditions = make([]*pb.ConIProgress, 0)
|
||||||
for _, items := range buried.Items {
|
for _, items := range buried.Items {
|
||||||
for _, v := range items.Condi {
|
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})
|
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
|
continue
|
||||||
}
|
}
|
||||||
if change, bitem, err = this.updateAndCheckBuried(bconf, bdata, buried, cond, autoActivated); change {
|
if change, bitem, err = this.updateAndCheckBuried(bconf, bdata, buried, cond, autoActivated); change {
|
||||||
cp := &pb.ConIProgress{
|
cp := comm.GetBuriedConIProgress2()
|
||||||
Btype: bdata.Btype,
|
cp.Btype = bdata.Btype
|
||||||
Conid: cond.Id,
|
cp.Conid = cond.Id
|
||||||
Value: bitem.Value,
|
cp.Value = bitem.Value
|
||||||
Target: cond.Value,
|
cp.Target = cond.Value
|
||||||
State: bitem.Finish,
|
cp.State = bitem.Finish
|
||||||
}
|
|
||||||
changes = append(changes, cp)
|
changes = append(changes, cp)
|
||||||
if len(cond.Notify) > 0 {
|
if len(cond.Notify) > 0 {
|
||||||
for _, mname := range cond.Notify {
|
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