上传埋点中心
This commit is contained in:
parent
f4a376ad10
commit
8ed57d862c
@ -461,9 +461,10 @@ type TaskParam struct {
|
|||||||
Params []int32
|
Params []int32
|
||||||
}
|
}
|
||||||
type BuriedParam struct {
|
type BuriedParam struct {
|
||||||
Btype TaskType
|
Btype TaskType
|
||||||
Value int32
|
Value int32 //累加或者覆盖参数
|
||||||
Filter []int32
|
Statistics string //统计类型 传递参数
|
||||||
|
Filter []int32
|
||||||
}
|
}
|
||||||
|
|
||||||
// 日常任务事件类型
|
// 日常任务事件类型
|
||||||
|
@ -501,4 +501,13 @@ type (
|
|||||||
ITaskComplete
|
ITaskComplete
|
||||||
TestFunc(session IUserSession)
|
TestFunc(session IUserSession)
|
||||||
}
|
}
|
||||||
|
//埋点中心
|
||||||
|
IBuried interface {
|
||||||
|
//埋点中心触发
|
||||||
|
TriggerBuried(uid string, burieds ...*BuriedParam)
|
||||||
|
//校验条件是否达成
|
||||||
|
CheckCondition(uid string, condiIds ...int32) (condIds []int32)
|
||||||
|
//激活条件
|
||||||
|
ActiveCondition(uid string, condiIds ...int32)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
@ -19,7 +19,7 @@ const (
|
|||||||
//累加
|
//累加
|
||||||
overlay = 2
|
overlay = 2
|
||||||
//统计
|
//统计
|
||||||
stats = 3
|
statistics = 3
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -58,11 +58,16 @@ func (this *Buried) OnInstallComp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//激活数据采集点
|
//激活数据采集点
|
||||||
func (this *Buried) ActivationBuried(uid string, conids ...int32) (err error) {
|
func (this *Buried) ActiveCondition(uid string, condiIds ...int32) {
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//激活数据采集点
|
||||||
|
func (this *Buried) CheckCondition(uid string, condiIds ...int32) (condIds []int32) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
//触发埋点
|
//触发埋点
|
||||||
func (this *Buried) TriggerBuried(uid string, burieds ...*comm.BuriedParam) {
|
func (this *Buried) TriggerBuried(uid string, burieds ...*comm.BuriedParam) {
|
||||||
var (
|
var (
|
||||||
@ -151,11 +156,11 @@ func (this *Buried) updateAndCheckBuried(bconf *cfg.GameBuriedTypeData, bdata *p
|
|||||||
if bitem, ok = bdata.Items[int32(cond.Id)]; !ok {
|
if bitem, ok = bdata.Items[int32(cond.Id)]; !ok {
|
||||||
if autoActivated { //自动激活
|
if autoActivated { //自动激活
|
||||||
bitem = &pb.DBBuriedItem{
|
bitem = &pb.DBBuriedItem{
|
||||||
Conid: cond.Id,
|
Conid: cond.Id,
|
||||||
State: pb.BuriedItemState_Activated,
|
State: pb.BuriedItemState_Activated,
|
||||||
Value: 0,
|
Value: 0,
|
||||||
Stats: make([]string, 0),
|
Statistics: make([]string, 0),
|
||||||
Timestamp: time.Now().Unix(),
|
Timestamp: time.Now().Unix(),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
@ -171,9 +176,17 @@ func (this *Buried) updateAndCheckBuried(bconf *cfg.GameBuriedTypeData, bdata *p
|
|||||||
bitem.Value += collec.Value
|
bitem.Value += collec.Value
|
||||||
case cover:
|
case cover:
|
||||||
bitem.Value = collec.Value
|
bitem.Value = collec.Value
|
||||||
case stats:
|
case statistics:
|
||||||
bitem.Stats = append(bitem.Stats, "")
|
ok = true
|
||||||
bitem.Value = int32(len(bitem.Stats))
|
for _, v := range bitem.Statistics {
|
||||||
|
if v == collec.Statistics { //已统计过
|
||||||
|
ok = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ok {
|
||||||
|
bitem.Statistics = append(bitem.Statistics, "")
|
||||||
|
bitem.Value = int32(len(bitem.Statistics))
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
err = fmt.Errorf("未知的埋点数据处理类型:%d", bconf.Insert)
|
err = fmt.Errorf("未知的埋点数据处理类型:%d", bconf.Insert)
|
||||||
return
|
return
|
||||||
|
@ -42,6 +42,7 @@ type ModuleBase struct {
|
|||||||
ModulePractice comm.IPractice //练功房
|
ModulePractice comm.IPractice //练功房
|
||||||
ModuleParkour comm.IParkour //捕羊大赛
|
ModuleParkour comm.IParkour //捕羊大赛
|
||||||
ModuleTools comm.ITools //工具类 获取一些通用配置
|
ModuleTools comm.ITools //工具类 获取一些通用配置
|
||||||
|
ModuleBuried comm.IBuried //触发埋点中心
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重构模块配置对象
|
// 重构模块配置对象
|
||||||
@ -135,6 +136,10 @@ func (this *ModuleBase) Start() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.ModuleTools = module.(comm.ITools)
|
this.ModuleTools = module.(comm.ITools)
|
||||||
|
if module, err = this.service.GetModule(comm.ModuleBuried); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.ModuleBuried = module.(comm.IBuried)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/base"
|
"go_dreamfactory/lego/base"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/lego/sys/event"
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
@ -45,6 +46,7 @@ func (this *Worldtask) GetType() core.M_Modules {
|
|||||||
|
|
||||||
func (this *Worldtask) Start() (err error) {
|
func (this *Worldtask) Start() (err error) {
|
||||||
err = this.ModuleBase.Start()
|
err = this.ModuleBase.Start()
|
||||||
|
event.RegisterGO(comm.EventBuriedComplete, this.ConditionFinishNotify)
|
||||||
if this.worldtaskConf, err = this.configure.getWorldtaskCfg(); err != nil {
|
if this.worldtaskConf, err = this.configure.getWorldtaskCfg(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -331,3 +333,7 @@ func (this *Worldtask) UpdateTaskStatus(uid string, taskId int32) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Worldtask) ConditionFinishNotify(uid string, condIds []int32) {
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -79,11 +79,11 @@ type DBBuriedItem struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Conid int32 `protobuf:"varint,1,opt,name=conid,proto3" json:"conid" bson:"conid"` //条件id
|
Conid int32 `protobuf:"varint,1,opt,name=conid,proto3" json:"conid" bson:"conid"` //条件id
|
||||||
State BuriedItemState `protobuf:"varint,2,opt,name=state,proto3,enum=BuriedItemState" json:"state" bson:"state"` //状态
|
State BuriedItemState `protobuf:"varint,2,opt,name=state,proto3,enum=BuriedItemState" json:"state" bson:"state"` //状态
|
||||||
Value int32 `protobuf:"varint,3,opt,name=value,proto3" json:"value" bson:"value"` //条件值
|
Value int32 `protobuf:"varint,3,opt,name=value,proto3" json:"value" bson:"value"` //条件值
|
||||||
Stats []string `protobuf:"bytes,4,rep,name=stats,proto3" json:"stats" bson:"stats"` //统计值
|
Statistics []string `protobuf:"bytes,4,rep,name=statistics,proto3" json:"statistics" bson:"stats"` //统计值
|
||||||
Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp" bson:"timestamp"` //最后一次操作时间
|
Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp" bson:"timestamp"` //最后一次操作时间
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBBuriedItem) Reset() {
|
func (x *DBBuriedItem) Reset() {
|
||||||
@ -139,9 +139,9 @@ func (x *DBBuriedItem) GetValue() int32 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBBuriedItem) GetStats() []string {
|
func (x *DBBuriedItem) GetStatistics() []string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Stats
|
return x.Statistics
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -229,34 +229,34 @@ var File_buried_buried_db_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
var file_buried_buried_db_proto_rawDesc = []byte{
|
var file_buried_buried_db_proto_rawDesc = []byte{
|
||||||
0x0a, 0x16, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x2f, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x5f,
|
0x0a, 0x16, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x2f, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x5f,
|
||||||
0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x96, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x42,
|
0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa0, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x42,
|
||||||
0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6e,
|
0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6e,
|
||||||
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x6e, 0x69, 0x64, 0x12,
|
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x6e, 0x69, 0x64, 0x12,
|
||||||
0x26, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10,
|
0x26, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10,
|
||||||
0x2e, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65,
|
0x2e, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65,
|
||||||
0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
||||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a,
|
0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1e, 0x0a,
|
||||||
0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74,
|
0x0a, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28,
|
||||||
0x61, 0x74, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
|
0x09, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x12, 0x1c, 0x0a,
|
||||||
0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
|
0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03,
|
||||||
0x70, 0x22, 0xb7, 0x01, 0x0a, 0x08, 0x44, 0x42, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x12, 0x0e,
|
0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0xb7, 0x01, 0x0a, 0x08,
|
||||||
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10,
|
0x44, 0x42, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
|
||||||
0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64,
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
|
||||||
0x12, 0x14, 0x0a, 0x05, 0x62, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
|
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x74,
|
||||||
0x05, 0x62, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18,
|
0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x74, 0x79, 0x70, 0x65,
|
||||||
0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64,
|
0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
||||||
0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, 0x65,
|
0x14, 0x2e, 0x44, 0x42, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73,
|
||||||
0x6d, 0x73, 0x1a, 0x47, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79,
|
0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x47, 0x0a, 0x0a,
|
||||||
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b,
|
0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
|
||||||
0x65, 0x79, 0x12, 0x23, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x05,
|
||||||
0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d,
|
0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42,
|
||||||
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x48, 0x0a, 0x0f, 0x42,
|
0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
|
||||||
0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f,
|
0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x48, 0x0a, 0x0f, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49,
|
||||||
0x0a, 0x0b, 0x49, 0x6e, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x10, 0x00, 0x12,
|
0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x6e, 0x61, 0x63,
|
||||||
0x0d, 0x0a, 0x09, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a,
|
0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x63, 0x74,
|
||||||
0x0a, 0x06, 0x46, 0x72, 0x65, 0x65, 0x7a, 0x65, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x6c,
|
0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x72, 0x65, 0x65,
|
||||||
0x65, 0x65, 0x70, 0x10, 0x03, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
|
0x7a, 0x65, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x6c, 0x65, 0x65, 0x70, 0x10, 0x03, 0x42,
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"go_dreamfactory/modules/arena"
|
"go_dreamfactory/modules/arena"
|
||||||
"go_dreamfactory/modules/atlas"
|
"go_dreamfactory/modules/atlas"
|
||||||
"go_dreamfactory/modules/battle"
|
"go_dreamfactory/modules/battle"
|
||||||
|
"go_dreamfactory/modules/buried"
|
||||||
"go_dreamfactory/modules/caravan"
|
"go_dreamfactory/modules/caravan"
|
||||||
"go_dreamfactory/modules/chat"
|
"go_dreamfactory/modules/chat"
|
||||||
"go_dreamfactory/modules/combat"
|
"go_dreamfactory/modules/combat"
|
||||||
@ -122,6 +123,7 @@ func main() {
|
|||||||
reputation.NewModule(),
|
reputation.NewModule(),
|
||||||
oldtimes.NewModule(),
|
oldtimes.NewModule(),
|
||||||
caravan.NewModule(),
|
caravan.NewModule(),
|
||||||
|
buried.NewModule(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user