diff --git a/comm/const.go b/comm/const.go index e1ee12db4..53ebb322c 100644 --- a/comm/const.go +++ b/comm/const.go @@ -297,7 +297,14 @@ const ( //红点枚举 type ReddotType int32 -const () +const ( + Reddot1 ReddotType = 10001 //任务-日常活跃宝箱 + Reddot2 ReddotType = 10002 //任务-周活跃宝箱 + Reddot3 ReddotType = 10003 //公会签到 + Reddot4 ReddotType = 10004 //任务-成就奖励 + Reddot5 ReddotType = 10005 //主线关卡 + Reddot6 ReddotType = 10006 //爬塔 +) type TaskType int32 diff --git a/comm/imodule.go b/comm/imodule.go index 5093c897d..e647cf8b0 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -244,7 +244,7 @@ type ( } //武馆 IMartialhall interface { - Reddot(uid string) bool + Reddot(uid string, rid ...ReddotType) map[ReddotType]bool } // 世界任务 IWorldtask interface { diff --git a/modules/martialhall/module.go b/modules/martialhall/module.go index 0cb6dba67..1028595ab 100644 --- a/modules/martialhall/module.go +++ b/modules/martialhall/module.go @@ -51,6 +51,6 @@ func (this *Martialhall) OnInstallComp() { } //红点查询 -func (this *Martialhall) Reddot(uid string) bool { +func (this *Martialhall) Reddot(rid comm.ReddotType, uid string) bool { return this.modelMartialhall.checkReddot(uid) } diff --git a/modules/reddot/api_get.go b/modules/reddot/api_get.go new file mode 100644 index 000000000..e4146554b --- /dev/null +++ b/modules/reddot/api_get.go @@ -0,0 +1,29 @@ +package reddot + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +//参数校验 +func (this *apiComp) GetCheck(session comm.IUserSession, req *pb.ReddotGetReq) (code pb.ErrorCode) { + + return +} + +///获取系统公告 +func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (code pb.ErrorCode, data proto.Message) { + var ( + reddot map[int32]bool = make(map[int32]bool) + ) + if code = this.GetCheck(session, req); code != pb.ErrorCode_Success { + return + } + for k, v := range this.module.martialhall.Reddot(session.GetUserId(), comm.Reddot1) { + reddot[int32(k)] = v + } + session.SendMsg(string(this.module.GetType()), "get", &pb.ReddotGetAllResp{Reddot: reddot}) + return +} diff --git a/modules/reddot/api_getall.go b/modules/reddot/api_getall.go new file mode 100644 index 000000000..cd74c8a7b --- /dev/null +++ b/modules/reddot/api_getall.go @@ -0,0 +1,29 @@ +package reddot + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +//参数校验 +func (this *apiComp) GetAllCheck(session comm.IUserSession, req *pb.ReddotGetAllReq) (code pb.ErrorCode) { + + return +} + +///获取系统公告 +func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq) (code pb.ErrorCode, data proto.Message) { + var ( + reddot map[int32]bool = make(map[int32]bool) + ) + if code = this.GetAllCheck(session, req); code != pb.ErrorCode_Success { + return + } + for k, v := range this.module.martialhall.Reddot(session.GetUserId(), comm.Reddot1) { + reddot[int32(k)] = v + } + session.SendMsg(string(this.module.GetType()), "getall", &pb.ReddotGetAllResp{Reddot: reddot}) + return +} diff --git a/modules/reddot/api_info.go b/modules/reddot/api_info.go deleted file mode 100644 index 1974e9bf4..000000000 --- a/modules/reddot/api_info.go +++ /dev/null @@ -1,27 +0,0 @@ -package reddot - -import ( - "go_dreamfactory/comm" - "go_dreamfactory/pb" - - "google.golang.org/protobuf/proto" -) - -//参数校验 -func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.ReddotInfoReq) (code pb.ErrorCode) { - - return -} - -///获取系统公告 -func (this *apiComp) Info(session comm.IUserSession, req *pb.ReddotInfoReq) (code pb.ErrorCode, data proto.Message) { - var ( - reddot map[string]bool = make(map[string]bool) - ) - if code = this.InfoCheck(session, req); code != pb.ErrorCode_Success { - return - } - reddot[string(comm.ModuleMartialhall)] = this.module.martialhall.Reddot(session.GetUserId()) - session.SendMsg(string(this.module.GetType()), "info", &pb.ReddotInfoResp{Reddot: reddot}) - return -} diff --git a/pb/reddot_msg.pb.go b/pb/reddot_msg.pb.go index 8fd36c445..b35001ef4 100644 --- a/pb/reddot_msg.pb.go +++ b/pb/reddot_msg.pb.go @@ -21,14 +21,14 @@ const ( ) //红点信息请求 -type ReddotInfoReq struct { +type ReddotGetAllReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *ReddotInfoReq) Reset() { - *x = ReddotInfoReq{} +func (x *ReddotGetAllReq) Reset() { + *x = ReddotGetAllReq{} if protoimpl.UnsafeEnabled { mi := &file_reddot_reddot_msg_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -36,13 +36,13 @@ func (x *ReddotInfoReq) Reset() { } } -func (x *ReddotInfoReq) String() string { +func (x *ReddotGetAllReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ReddotInfoReq) ProtoMessage() {} +func (*ReddotGetAllReq) ProtoMessage() {} -func (x *ReddotInfoReq) ProtoReflect() protoreflect.Message { +func (x *ReddotGetAllReq) ProtoReflect() protoreflect.Message { mi := &file_reddot_reddot_msg_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -54,21 +54,21 @@ func (x *ReddotInfoReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ReddotInfoReq.ProtoReflect.Descriptor instead. -func (*ReddotInfoReq) Descriptor() ([]byte, []int) { +// Deprecated: Use ReddotGetAllReq.ProtoReflect.Descriptor instead. +func (*ReddotGetAllReq) Descriptor() ([]byte, []int) { return file_reddot_reddot_msg_proto_rawDescGZIP(), []int{0} } -type ReddotInfoResp struct { +type ReddotGetAllResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Reddot map[string]bool `protobuf:"bytes,1,rep,name=reddot,proto3" json:"reddot" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //红点信息 + Reddot map[int32]bool `protobuf:"bytes,1,rep,name=reddot,proto3" json:"reddot" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //红点信息 } -func (x *ReddotInfoResp) Reset() { - *x = ReddotInfoResp{} +func (x *ReddotGetAllResp) Reset() { + *x = ReddotGetAllResp{} if protoimpl.UnsafeEnabled { mi := &file_reddot_reddot_msg_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -76,13 +76,13 @@ func (x *ReddotInfoResp) Reset() { } } -func (x *ReddotInfoResp) String() string { +func (x *ReddotGetAllResp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ReddotInfoResp) ProtoMessage() {} +func (*ReddotGetAllResp) ProtoMessage() {} -func (x *ReddotInfoResp) ProtoReflect() protoreflect.Message { +func (x *ReddotGetAllResp) ProtoReflect() protoreflect.Message { mi := &file_reddot_reddot_msg_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -94,12 +94,107 @@ func (x *ReddotInfoResp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ReddotInfoResp.ProtoReflect.Descriptor instead. -func (*ReddotInfoResp) Descriptor() ([]byte, []int) { +// Deprecated: Use ReddotGetAllResp.ProtoReflect.Descriptor instead. +func (*ReddotGetAllResp) Descriptor() ([]byte, []int) { return file_reddot_reddot_msg_proto_rawDescGZIP(), []int{1} } -func (x *ReddotInfoResp) GetReddot() map[string]bool { +func (x *ReddotGetAllResp) GetReddot() map[int32]bool { + if x != nil { + return x.Reddot + } + return nil +} + +//红点信息请求 +type ReddotGetReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Rids []int32 `protobuf:"varint,1,rep,packed,name=rids,proto3" json:"rids"` +} + +func (x *ReddotGetReq) Reset() { + *x = ReddotGetReq{} + if protoimpl.UnsafeEnabled { + mi := &file_reddot_reddot_msg_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReddotGetReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReddotGetReq) ProtoMessage() {} + +func (x *ReddotGetReq) ProtoReflect() protoreflect.Message { + mi := &file_reddot_reddot_msg_proto_msgTypes[2] + 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 ReddotGetReq.ProtoReflect.Descriptor instead. +func (*ReddotGetReq) Descriptor() ([]byte, []int) { + return file_reddot_reddot_msg_proto_rawDescGZIP(), []int{2} +} + +func (x *ReddotGetReq) GetRids() []int32 { + if x != nil { + return x.Rids + } + return nil +} + +type ReddotGetResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Reddot map[int32]bool `protobuf:"bytes,1,rep,name=reddot,proto3" json:"reddot" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //红点信息 +} + +func (x *ReddotGetResp) Reset() { + *x = ReddotGetResp{} + if protoimpl.UnsafeEnabled { + mi := &file_reddot_reddot_msg_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReddotGetResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReddotGetResp) ProtoMessage() {} + +func (x *ReddotGetResp) ProtoReflect() protoreflect.Message { + mi := &file_reddot_reddot_msg_proto_msgTypes[3] + 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 ReddotGetResp.ProtoReflect.Descriptor instead. +func (*ReddotGetResp) Descriptor() ([]byte, []int) { + return file_reddot_reddot_msg_proto_rawDescGZIP(), []int{3} +} + +func (x *ReddotGetResp) GetReddot() map[int32]bool { if x != nil { return x.Reddot } @@ -110,17 +205,28 @@ var File_reddot_reddot_msg_proto protoreflect.FileDescriptor var file_reddot_reddot_msg_proto_rawDesc = []byte{ 0x0a, 0x17, 0x72, 0x65, 0x64, 0x64, 0x6f, 0x74, 0x2f, 0x72, 0x65, 0x64, 0x64, 0x6f, 0x74, 0x5f, - 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0f, 0x0a, 0x0d, 0x52, 0x65, 0x64, - 0x64, 0x6f, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x22, 0x80, 0x01, 0x0a, 0x0e, 0x52, - 0x65, 0x64, 0x64, 0x6f, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x33, 0x0a, - 0x06, 0x72, 0x65, 0x64, 0x64, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x52, 0x65, 0x64, 0x64, 0x6f, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x52, - 0x65, 0x64, 0x64, 0x6f, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x72, 0x65, 0x64, 0x64, - 0x6f, 0x74, 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x64, 0x64, 0x6f, 0x74, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, - 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x11, 0x0a, 0x0f, 0x52, 0x65, 0x64, + 0x64, 0x6f, 0x74, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x22, 0x84, 0x01, 0x0a, + 0x10, 0x52, 0x65, 0x64, 0x64, 0x6f, 0x74, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, + 0x70, 0x12, 0x35, 0x0a, 0x06, 0x72, 0x65, 0x64, 0x64, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1d, 0x2e, 0x52, 0x65, 0x64, 0x64, 0x6f, 0x74, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, + 0x52, 0x65, 0x73, 0x70, 0x2e, 0x52, 0x65, 0x64, 0x64, 0x6f, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x06, 0x72, 0x65, 0x64, 0x64, 0x6f, 0x74, 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x64, 0x64, + 0x6f, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x22, 0x22, 0x0a, 0x0c, 0x52, 0x65, 0x64, 0x64, 0x6f, 0x74, 0x47, 0x65, 0x74, + 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x05, 0x52, 0x04, 0x72, 0x69, 0x64, 0x73, 0x22, 0x7e, 0x0a, 0x0d, 0x52, 0x65, 0x64, 0x64, 0x6f, + 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x32, 0x0a, 0x06, 0x72, 0x65, 0x64, 0x64, + 0x6f, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x52, 0x65, 0x64, 0x64, 0x6f, + 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x52, 0x65, 0x64, 0x64, 0x6f, 0x74, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x72, 0x65, 0x64, 0x64, 0x6f, 0x74, 0x1a, 0x39, 0x0a, 0x0b, + 0x52, 0x65, 0x64, 0x64, 0x6f, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -135,19 +241,23 @@ func file_reddot_reddot_msg_proto_rawDescGZIP() []byte { return file_reddot_reddot_msg_proto_rawDescData } -var file_reddot_reddot_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_reddot_reddot_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_reddot_reddot_msg_proto_goTypes = []interface{}{ - (*ReddotInfoReq)(nil), // 0: ReddotInfoReq - (*ReddotInfoResp)(nil), // 1: ReddotInfoResp - nil, // 2: ReddotInfoResp.ReddotEntry + (*ReddotGetAllReq)(nil), // 0: ReddotGetAllReq + (*ReddotGetAllResp)(nil), // 1: ReddotGetAllResp + (*ReddotGetReq)(nil), // 2: ReddotGetReq + (*ReddotGetResp)(nil), // 3: ReddotGetResp + nil, // 4: ReddotGetAllResp.ReddotEntry + nil, // 5: ReddotGetResp.ReddotEntry } var file_reddot_reddot_msg_proto_depIdxs = []int32{ - 2, // 0: ReddotInfoResp.reddot:type_name -> ReddotInfoResp.ReddotEntry - 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: ReddotGetAllResp.reddot:type_name -> ReddotGetAllResp.ReddotEntry + 5, // 1: ReddotGetResp.reddot:type_name -> ReddotGetResp.ReddotEntry + 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_reddot_reddot_msg_proto_init() } @@ -157,7 +267,7 @@ func file_reddot_reddot_msg_proto_init() { } if !protoimpl.UnsafeEnabled { file_reddot_reddot_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReddotInfoReq); i { + switch v := v.(*ReddotGetAllReq); i { case 0: return &v.state case 1: @@ -169,7 +279,31 @@ func file_reddot_reddot_msg_proto_init() { } } file_reddot_reddot_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReddotInfoResp); i { + switch v := v.(*ReddotGetAllResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reddot_reddot_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReddotGetReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_reddot_reddot_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReddotGetResp); i { case 0: return &v.state case 1: @@ -187,7 +321,7 @@ func file_reddot_reddot_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_reddot_reddot_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 3, + NumMessages: 6, NumExtensions: 0, NumServices: 0, },