上传红点消息

This commit is contained in:
liwei1dao 2022-11-09 16:58:38 +08:00
parent 15a53a403c
commit 4ec41044e6
6 changed files with 110 additions and 17 deletions

View File

@ -240,4 +240,8 @@ type (
// 检查特权
CheckPrivilege(session IUserSession)
}
//武馆
IMartialhall interface {
Reddot(uid string) bool
}
)

View File

@ -6,6 +6,7 @@ import (
"go_dreamfactory/lego/sys/mgo"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
@ -55,3 +56,40 @@ func (this *modelMartialhall) queryUserMartialhall(uid string) (result *pb.DBMar
err = nil
return
}
func (this *modelMartialhall) checkReddot(uid string) bool {
var (
err error
mart *pb.DBMartialhall
mdata *cfg.GameKungfuMasterworkerData
)
if mart, err = this.module.modelMartialhall.queryUserMartialhall(uid); err != nil {
return false
}
if mdata, err = this.module.configure.getMasterworker(mart.Lv); err != nil {
return false
}
check(mart.Pillar1, mdata)
if mart.Pillar1.State == pb.PillarState_Receive {
return true
}
check(mart.Pillar2, mdata)
if mart.Pillar2.State == pb.PillarState_Receive {
return true
}
check(mart.Pillar3, mdata)
if mart.Pillar3.State == pb.PillarState_Receive {
return true
}
check(mart.Pillar4, mdata)
if mart.Pillar4.State == pb.PillarState_Receive {
return true
}
check(mart.Pillar5, mdata)
if mart.Pillar5.State == pb.PillarState_Receive {
return true
}
return false
}

View File

@ -49,3 +49,8 @@ func (this *Martialhall) OnInstallComp() {
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
this.modelMartialhall = this.RegisterComp(new(modelMartialhall)).(*modelMartialhall)
}
//红点查询
func (this *Martialhall) Reddot(uid string) bool {
return this.modelMartialhall.checkReddot(uid)
}

View File

@ -0,0 +1,27 @@
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
}

View File

@ -19,8 +19,9 @@ func NewModule() core.IModule {
type Reddot struct {
modules.ModuleBase
service base.IRPCXService
api_comp *apiComp
service base.IRPCXService
martialhall comm.IMartialhall
api_comp *apiComp
}
//模块名
@ -36,11 +37,11 @@ func (this *Reddot) Init(service core.IService, module core.IModule, options cor
}
func (this *Reddot) Start() (err error) {
err = this.ModuleBase.Start()
// var module core.IModule
// if module, err = this.service.GetModule(comm.ModuleEquipment); err != nil {
// return
// }
// this.equip = module.(comm.IEquipment)
var module core.IModule
if module, err = this.service.GetModule(comm.ModuleMartialhall); err != nil {
return
}
this.martialhall = module.(comm.IMartialhall)
return
}

View File

@ -63,6 +63,8 @@ type ReddotInfoResp 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"` //红点信息
}
func (x *ReddotInfoResp) Reset() {
@ -97,14 +99,28 @@ func (*ReddotInfoResp) Descriptor() ([]byte, []int) {
return file_reddot_reddot_msg_proto_rawDescGZIP(), []int{1}
}
func (x *ReddotInfoResp) GetReddot() map[string]bool {
if x != nil {
return x.Reddot
}
return nil
}
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, 0x10, 0x0a, 0x0e, 0x52, 0x65,
0x64, 0x64, 0x6f, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04,
0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
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,
}
var (
@ -119,17 +135,19 @@ 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, 2)
var file_reddot_reddot_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_reddot_reddot_msg_proto_goTypes = []interface{}{
(*ReddotInfoReq)(nil), // 0: ReddotInfoReq
(*ReddotInfoResp)(nil), // 1: ReddotInfoResp
nil, // 2: ReddotInfoResp.ReddotEntry
}
var file_reddot_reddot_msg_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
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
}
func init() { file_reddot_reddot_msg_proto_init() }
@ -169,7 +187,7 @@ func file_reddot_reddot_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_reddot_reddot_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
},