From d60181b948fd5febd9bcf600be687d4142290e74 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 13 Oct 2022 10:14:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=BF=80=E6=B4=BB=E7=BE=81=E7=BB=8A=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/library/api.go | 17 ++- modules/library/api_activationfetter.go | 41 ++++++ pb/battle_db.pb.go | 24 +-- pb/errorcode.pb.go | 17 ++- pb/library_msg.pb.go | 185 ++++++++++++++++++++---- 5 files changed, 232 insertions(+), 52 deletions(-) create mode 100644 modules/library/api_activationfetter.go diff --git a/modules/library/api.go b/modules/library/api.go index e1c9b5a72..1415e74bf 100644 --- a/modules/library/api.go +++ b/modules/library/api.go @@ -6,14 +6,15 @@ import ( ) const ( - LibraryGetListResp = "getlist" - LibraryUseGiftResp = "usegift" - LibraryGetFetterListResp = "getfetterlist" - LibraryChallengeResp = "challenge" - LibrarySkillLvResp = "skilllv" - LibraryGetRewardResp = "getreward" - LibraryBuyResp = "buy" - LibraryRankListResp = "ranklist" + LibraryGetListResp = "getlist" + LibraryUseGiftResp = "usegift" + LibraryGetFetterListResp = "getfetterlist" + LibraryChallengeResp = "challenge" + LibrarySkillLvResp = "skilllv" + LibraryGetRewardResp = "getreward" + LibraryBuyResp = "buy" + LibraryRankListResp = "ranklist" + LibraryActivationFetterResp = "activationfetter" ) type apiComp struct { diff --git a/modules/library/api_activationfetter.go b/modules/library/api_activationfetter.go new file mode 100644 index 000000000..5ddb169be --- /dev/null +++ b/modules/library/api_activationfetter.go @@ -0,0 +1,41 @@ +package library + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +//参数校验 +func (this *apiComp) ActivationFetterCheck(session comm.IUserSession, req *pb.LibraryActivationFetterReq) (code pb.ErrorCode) { + if req.Oid == "" { + code = pb.ErrorCode_ReqParameterError + } + return +} + +func (this *apiComp) ActivationFetter(session comm.IUserSession, req *pb.LibraryActivationFetterReq) (code pb.ErrorCode, data proto.Message) { + + code = this.ActivationFetterCheck(session, req) + if code != pb.ErrorCode_Success { + return // 参数校验失败直接返回 + } + rsp := &pb.LibraryActivationFetterResp{} + defer session.SendMsg(string(this.module.GetType()), LibraryActivationFetterResp, rsp) + fetter := this.module.modelLibrary.getOneLibrary(session.GetUserId(), req.Oid) + if fetter == nil { + code = pb.ErrorCode_LibraryNoData + return + } + if fetter.Activation { + code = pb.ErrorCode_LibraryActivation + return + } + fetter.Activation = true + mapData := make(map[string]interface{}, 0) + mapData["activation"] = fetter.Activation + this.module.modelLibrary.modifyLibraryDataByObjId(session.GetUserId(), fetter.Id, mapData) + + return +} diff --git a/pb/battle_db.pb.go b/pb/battle_db.pb.go index 20066f71f..e2fa769f6 100644 --- a/pb/battle_db.pb.go +++ b/pb/battle_db.pb.go @@ -79,9 +79,9 @@ const ( PlayType_moonfantasy PlayType = 0 //月之秘境 PlayType_mainline PlayType = 1 //主线玩法 PlayType_pagoda PlayType = 2 //爬塔 - PlayType_viking PlayType = 3 //远征 - PlayType_rtask PlayType = 4 //随机任务 - PlayType_hunting PlayType = 5 //狩猎 + PlayType_rtask PlayType = 3 //随机任务战斗 + PlayType_hunting PlayType = 4 //狩猎 + PlayType_viking PlayType = 5 //维京远征 ) // Enum value maps for PlayType. @@ -90,17 +90,17 @@ var ( 0: "moonfantasy", 1: "mainline", 2: "pagoda", - 3: "viking", - 4: "rtask", - 5: "hunting", + 3: "rtask", + 4: "hunting", + 5: "viking", } PlayType_value = map[string]int32{ "moonfantasy": 0, "mainline": 1, "pagoda": 2, - "viking": 3, - "rtask": 4, - "hunting": 5, + "rtask": 3, + "hunting": 4, + "viking": 5, } ) @@ -615,9 +615,9 @@ var file_battle_battle_db_proto_rawDesc = []byte{ 0x70, 0x76, 0x62, 0x10, 0x03, 0x2a, 0x59, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x6d, 0x6f, 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61, 0x73, 0x79, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x6d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x10, 0x01, - 0x12, 0x0a, 0x0a, 0x06, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, - 0x76, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x72, 0x74, 0x61, 0x73, - 0x6b, 0x10, 0x04, 0x12, 0x0b, 0x0a, 0x07, 0x68, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x10, 0x05, + 0x12, 0x0a, 0x0a, 0x06, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, + 0x72, 0x74, 0x61, 0x73, 0x6b, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x68, 0x75, 0x6e, 0x74, 0x69, + 0x6e, 0x67, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x10, 0x05, 0x2a, 0x1f, 0x0a, 0x0c, 0x42, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x69, 0x6e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x10, 0x02, 0x2a, 0x2b, 0x0a, 0x0c, 0x44, 0x42, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6d, diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index cb2f35901..8cb072ede 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -190,7 +190,9 @@ const ( ErrorCode_HuntingBuyMaxCount ErrorCode = 2703 // 购买达到最大次数 ErrorCode_HuntingMaxChallengeCount ErrorCode = 2704 // 挑战达到最大次数 // library - ErrorCode_LibraryMaxLv ErrorCode = 2801 // 达到最大等级 + ErrorCode_LibraryMaxLv ErrorCode = 2801 // 达到最大等级 + ErrorCode_LibraryNoData ErrorCode = 2802 // 没找到羁绊数据 + ErrorCode_LibraryActivation ErrorCode = 2803 // 已经是激活状态 ) // Enum value maps for ErrorCode. @@ -347,6 +349,8 @@ var ( 2703: "HuntingBuyMaxCount", 2704: "HuntingMaxChallengeCount", 2801: "LibraryMaxLv", + 2802: "LibraryNoData", + 2803: "LibraryActivation", } ErrorCode_value = map[string]int32{ "Success": 0, @@ -500,6 +504,8 @@ var ( "HuntingBuyMaxCount": 2703, "HuntingMaxChallengeCount": 2704, "LibraryMaxLv": 2801, + "LibraryNoData": 2802, + "LibraryActivation": 2803, } ) @@ -534,7 +540,7 @@ var File_errorcode_proto protoreflect.FileDescriptor var file_errorcode_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2a, 0xa3, 0x1a, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0xcf, 0x1a, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12, 0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, @@ -744,8 +750,11 @@ var file_errorcode_proto_rawDesc = []byte{ 0x6e, 0x74, 0x10, 0x8f, 0x15, 0x12, 0x1d, 0x0a, 0x18, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x78, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0x90, 0x15, 0x12, 0x11, 0x0a, 0x0c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x4d, - 0x61, 0x78, 0x4c, 0x76, 0x10, 0xf1, 0x15, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x78, 0x4c, 0x76, 0x10, 0xf1, 0x15, 0x12, 0x12, 0x0a, 0x0d, 0x4c, 0x69, 0x62, 0x72, 0x61, + 0x72, 0x79, 0x4e, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x10, 0xf2, 0x15, 0x12, 0x16, 0x0a, 0x11, 0x4c, + 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x10, 0xf3, 0x15, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/pb/library_msg.pb.go b/pb/library_msg.pb.go index a66c6d480..80cbb9664 100644 --- a/pb/library_msg.pb.go +++ b/pb/library_msg.pb.go @@ -501,6 +501,101 @@ func (x *LibraryUseGiftResp) GetData() *DBHeroFetter { return nil } +// 激活羁绊 +type LibraryActivationFetterReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Oid string `protobuf:"bytes,1,opt,name=oid,proto3" json:"oid"` //对象id +} + +func (x *LibraryActivationFetterReq) Reset() { + *x = LibraryActivationFetterReq{} + if protoimpl.UnsafeEnabled { + mi := &file_library_library_msg_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LibraryActivationFetterReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LibraryActivationFetterReq) ProtoMessage() {} + +func (x *LibraryActivationFetterReq) ProtoReflect() protoreflect.Message { + mi := &file_library_library_msg_proto_msgTypes[10] + 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 LibraryActivationFetterReq.ProtoReflect.Descriptor instead. +func (*LibraryActivationFetterReq) Descriptor() ([]byte, []int) { + return file_library_library_msg_proto_rawDescGZIP(), []int{10} +} + +func (x *LibraryActivationFetterReq) GetOid() string { + if x != nil { + return x.Oid + } + return "" +} + +type LibraryActivationFetterResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data *DBLibrary `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` +} + +func (x *LibraryActivationFetterResp) Reset() { + *x = LibraryActivationFetterResp{} + if protoimpl.UnsafeEnabled { + mi := &file_library_library_msg_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LibraryActivationFetterResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LibraryActivationFetterResp) ProtoMessage() {} + +func (x *LibraryActivationFetterResp) ProtoReflect() protoreflect.Message { + mi := &file_library_library_msg_proto_msgTypes[11] + 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 LibraryActivationFetterResp.ProtoReflect.Descriptor instead. +func (*LibraryActivationFetterResp) Descriptor() ([]byte, []int) { + return file_library_library_msg_proto_rawDescGZIP(), []int{11} +} + +func (x *LibraryActivationFetterResp) GetData() *DBLibrary { + if x != nil { + return x.Data + } + return nil +} + var File_library_library_msg_proto protoreflect.FileDescriptor var file_library_library_msg_proto_rawDesc = []byte{ @@ -547,8 +642,15 @@ var file_library_library_msg_proto_rawDesc = []byte{ 0x12, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x55, 0x73, 0x65, 0x47, 0x69, 0x66, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, - 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x2e, 0x0a, 0x1a, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, + 0x79, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x65, 0x74, 0x74, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6f, 0x69, 0x64, 0x22, 0x3d, 0x0a, 0x1b, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, + 0x79, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x65, 0x74, 0x74, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -563,34 +665,37 @@ func file_library_library_msg_proto_rawDescGZIP() []byte { return file_library_library_msg_proto_rawDescData } -var file_library_library_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_library_library_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_library_library_msg_proto_goTypes = []interface{}{ - (*LibraryGetListReq)(nil), // 0: LibraryGetListReq - (*LibraryGetListResp)(nil), // 1: LibraryGetListResp - (*LibraryGetFetterListReq)(nil), // 2: LibraryGetFetterListReq - (*LibraryGetFetterListResp)(nil), // 3: LibraryGetFetterListResp - (*LibraryGetRewardReq)(nil), // 4: LibraryGetRewardReq - (*LibraryGetRewardResp)(nil), // 5: LibraryGetRewardResp - (*LibraryGetStoryRewardReq)(nil), // 6: LibraryGetStoryRewardReq - (*LibraryGetStoryRewardResp)(nil), // 7: LibraryGetStoryRewardResp - (*LibraryUseGiftReq)(nil), // 8: LibraryUseGiftReq - (*LibraryUseGiftResp)(nil), // 9: LibraryUseGiftResp - nil, // 10: LibraryUseGiftReq.ItemsEntry - (*DBLibrary)(nil), // 11: DBLibrary - (*DBHeroFetter)(nil), // 12: DBHeroFetter + (*LibraryGetListReq)(nil), // 0: LibraryGetListReq + (*LibraryGetListResp)(nil), // 1: LibraryGetListResp + (*LibraryGetFetterListReq)(nil), // 2: LibraryGetFetterListReq + (*LibraryGetFetterListResp)(nil), // 3: LibraryGetFetterListResp + (*LibraryGetRewardReq)(nil), // 4: LibraryGetRewardReq + (*LibraryGetRewardResp)(nil), // 5: LibraryGetRewardResp + (*LibraryGetStoryRewardReq)(nil), // 6: LibraryGetStoryRewardReq + (*LibraryGetStoryRewardResp)(nil), // 7: LibraryGetStoryRewardResp + (*LibraryUseGiftReq)(nil), // 8: LibraryUseGiftReq + (*LibraryUseGiftResp)(nil), // 9: LibraryUseGiftResp + (*LibraryActivationFetterReq)(nil), // 10: LibraryActivationFetterReq + (*LibraryActivationFetterResp)(nil), // 11: LibraryActivationFetterResp + nil, // 12: LibraryUseGiftReq.ItemsEntry + (*DBLibrary)(nil), // 13: DBLibrary + (*DBHeroFetter)(nil), // 14: DBHeroFetter } var file_library_library_msg_proto_depIdxs = []int32{ - 11, // 0: LibraryGetListResp.data:type_name -> DBLibrary - 12, // 1: LibraryGetFetterListResp.data:type_name -> DBHeroFetter - 11, // 2: LibraryGetRewardResp.data:type_name -> DBLibrary - 11, // 3: LibraryGetStoryRewardResp.data:type_name -> DBLibrary - 10, // 4: LibraryUseGiftReq.items:type_name -> LibraryUseGiftReq.ItemsEntry - 12, // 5: LibraryUseGiftResp.data:type_name -> DBHeroFetter - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 13, // 0: LibraryGetListResp.data:type_name -> DBLibrary + 14, // 1: LibraryGetFetterListResp.data:type_name -> DBHeroFetter + 13, // 2: LibraryGetRewardResp.data:type_name -> DBLibrary + 13, // 3: LibraryGetStoryRewardResp.data:type_name -> DBLibrary + 12, // 4: LibraryUseGiftReq.items:type_name -> LibraryUseGiftReq.ItemsEntry + 14, // 5: LibraryUseGiftResp.data:type_name -> DBHeroFetter + 13, // 6: LibraryActivationFetterResp.data:type_name -> DBLibrary + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_library_library_msg_proto_init() } @@ -720,6 +825,30 @@ func file_library_library_msg_proto_init() { return nil } } + file_library_library_msg_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LibraryActivationFetterReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_library_library_msg_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LibraryActivationFetterResp); 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{ @@ -727,7 +856,7 @@ func file_library_library_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_library_library_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 11, + NumMessages: 13, NumExtensions: 0, NumServices: 0, },