Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev

This commit is contained in:
meixiongfeng 2022-07-19 10:38:13 +08:00
commit cba8bb0ec4
8 changed files with 238 additions and 36 deletions

View File

@ -39,7 +39,7 @@ var user_builders = []*TestCase{
req: &pb.UserAddResReq{
Res: &pb.UserAssets{
A: "hero",
T: "25001",
T: "43001",
N: 1,
},
},

View File

@ -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

View File

@ -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()
}
}

View File

@ -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

View File

@ -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:

View File

@ -124,7 +124,7 @@ message HeroLockResp {
}
//
message AddNewHeroPush {
message HeroAddNewHeroPush {
DBHero hero = 1; //
int32 count = 2; //
}

13
pb/proto/userrecord.proto Normal file
View File

@ -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; //
}

188
pb/userrecord.pb.go Normal file
View File

@ -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
}