diff --git a/dist.rar b/dist.rar index 7761200..220232f 100644 Binary files a/dist.rar and b/dist.rar differ diff --git a/pb.bat b/pb.bat index b1d22b9..cece5bb 100644 --- a/pb.bat +++ b/pb.bat @@ -14,6 +14,5 @@ set TAR=%PROJECT_ROOT%\src\pb\js @REM protoc --proto_path=%SRC% --js_out=import_style=commonjs,binary:%TAR%\. %SRC%\pack\*.proto @REM protoc --proto_path=%SRC% --js_out=import_style=commonjs,binary:%TAR%\. %SRC%\mail\*.proto -npx pbjs -t json-module -w commonjs -o src/pb/proto.js %SRC%\*.proto - +npx pbjs -t json-module -w commonjs -o src/pb/proto.js %SRC%\*.proto pause \ No newline at end of file diff --git a/src/pb/proto.js b/src/pb/proto.js index 3afee74..4fb52d1 100644 --- a/src/pb/proto.js +++ b/src/pb/proto.js @@ -71,7 +71,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr id: 2 }, ErrorData: { - type: "string", + type: "google.protobuf.Any", id: 3 }, Reply: { @@ -111,17 +111,10 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr type: "string", id: 1 }, - MainType: { - type: "string", + Reply: { + rule: "repeated", + type: "UserMessage", id: 2 - }, - SubType: { - type: "string", - id: 3 - }, - Data: { - type: "google.protobuf.Any", - id: 4 } } }, @@ -191,6 +184,30 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr Crit: 4 } }, + UserAssets: { + fields: { + A: { + type: "string", + id: 1 + }, + T: { + type: "string", + id: 2 + }, + N: { + type: "int32", + id: 3 + } + } + }, + TaskParam: { + fields: { + first: { + type: "int32", + id: 1 + } + } + }, ErrorCode: { values: { Success: 0, @@ -218,6 +235,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr GoldNoEnough: 1003, DiamondNoEnough: 1004, RoleCreated: 1005, + NameExist: 1006, FriendNotSelf: 1100, FriendSelfMax: 1101, FriendTargetMax: 1102, @@ -245,8 +263,20 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr HeroNotNeedResonate: 1308, HeroNoEnergy: 1309, HeroCreate: 1310, + HeroEquipUpdate: 1311, + HeroMaxAwaken: 1312, + HeroIsLock: 1313, EquipmentOnFoundEquipment: 1400, - EquipmentLvlimitReached: 1401 + EquipmentLvlimitReached: 1401, + StoryNotFindChapter: 1500, + StoryIDFailed: 1501, + TaskInit: 1600, + TaskReset: 1601, + TaskHandle: 1602, + TaskReceived: 1603, + TaskActiveInit: 1606, + TaskActiveNofound: 1604, + TaskActiveNoenough: 1605 } }, google: { @@ -395,7 +425,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr }, DBFriend: { fields: { - uId: { + uid: { type: "string", id: 1 }, @@ -451,7 +481,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr FriendListReq: { fields: {} }, - FriendListRsp: { + FriendListResp: { fields: { list: { rule: "repeated", @@ -468,7 +498,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, - FriendApplyRsp: { + FriendApplyResp: { fields: { userId: { type: "string", @@ -488,7 +518,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, - FriendDelRsp: { + FriendDelResp: { fields: { friendId: { type: "string", @@ -509,7 +539,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, - FriendAgreeRsp: { + FriendAgreeResp: { fields: { Num: { type: "int32", @@ -526,7 +556,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, - FriendRefuseRsp: { + FriendRefuseResp: { fields: { Num: { type: "int32", @@ -537,7 +567,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr FriendApplyListReq: { fields: {} }, - FriendApplyListRsp: { + FriendApplyListResp: { fields: { list: { rule: "repeated", @@ -554,7 +584,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, - FriendSearchRsp: { + FriendSearchResp: { fields: { friend: { type: "FriendBase", @@ -565,7 +595,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr FriendBlackListReq: { fields: {} }, - FriendBlackListRsp: { + FriendBlackListResp: { fields: { friends: { rule: "repeated", @@ -582,7 +612,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, - FriendBlackAddRsp: { + FriendBlackAddResp: { fields: { friendId: { type: "string", @@ -602,7 +632,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, - FriendDelBlackRsp: { + FriendDelBlackResp: { fields: { friendId: { type: "string", @@ -622,7 +652,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, - FriendReceiveRsp: { + FriendReceiveResp: { fields: { friendId: { type: "string", @@ -642,7 +672,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, - FriendGiveRsp: { + FriendGiveResp: { fields: { friendId: { type: "string", @@ -662,7 +692,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, - FriendTotalRsp: { + FriendTotalResp: { fields: { friendId: { type: "string", @@ -800,7 +830,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, - HeroInfoRsp: { + HeroInfoResp: { fields: { base: { type: "DBHero", @@ -811,7 +841,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr HeroListReq: { fields: {} }, - HeroListRsp: { + HeroListResp: { fields: { list: { rule: "repeated", @@ -921,12 +951,9 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr id: 1 }, costObjID: { + rule: "repeated", type: "string", id: 2 - }, - amount: { - type: "int32", - id: 3 } } }, @@ -1042,6 +1069,22 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, + HeroLockReq: { + fields: { + heroid: { + type: "string", + id: 1 + } + } + }, + HeroLockResp: { + fields: { + hero: { + type: "DBHero", + id: 1 + } + } + }, DB_UserItemData: { fields: { gridId: { @@ -1098,7 +1141,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr ItemsUseItemReq: { fields: { GridId: { - type: "int32", + type: "string", id: 1 }, ItemId: { @@ -1117,7 +1160,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr ItemsSellItemReq: { fields: { GridId: { - type: "int32", + type: "string", id: 1 }, ItemId: { @@ -1133,18 +1176,6 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr ItemsSellItemResp: { fields: {} }, - MailAttachment: { - fields: { - ItemId: { - type: "uint32", - id: 1 - }, - ItemCount: { - type: "uint32", - id: 2 - } - } - }, DBMailData: { fields: { ObjId: { @@ -1181,7 +1212,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr }, Items: { rule: "repeated", - type: "MailAttachment", + type: "UserAssets", id: 9 } } @@ -1247,6 +1278,42 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, + MailGetNewMailPush: { + fields: { + Mail: { + type: "DBMailData", + id: 1 + } + } + }, + DBSystemNotify: { + fields: { + id: { + type: "string", + id: 1 + }, + title: { + type: "string", + id: 2 + }, + content: { + type: "string", + id: 3 + }, + istop: { + type: "bool", + id: 4 + }, + ctime: { + type: "int64", + id: 5 + }, + rtime: { + type: "int64", + id: 6 + } + } + }, NotifyErrorNotifyPush: { fields: { ReqMainType: { @@ -1267,7 +1334,392 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr }, Data: { type: "string", + id: 5 + } + } + }, + NotifyGetListReq: { + fields: {} + }, + NotifyGetListResp: { + fields: { + LastReadTime: { + type: "int64", + id: 1 + }, + SysNotify: { + rule: "repeated", + type: "DBSystemNotify", + id: 2 + } + } + }, + ShopType: { + values: { + Null: 0, + GoldShop: 1, + DiamondShop: 2, + PVPShop: 3, + PVEShop: 4, + AllianceShop: 5 + } + }, + UserShopData: { + fields: { + LastRefreshTime: { + type: "int64", + id: 1 + }, + ManualRefreshNum: { + type: "int32", + id: 2 + }, + Items: { + rule: "repeated", + type: "int32", + id: 3 + } + } + }, + DBShop: { + fields: { + id: { + type: "string", + id: 1 + }, + uid: { + type: "string", + id: 2 + }, + goldShop: { + type: "UserShopData", + id: 3 + }, + diamondShop: { + type: "UserShopData", + id: 4 + }, + pvpShop: { + type: "UserShopData", + id: 5 + }, + pveShop: { + type: "UserShopData", id: 6 + }, + allianceShop: { + type: "UserShopData", + id: 7 + } + } + }, + DBShopItem: { + fields: { + id: { + type: "string", + id: 1 + }, + uid: { + type: "string", + id: 2 + }, + goodsId: { + type: "int32", + id: 3 + }, + buyNum: { + type: "int32", + id: 4 + }, + lastBuyTime: { + type: "int64", + id: 5 + } + } + }, + ShopItem: { + fields: { + GoodsId: { + type: "int32", + id: 1 + }, + Items: { + rule: "repeated", + type: "UserAssets", + id: 2 + }, + Consume: { + rule: "repeated", + type: "UserAssets", + id: 3 + }, + Sale: { + type: "int32", + id: 4 + }, + LeftBuyNum: { + type: "int32", + id: 5 + } + } + }, + ShopGetListReq: { + fields: { + sType: { + type: "ShopType", + id: 1 + }, + IsManualRefresh: { + type: "bool", + id: 2 + } + } + }, + ShopGetListResp: { + fields: { + Goods: { + rule: "repeated", + type: "ShopItem", + id: 1 + } + } + }, + ShopBuyReq: { + fields: { + GoodsId: { + type: "int32", + id: 1 + } + } + }, + ShopBuyResp: { + fields: { + IsSucc: { + type: "bool", + id: 1 + } + } + }, + DBStory: { + fields: { + id: { + type: "string", + id: 1 + }, + uid: { + type: "string", + id: 2 + }, + chapterId: { + type: "int32", + id: 3 + }, + storyId: { + type: "int32", + id: 4 + }, + intensity: { + type: "int32", + id: 5 + }, + awaredID: { + type: "int32", + id: 6 + }, + progress: { + type: "int32", + id: 7 + }, + totalBox: { + type: "int32", + id: 8 + }, + branchID: { + rule: "repeated", + type: "int32", + id: 9 + } + } + }, + StoryGetListReq: { + fields: {} + }, + StoryGetListResp: { + fields: { + data: { + rule: "repeated", + type: "DBStory", + id: 1 + } + } + }, + StoryGetRewrdReq: { + fields: { + chapterId: { + type: "uint32", + id: 1 + }, + boxId: { + type: "uint32", + id: 2 + } + } + }, + StoryGetRewrdResp: { + fields: { + data: { + type: "DBStory", + id: 1 + } + } + }, + StoryChallengeReq: { + fields: { + chapterId: { + type: "uint32", + id: 1 + }, + storyId: { + type: "uint32", + id: 2 + } + } + }, + StoryChallengeResp: { + fields: { + data: { + type: "DBStory", + id: 1 + } + } + }, + DBTask: { + fields: { + id: { + type: "string", + id: 1 + }, + uid: { + type: "string", + id: 2 + }, + taskId: { + type: "int32", + id: 3 + }, + progress: { + type: "int32", + id: 4 + }, + active: { + type: "int32", + id: 5 + }, + status: { + type: "int32", + id: 6 + }, + received: { + type: "int32", + id: 7 + } + } + }, + DBTaskActive: { + fields: { + id: { + type: "string", + id: 1 + }, + uid: { + type: "string", + id: 2 + }, + rId: { + type: "int32", + id: 3 + }, + received: { + type: "int32", + id: 4 + } + } + }, + TaskReceiveReq: { + fields: { + taskTag: { + type: "int32", + id: 1 + }, + id: { + type: "string", + id: 2 + } + } + }, + TaskReceiveResp: { + fields: { + taskId: { + type: "int32", + id: 1 + } + } + }, + TaskListReq: { + fields: { + taskTag: { + type: "int32", + id: 1 + } + } + }, + TaskListResp: { + fields: { + list: { + rule: "repeated", + type: "DBTask", + id: 1 + } + } + }, + TaskActiveListReq: { + fields: { + taskTag: { + type: "int32", + id: 1 + } + } + }, + TaskActiveListResp: { + fields: { + list: { + rule: "repeated", + type: "DBTaskActive", + id: 1 + } + } + }, + TaskActiveReceiveReq: { + fields: { + taskTag: { + type: "int32", + id: 1 + }, + id: { + type: "string", + id: 2 + } + } + }, + TaskActiveReceiveResp: { + fields: { + taskTag: { + type: "int32", + id: 1 + }, + id: { + type: "string", + id: 2 } } }, @@ -1284,6 +1736,10 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr GatewayServiceId: { type: "string", id: 3 + }, + ip: { + type: "string", + id: 4 } } }, @@ -1348,6 +1804,18 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr created: { type: "bool", id: 15 + }, + lv: { + type: "int32", + id: 16 + }, + vip: { + type: "int32", + id: 17 + }, + diamond: { + type: "int32", + id: 18 } } }, @@ -1383,7 +1851,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, - UserRegisterRsp: { + UserRegisterResp: { fields: { Code: { type: "ErrorCode", @@ -1395,7 +1863,7 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, - UserLoadRsp: { + UserLoadResp: { fields: { data: { type: "CacheUser", @@ -1411,30 +1879,22 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, - UserCreateRsp: { + UserCreateResp: { fields: {} }, UserAddResReq: { fields: { - resType: { - type: "string", + res: { + type: "UserAssets", id: 1 - }, - count: { - type: "int32", - id: 2 } } }, UserAddResResp: { fields: { - resType: { - type: "string", + res: { + type: "UserAssets", id: 1 - }, - count: { - type: "int32", - id: 2 } } } diff --git a/src/pb/proto/comm.proto b/src/pb/proto/comm.proto index 41e4797..ba2de3d 100644 --- a/src/pb/proto/comm.proto +++ b/src/pb/proto/comm.proto @@ -27,7 +27,7 @@ message AgentMessage { message RPCMessageReply { ErrorCode Code = 1; string ErrorMessage = 2; - string ErrorData = 3; + google.protobuf.Any ErrorData = 3; repeated UserMessage Reply = 4; } @@ -43,9 +43,7 @@ message AgentUnBuildReq { string UserSessionId = 1; } //向用户代理发送消息请求 message AgentSendMessageReq { string UserSessionId = 1; - string MainType = 2; - string SubType = 3; - google.protobuf.Any Data = 4; + repeated UserMessage Reply = 2; } //发送批量消息 @@ -67,13 +65,27 @@ message BroadCastMessageReq { message AgentCloseeReq { string UserSessionId = 1; } //通知用户离线 -message NoticeUserCloseReq {string UserSessionId = 1; string UserId = 2; } +message NoticeUserCloseReq { + string UserSessionId = 1; + string UserId = 2; +} //英雄属性类型 -enum HeroAttributesType{ - Hp = 0; //血量 - Atk = 1; //攻击 - Def = 2; //防御 +enum HeroAttributesType { + Hp = 0; //血量 + Atk = 1; //攻击 + Def = 2; //防御 Speed = 3; //速度 - Crit = 4; //暴击 + Crit = 4; //暴击 +} + +//用户资产数据 对标*cfg.Game_atn 数据结构 +message UserAssets { + string A = 1; + string T = 2; + int32 N = 3; +} + +message TaskParam { + int32 first = 1; //限定条件 } \ No newline at end of file diff --git a/src/pb/proto/equipment_msg.proto b/src/pb/proto/equipment_msg.proto index 5619a88..1518e57 100644 --- a/src/pb/proto/equipment_msg.proto +++ b/src/pb/proto/equipment_msg.proto @@ -3,31 +3,32 @@ option go_package = ".;pb"; import "equipment_db.proto"; //获取装备列表请求 -message EquipmentGetListReq {} +message EquipmentGetListReq { + +} //获取装备列表请求 回应 message EquipmentGetListResp { - repeated DB_Equipment Equipments = 1; //装备列表 + repeated DB_Equipment Equipments = 1; //装备列表 } //装备挂在到英雄上 -message EquipmentEquipReq { - string HeroCardId = 1; //英雄卡Id - repeated string EquipmentId = 2; //装备Id 固定长度的数组 0-5 对应的装备栏 +message EquipmentEquipReq{ + string HeroCardId = 1; //英雄卡Id + repeated string EquipmentId = 2; //装备Id 固定长度的数组 0-5 对应的装备栏 } //装备挂在到英雄上 回应 -message EquipmentEquipResp { - repeated DB_Equipment Equipments = 1; //挂在装备列表 +message EquipmentEquipResp{ + repeated DB_Equipment Equipments = 1; //挂在装备列表 } //装备升级 -message EquipmentUpgradeReq { - string EquipmentId = 1; //装备Id +message EquipmentUpgradeReq{ + string EquipmentId = 1; //装备Id } //装备升级 回应 -message EquipmentUpgradeResp { - bool IsSucc = 1; - repeated DB_Equipment Equipment = - 2; //由于装备可以叠加 升级后会创建一个新的装备出来 所以可能影响两个装备 +message EquipmentUpgradeResp{ + bool IsSucc = 1; + repeated DB_Equipment Equipment = 2; //由于装备可以叠加 升级后会创建一个新的装备出来 所以可能影响两个装备 } \ No newline at end of file diff --git a/src/pb/proto/errorcode.proto b/src/pb/proto/errorcode.proto index e519f65..9f8b44f 100644 --- a/src/pb/proto/errorcode.proto +++ b/src/pb/proto/errorcode.proto @@ -29,6 +29,7 @@ enum ErrorCode { GoldNoEnough = 1003; // 金币不足 DiamondNoEnough = 1004; // 钻石不足 RoleCreated = 1005; //已创角 + NameExist = 1006; //昵称已存在 // friend FriendNotSelf = 1100; //不能是自己 @@ -51,20 +52,34 @@ enum ErrorCode { ItemsGirdAmountUpper = 1203; //背包格子容量已达上限 // hero - HeroNoExist = 1300; //英雄不存在 - HeroNoEnough = 1301; //英雄数量不足 - HeroMaxLv = 1302; //英雄达到最大等级 - HeroInitCreat = 1303; //初始化英雄 - - HeroColorErr = 1304; // 品质不匹配 - HeroSkillUpErr = 1305;// 技能升级失败 - HeroMaxResonate = 1306; // 达到最大共鸣次数 - HeroNoResonate = 1307; // 没有共鸣 + HeroNoExist = 1300; //英雄不存在 + HeroNoEnough = 1301; //英雄数量不足 + HeroMaxLv = 1302; //英雄达到最大等级 + HeroInitCreat = 1303; //初始化英雄 + HeroColorErr = 1304; // 品质不匹配 + HeroSkillUpErr = 1305; // 技能升级失败 + HeroMaxResonate = 1306; // 达到最大共鸣次数 + HeroNoResonate = 1307; // 没有共鸣 HeroNotNeedResonate = 1308; // 不需要重置共鸣 - HeroNoEnergy = 1309; // 没有能量点数 - HeroCreate = 1310; // 创建卡失败 + HeroNoEnergy = 1309; // 没有能量点数 + HeroCreate = 1310; // 创建卡失败 + HeroEquipUpdate = 1311; // 更新装备失败 + HeroMaxAwaken = 1312; // 达到最大觉醒等级 + HeroIsLock = 1313; // 英雄被锁定不能被消耗 // equipment EquipmentOnFoundEquipment = 1400; // 未找到武器 EquipmentLvlimitReached = 1401; // 武器等级已达上限 + // mainStory + StoryNotFindChapter = 1500; // 没有找到主线关卡信息 + StoryIDFailed = 1501; // 关卡ID 错误 + + // task + TaskInit = 1600; //初始化失败 + TaskReset = 1601; //重置任务失败 + TaskHandle = 1602; //任务处理失败 + TaskReceived = 1603; //已领取 + TaskActiveInit = 1606; //初始化活跃度失败 + TaskActiveNofound = 1604; //未找到用户活跃度配置 + TaskActiveNoenough = 1605; //活跃值未达标 } \ No newline at end of file diff --git a/src/pb/proto/friend_db.proto b/src/pb/proto/friend_db.proto index e4944d2..41072cf 100644 --- a/src/pb/proto/friend_db.proto +++ b/src/pb/proto/friend_db.proto @@ -2,7 +2,7 @@ syntax = "proto3"; option go_package = ".;pb"; message DBFriend { - string uId = 1; //@go_tags(`bson:"uId"`) 用户ID + string uid = 1; //@go_tags(`bson:"uid"`) 用户ID repeated string friendIds = 2; //@go_tags(`bson:"friendIds"`) 好友ID repeated string applyIds = 3; //@go_tags(`bson:"applyIds"`) 申请用户ID repeated string blackIds = 4; //@go_tags(`bson:"blackIds"`) 黑名单ID diff --git a/src/pb/proto/friend_msg.proto b/src/pb/proto/friend_msg.proto index 5b25eac..86ca756 100644 --- a/src/pb/proto/friend_msg.proto +++ b/src/pb/proto/friend_msg.proto @@ -14,13 +14,13 @@ message FriendBase { //好友列表 message FriendListReq {} -message FriendListRsp { repeated FriendBase list = 1; } +message FriendListResp { repeated FriendBase list = 1; } //申请好友 message FriendApplyReq { string friendId = 1; //好友ID } -message FriendApplyRsp { +message FriendApplyResp { string userId = 1; //用户ID string friendId = 2; //好友ID } @@ -30,7 +30,7 @@ message FriendDelReq { string friendId = 1; //好友ID } -message FriendDelRsp { +message FriendDelResp { string friendId = 1; //好友ID string userId = 2; //用户ID } @@ -39,7 +39,7 @@ message FriendDelRsp { message FriendAgreeReq { repeated string friendIds = 1; //被同意的用户 } -message FriendAgreeRsp { +message FriendAgreeResp { int32 Num = 1; //操作的数量 } @@ -47,30 +47,30 @@ message FriendAgreeRsp { message FriendRefuseReq { repeated string friendIds = 1; //被拒绝的用户 } -message FriendRefuseRsp { +message FriendRefuseResp { int32 Num = 1; //操作的数量 } //好友申请列表 message FriendApplyListReq {} -message FriendApplyListRsp { repeated FriendBase list = 1; } +message FriendApplyListResp { repeated FriendBase list = 1; } //好友搜索 message FriendSearchReq { string nickName = 1; //好友昵称 } -message FriendSearchRsp { FriendBase friend = 1; } +message FriendSearchResp { FriendBase friend = 1; } //黑名单 message FriendBlackListReq {} -message FriendBlackListRsp { repeated FriendBase friends = 1; } +message FriendBlackListResp { repeated FriendBase friends = 1; } //添加黑名单 message FriendBlackAddReq { string friendId = 1; } -message FriendBlackAddRsp { +message FriendBlackAddResp { string friendId = 1; string userId = 2; } @@ -78,7 +78,7 @@ message FriendBlackAddRsp { //删除黑名单 message FriendDelBlackReq { string friendId = 1; } -message FriendDelBlackRsp { +message FriendDelBlackResp { string friendId = 1; string userId = 2; } @@ -86,7 +86,7 @@ message FriendDelBlackRsp { //接收 message FriendReceiveReq { string friendId = 1; } -message FriendReceiveRsp { +message FriendReceiveResp { string friendId = 1; string userId = 2; } @@ -94,7 +94,7 @@ message FriendReceiveRsp { //赠送 message FriendGiveReq { string friendId = 1; } -message FriendGiveRsp { +message FriendGiveResp { string friendId = 1; string userId = 2; } @@ -102,7 +102,7 @@ message FriendGiveRsp { //好友数量 message FriendTotalReq { string friendId = 1; } -message FriendTotalRsp { +message FriendTotalResp { string friendId = 1; int32 total = 2; //好友数量 } \ No newline at end of file diff --git a/src/pb/proto/google/protobuf/any.proto b/src/pb/proto/google/protobuf/any.proto deleted file mode 100644 index e2c2042..0000000 --- a/src/pb/proto/google/protobuf/any.proto +++ /dev/null @@ -1,158 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "google.golang.org/protobuf/types/known/anypb"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "AnyProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; - -// `Any` contains an arbitrary serialized protocol buffer message along with a -// URL that describes the type of the serialized message. -// -// Protobuf library provides support to pack/unpack Any values in the form -// of utility functions or additional generated methods of the Any type. -// -// Example 1: Pack and unpack a message in C++. -// -// Foo foo = ...; -// Any any; -// any.PackFrom(foo); -// ... -// if (any.UnpackTo(&foo)) { -// ... -// } -// -// Example 2: Pack and unpack a message in Java. -// -// Foo foo = ...; -// Any any = Any.pack(foo); -// ... -// if (any.is(Foo.class)) { -// foo = any.unpack(Foo.class); -// } -// -// Example 3: Pack and unpack a message in Python. -// -// foo = Foo(...) -// any = Any() -// any.Pack(foo) -// ... -// if any.Is(Foo.DESCRIPTOR): -// any.Unpack(foo) -// ... -// -// Example 4: Pack and unpack a message in Go -// -// foo := &pb.Foo{...} -// any, err := anypb.New(foo) -// if err != nil { -// ... -// } -// ... -// foo := &pb.Foo{} -// if err := any.UnmarshalTo(foo); err != nil { -// ... -// } -// -// The pack methods provided by protobuf library will by default use -// 'type.googleapis.com/full.type.name' as the type URL and the unpack -// methods only use the fully qualified type name after the last '/' -// in the type URL, for example "foo.bar.com/x/y.z" will yield type -// name "y.z". -// -// -// JSON -// -// The JSON representation of an `Any` value uses the regular -// representation of the deserialized, embedded message, with an -// additional field `@type` which contains the type URL. Example: -// -// package google.profile; -// message Person { -// string first_name = 1; -// string last_name = 2; -// } -// -// { -// "@type": "type.googleapis.com/google.profile.Person", -// "firstName": , -// "lastName": -// } -// -// If the embedded message type is well-known and has a custom JSON -// representation, that representation will be embedded adding a field -// `value` which holds the custom JSON in addition to the `@type` -// field. Example (for message [google.protobuf.Duration][]): -// -// { -// "@type": "type.googleapis.com/google.protobuf.Duration", -// "value": "1.212s" -// } -// -message Any { - // A URL/resource name that uniquely identifies the type of the serialized - // protocol buffer message. This string must contain at least - // one "/" character. The last segment of the URL's path must represent - // the fully qualified name of the type (as in - // `path/google.protobuf.Duration`). The name should be in a canonical form - // (e.g., leading "." is not accepted). - // - // In practice, teams usually precompile into the binary all types that they - // expect it to use in the context of Any. However, for URLs which use the - // scheme `http`, `https`, or no scheme, one can optionally set up a type - // server that maps type URLs to message definitions as follows: - // - // * If no scheme is provided, `https` is assumed. - // * An HTTP GET on the URL must yield a [google.protobuf.Type][] - // value in binary format, or produce an error. - // * Applications are allowed to cache lookup results based on the - // URL, or have them precompiled into a binary to avoid any - // lookup. Therefore, binary compatibility needs to be preserved - // on changes to types. (Use versioned type names to manage - // breaking changes.) - // - // Note: this functionality is not currently available in the official - // protobuf release, and it is not used for type URLs beginning with - // type.googleapis.com. - // - // Schemes other than `http`, `https` (or the empty scheme) might be - // used with implementation specific semantics. - // - string type_url = 1; - - // Must be a valid serialized protocol buffer of the above specified type. - bytes value = 2; -} diff --git a/src/pb/proto/hero_db.proto b/src/pb/proto/hero_db.proto index ff12059..0a12ead 100644 --- a/src/pb/proto/hero_db.proto +++ b/src/pb/proto/hero_db.proto @@ -29,7 +29,7 @@ message DBHero { int32 resonateNum = 18; //@go_tags(`bson:"resonateNum"`) 共鸣次数 int32 distributionResonate = 19; //@go_tags(`bson:"distributionResonate"`) 分配的共鸣能量 - map energy = 20; // @go_tags(`bson:"energy"`)能量分配到哪里 + map energy = 20; // @go_tags(`bson:"energy"`)能量分配到哪里[1,0] int32 sameCount = 21; // @go_tags(`bson:"sameCount"`) 卡片叠加数量 int32 suiteId = 22; //@go_tags(`bson:"suiteId"`) 套装Id int32 suiteExtId = 23; // go_tags(`bson:"suiteExtId"`) 扩展套装Id diff --git a/src/pb/proto/hero_msg.proto b/src/pb/proto/hero_msg.proto index a9815b0..1c1bd9b 100644 --- a/src/pb/proto/hero_msg.proto +++ b/src/pb/proto/hero_msg.proto @@ -6,12 +6,12 @@ import "hero_db.proto"; message HeroInfoReq { string heroId = 1; //英雄唯一ID } -message HeroInfoRsp { DBHero base = 1; } +message HeroInfoResp { DBHero base = 1; } //英雄列表 message HeroListReq {} -message HeroListRsp { repeated DBHero list = 1; } +message HeroListResp { repeated DBHero list = 1; } /// 卡牌养成: 强化(卡牌升级、卡牌升星、技能升级) /// 卡牌养成: 共鸣(共鸣消耗、材料返回、能量点使用) @@ -64,8 +64,7 @@ message HeroStrengthenUpSkillResp { // 共鸣英雄 message HeroResonanceReq { string heroObjID = 1; // 英雄对象ID - string costObjID = 2; // 消耗对象 - int32 amount = 3; // 消耗的数量 + repeated string costObjID = 2; // 消耗对象 } message HeroResonanceResp { @@ -115,4 +114,14 @@ message HeroProperty { string heroId = 1; //英雄唯一ID map property = 2; //基础属性 map addProperty = 3; //附加属性 +} + +// 英雄锁定 +message HeroLockReq{ + string heroid = 1; +} + +// 英雄锁定返回 +message HeroLockResp{ + DBHero hero = 1; // 英雄对象 } \ No newline at end of file diff --git a/src/pb/proto/items_msg.proto b/src/pb/proto/items_msg.proto index 0880e67..f6eb444 100644 --- a/src/pb/proto/items_msg.proto +++ b/src/pb/proto/items_msg.proto @@ -4,30 +4,34 @@ import "items_db.proto"; //查询用户背包请求 message ItemsGetlistReq { - int32 IType = 1; //道具类型 + int32 IType = 1; //道具类型 } //查询用户背包请求 回应 message ItemsGetlistResp { - repeated DB_UserItemData Grids = 1; //用户背包列表 + repeated DB_UserItemData Grids = 1; //用户背包列表 } //使用物品请求 message ItemsUseItemReq { - int32 GridId = 1; //格子Id - int32 ItemId = 2; //物品Id - uint32 Amount = 3; //使用数量 + string GridId = 1; //格子Id + int32 ItemId = 2; //物品Id + uint32 Amount = 3; //使用数量 } //使用物品请求 回应 -message ItemsUseItemResp {} +message ItemsUseItemResp { + +} //出售道具请求sailitem message ItemsSellItemReq { - int32 GridId = 1; //格子Id - int32 ItemId = 2; //物品Id - uint32 Amount = 3; //使用数量 + string GridId = 1; //格子Id + int32 ItemId = 2; //物品Id + uint32 Amount = 3; //使用数量 } //出售道具请求 回应 -message ItemsSellItemResp {} \ No newline at end of file +message ItemsSellItemResp { + +} \ No newline at end of file diff --git a/src/pb/proto/mail_db.proto b/src/pb/proto/mail_db.proto index cc90632..e5f17d5 100644 --- a/src/pb/proto/mail_db.proto +++ b/src/pb/proto/mail_db.proto @@ -1,15 +1,6 @@ syntax = "proto3"; option go_package = ".;pb"; - -// message Cache_mailData { -// string UserID = 1; -// repeated DB_MailData MailData = 2; -// } - -message MailAttachment { // 附件 - uint32 ItemId = 1; // 道具iD - uint32 ItemCount = 2; // 数量 -} +import "comm.proto"; message DBMailData { string ObjId = 1; // @go_tags(`bson:"_id"`) ID @@ -20,5 +11,5 @@ message DBMailData { uint64 DueTime = 6; // 过期时间 bool Check = 7; // 是否查看 bool Reward = 8; // 附件领取状态 - repeated MailAttachment Items = 9; // 附件 + repeated UserAssets Items = 9; // 附件 } diff --git a/src/pb/proto/mail_msg.proto b/src/pb/proto/mail_msg.proto index 91419ff..55fa623 100644 --- a/src/pb/proto/mail_msg.proto +++ b/src/pb/proto/mail_msg.proto @@ -2,22 +2,43 @@ syntax = "proto3"; option go_package = ".;pb"; import "mail_db.proto"; -message MailGetListReq {} +message MailGetListReq { + +} // 查询邮件信息 -message MailGetListResp { repeated DBMailData Mails = 1; } +message MailGetListResp { + repeated DBMailData Mails = 1; +} // 查看邮件 -message MailReadMailReq { string ObjID = 1; } +message MailReadMailReq { + string ObjID = 1; +} -message MailReadMailResp { DBMailData Mail = 1; } +message MailReadMailResp { + DBMailData Mail = 1; +} // 领取附件 -message MailGetUserMailAttachmentReq { string ObjID = 1; } +message MailGetUserMailAttachmentReq { + string ObjID = 1; +} -message MailGetUserMailAttachmentResp { DBMailData Mail = 1; } +message MailGetUserMailAttachmentResp { + DBMailData Mail = 1; +} // 删除某个邮件 -message MailDelMailReq { string ObjID = 1; } +message MailDelMailReq { + string ObjID = 1; +} -message MailDelMailResp { repeated DBMailData Mail = 1; } +message MailDelMailResp { + repeated DBMailData Mail = 1; +} + +// 推送邮件 +message MailGetNewMailPush{ + DBMailData Mail = 1; // 推送新的邮件信息 +} \ No newline at end of file diff --git a/src/pb/proto/notify_db.proto b/src/pb/proto/notify_db.proto new file mode 100644 index 0000000..bee9b6d --- /dev/null +++ b/src/pb/proto/notify_db.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +option go_package = ".;pb"; + +//系统公告数据结构 +message DBSystemNotify { + string id = 1; //数据公告Id + string title = 2; //公告标题 + string content = 3; //公告内容 + bool istop = 4; //是否置顶 + int64 ctime = 5; //创建时间 + int64 rtime = 6; //发布时间 +} \ No newline at end of file diff --git a/src/pb/proto/notify_msg.proto b/src/pb/proto/notify_msg.proto index 839c3c9..1008862 100644 --- a/src/pb/proto/notify_msg.proto +++ b/src/pb/proto/notify_msg.proto @@ -1,6 +1,7 @@ syntax = "proto3"; option go_package = ".;pb"; import "errorcode.proto"; +import "notify/notify_db.proto"; //统一错误码推送 message NotifyErrorNotifyPush { @@ -8,5 +9,15 @@ message NotifyErrorNotifyPush { string ReqSubType = 2; // 请求协议函数 例如:login 对应项目中 user的模块中 api_login 的处理函数 ErrorCode Code = 3; // 执行返回错误码 对应 errorcode.proto 枚举 string Message = 4; // 错误消息 - string Data = 6; // 错误数据 + string Data = 5; // 错误数据 } + +//获取系统公告 请求 +message NotifyGetListReq { +} + +//获取系统公告 回应 +message NotifyGetListResp { + int64 LastReadTime = 1; //最后一次阅读时间 + repeated DBSystemNotify SysNotify = 2; //公告列表 +} \ No newline at end of file diff --git a/src/pb/proto/shop_db.proto b/src/pb/proto/shop_db.proto new file mode 100644 index 0000000..3f5294e --- /dev/null +++ b/src/pb/proto/shop_db.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; +option go_package = ".;pb"; + +enum ShopType { + Null = 0; + GoldShop = 1; + DiamondShop = 2; + PVPShop = 3; + PVEShop = 4; + AllianceShop = 5; +} + +message UserShopData { + int64 LastRefreshTime = 1; //最后一次刷新时间 + int32 ManualRefreshNum = 2; //手动刷新次数 + repeated int32 Items = 3; //商品列表 +} + +message DBShop { + string id = 1; //@go_tags(`bson:"_id"`) 装备id + string uid = 2; //@go_tags(`bson:"uid"`) 装备id + UserShopData goldShop = 3; //@go_tags(`bson:"goldShop"`)金币商店数据 + UserShopData diamondShop = 4; //@go_tags(`bson:"diamondShop"`)金币商店数据 + UserShopData pvpShop = 5; //@go_tags(`bson:"pvpShop"`)金币商店数据 + UserShopData pveShop = 6; //@go_tags(`bson:"pveShop"`)金币商店数据 + UserShopData allianceShop = 7; //@go_tags(`bson:"allianceShop"`)金币商店数据 +} + +message DBShopItem { + string id = 1; //@go_tags(`bson:"_id"`) 装备id + string uid = 2; //@go_tags(`bson:"uid"`) 装备id + int32 goodsId = 3; //@go_tags(`bson:"goodsId"`)商品Id + int32 buyNum = 4; //@go_tags(`bson:"buyNum"`)购买数量 + int64 lastBuyTime = 5; //@go_tags(`bson:"lastBuyTime"`)最后一次购买的时间 +} \ No newline at end of file diff --git a/src/pb/proto/shop_msg.proto b/src/pb/proto/shop_msg.proto new file mode 100644 index 0000000..860230a --- /dev/null +++ b/src/pb/proto/shop_msg.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; +option go_package = ".;pb"; +import "shop_db.proto"; +import "comm.proto"; + + +//商品对象数据 +message ShopItem { + int32 GoodsId = 1; //商品Id + repeated UserAssets Items = 2; //货物 + repeated UserAssets Consume = 3; //消耗 + int32 Sale = 4; //打折 + int32 LeftBuyNum = 5; //还可购买次数 +} + +//获取装备列表请求 +message ShopGetListReq { + ShopType sType = 1; //商城类型 + bool IsManualRefresh = 2; //是否手动刷新 +} + +//获取装备列表请求 +message ShopGetListResp { + repeated ShopItem Goods = 1; //商品列表 +} + +//购买商品 请求 +message ShopBuyReq { + int32 GoodsId = 1; //商品Id +} + +//购买商品 回应 +message ShopBuyResp { + bool IsSucc = 1; //是否成功 +} diff --git a/src/pb/proto/story_db.proto b/src/pb/proto/story_db.proto new file mode 100644 index 0000000..5e1bea8 --- /dev/null +++ b/src/pb/proto/story_db.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +option go_package = ".;pb"; + +message DBStory { + string id = 1; //@go_tags(`bson:"_id"`) ID + string uid = 2; //@go_tags(`bson:"uid"`) 用户ID + int32 chapterId = 3; //@go_tags(`bson:"chapterId"`) 章节ID + int32 storyId = 4; //@go_tags(`bson:"storyId"`) 主线关卡ID + int32 intensity = 5; //@go_tags(`bson:"intensity"`) 难度类型 + int32 awaredID = 6; //@go_tags(`bson:"awaredID"`) 领奖ID + int32 progress = 7; // @go_tags(`bson:"progress"`) 通关进度(打了多少主关卡) + int32 totalBox = 8; // @go_tags(`bson:"totalBox"`) 总关卡数量 + repeated int32 branchID = 9; // @go_tags(`bson:"branchID"`) 记录分支通关的情况 +} \ No newline at end of file diff --git a/src/pb/proto/story_msg.proto b/src/pb/proto/story_msg.proto new file mode 100644 index 0000000..ff7fd17 --- /dev/null +++ b/src/pb/proto/story_msg.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; +option go_package = ".;pb"; +import "story_db.proto"; + +// 查询关卡进度 +message StoryGetListReq { + +} +// 返回进度信息 +message StoryGetListResp { + repeated DBStory data = 1; +} + +// 领取关卡宝箱 +message StoryGetRewrdReq { + uint32 chapterId = 1; // 章节ID + uint32 boxId = 2; // 宝箱ID +} + +message StoryGetRewrdResp { + DBStory data = 1; //当前章节信息 +} + +// 挑战关卡 +message StoryChallengeReq { + uint32 chapterId = 1; // 章节ID + uint32 storyId = 2; // 小关ID +} + +message StoryChallengeResp { + DBStory data = 1; //当前章节信息 +} \ No newline at end of file diff --git a/src/pb/proto/task_db.proto b/src/pb/proto/task_db.proto new file mode 100644 index 0000000..7e44af9 --- /dev/null +++ b/src/pb/proto/task_db.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; +option go_package = ".;pb"; + +message DBTask { + string id = 1; //@go_tags(`bson:"_id"`) ID + string uid = 2; //@go_tags(`bson:"uid"`) 用户ID + int32 taskId = 3; //@go_tags(`bson:"taskId"`) 任务Id + int32 progress = 4; //@go_tags(`bson:"progress"`) 任务进度/完成次数 + int32 active = 5; //@go_tags(`bson:"active"`) 活跃度 + int32 status = 6; //@go_tags(`bson:"status"`) 任务状态 默认0未完成 1已完成 + int32 received = 7; //@go_tags(`bson:"received"`) 领取状态 默认0未领取 1已领取 +} + +message DBTaskActive { + string id = 1; //@go_tags(`bson:"_id"`) ID + string uid = 2; //@go_tags(`bson:"uid"`) 用户ID + int32 rId = 3; //@go_tags(`bson:"taskId"`) rewardId + int32 received = 4; //@go_tags(`bson:"received"`) 领取状态 默认0未领取 1已领取 +} \ No newline at end of file diff --git a/src/pb/proto/task_msg.proto b/src/pb/proto/task_msg.proto new file mode 100644 index 0000000..261b696 --- /dev/null +++ b/src/pb/proto/task_msg.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; +option go_package = ".;pb"; +import "task_db.proto"; + +//领取 +message TaskReceiveReq { + int32 taskTag = 1; // 1日常/2周常/3成就 + string id = 2; //任务唯一ID +} + +message TaskReceiveResp { + int32 taskId = 1; //任务配置ID +} + +//任务列表 +message TaskListReq { + int32 taskTag = 1; //日常/周常/成就 +} + +message TaskListResp { repeated DBTask list = 1; } + +//活跃度 +message TaskActiveListReq { int32 taskTag = 1; } +message TaskActiveListResp { repeated DBTaskActive list = 1; } + +//活跃度领取 +message TaskActiveReceiveReq { + int32 taskTag = 1; // 1日常/2周常 + string id = 2; //唯一id +} +message TaskActiveReceiveResp { + int32 taskTag = 1; + string id = 2; +} \ No newline at end of file diff --git a/src/pb/proto/user_db.proto b/src/pb/proto/user_db.proto index 59afbbc..17fadb1 100644 --- a/src/pb/proto/user_db.proto +++ b/src/pb/proto/user_db.proto @@ -5,6 +5,7 @@ message CacheUser { string uid = 1; string SessionId = 2; string GatewayServiceId = 3; + string ip = 4; // DB_UserData UserData = 4; //@go_tags(`json:",inline"`) } @@ -24,4 +25,7 @@ message DBUser { int32 gold = 13; //@go_tags(`bson:"gold"`) 金币 int32 exp = 14; //@go_tags(`bson:"exp"`) 经验 bool created = 15; //@go_tags(`bson:"created"`) 创角 + int32 lv = 16; //@go_tags(`bson:"lv"`) 等级 + int32 vip = 17; //@go_tags(`bson:"vip"`) vip + int32 diamond = 18; //@go_tags(`bson:"diamond"`) 钻石 } \ No newline at end of file diff --git a/src/pb/proto/user_msg.proto b/src/pb/proto/user_msg.proto index 8bb425a..544ec57 100644 --- a/src/pb/proto/user_msg.proto +++ b/src/pb/proto/user_msg.proto @@ -2,7 +2,7 @@ syntax = "proto3"; option go_package = ".;pb"; import "errorcode.proto"; import "user_db.proto"; - +import "comm.proto"; //用户登录 message UserLoginReq { string account = 1; //账号 @@ -16,27 +16,25 @@ message UserRegisterReq { int32 sid = 2; } -message UserRegisterRsp { +message UserRegisterResp { ErrorCode Code = 1; string account = 2; } -message UserLoadRsp { CacheUser data = 1; } +message UserLoadResp { CacheUser data = 1; } //创角 message UserCreateReq { string NickName = 1; //昵称 } -message UserCreateRsp {} +message UserCreateResp {} //添加用户资源 message UserAddResReq { - string resType = 1; //资源类型 - int32 count = 2; //资源数量 + UserAssets res = 1; //资源类型 } message UserAddResResp { - string resType = 1; //资源类型 - int32 count = 2; //资源数量 + UserAssets res = 1; //资源类型 } diff --git a/src/views/protocol/Index.vue b/src/views/protocol/Index.vue index b5dadd0..db20823 100644 --- a/src/views/protocol/Index.vue +++ b/src/views/protocol/Index.vue @@ -60,26 +60,38 @@ {{item.FieldName}} - - + + :label="item.FieldName" + :type="item.FieldType" + :hint="item.FieldType" + :disabled="!isconnect" + outlined + clearable> + + + + + - - @@ -191,13 +203,16 @@ export default defineComponent({ computed: {}, setup() { const proto_models = reactive([ - { mainType: 'notify', disabled: true, subs: [] }, + { mainType: 'notify', disabled: false, subs: [] }, { mainType: 'user', subs: [] }, { mainType: 'items', subs: [] }, { mainType: 'mail', subs: [] }, { mainType: 'friend', subs: [] }, { mainType: 'equipment', subs: [] }, { mainType: 'hero', subs: [] }, + { mainType: 'shop', subs: [] }, + { mainType: 'stak', subs: [] }, + { mainType: 'story', subs: [] }, ]) for (const v of Object.keys(proto)) { for (const v1 of proto_models) { @@ -321,36 +336,63 @@ export default defineComponent({ this.reqproto = [] let keys = Object.keys(this.subSelect.reqproto.fields) for (const v of keys) { + let rule = this.subSelect.reqproto.fields[v].rule let ftype = this.subSelect.reqproto.fields[v].type - console.log('ftype', ftype) + let range = [] let fvalue = null - switch (this.subSelect.reqproto.fields[v].type) { - case 'int32': - case 'int64': - case 'uint32': - case 'uint64': - case 'float32': - case 'float64': - ftype = 'number' - fvalue = 0 - break - case 'string': - ftype = 'text' - fvalue = '' - break - default: - ftype = 'Object' - fvalue = {} - break - } + if (!rule) { + switch (ftype) { + case 'int32': + case 'int64': + case 'uint32': + case 'uint64': + case 'float32': + case 'float64': + ftype = 'number' + fvalue = 0 + break + case 'string': + ftype = 'text' + fvalue = '' + break + case 'bool': + ftype = 'bool' + fvalue = false + break + default: + let data = proto.lookup(ftype) + if (data == null) { + ftype = 'object' + fvalue = {} + } else { + if (data.values) { + //是枚举 + ftype = 'enum' + for (let key of Object.keys(data.values)) { + range.push({ name: key, value: data.values[key] }) + } + fvalue = range[0] + } else { + ftype = 'object' + fvalue = {} + } + } + break + } + } else { + ftype = 'object' + fvalue = {} + } + console.log('ftype', ftype) this.reqproto.push({ FieldName: v, FieldType: ftype, + FieldRange: range, FieldValue: fvalue, }) } - console.log(this.reqproto) + // console.log(this.reqproto) }, closelisten() { this.isconnect = false @@ -368,10 +410,10 @@ export default defineComponent({ .then((bytes) => { console.log('bytes', bytes) let message = proto.lookup('UserMessage').decode(bytes) - console.log('接收到消息 message', message) let mainType = message.MainType let subType = message.SubType let iskeep = false + console.log('接收到消息 message', message) for (const v of this.proto_models) { if (v.mainType == mainType) { for (const v1 of v.subs) {