diff --git a/cmd/robot/user.go b/cmd/robot/user.go index f89ce08f6..99c0c83f6 100644 --- a/cmd/robot/user.go +++ b/cmd/robot/user.go @@ -39,7 +39,7 @@ var user_builders = []*TestCase{ req: &pb.UserAddResReq{ Res: &pb.UserAssets{ A: "hero", - T: "25001", + T: "43001", N: 1, }, }, diff --git a/modules/mail/module.go b/modules/mail/module.go index a52dd2d20..7ac78c923 100644 --- a/modules/mail/module.go +++ b/modules/mail/module.go @@ -64,7 +64,7 @@ func (this *Mail) CreateNewMail(uId string, mail *pb.DBMailData) bool { // 获得新邮件 推送给玩家 func (this *Mail) AddNewMailPush(uid string, mail *pb.DBMailData) (err error) { if session, ok := this.GetUserSession(uid); ok { - session.SendMsg(string(this.GetType()), "newmail", &pb.MailGetNewMailPush{Mail: mail}) + session.SendMsg(string(this.GetType()), "getnewmail", &pb.MailGetNewMailPush{Mail: mail}) err = session.Push() } return diff --git a/modules/modulebase.go b/modules/modulebase.go index 78db3d701..ada1c8d48 100644 --- a/modules/modulebase.go +++ b/modules/modulebase.go @@ -241,7 +241,7 @@ func (this *ModuleBase) DispenseRes(uid string, res []*cfg.Game_atn, bPush bool) // 创建英雄成功 向客户端推送数据 if bPush { if session, ok := this.GetUserSession(uid); ok { - session.SendMsg("push", "addhero", &pb.AddNewHeroPush{Hero: hero, Count: v.N}) + session.SendMsg("hero", "addnewhero", &pb.HeroAddNewHeroPush{Hero: hero, Count: v.N}) err = session.Push() } } diff --git a/modules/user/module.go b/modules/user/module.go index 74c1d7b98..c5a86ca80 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -137,7 +137,7 @@ func (this *User) AddAttributeValue(uid string, attr string, add int32, bPush bo var _cache = &pb.CacheUser{} err := this.modelUser.MCompModel.Get(uid, _cache) if err != nil { - this.SendMsgToUser(string(this.GetType()), "addres", data, _cache) + this.SendMsgToUser(string(this.GetType()), "reschange", data, _cache) } if bPush { this.UserChangePush(uid, _change) // 推送玩家数据变化 @@ -149,7 +149,7 @@ func (this *User) AddAttributeValue(uid string, attr string, add int32, bPush bo //推送玩家账号信息变化消息 func (this *User) UserChangePush(uid string, resChange *pb.UserResChangePush) (err error) { if session, ok := this.ModuleBase.GetUserSession(uid); ok { - session.SendMsg(string(this.GetType()), "userchange", resChange) + session.SendMsg(string(this.GetType()), "reschange", resChange) err = session.Push() } return diff --git a/pb/hero_msg.pb.go b/pb/hero_msg.pb.go index 918191ff4..acc282098 100644 --- a/pb/hero_msg.pb.go +++ b/pb/hero_msg.pb.go @@ -1316,7 +1316,7 @@ func (x *HeroLockResp) GetHero() *DBHero { } // 增加新英雄推送 -type AddNewHeroPush struct { +type HeroAddNewHeroPush struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -1325,8 +1325,8 @@ type AddNewHeroPush struct { Count int32 `protobuf:"varint,2,opt,name=count,proto3" json:"count"` //数量 } -func (x *AddNewHeroPush) Reset() { - *x = AddNewHeroPush{} +func (x *HeroAddNewHeroPush) Reset() { + *x = HeroAddNewHeroPush{} if protoimpl.UnsafeEnabled { mi := &file_hero_hero_msg_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1334,13 +1334,13 @@ func (x *AddNewHeroPush) Reset() { } } -func (x *AddNewHeroPush) String() string { +func (x *HeroAddNewHeroPush) String() string { return protoimpl.X.MessageStringOf(x) } -func (*AddNewHeroPush) ProtoMessage() {} +func (*HeroAddNewHeroPush) ProtoMessage() {} -func (x *AddNewHeroPush) ProtoReflect() protoreflect.Message { +func (x *HeroAddNewHeroPush) ProtoReflect() protoreflect.Message { mi := &file_hero_hero_msg_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1352,19 +1352,19 @@ func (x *AddNewHeroPush) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use AddNewHeroPush.ProtoReflect.Descriptor instead. -func (*AddNewHeroPush) Descriptor() ([]byte, []int) { +// Deprecated: Use HeroAddNewHeroPush.ProtoReflect.Descriptor instead. +func (*HeroAddNewHeroPush) Descriptor() ([]byte, []int) { return file_hero_hero_msg_proto_rawDescGZIP(), []int{25} } -func (x *AddNewHeroPush) GetHero() *DBHero { +func (x *HeroAddNewHeroPush) GetHero() *DBHero { if x != nil { return x.Hero } return nil } -func (x *AddNewHeroPush) GetCount() int32 { +func (x *HeroAddNewHeroPush) GetCount() int32 { if x != nil { return x.Count } @@ -1615,23 +1615,24 @@ var file_hero_hero_msg_proto_rawDesc = []byte{ 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x22, 0x2b, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x4c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, - 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x43, 0x0a, 0x0e, - 0x41, 0x64, 0x64, 0x4e, 0x65, 0x77, 0x48, 0x65, 0x72, 0x6f, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1b, - 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, - 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x22, 0x77, 0x0a, 0x13, 0x48, 0x65, 0x72, 0x6f, 0x47, 0x65, 0x74, 0x53, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x65, 0x64, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x68, 0x65, 0x72, 0x6f, - 0x43, 0x6f, 0x69, 0x6e, 0x66, 0x69, 0x67, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x0d, 0x68, 0x65, 0x72, 0x6f, 0x43, 0x6f, 0x69, 0x6e, 0x66, 0x69, 0x67, 0x49, 0x44, 0x12, 0x16, - 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, - 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x61, 0x72, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x74, 0x61, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x22, 0x33, 0x0a, 0x14, 0x48, 0x65, - 0x72, 0x6f, 0x47, 0x65, 0x74, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x42, - 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x47, 0x0a, 0x12, + 0x48, 0x65, 0x72, 0x6f, 0x41, 0x64, 0x64, 0x4e, 0x65, 0x77, 0x48, 0x65, 0x72, 0x6f, 0x50, 0x75, + 0x73, 0x68, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, + 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x77, 0x0a, 0x13, 0x48, 0x65, 0x72, 0x6f, 0x47, 0x65, 0x74, + 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, + 0x68, 0x65, 0x72, 0x6f, 0x43, 0x6f, 0x69, 0x6e, 0x66, 0x69, 0x67, 0x49, 0x44, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0d, 0x68, 0x65, 0x72, 0x6f, 0x43, 0x6f, 0x69, 0x6e, 0x66, 0x69, 0x67, + 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, + 0x61, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x74, 0x61, 0x72, 0x12, 0x0e, + 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x22, 0x33, + 0x0a, 0x14, 0x48, 0x65, 0x72, 0x6f, 0x47, 0x65, 0x74, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, + 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, + 0x65, 0x72, 0x6f, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -1673,7 +1674,7 @@ var file_hero_hero_msg_proto_goTypes = []interface{}{ (*HeroProperty)(nil), // 22: HeroProperty (*HeroLockReq)(nil), // 23: HeroLockReq (*HeroLockResp)(nil), // 24: HeroLockResp - (*AddNewHeroPush)(nil), // 25: AddNewHeroPush + (*HeroAddNewHeroPush)(nil), // 25: HeroAddNewHeroPush (*HeroGetSpecifiedReq)(nil), // 26: HeroGetSpecifiedReq (*HeroGetSpecifiedResp)(nil), // 27: HeroGetSpecifiedResp nil, // 28: HeroStrengthenUplvReq.ExpCardsEntry @@ -1699,7 +1700,7 @@ var file_hero_hero_msg_proto_depIdxs = []int32{ 29, // 14: HeroProperty.property:type_name -> HeroProperty.PropertyEntry 30, // 15: HeroProperty.addProperty:type_name -> HeroProperty.AddPropertyEntry 31, // 16: HeroLockResp.hero:type_name -> DBHero - 31, // 17: AddNewHeroPush.hero:type_name -> DBHero + 31, // 17: HeroAddNewHeroPush.hero:type_name -> DBHero 31, // 18: HeroGetSpecifiedResp.hero:type_name -> DBHero 19, // [19:19] is the sub-list for method output_type 19, // [19:19] is the sub-list for method input_type @@ -2016,7 +2017,7 @@ func file_hero_hero_msg_proto_init() { } } file_hero_hero_msg_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddNewHeroPush); i { + switch v := v.(*HeroAddNewHeroPush); i { case 0: return &v.state case 1: diff --git a/pb/proto/hero/hero_msg.proto b/pb/proto/hero/hero_msg.proto index b26d76b63..1846a9f25 100644 --- a/pb/proto/hero/hero_msg.proto +++ b/pb/proto/hero/hero_msg.proto @@ -124,7 +124,7 @@ message HeroLockResp { } // 增加新英雄推送 -message AddNewHeroPush { +message HeroAddNewHeroPush { DBHero hero = 1; // 英雄对象 int32 count = 2; //数量 } diff --git a/pb/proto/userrecord.proto b/pb/proto/userrecord.proto new file mode 100644 index 000000000..c72f140a8 --- /dev/null +++ b/pb/proto/userrecord.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +option go_package = ".;pb"; + + +//用户扩展数据 +message DBUserRecord { + string id = 1; // 主键id + string uid = 2; // 用户id + int32 type = 3; // 数据类型 + int32 parame = 4; // 参数 + int32 value = 5; // 值 + int64 ctime = 6; // 创建时间 +} \ No newline at end of file diff --git a/pb/userrecord.pb.go b/pb/userrecord.pb.go new file mode 100644 index 000000000..3730894dd --- /dev/null +++ b/pb/userrecord.pb.go @@ -0,0 +1,188 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.20.0 +// source: userrecord.proto + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +//用户扩展数据 +type DBUserRecord struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` // 主键id + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` // 用户id + Type int32 `protobuf:"varint,3,opt,name=type,proto3" json:"type"` // 数据类型 + Parame int32 `protobuf:"varint,4,opt,name=parame,proto3" json:"parame"` // 参数 + Value int32 `protobuf:"varint,5,opt,name=value,proto3" json:"value"` // 值 + Ctime int64 `protobuf:"varint,6,opt,name=ctime,proto3" json:"ctime"` // 创建时间 +} + +func (x *DBUserRecord) Reset() { + *x = DBUserRecord{} + if protoimpl.UnsafeEnabled { + mi := &file_userrecord_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DBUserRecord) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DBUserRecord) ProtoMessage() {} + +func (x *DBUserRecord) ProtoReflect() protoreflect.Message { + mi := &file_userrecord_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 DBUserRecord.ProtoReflect.Descriptor instead. +func (*DBUserRecord) Descriptor() ([]byte, []int) { + return file_userrecord_proto_rawDescGZIP(), []int{0} +} + +func (x *DBUserRecord) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *DBUserRecord) GetUid() string { + if x != nil { + return x.Uid + } + return "" +} + +func (x *DBUserRecord) GetType() int32 { + if x != nil { + return x.Type + } + return 0 +} + +func (x *DBUserRecord) GetParame() int32 { + if x != nil { + return x.Parame + } + return 0 +} + +func (x *DBUserRecord) GetValue() int32 { + if x != nil { + return x.Value + } + return 0 +} + +func (x *DBUserRecord) GetCtime() int64 { + if x != nil { + return x.Ctime + } + return 0 +} + +var File_userrecord_proto protoreflect.FileDescriptor + +var file_userrecord_proto_rawDesc = []byte{ + 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x88, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x42, 0x06, 0x5a, + 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_userrecord_proto_rawDescOnce sync.Once + file_userrecord_proto_rawDescData = file_userrecord_proto_rawDesc +) + +func file_userrecord_proto_rawDescGZIP() []byte { + file_userrecord_proto_rawDescOnce.Do(func() { + file_userrecord_proto_rawDescData = protoimpl.X.CompressGZIP(file_userrecord_proto_rawDescData) + }) + return file_userrecord_proto_rawDescData +} + +var file_userrecord_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_userrecord_proto_goTypes = []interface{}{ + (*DBUserRecord)(nil), // 0: DBUserRecord +} +var file_userrecord_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 +} + +func init() { file_userrecord_proto_init() } +func file_userrecord_proto_init() { + if File_userrecord_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_userrecord_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DBUserRecord); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_userrecord_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_userrecord_proto_goTypes, + DependencyIndexes: file_userrecord_proto_depIdxs, + MessageInfos: file_userrecord_proto_msgTypes, + }.Build() + File_userrecord_proto = out.File + file_userrecord_proto_rawDesc = nil + file_userrecord_proto_goTypes = nil + file_userrecord_proto_depIdxs = nil +}