From f769198052949e5c95779516d302aff03a558d06 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 5 Sep 2023 16:21:52 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=9D=90=E9=AA=91=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=8F=98=E5=8C=96=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/dragon/api_list.go | 1 + modules/dragon/api_train.go | 28 +++--- modules/dragon/model_dragon.go | 17 ++-- pb/dragon_msg.pb.go | 92 +++++++++++++++--- pb/mainline_db.pb.go | 167 ++++++++++++++++++--------------- 5 files changed, 194 insertions(+), 111 deletions(-) diff --git a/modules/dragon/api_list.go b/modules/dragon/api_list.go index c0405b8da..e12597641 100644 --- a/modules/dragon/api_list.go +++ b/modules/dragon/api_list.go @@ -34,6 +34,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.DragonGetListReq this.module.modelDragon.UpdateDragonData(session.GetUserId(), v.Id, update) } } + rsp.Dragons = dragon session.SendMsg(string(this.module.GetType()), "getlist", rsp) return diff --git a/modules/dragon/api_train.go b/modules/dragon/api_train.go index ff864083c..a13712a08 100644 --- a/modules/dragon/api_train.go +++ b/modules/dragon/api_train.go @@ -20,17 +20,18 @@ func (this *apiComp) TrainCheck(session comm.IUserSession, req *pb.DragonTrainRe func (this *apiComp) Train(session comm.IUserSession, req *pb.DragonTrainReq) (errdata *pb.ErrorData) { var ( - err error - dragon *pb.DBDragon - playConf *cfg.GameDragonPlayData - update map[string]interface{} - preType int32 - curType int32 // 当前阶段 - reward []*cfg.Gameatn - preLv int32 // 升级之前的等级 - curLv int32 // 升级之后的等级 - atno []*pb.UserAtno - speed int32 + err error + dragon *pb.DBDragon + playConf *cfg.GameDragonPlayData + update map[string]interface{} + preType int32 + curType int32 // 当前阶段 + reward []*cfg.Gameatn + preLv int32 // 升级之前的等级 + curLv int32 // 升级之后的等级 + atno []*pb.UserAtno + speed int32 + chanegList []*pb.DBDragon ) update = make(map[string]interface{}) rsp := &pb.DragonTrainResp{} @@ -145,6 +146,11 @@ func (this *apiComp) Train(session comm.IUserSession, req *pb.DragonTrainReq) (e } rsp.Dragons = dragon this.module.modelDragon.UpdateDragonData(session.GetUserId(), dragon.Id, update) + + chanegList = append(chanegList, dragon) + session.SendMsg(string(this.module.GetType()), "change", &pb.DragonChangePush{ + Dragons: chanegList, + }) session.SendMsg(string(this.module.GetType()), "train", rsp) return } diff --git a/modules/dragon/model_dragon.go b/modules/dragon/model_dragon.go index ff595c255..b87c10c9f 100644 --- a/modules/dragon/model_dragon.go +++ b/modules/dragon/model_dragon.go @@ -32,9 +32,10 @@ func (this *ModelDragon) Init(service core.IService, module core.IModule, comp c // 获取一个新的坐骑 func (this *ModelDragon) CreateDragon(session comm.IUserSession, dragons map[string]int32) (errdata *pb.ErrorData) { var ( - dbModel *db.DBModel - err error - dragon *pb.DBDragon + dbModel *db.DBModel + err error + dragon *pb.DBDragon + chanegList []*pb.DBDragon ) dragonList := make([]*pb.DBDragon, 0) uid := session.GetUserId() @@ -133,7 +134,10 @@ func (this *ModelDragon) CreateDragon(session comm.IUserSession, dragons map[str } } } - + chanegList = append(chanegList, dragon) + session.SendMsg(string(this.module.GetType()), "change", &pb.DragonChangePush{ + Dragons: chanegList, + }) return } @@ -183,8 +187,3 @@ func (this *ModelDragon) GetDragonByOid(uid string, oid string) (dragon *pb.DBDr } return } - -func (this *ModelDragon) CreateAiDragon(dragonid string, lv int32) (dragon *pb.DBDragon, err error) { - - return -} diff --git a/pb/dragon_msg.pb.go b/pb/dragon_msg.pb.go index 1b2a2616a..d8dff477f 100644 --- a/pb/dragon_msg.pb.go +++ b/pb/dragon_msg.pb.go @@ -218,6 +218,54 @@ func (x *DragonTrainResp) GetReward() []*UserAtno { return nil } +// 坐骑变化推送 +type DragonChangePush struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Dragons []*DBDragon `protobuf:"bytes,1,rep,name=dragons,proto3" json:"dragons"` +} + +func (x *DragonChangePush) Reset() { + *x = DragonChangePush{} + if protoimpl.UnsafeEnabled { + mi := &file_dragon_dragon_msg_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DragonChangePush) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DragonChangePush) ProtoMessage() {} + +func (x *DragonChangePush) ProtoReflect() protoreflect.Message { + mi := &file_dragon_dragon_msg_proto_msgTypes[4] + 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 DragonChangePush.ProtoReflect.Descriptor instead. +func (*DragonChangePush) Descriptor() ([]byte, []int) { + return file_dragon_dragon_msg_proto_rawDescGZIP(), []int{4} +} + +func (x *DragonChangePush) GetDragons() []*DBDragon { + if x != nil { + return x.Dragons + } + return nil +} + var File_dragon_dragon_msg_proto protoreflect.FileDescriptor var file_dragon_dragon_msg_proto_rawDesc = []byte{ @@ -239,7 +287,11 @@ var file_dragon_dragon_msg_proto_rawDesc = []byte{ 0x61, 0x67, 0x6f, 0x6e, 0x52, 0x07, 0x64, 0x72, 0x61, 0x67, 0x6f, 0x6e, 0x73, 0x12, 0x21, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, - 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x22, 0x37, 0x0a, 0x10, 0x44, 0x72, 0x61, 0x67, 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, + 0x50, 0x75, 0x73, 0x68, 0x12, 0x23, 0x0a, 0x07, 0x64, 0x72, 0x61, 0x67, 0x6f, 0x6e, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x44, 0x72, 0x61, 0x67, 0x6f, 0x6e, + 0x52, 0x07, 0x64, 0x72, 0x61, 0x67, 0x6f, 0x6e, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -254,24 +306,26 @@ func file_dragon_dragon_msg_proto_rawDescGZIP() []byte { return file_dragon_dragon_msg_proto_rawDescData } -var file_dragon_dragon_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_dragon_dragon_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_dragon_dragon_msg_proto_goTypes = []interface{}{ (*DragonGetListReq)(nil), // 0: DragonGetListReq (*DragonGetListResp)(nil), // 1: DragonGetListResp (*DragonTrainReq)(nil), // 2: DragonTrainReq (*DragonTrainResp)(nil), // 3: DragonTrainResp - (*DBDragon)(nil), // 4: DBDragon - (*UserAtno)(nil), // 5: UserAtno + (*DragonChangePush)(nil), // 4: DragonChangePush + (*DBDragon)(nil), // 5: DBDragon + (*UserAtno)(nil), // 6: UserAtno } var file_dragon_dragon_msg_proto_depIdxs = []int32{ - 4, // 0: DragonGetListResp.dragons:type_name -> DBDragon - 4, // 1: DragonTrainResp.dragons:type_name -> DBDragon - 5, // 2: DragonTrainResp.reward:type_name -> UserAtno - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 5, // 0: DragonGetListResp.dragons:type_name -> DBDragon + 5, // 1: DragonTrainResp.dragons:type_name -> DBDragon + 6, // 2: DragonTrainResp.reward:type_name -> UserAtno + 5, // 3: DragonChangePush.dragons:type_name -> DBDragon + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_dragon_dragon_msg_proto_init() } @@ -330,6 +384,18 @@ func file_dragon_dragon_msg_proto_init() { return nil } } + file_dragon_dragon_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DragonChangePush); 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{ @@ -337,7 +403,7 @@ func file_dragon_dragon_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_dragon_dragon_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 5, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/mainline_db.pb.go b/pb/mainline_db.pb.go index dc8aa9188..5a6248c82 100644 --- a/pb/mainline_db.pb.go +++ b/pb/mainline_db.pb.go @@ -35,8 +35,9 @@ type DBMainline struct { Ps map[int32]int32 `protobuf:"bytes,8,rep,name=ps,proto3" json:"ps" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 预扣的体力 Chapterboos map[int32]int32 `protobuf:"bytes,9,rep,name=chapterboos,proto3" json:"chapterboos" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //章节boos Currbooschapter int32 `protobuf:"varint,10,opt,name=currbooschapter,proto3" json:"currbooschapter"` //当前boos章节 - Currbooschallengenum int32 `protobuf:"varint,11,opt,name=currbooschallengenum,proto3" json:"currbooschallengenum"` //当日boos挑战次数 - Lastboosrefresh int64 `protobuf:"varint,12,opt,name=lastboosrefresh,proto3" json:"lastboosrefresh"` //上一次boos刷新时间 + Currboosmodel int32 `protobuf:"varint,11,opt,name=currboosmodel,proto3" json:"currboosmodel"` //boos形象 + Currbooschallengenum int32 `protobuf:"varint,12,opt,name=currbooschallengenum,proto3" json:"currbooschallengenum"` //当日boos挑战次数 + Lastboosrefresh int64 `protobuf:"varint,13,opt,name=lastboosrefresh,proto3" json:"lastboosrefresh"` //上一次boos刷新时间 } func (x *DBMainline) Reset() { @@ -141,6 +142,13 @@ func (x *DBMainline) GetCurrbooschapter() int32 { return 0 } +func (x *DBMainline) GetCurrboosmodel() int32 { + if x != nil { + return x.Currboosmodel + } + return 0 +} + func (x *DBMainline) GetCurrbooschallengenum() int32 { if x != nil { return x.Currbooschallengenum @@ -357,7 +365,7 @@ var File_mainline_mainline_db_proto protoreflect.FileDescriptor var file_mainline_mainline_db_proto_rawDesc = []byte{ 0x0a, 0x1a, 0x6d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x2f, 0x6d, 0x61, 0x69, 0x6e, 0x6c, - 0x69, 0x6e, 0x65, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xac, 0x08, 0x0a, + 0x69, 0x6e, 0x65, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd2, 0x08, 0x0a, 0x0a, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 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, 0x38, 0x0a, @@ -388,87 +396,90 @@ var file_mainline_mainline_db_proto_rawDesc = []byte{ 0x52, 0x0b, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x63, 0x75, 0x72, 0x72, 0x62, 0x6f, 0x6f, 0x73, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x63, 0x75, 0x72, 0x72, 0x62, 0x6f, 0x6f, 0x73, - 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x14, 0x63, 0x75, 0x72, 0x72, 0x62, - 0x6f, 0x6f, 0x73, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x6e, 0x75, 0x6d, 0x18, - 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x14, 0x63, 0x75, 0x72, 0x72, 0x62, 0x6f, 0x6f, 0x73, 0x63, - 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x28, 0x0a, 0x0f, 0x6c, - 0x61, 0x73, 0x74, 0x62, 0x6f, 0x6f, 0x73, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x18, 0x0c, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x6c, 0x61, 0x73, 0x74, 0x62, 0x6f, 0x6f, 0x73, 0x72, 0x65, - 0x66, 0x72, 0x65, 0x73, 0x68, 0x1a, 0x3c, 0x0a, 0x0e, 0x4c, 0x61, 0x73, 0x74, 0x6c, 0x65, 0x76, + 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x62, + 0x6f, 0x6f, 0x73, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, + 0x63, 0x75, 0x72, 0x72, 0x62, 0x6f, 0x6f, 0x73, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x32, 0x0a, + 0x14, 0x63, 0x75, 0x72, 0x72, 0x62, 0x6f, 0x6f, 0x73, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, + 0x67, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x14, 0x63, 0x75, 0x72, + 0x72, 0x62, 0x6f, 0x6f, 0x73, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x6e, 0x75, + 0x6d, 0x12, 0x28, 0x0a, 0x0f, 0x6c, 0x61, 0x73, 0x74, 0x62, 0x6f, 0x6f, 0x73, 0x72, 0x65, 0x66, + 0x72, 0x65, 0x73, 0x68, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x6c, 0x61, 0x73, 0x74, + 0x62, 0x6f, 0x6f, 0x73, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x1a, 0x3c, 0x0a, 0x0e, 0x4c, + 0x61, 0x73, 0x74, 0x6c, 0x65, 0x76, 0x65, 0x6c, 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, 0x05, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x4c, 0x65, 0x76, 0x65, 0x6c, 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, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x4c, 0x65, 0x76, 0x65, 0x6c, 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, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x51, 0x0a, - 0x11, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x61, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, - 0x41, 0x77, 0x61, 0x72, 0x64, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, - 0x1a, 0x51, 0x0a, 0x11, 0x45, 0x78, 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x61, 0x77, 0x61, 0x72, 0x64, + 0x02, 0x38, 0x01, 0x1a, 0x51, 0x0a, 0x11, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x61, 0x77, + 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x44, 0x42, 0x4d, 0x61, + 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x41, 0x77, 0x61, 0x72, 0x64, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x51, 0x0a, 0x11, 0x45, 0x78, 0x70, 0x6c, 0x6f, 0x72, + 0x65, 0x61, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x26, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x44, + 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x41, 0x77, 0x61, 0x72, 0x64, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4f, 0x0a, 0x0f, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x61, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x26, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, + 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x41, 0x77, 0x61, 0x72, 0x64, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x35, 0x0a, 0x07, 0x50, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, - 0x69, 0x6e, 0x65, 0x41, 0x77, 0x61, 0x72, 0x64, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x02, 0x38, 0x01, 0x1a, 0x4f, 0x0a, 0x0f, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x61, 0x77, 0x61, 0x72, - 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, - 0x6c, 0x69, 0x6e, 0x65, 0x41, 0x77, 0x61, 0x72, 0x64, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x35, 0x0a, 0x07, 0x50, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x73, + 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, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x22, 0x94, 0x01, 0x0a, 0x0f, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, + 0x41, 0x77, 0x61, 0x72, 0x64, 0x12, 0x31, 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, + 0x65, 0x41, 0x77, 0x61, 0x72, 0x64, 0x2e, 0x41, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x67, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x67, 0x65, 0x1a, 0x38, + 0x0a, 0x0a, 0x41, 0x77, 0x61, 0x72, 0x64, 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, 0x05, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x96, 0x02, 0x0a, 0x0e, 0x44, 0x42, 0x4d, + 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x68, 0x6f, 0x70, 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, 0x36, 0x0a, + 0x07, 0x62, 0x75, 0x79, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, + 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x68, 0x6f, 0x70, 0x2e, + 0x42, 0x75, 0x79, 0x74, 0x69, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x62, 0x75, + 0x79, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x75, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, + 0x6e, 0x65, 0x53, 0x68, 0x6f, 0x70, 0x2e, 0x55, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x06, 0x75, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x1a, 0x3a, 0x0a, 0x0c, 0x42, 0x75, + 0x79, 0x74, 0x69, 0x6d, 0x65, 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, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x55, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, + 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, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x22, 0x82, 0x02, 0x0a, 0x0a, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x73, 0x6b, + 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, 0x2c, 0x0a, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x16, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x73, 0x6b, 0x2e, 0x54, + 0x61, 0x73, 0x6b, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, + 0x12, 0x2f, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x73, 0x6b, 0x2e, 0x52, 0x65, + 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, + 0x64, 0x1a, 0x38, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x73, 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, 0x05, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x43, - 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x62, 0x6f, 0x6f, 0x73, 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, 0x05, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x94, 0x01, 0x0a, 0x0f, - 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x41, 0x77, 0x61, 0x72, 0x64, 0x12, - 0x31, 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x41, 0x77, 0x61, 0x72, 0x64, - 0x2e, 0x41, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x61, 0x77, 0x61, - 0x72, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x67, 0x65, 0x1a, 0x38, 0x0a, 0x0a, 0x41, 0x77, 0x61, 0x72, - 0x64, 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, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x22, 0x96, 0x02, 0x0a, 0x0e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, - 0x65, 0x53, 0x68, 0x6f, 0x70, 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, 0x36, 0x0a, 0x07, 0x62, 0x75, 0x79, 0x74, 0x69, - 0x6d, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, - 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x68, 0x6f, 0x70, 0x2e, 0x42, 0x75, 0x79, 0x74, 0x69, 0x6d, - 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x62, 0x75, 0x79, 0x74, 0x69, 0x6d, 0x65, 0x12, - 0x33, 0x0a, 0x06, 0x75, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1b, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x68, 0x6f, 0x70, - 0x2e, 0x55, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x75, 0x6e, - 0x6c, 0x6f, 0x63, 0x6b, 0x1a, 0x3a, 0x0a, 0x0c, 0x42, 0x75, 0x79, 0x74, 0x69, 0x6d, 0x65, 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, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, - 0x1a, 0x39, 0x0a, 0x0b, 0x55, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 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, 0x05, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x82, 0x02, 0x0a, 0x0a, - 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x73, 0x6b, 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, 0x2c, 0x0a, 0x05, - 0x74, 0x61, 0x73, 0x6b, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x44, 0x42, - 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x73, 0x6b, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x52, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x12, 0x2f, 0x0a, 0x06, 0x72, 0x65, - 0x77, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x44, 0x42, 0x4d, - 0x61, 0x69, 0x6e, 0x54, 0x61, 0x73, 0x6b, 0x2e, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x52, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x1a, 0x38, 0x0a, 0x0a, 0x54, - 0x61, 0x73, 0x6b, 0x73, 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, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 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, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x52, + 0x65, 0x77, 0x61, 0x72, 0x64, 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 ( From b102f801884db7b35b4637dda7e55c7d5a068185 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 5 Sep 2023 16:48:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=80=9A=E8=BF=87=E5=8C=BA=E6=9C=8Did=20?= =?UTF-8?q?=E5=92=8C=E5=94=AF=E4=B8=80id=20=E6=9F=A5=E8=AF=A2=E5=9D=90?= =?UTF-8?q?=E9=AA=91=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 3 ++ modules/dragon/model_dragon.go | 64 ++++++++++++++++------------------ modules/dragon/module.go | 22 ++++++++++++ modules/modulebase.go | 4 +-- 4 files changed, 58 insertions(+), 35 deletions(-) diff --git a/comm/imodule.go b/comm/imodule.go index 4d8258272..7500dd652 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -660,5 +660,8 @@ type ( QueryBigDragonList(uid string) (dragon []*pb.DBDragon, err error) // 通过ID 查询龙的信息 QueryDragonById(uid string, dragonid string) (dragon *pb.DBDragon, err error) + + // 跨服接口 通过 服务器标签和唯一id 获取坐骑信息 + QueryDragonByTagAndOid(tag string, objId string) (dragon *pb.DBDragon, err error) } ) diff --git a/modules/dragon/model_dragon.go b/modules/dragon/model_dragon.go index b87c10c9f..af81204e0 100644 --- a/modules/dragon/model_dragon.go +++ b/modules/dragon/model_dragon.go @@ -82,10 +82,19 @@ func (this *ModelDragon) CreateDragon(session comm.IUserSession, dragons map[str return } } - bFound := false + dragon = &pb.DBDragon{ + Id: primitive.NewObjectID().Hex(), + Uid: uid, + Dragonid: dragonCfgId, + Lv: lv, + Exp: 0, + Property: map[string]int32{}, + Play: map[int32]*pb.PlayData{}, + Rtime: configure.Now().Unix(), + } for _, obj := range dragonList { if obj.Dragonid == dragonCfgId { // 重复获得 直接返回 - bFound = true + dragon.Id = obj.Id update := make(map[string]interface{}, 0) update["lv"] = lv // 更新等级 if err = this.UpdateDragonData(session.GetUserId(), obj.Id, update); err != nil { @@ -99,40 +108,29 @@ func (this *ModelDragon) CreateDragon(session comm.IUserSession, dragons map[str break } } - if !bFound { - dragon = &pb.DBDragon{ - Id: primitive.NewObjectID().Hex(), - Uid: uid, - Dragonid: dragonCfgId, - Lv: lv, - Exp: 0, - Property: map[string]int32{}, - Play: map[int32]*pb.PlayData{}, - Rtime: configure.Now().Unix(), - } - if conf, err := this.module.configure.GetDragonConfById(dragonCfgId, lv); err == nil { - if c, err := this.module.configure.GetDragonMount(dragonCfgId, conf.Type); err == nil { - dragon.Property["stime"] = c.Stime - dragon.Property["etime"] = c.Etime - dragon.Property["hp"] = c.Hp - dragon.Property["moderate"] = c.Moderate - dragon.Property["sprint"] = c.Sprint - dragon.Property["acceleration"] = c.Acceleration - dragon.Property["deceleration"] = c.Deceleration - // dragon.Property["itemsprint"] = c.Itemsprint - dragon.Property["caddtime"] = c.Caddtime - dragon.Property["csubtime"] = c.Csubtime - } - } - if dbModel != nil { - if dbModel, err1 := this.module.GetDBModelByUid(uid, this.TableName); err1 == nil { - err = dbModel.AddList(uid, dragonCfgId, dragon) - } - } else { - err = this.AddList(uid, dragonCfgId, dragon) + if conf, err := this.module.configure.GetDragonConfById(dragonCfgId, lv); err == nil { + if c, err := this.module.configure.GetDragonMount(dragonCfgId, conf.Type); err == nil { + dragon.Property["stime"] = c.Stime + dragon.Property["etime"] = c.Etime + dragon.Property["hp"] = c.Hp + dragon.Property["moderate"] = c.Moderate + dragon.Property["sprint"] = c.Sprint + dragon.Property["acceleration"] = c.Acceleration + dragon.Property["deceleration"] = c.Deceleration + // dragon.Property["itemsprint"] = c.Itemsprint + dragon.Property["caddtime"] = c.Caddtime + dragon.Property["csubtime"] = c.Csubtime } } + + if dbModel != nil { + if dbModel, err1 := this.module.GetDBModelByUid(uid, this.TableName); err1 == nil { + err = dbModel.AddList(uid, dragonCfgId, dragon) + } + } else { + err = this.AddList(uid, dragonCfgId, dragon) + } } chanegList = append(chanegList, dragon) session.SendMsg(string(this.module.GetType()), "change", &pb.DragonChangePush{ diff --git a/modules/dragon/module.go b/modules/dragon/module.go index 3a009ee3b..351383ffe 100644 --- a/modules/dragon/module.go +++ b/modules/dragon/module.go @@ -8,6 +8,10 @@ import ( "go_dreamfactory/pb" "go_dreamfactory/sys/configure" cfg "go_dreamfactory/sys/configure/structs" + "go_dreamfactory/sys/db" + "time" + + "go.mongodb.org/mongo-driver/bson" ) func NewModule() core.IModule { @@ -126,3 +130,21 @@ func (this *Dragon) QueryDragonById(uid string, dragonid string) (dragon *pb.DBD err = fmt.Errorf("not found dragon dragonid:%s", dragonid) return } + +// 通过区服id 和唯一id 查询坐骑信息 +func (this *Dragon) QueryDragonByTagAndOid(tag string, objId string) (dragon *pb.DBDragon, err error) { + var ( + conn *db.DBConn + model *db.DBModel + ) + if conn, err = db.ServerDBConn(tag); err != nil { + return + } + dragon = &pb.DBDragon{} + model = db.NewDBModel(this.modelDragon.TableName, time.Hour, conn) + if model.DB.FindOne(comm.TableHero, bson.M{"_id": objId}).Decode(dragon); err != nil { + return + } + + return +} diff --git a/modules/modulebase.go b/modules/modulebase.go index 48976d2ff..fbdda3575 100644 --- a/modules/modulebase.go +++ b/modules/modulebase.go @@ -469,7 +469,7 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat case comm.PandaType: panda[v.T] = 1 case comm.MountsType: - mts[v.T] = 1 + mts[v.T] = v.N // N 表示等级 case comm.PerType: per[v.T] = 1 default: @@ -691,7 +691,7 @@ func (this *ModuleBase) DispenseAtno(session comm.IUserSession, res []*cfg.Gamea case comm.PandaType: panda[v.T] = 1 case comm.MountsType: - mts[v.T] = 1 + mts[v.T] += v.N case comm.PerType: per[v.T] = 1 default: