上传埋点中中心协议

This commit is contained in:
liwei1dao 2023-05-31 15:40:46 +08:00
parent 4e70b9204a
commit c48cf68e26
5 changed files with 250 additions and 41 deletions

30
modules/buried/api.go Normal file
View File

@ -0,0 +1,30 @@
package buried
import (
"go_dreamfactory/modules"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
)
/*
API
*/
type apiComp struct {
modules.MCompGate
service base.IRPCXService
module *Buried
}
//组件初始化接口
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.MCompGate.Init(service, module, comp, options)
this.module = module.(*Buried)
this.service = service.(base.IRPCXService)
return
}
func (this *apiComp) Start() (err error) {
err = this.MCompGate.Start()
return
}

View File

@ -0,0 +1,40 @@
package buried
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb"
)
//参数校验
func (this *apiComp) SendCheck(session comm.IUserSession, req *pb.BuriedInquireProgressReq) (code pb.ErrorCode) {
if len(req.Conditions) == 0 {
code = pb.ErrorCode_ReqParameterError
}
return
}
///查询任务进度接口
func (this *apiComp) InquireProgress(session comm.IUserSession, req *pb.BuriedInquireProgressReq) (code pb.ErrorCode, data *pb.ErrorData) {
var (
complete []int32
incomplete []*pb.ConIProgress
err error
)
if code = this.SendCheck(session, req); code != pb.ErrorCode_Success {
return
}
if complete, incomplete, err = this.module.CheckCondition(session.GetUserId(), req.Conditions...); err != nil {
this.module.Error("查询埋点进度错误!", log.Field{Key: "err", Value: err.Error()})
code = pb.ErrorCode_ConfigNoFound
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return
}
session.SendMsg(string(this.module.GetType()), "inquireprogress", &pb.BuriedInquireProgressResp{Finished: complete, Unfinished: incomplete})
return
}

View File

@ -57,11 +57,6 @@ func (this *apiComp) Useitem(session comm.IUserSession, req *pb.ItemsUseItemReq)
return
}
//随机任务
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype21, 1)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype22, utils.ToInt32(sale.Prize[0].T))
// go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype21, 1), comm.GetBuriedParam(comm.Rtype22, utils.ToInt32(sale.Prize[0].T)))
case 4: //自选宝箱
if prop = this.module.configure.GetDropData(itemcf.BoxId); prop == nil {
code = pb.ErrorCode_ConfigNoFound
@ -107,6 +102,7 @@ func (this *apiComp) Useitem(session comm.IUserSession, req *pb.ItemsUseItemReq)
return
}
case 6: //箱子
if prop = this.module.configure.GetDropData(itemcf.BoxId); prop == nil {
code = pb.ErrorCode_ConfigNoFound
return

View File

@ -393,16 +393,16 @@ func (this *ModuleRtask) processTasks(session comm.IUserSession, taskParams ...*
}
}
}
// 通知公会任务模块
sociatyModule, err := this.service.GetModule(comm.ModuleSociaty)
if err != nil {
return
}
if sociaty, ok := sociatyModule.(comm.ISociaty); ok {
if err2 := sociaty.TaskcondNotify(uid, condIdsForNotify); err2 != nil {
// // 通知公会任务模块
// sociatyModule, err := this.service.GetModule(comm.ModuleSociaty)
// if err != nil {
// return
// }
// if sociaty, ok := sociatyModule.(comm.ISociaty); ok {
// if err2 := sociaty.TaskcondNotify(uid, condIdsForNotify); err2 != nil {
}
}
// }
// }
}
// 任务条件校验

View File

@ -20,6 +20,111 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
//查询任务条件进度需求
type BuriedInquireProgressReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Conditions []int32 `protobuf:"varint,1,rep,packed,name=conditions,proto3" json:"conditions"`
}
func (x *BuriedInquireProgressReq) Reset() {
*x = BuriedInquireProgressReq{}
if protoimpl.UnsafeEnabled {
mi := &file_buried_buried_msg_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BuriedInquireProgressReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BuriedInquireProgressReq) ProtoMessage() {}
func (x *BuriedInquireProgressReq) ProtoReflect() protoreflect.Message {
mi := &file_buried_buried_msg_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use BuriedInquireProgressReq.ProtoReflect.Descriptor instead.
func (*BuriedInquireProgressReq) Descriptor() ([]byte, []int) {
return file_buried_buried_msg_proto_rawDescGZIP(), []int{0}
}
func (x *BuriedInquireProgressReq) GetConditions() []int32 {
if x != nil {
return x.Conditions
}
return nil
}
//查询任务条件进度需求
type BuriedInquireProgressResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Finished []int32 `protobuf:"varint,1,rep,packed,name=finished,proto3" json:"finished"` //已完成
Unfinished []*ConIProgress `protobuf:"bytes,2,rep,name=unfinished,proto3" json:"unfinished"` //未完成
}
func (x *BuriedInquireProgressResp) Reset() {
*x = BuriedInquireProgressResp{}
if protoimpl.UnsafeEnabled {
mi := &file_buried_buried_msg_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BuriedInquireProgressResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BuriedInquireProgressResp) ProtoMessage() {}
func (x *BuriedInquireProgressResp) ProtoReflect() protoreflect.Message {
mi := &file_buried_buried_msg_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use BuriedInquireProgressResp.ProtoReflect.Descriptor instead.
func (*BuriedInquireProgressResp) Descriptor() ([]byte, []int) {
return file_buried_buried_msg_proto_rawDescGZIP(), []int{1}
}
func (x *BuriedInquireProgressResp) GetFinished() []int32 {
if x != nil {
return x.Finished
}
return nil
}
func (x *BuriedInquireProgressResp) GetUnfinished() []*ConIProgress {
if x != nil {
return x.Unfinished
}
return nil
}
//RPC 协议 服务器内部使用 客户端不用
type Rpc_ModuleBuriedTriggerReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -32,7 +137,7 @@ type Rpc_ModuleBuriedTriggerReq struct {
func (x *Rpc_ModuleBuriedTriggerReq) Reset() {
*x = Rpc_ModuleBuriedTriggerReq{}
if protoimpl.UnsafeEnabled {
mi := &file_buried_buried_msg_proto_msgTypes[0]
mi := &file_buried_buried_msg_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -45,7 +150,7 @@ func (x *Rpc_ModuleBuriedTriggerReq) String() string {
func (*Rpc_ModuleBuriedTriggerReq) ProtoMessage() {}
func (x *Rpc_ModuleBuriedTriggerReq) ProtoReflect() protoreflect.Message {
mi := &file_buried_buried_msg_proto_msgTypes[0]
mi := &file_buried_buried_msg_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -58,7 +163,7 @@ func (x *Rpc_ModuleBuriedTriggerReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use Rpc_ModuleBuriedTriggerReq.ProtoReflect.Descriptor instead.
func (*Rpc_ModuleBuriedTriggerReq) Descriptor() ([]byte, []int) {
return file_buried_buried_msg_proto_rawDescGZIP(), []int{0}
return file_buried_buried_msg_proto_rawDescGZIP(), []int{2}
}
func (x *Rpc_ModuleBuriedTriggerReq) GetUid() string {
@ -84,7 +189,7 @@ type Rpc_ModuleBuriedTriggerResp struct {
func (x *Rpc_ModuleBuriedTriggerResp) Reset() {
*x = Rpc_ModuleBuriedTriggerResp{}
if protoimpl.UnsafeEnabled {
mi := &file_buried_buried_msg_proto_msgTypes[1]
mi := &file_buried_buried_msg_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -97,7 +202,7 @@ func (x *Rpc_ModuleBuriedTriggerResp) String() string {
func (*Rpc_ModuleBuriedTriggerResp) ProtoMessage() {}
func (x *Rpc_ModuleBuriedTriggerResp) ProtoReflect() protoreflect.Message {
mi := &file_buried_buried_msg_proto_msgTypes[1]
mi := &file_buried_buried_msg_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -110,7 +215,7 @@ func (x *Rpc_ModuleBuriedTriggerResp) ProtoReflect() protoreflect.Message {
// Deprecated: Use Rpc_ModuleBuriedTriggerResp.ProtoReflect.Descriptor instead.
func (*Rpc_ModuleBuriedTriggerResp) Descriptor() ([]byte, []int) {
return file_buried_buried_msg_proto_rawDescGZIP(), []int{1}
return file_buried_buried_msg_proto_rawDescGZIP(), []int{3}
}
var File_buried_buried_msg_proto protoreflect.FileDescriptor
@ -119,15 +224,25 @@ var file_buried_buried_msg_proto_rawDesc = []byte{
0x0a, 0x17, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x2f, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x5f,
0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x62, 0x75, 0x72, 0x69, 0x65,
0x64, 0x2f, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0x56, 0x0a, 0x1a, 0x52, 0x70, 0x63, 0x5f, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42,
0x75, 0x72, 0x69, 0x65, 0x64, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12,
0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69,
0x64, 0x12, 0x26, 0x0a, 0x07, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d,
0x52, 0x07, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x73, 0x22, 0x1d, 0x0a, 0x1b, 0x52, 0x70, 0x63,
0x5f, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x54, 0x72, 0x69,
0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6f, 0x22, 0x3a, 0x0a, 0x18, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x6e, 0x71, 0x75, 0x69,
0x72, 0x65, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x12, 0x1e, 0x0a,
0x0a, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
0x05, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x66, 0x0a,
0x19, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x6e, 0x71, 0x75, 0x69, 0x72, 0x65, 0x50, 0x72,
0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69,
0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x66, 0x69,
0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x12, 0x2d, 0x0a, 0x0a, 0x75, 0x6e, 0x66, 0x69, 0x6e, 0x69,
0x73, 0x68, 0x65, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x43, 0x6f, 0x6e,
0x49, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x52, 0x0a, 0x75, 0x6e, 0x66, 0x69, 0x6e,
0x69, 0x73, 0x68, 0x65, 0x64, 0x22, 0x56, 0x0a, 0x1a, 0x52, 0x70, 0x63, 0x5f, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72,
0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x26, 0x0a, 0x07, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x73,
0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x50,
0x61, 0x72, 0x61, 0x6d, 0x52, 0x07, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x73, 0x22, 0x1d, 0x0a,
0x1b, 0x52, 0x70, 0x63, 0x5f, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x75, 0x72, 0x69, 0x65,
0x64, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04,
0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -142,19 +257,23 @@ func file_buried_buried_msg_proto_rawDescGZIP() []byte {
return file_buried_buried_msg_proto_rawDescData
}
var file_buried_buried_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_buried_buried_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_buried_buried_msg_proto_goTypes = []interface{}{
(*Rpc_ModuleBuriedTriggerReq)(nil), // 0: Rpc_ModuleBuriedTriggerReq
(*Rpc_ModuleBuriedTriggerResp)(nil), // 1: Rpc_ModuleBuriedTriggerResp
(*BuriedParam)(nil), // 2: BuriedParam
(*BuriedInquireProgressReq)(nil), // 0: BuriedInquireProgressReq
(*BuriedInquireProgressResp)(nil), // 1: BuriedInquireProgressResp
(*Rpc_ModuleBuriedTriggerReq)(nil), // 2: Rpc_ModuleBuriedTriggerReq
(*Rpc_ModuleBuriedTriggerResp)(nil), // 3: Rpc_ModuleBuriedTriggerResp
(*ConIProgress)(nil), // 4: ConIProgress
(*BuriedParam)(nil), // 5: BuriedParam
}
var file_buried_buried_msg_proto_depIdxs = []int32{
2, // 0: Rpc_ModuleBuriedTriggerReq.burieds:type_name -> BuriedParam
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
4, // 0: BuriedInquireProgressResp.unfinished:type_name -> ConIProgress
5, // 1: Rpc_ModuleBuriedTriggerReq.burieds:type_name -> BuriedParam
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_buried_buried_msg_proto_init() }
@ -165,7 +284,7 @@ func file_buried_buried_msg_proto_init() {
file_buried_buried_db_proto_init()
if !protoimpl.UnsafeEnabled {
file_buried_buried_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Rpc_ModuleBuriedTriggerReq); i {
switch v := v.(*BuriedInquireProgressReq); i {
case 0:
return &v.state
case 1:
@ -177,6 +296,30 @@ func file_buried_buried_msg_proto_init() {
}
}
file_buried_buried_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BuriedInquireProgressResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_buried_buried_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Rpc_ModuleBuriedTriggerReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_buried_buried_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Rpc_ModuleBuriedTriggerResp); i {
case 0:
return &v.state
@ -195,7 +338,7 @@ func file_buried_buried_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_buried_buried_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},