This commit is contained in:
wh_zcy 2023-05-29 16:14:29 +08:00
commit 4dcfa9593d
7 changed files with 83 additions and 289 deletions

View File

@ -1619,246 +1619,6 @@
} }
] ]
}, },
{
"index": "328",
"var": [
{
"a": "item",
"t": "14010101",
"n": 10
}
]
},
{
"index": "329",
"var": [
{
"a": "item",
"t": "14010102",
"n": 11
}
]
},
{
"index": "330",
"var": [
{
"a": "item",
"t": "14010203",
"n": 12
}
]
},
{
"index": "331",
"var": [
{
"a": "item",
"t": "14010204",
"n": 13
}
]
},
{
"index": "332",
"var": [
{
"a": "item",
"t": "14010305",
"n": 14
}
]
},
{
"index": "333",
"var": [
{
"a": "item",
"t": "14010306",
"n": 15
}
]
},
{
"index": "334",
"var": [
{
"a": "item",
"t": "14010407",
"n": 16
}
]
},
{
"index": "335",
"var": [
{
"a": "item",
"t": "14010408",
"n": 17
}
]
},
{
"index": "336",
"var": [
{
"a": "item",
"t": "14020101",
"n": 18
}
]
},
{
"index": "337",
"var": [
{
"a": "item",
"t": "14020102",
"n": 19
}
]
},
{
"index": "338",
"var": [
{
"a": "item",
"t": "14020203",
"n": 20
}
]
},
{
"index": "339",
"var": [
{
"a": "item",
"t": "14020204",
"n": 21
}
]
},
{
"index": "340",
"var": [
{
"a": "item",
"t": "14020305",
"n": 22
}
]
},
{
"index": "341",
"var": [
{
"a": "item",
"t": "14020306",
"n": 23
}
]
},
{
"index": "342",
"var": [
{
"a": "item",
"t": "14020407",
"n": 24
}
]
},
{
"index": "343",
"var": [
{
"a": "item",
"t": "14020408",
"n": 25
}
]
},
{
"index": "344",
"var": [
{
"a": "item",
"t": "14030101",
"n": 26
}
]
},
{
"index": "345",
"var": [
{
"a": "item",
"t": "14030102",
"n": 27
}
]
},
{
"index": "346",
"var": [
{
"a": "item",
"t": "14030203",
"n": 28
}
]
},
{
"index": "347",
"var": [
{
"a": "item",
"t": "14030204",
"n": 29
}
]
},
{
"index": "348",
"var": [
{
"a": "item",
"t": "14030305",
"n": 30
}
]
},
{
"index": "349",
"var": [
{
"a": "item",
"t": "14030306",
"n": 31
}
]
},
{
"index": "350",
"var": [
{
"a": "item",
"t": "14030407",
"n": 32
}
]
},
{
"index": "351",
"var": [
{
"a": "item",
"t": "14030408",
"n": 33
}
]
},
{ {
"index": "352", "index": "352",
"var": [ "var": [

View File

@ -9116,7 +9116,7 @@
390001211, 390001211,
1000, 1000,
5, 5,
1 -1
], ],
"FollowSK": [], "FollowSK": [],
"SucFollowSK": [], "SucFollowSK": [],

View File

@ -11,6 +11,7 @@ import (
) )
const ( const (
game_buriedtype = "game_buriedtype.json"
game_buriedcondi = "game_buriedcondi.json" game_buriedcondi = "game_buriedcondi.json"
) )
@ -31,6 +32,25 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
return return
} }
//读取埋点配置数据
func (this *configureComp) getburiedtypedata(tt comm.TaskType) (result *cfg.GameBuriedTypeData, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_buriedtype); err != nil {
this.module.Errorf("err:%v", err)
return
} else {
if result, ok = v.(*cfg.GameBuriedType).GetDataMap()[int32(tt)]; !ok {
err = comm.NewNotFoundConfErr(moduleName, game_buriedtype, tt)
this.module.Errorf("err:%v", err)
return
}
}
return
}
//动态更新配置 //动态更新配置
func (this *configureComp) updateconfigure() { func (this *configureComp) updateconfigure() {
if v, err := this.GetConfigure(game_buriedcondi); err != nil { if v, err := this.GetConfigure(game_buriedcondi); err != nil {

View File

@ -18,8 +18,8 @@ const (
cover = 1 cover = 1
//累加 //累加
overlay = 2 overlay = 2
//查询 //统计
query = 3 stats = 3
) )
const ( const (

View File

@ -1,6 +1,7 @@
package buried package buried
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/base" "go_dreamfactory/lego/base"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
@ -20,6 +21,8 @@ import (
开发人员:李伟 开发人员:李伟
*/ */
const moduleName = "埋点统计中心"
type Buried struct { type Buried struct {
modules.ModuleBase modules.ModuleBase
service base.IRPCXService service base.IRPCXService
@ -64,6 +67,7 @@ func (this *Buried) ActivationBuried(uid string, conids ...int32) (err error) {
func (this *Buried) TriggerBuried(uid string, burieds ...*comm.BuriedParam) { func (this *Buried) TriggerBuried(uid string, burieds ...*comm.BuriedParam) {
var ( var (
pass map[*comm.BuriedParam][]*cfg.GameBuriedCondiData = make(map[*comm.BuriedParam][]*cfg.GameBuriedCondiData) pass map[*comm.BuriedParam][]*cfg.GameBuriedCondiData = make(map[*comm.BuriedParam][]*cfg.GameBuriedCondiData)
bconf *cfg.GameBuriedTypeData
model *buriedModel model *buriedModel
bdatas map[int32]*pb.DBBuried bdatas map[int32]*pb.DBBuried
change []*pb.DBBuried change []*pb.DBBuried
@ -97,6 +101,10 @@ func (this *Buried) TriggerBuried(uid string, burieds ...*comm.BuriedParam) {
change = make([]*pb.DBBuried, 0) change = make([]*pb.DBBuried, 0)
//处理校验通过埋点数据 //处理校验通过埋点数据
for buried, conds := range pass { for buried, conds := range pass {
if bconf, err = this.configure.getburiedtypedata(buried.Btype); err != nil {
this.Error("未找到目标埋点类型配置", log.Field{Key: "type", Value: buried.Btype})
continue
}
if bdata, ok = bdatas[bdata.Btype]; !ok { if bdata, ok = bdatas[bdata.Btype]; !ok {
bdatas[bdata.Btype] = &pb.DBBuried{ bdatas[bdata.Btype] = &pb.DBBuried{
Id: primitive.NewObjectID().Hex(), Id: primitive.NewObjectID().Hex(),
@ -108,11 +116,11 @@ func (this *Buried) TriggerBuried(uid string, burieds ...*comm.BuriedParam) {
} }
for _, cond := range conds { for _, cond := range conds {
if cond.Rtype == rtype1 { //创号后入录 if cond.Rtype == rtype1 { //创号后入录
if complete, err = this.updateAndCheckBuried(bdata, buried, cond, true); complete { if complete, err = this.updateAndCheckBuried(bconf, bdata, buried, cond, true); complete {
completeConIds = append(completeConIds, cond.Id) completeConIds = append(completeConIds, cond.Id)
} }
} else if cond.Rtype == rtype2 { //任务接取后才会录入 判断用户埋点数据是否存在 不存在等待任务系统调用接口 ActivationBuried 激活 } else if cond.Rtype == rtype2 { //任务接取后才会录入 判断用户埋点数据是否存在 不存在等待任务系统调用接口 ActivationBuried 激活
if complete, err = this.updateAndCheckBuried(bdata, buried, cond, false); complete { if complete, err = this.updateAndCheckBuried(bconf, bdata, buried, cond, false); complete {
completeConIds = append(completeConIds, cond.Id) completeConIds = append(completeConIds, cond.Id)
} }
} }
@ -134,7 +142,7 @@ func (this *Buried) TriggerBuried(uid string, burieds ...*comm.BuriedParam) {
} }
//更新并校验完成 //更新并校验完成
func (this *Buried) updateAndCheckBuried(bdata *pb.DBBuried, collec *comm.BuriedParam, cond *cfg.GameBuriedCondiData, autoActivated bool) (complete bool, err error) { func (this *Buried) updateAndCheckBuried(bconf *cfg.GameBuriedTypeData, bdata *pb.DBBuried, collec *comm.BuriedParam, cond *cfg.GameBuriedCondiData, autoActivated bool) (complete bool, err error) {
var ( var (
ok bool ok bool
bitem *pb.DBBuriedItem bitem *pb.DBBuriedItem
@ -145,7 +153,8 @@ func (this *Buried) updateAndCheckBuried(bdata *pb.DBBuried, collec *comm.Buried
bitem = &pb.DBBuriedItem{ bitem = &pb.DBBuriedItem{
Conid: cond.Id, Conid: cond.Id,
State: pb.BuriedItemState_Activated, State: pb.BuriedItemState_Activated,
Value: make([]int32, 0), Value: 0,
Stats: make([]string, 0),
Timestamp: time.Now().Unix(), Timestamp: time.Now().Unix(),
} }
} else { } else {
@ -157,25 +166,20 @@ func (this *Buried) updateAndCheckBuried(bdata *pb.DBBuried, collec *comm.Buried
return return
} }
// switch cond.Vtype { //数据接入方式 switch bconf.Insert { //数据接入方式
// case overlay: //累加数据 case overlay: //累加数据
// bitem.Value[0] += collec.Value bitem.Value += collec.Value
// case cover: case cover:
// bitem.Value[0] = collec.Value bitem.Value = collec.Value
// case query: case stats:
// switch collec.Btype { bitem.Stats = append(bitem.Stats, "")
// case comm.Rtype1: bitem.Value = int32(len(bitem.Stats))
// default: default:
// err = fmt.Errorf("未实现的数据查询类型 埋点类型:%d", collec.Btype) err = fmt.Errorf("未知的埋点数据处理类型:%d", bconf.Insert)
// return return
// } }
// default: if bitem.Value >= cond.Value { //完成进度
// err = fmt.Errorf("未知的埋点数据处理类型:%d", cond.Vtype)
// return
// }
if bitem.Value[0] >= cond.Value { //完成进度
complete = true complete = true
} }
return return

View File

@ -85,7 +85,7 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (c
res []*cfg.Gameatn res []*cfg.Gameatn
) )
//初始化英雄卡 //初始化创角资源
if val, err := this.module.configure.GetGlobalInitConf(); err == nil { if val, err := this.module.configure.GetGlobalInitConf(); err == nil {
for _, v := range val.GetDataList() { for _, v := range val.GetDataList() {
res = append(res, v.Var...) res = append(res, v.Var...)

View File

@ -81,7 +81,8 @@ type DBBuriedItem struct {
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,rep,packed,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"` //统计值
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"` //最后一次操作时间
} }
@ -131,10 +132,17 @@ func (x *DBBuriedItem) GetState() BuriedItemState {
return BuriedItemState_Inactivated return BuriedItemState_Inactivated
} }
func (x *DBBuriedItem) GetValue() []int32 { func (x *DBBuriedItem) GetValue() int32 {
if x != nil { if x != nil {
return x.Value return x.Value
} }
return 0
}
func (x *DBBuriedItem) GetStats() []string {
if x != nil {
return x.Stats
}
return nil return nil
} }
@ -221,32 +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, 0x80, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x42, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x96, 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, 0x03, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a,
0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74,
0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0xb7, 0x01, 0x0a, 0x08, 0x61, 0x74, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
0x44, 0x42, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x70, 0x22, 0xb7, 0x01, 0x0a, 0x08, 0x44, 0x42, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x12, 0x0e,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x74, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10,
0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x74, 0x79, 0x70, 0x65, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64,
0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
0x14, 0x2e, 0x44, 0x42, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x05, 0x62, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x47, 0x0a, 0x0a, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64,
0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, 0x65,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x05, 0x6d, 0x73, 0x1a, 0x47, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b,
0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x48, 0x0a, 0x0f, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d,
0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x6e, 0x61, 0x63, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x48, 0x0a, 0x0f, 0x42,
0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x63, 0x74, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f,
0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x72, 0x65, 0x65, 0x0a, 0x0b, 0x49, 0x6e, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x10, 0x00, 0x12,
0x7a, 0x65, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x6c, 0x65, 0x65, 0x70, 0x10, 0x03, 0x42, 0x0d, 0x0a, 0x09, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a,
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x0a, 0x06, 0x46, 0x72, 0x65, 0x65, 0x7a, 0x65, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x6c,
0x65, 0x65, 0x70, 0x10, 0x03, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (