From a51587e608c0e0dd72d91fec3bd564fbf1ecfee1 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Wed, 16 Nov 2022 17:39:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=B7=A5=E5=85=B7=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 +- src/api/api.js | 10 + src/pb/proto.js | 1406 +++++++++++++++++++-------------- src/pb/proto/battle_db.proto | 23 +- src/pb/proto/battle_msg.proto | 40 +- src/pb/proto/combat_db.proto | 9 + src/pb/proto/combat_msg.proto | 57 ++ src/pb/proto/mail_db.proto | 2 + src/pb/proto/mail_msg.proto | 42 +- src/pb/proto/reddot_msg.proto | 18 + src/router/index.js | 18 +- src/utils/md5.js | 18 + src/utils/request.js | 108 +++ src/utils/upload.js | 85 ++ src/views/protocol/Index.vue | 2 + src/views/upload/Index.vue | 194 +++++ vue.config.js | 19 +- yarn.lock | 43 +- 18 files changed, 1478 insertions(+), 619 deletions(-) create mode 100644 src/api/api.js create mode 100644 src/pb/proto/combat_db.proto create mode 100644 src/pb/proto/combat_msg.proto create mode 100644 src/pb/proto/reddot_msg.proto create mode 100644 src/utils/md5.js create mode 100644 src/utils/request.js create mode 100644 src/utils/upload.js create mode 100644 src/views/upload/Index.vue diff --git a/package.json b/package.json index 229dc77..a964b89 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "lint": "vue-cli-service lint" }, "dependencies": { + "axios": "^0.27.2", "@mdi/font": "5.9.55", "core-js": "^3.8.3", "google-protobuf": "^3.20.1", @@ -57,4 +58,4 @@ "not dead", "not ie 11" ] -} +} \ No newline at end of file diff --git a/src/api/api.js b/src/api/api.js new file mode 100644 index 0000000..c8046c8 --- /dev/null +++ b/src/api/api.js @@ -0,0 +1,10 @@ +import request from '@/utils/request' + +///发送验证码 +export function upload (data) { + return request({ + url: '/api/upload', + method: 'post', + data + }) +} diff --git a/src/pb/proto.js b/src/pb/proto.js index 2b77559..cae99ca 100644 --- a/src/pb/proto.js +++ b/src/pb/proto.js @@ -13,17 +13,22 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr nil: 0, pve: 1, pvp: 2, - pvb: 3 + pvb: 3, + eve: 4 } }, PlayType: { values: { - moonfantasy: 0, + "null": 0, mainline: 1, pagoda: 2, - viking: 3, - rtask: 4, - hunting: 5 + rtask: 3, + hunting: 4, + viking: 5, + moonfantasy: 6, + arena: 7, + academy: 8, + heroteaching: 9 } }, BBattleState: { @@ -82,10 +87,19 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr type: "SkillData", id: 10 }, + equipSkill: { + rule: "repeated", + type: "SkillData", + id: 11 + }, property: { keyType: "string", type: "int32", - id: 11 + id: 12 + }, + ishelp: { + type: "bool", + id: 13 } } }, @@ -157,572 +171,6 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, - SkillData: { - fields: { - skillID: { - type: "int32", - id: 1 - }, - skillLv: { - type: "int32", - id: 2 - } - } - }, - HeroType: { - values: { - HeroTypeNil: 0, - HeroTypeKongFu: 1 - } - }, - DBHero: { - fields: { - id: { - type: "string", - id: 1 - }, - uid: { - type: "string", - id: 2 - }, - heroID: { - type: "string", - id: 3 - }, - star: { - type: "int32", - id: 4 - }, - lv: { - type: "int32", - id: 5 - }, - exp: { - type: "int32", - id: 6 - }, - juexingLv: { - type: "int32", - id: 7 - }, - captainSkill: { - type: "int32", - id: 8 - }, - normalSkill: { - rule: "repeated", - type: "SkillData", - id: 9 - }, - property: { - keyType: "string", - type: "int32", - id: 10 - }, - addProperty: { - keyType: "string", - type: "int32", - id: 11 - }, - cardType: { - type: "int32", - id: 12 - }, - curSkin: { - type: "int32", - id: 13 - }, - skins: { - rule: "repeated", - type: "int32", - id: 14 - }, - block: { - type: "bool", - id: 15 - }, - equipID: { - rule: "repeated", - type: "string", - id: 16 - }, - resonateNum: { - type: "int32", - id: 17 - }, - distributionResonate: { - type: "int32", - id: 18 - }, - energy: { - keyType: "string", - type: "int32", - id: 19 - }, - sameCount: { - type: "int32", - id: 20 - }, - suiteId: { - type: "int32", - id: 21 - }, - suiteExtId: { - type: "int32", - id: 22 - }, - isOverlying: { - type: "bool", - id: 23 - }, - energyProperty: { - keyType: "string", - type: "int32", - id: 24 - }, - juexProperty: { - keyType: "string", - type: "int32", - id: 25 - }, - status: { - type: "HeroType", - id: 26 - }, - suite1Star: { - type: "int32", - id: 27 - }, - suite2Star: { - type: "int32", - id: 28 - }, - suite1Lv: { - type: "int32", - id: 29 - }, - suite2Lv: { - type: "int32", - id: 30 - } - } - }, - Floor: { - fields: { - h4: { - type: "int32", - id: 1 - }, - h5: { - type: "int32", - id: 2 - } - } - }, - DBHeroRecord: { - fields: { - id: { - type: "string", - id: 1 - }, - uid: { - type: "string", - id: 2 - }, - star4: { - type: "int32", - id: 3 - }, - star5: { - type: "int32", - id: 4 - }, - mtime: { - type: "int64", - id: 5 - }, - drawcount: { - type: "int32", - id: 6 - } - } - }, - LineUp: { - fields: { - cid: { - type: "string", - id: 1 - }, - star: { - type: "int32", - id: 2 - }, - lv: { - type: "int32", - id: 3 - } - } - }, - BattlePVEReq: { - fields: { - ptype: { - type: "PlayType", - id: 1 - }, - title: { - type: "string", - id: 2 - }, - leadpos: { - type: "int32", - id: 3 - }, - teamids: { - rule: "repeated", - type: "string", - id: 4 - }, - mformat: { - rule: "repeated", - type: "int32", - id: 5 - } - } - }, - BattleInfo: { - fields: { - id: { - type: "string", - id: 1 - }, - title: { - type: "string", - id: 2 - }, - btype: { - type: "BattleType", - id: 3 - }, - ptype: { - type: "PlayType", - id: 4 - }, - redCompId: { - type: "string", - id: 5 - }, - redflist: { - rule: "repeated", - type: "DBBattleFormt", - id: 6 - }, - blueCompId: { - type: "string", - id: 7 - }, - buleflist: { - rule: "repeated", - type: "DBBattleFormt", - id: 8 - } - } - }, - BattleReport: { - fields: { - info: { - type: "BattleInfo", - id: 1 - }, - Costtime: { - type: "int32", - id: 2 - } - } - }, - ChatChannel: { - values: { - World: 0, - Union: 1, - Private: 2, - CrossServer: 3, - System: 4 - } - }, - ChatType: { - values: { - Text: 0, - Moonfantasy: 1, - Share: 2, - HeroShare: 3, - EquipmentShare: 4, - ItemShare: 5 - } - }, - DBChat: { - fields: { - id: { - type: "string", - id: 1 - }, - channel: { - type: "ChatChannel", - id: 2 - }, - ctype: { - type: "ChatType", - id: 3 - }, - suid: { - type: "string", - id: 4 - }, - slv: { - type: "int32", - id: 5 - }, - ruid: { - type: "string", - id: 6 - }, - channelId: { - type: "int32", - id: 7 - }, - unionId: { - type: "string", - id: 8 - }, - stag: { - type: "string", - id: 9 - }, - avatar: { - type: "string", - id: 10 - }, - uname: { - type: "string", - id: 11 - }, - content: { - type: "string", - id: 12 - }, - ctime: { - type: "int64", - id: 13 - }, - appendInt: { - type: "int64", - id: 14 - }, - appendStr: { - type: "string", - id: 15 - }, - appendBool: { - type: "string", - id: 16 - }, - appendBytes: { - type: "bytes", - id: 17 - } - } - }, - ChatMessagePush: { - fields: { - chat: { - type: "DBChat", - id: 1 - } - } - }, - ChatCrossChannelReq: { - fields: {} - }, - ChatCrossChannelResp: { - fields: { - channelId: { - type: "int32", - id: 1 - } - } - }, - ChatChanageChannelReq: { - fields: { - channelId: { - type: "int32", - id: 1 - } - } - }, - ChatChanageChannelResp: { - fields: { - channelId: { - type: "int32", - id: 1 - }, - isSucc: { - type: "bool", - id: 2 - } - } - }, - ChatGetListReq: { - fields: { - channel: { - type: "ChatChannel", - id: 1 - }, - channelId: { - type: "int32", - id: 2 - } - } - }, - ChatGetListResp: { - fields: { - chats: { - rule: "repeated", - type: "DBChat", - id: 1 - } - } - }, - ChatGetCrossListReq: { - fields: { - channel: { - type: "ChatChannel", - id: 1 - }, - channelId: { - type: "int32", - id: 2 - } - } - }, - ChatGetCrossListResp: { - fields: { - chats: { - rule: "repeated", - type: "DBChat", - id: 1 - } - } - }, - ChatSendReq: { - fields: { - avatar: { - type: "string", - id: 1 - }, - uname: { - type: "string", - id: 2 - }, - ulv: { - type: "int32", - id: 3 - }, - channel: { - type: "ChatChannel", - id: 4 - }, - targetId: { - type: "string", - id: 5 - }, - ctype: { - type: "ChatType", - id: 6 - }, - content: { - type: "string", - id: 7 - }, - appendInt: { - type: "int64", - id: 8 - }, - appendStr: { - type: "string", - id: 9 - }, - appendBool: { - type: "string", - id: 10 - }, - appendBytes: { - type: "bytes", - id: 11 - } - } - }, - ChatSendResp: { - fields: { - issucc: { - type: "bool", - id: 1 - } - } - }, - ChatSendCrossReq: { - fields: { - avatar: { - type: "string", - id: 1 - }, - uname: { - type: "string", - id: 2 - }, - ulv: { - type: "int32", - id: 3 - }, - channel: { - type: "ChatChannel", - id: 4 - }, - targetId: { - type: "string", - id: 5 - }, - ctype: { - type: "ChatType", - id: 6 - }, - content: { - type: "string", - id: 7 - }, - appendInt: { - type: "int64", - id: 8 - }, - appendStr: { - type: "string", - id: 9 - }, - appendBool: { - type: "string", - id: 10 - }, - appendBytes: { - type: "bytes", - id: 11 - } - } - }, - ChatSendCrossResp: { - fields: { - issucc: { - type: "bool", - id: 1 - } - } - }, UserMessage: { fields: { MainType: { @@ -1158,6 +606,781 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, + LineUp: { + fields: { + cid: { + type: "string", + id: 1 + }, + star: { + type: "int32", + id: 2 + }, + lv: { + type: "int32", + id: 3 + } + } + }, + BattleFormation: { + fields: { + leadpos: { + type: "int32", + id: 1 + }, + format: { + rule: "repeated", + type: "string", + id: 2 + }, + friendformat: { + rule: "repeated", + type: "string", + id: 3 + } + } + }, + BattleEVEReq: { + fields: { + ptype: { + type: "PlayType", + id: 1 + }, + title: { + type: "string", + id: 2 + }, + redformat: { + rule: "repeated", + type: "int32", + id: 3 + }, + buleformat: { + rule: "repeated", + type: "int32", + id: 4 + } + } + }, + BattlePVEReq: { + fields: { + ptype: { + type: "PlayType", + id: 1 + }, + title: { + type: "string", + id: 2 + }, + format: { + type: "BattleFormation", + id: 4 + }, + mformat: { + rule: "repeated", + type: "int32", + id: 5 + } + } + }, + PVPFormation: { + fields: { + uid: { + type: "string", + id: 1 + }, + leadpos: { + type: "int32", + id: 2 + }, + format: { + rule: "repeated", + type: "DBHero", + id: 3 + } + } + }, + BattlePVPReq: { + fields: { + ptype: { + type: "PlayType", + id: 1 + }, + title: { + type: "string", + id: 2 + }, + redformat: { + type: "PVPFormation", + id: 4 + }, + buleformat: { + type: "PVPFormation", + id: 5 + } + } + }, + BattleInfo: { + fields: { + id: { + type: "string", + id: 1 + }, + title: { + type: "string", + id: 2 + }, + btype: { + type: "BattleType", + id: 3 + }, + ptype: { + type: "PlayType", + id: 4 + }, + redCompId: { + type: "string", + id: 5 + }, + redflist: { + rule: "repeated", + type: "DBBattleFormt", + id: 6 + }, + blueCompId: { + type: "string", + id: 7 + }, + buleflist: { + rule: "repeated", + type: "DBBattleFormt", + id: 8 + }, + tasks: { + rule: "repeated", + type: "int32", + id: 9 + } + } + }, + BattleReport: { + fields: { + info: { + type: "BattleInfo", + id: 1 + }, + Costtime: { + type: "int32", + id: 2 + }, + process: { + type: "bytes", + id: 3 + }, + completetask: { + rule: "repeated", + type: "int32", + id: 4 + } + } + }, + SkillData: { + fields: { + skillID: { + type: "int32", + id: 1 + }, + skillLv: { + type: "int32", + id: 2 + } + } + }, + HeroType: { + values: { + HeroTypeNil: 0, + HeroTypeKongFu: 1 + } + }, + DBHero: { + fields: { + id: { + type: "string", + id: 1 + }, + uid: { + type: "string", + id: 2 + }, + heroID: { + type: "string", + id: 3 + }, + star: { + type: "int32", + id: 4 + }, + lv: { + type: "int32", + id: 5 + }, + exp: { + type: "int32", + id: 6 + }, + juexingLv: { + type: "int32", + id: 7 + }, + captainSkill: { + type: "int32", + id: 8 + }, + normalSkill: { + rule: "repeated", + type: "SkillData", + id: 9 + }, + property: { + keyType: "string", + type: "int32", + id: 10 + }, + addProperty: { + keyType: "string", + type: "int32", + id: 11 + }, + cardType: { + type: "int32", + id: 12 + }, + curSkin: { + type: "int32", + id: 13 + }, + skins: { + rule: "repeated", + type: "int32", + id: 14 + }, + block: { + type: "bool", + id: 15 + }, + equipID: { + rule: "repeated", + type: "string", + id: 16 + }, + resonateNum: { + type: "int32", + id: 17 + }, + distributionResonate: { + type: "int32", + id: 18 + }, + energy: { + keyType: "string", + type: "int32", + id: 19 + }, + sameCount: { + type: "int32", + id: 20 + }, + suiteId: { + type: "int32", + id: 21 + }, + suiteExtId: { + type: "int32", + id: 22 + }, + isOverlying: { + type: "bool", + id: 23 + }, + energyProperty: { + keyType: "string", + type: "int32", + id: 24 + }, + juexProperty: { + keyType: "string", + type: "int32", + id: 25 + }, + status: { + type: "HeroType", + id: 26 + }, + suite1Star: { + type: "int32", + id: 27 + }, + suite2Star: { + type: "int32", + id: 28 + }, + suite1Lv: { + type: "int32", + id: 29 + }, + suite2Lv: { + type: "int32", + id: 30 + } + } + }, + Floor: { + fields: { + h4: { + type: "int32", + id: 1 + }, + h5: { + type: "int32", + id: 2 + } + } + }, + DBHeroRecord: { + fields: { + id: { + type: "string", + id: 1 + }, + uid: { + type: "string", + id: 2 + }, + star4: { + type: "int32", + id: 3 + }, + star5: { + type: "int32", + id: 4 + }, + mtime: { + type: "int64", + id: 5 + }, + drawcount: { + type: "int32", + id: 6 + } + } + }, + ChatChannel: { + values: { + World: 0, + Union: 1, + Private: 2, + CrossServer: 3, + System: 4 + } + }, + ChatType: { + values: { + Text: 0, + Moonfantasy: 1, + Share: 2, + HeroShare: 3, + EquipmentShare: 4, + ItemShare: 5 + } + }, + DBChat: { + fields: { + id: { + type: "string", + id: 1 + }, + channel: { + type: "ChatChannel", + id: 2 + }, + ctype: { + type: "ChatType", + id: 3 + }, + suid: { + type: "string", + id: 4 + }, + slv: { + type: "int32", + id: 5 + }, + ruid: { + type: "string", + id: 6 + }, + channelId: { + type: "int32", + id: 7 + }, + unionId: { + type: "string", + id: 8 + }, + stag: { + type: "string", + id: 9 + }, + avatar: { + type: "string", + id: 10 + }, + uname: { + type: "string", + id: 11 + }, + content: { + type: "string", + id: 12 + }, + ctime: { + type: "int64", + id: 13 + }, + appendInt: { + type: "int64", + id: 14 + }, + appendStr: { + type: "string", + id: 15 + }, + appendBool: { + type: "string", + id: 16 + }, + appendBytes: { + type: "bytes", + id: 17 + } + } + }, + ChatMessagePush: { + fields: { + chat: { + type: "DBChat", + id: 1 + } + } + }, + ChatCrossChannelReq: { + fields: {} + }, + ChatCrossChannelResp: { + fields: { + channelId: { + type: "int32", + id: 1 + } + } + }, + ChatChanageChannelReq: { + fields: { + channelId: { + type: "int32", + id: 1 + } + } + }, + ChatChanageChannelResp: { + fields: { + channelId: { + type: "int32", + id: 1 + }, + isSucc: { + type: "bool", + id: 2 + } + } + }, + ChatGetListReq: { + fields: { + channel: { + type: "ChatChannel", + id: 1 + }, + channelId: { + type: "int32", + id: 2 + } + } + }, + ChatGetListResp: { + fields: { + chats: { + rule: "repeated", + type: "DBChat", + id: 1 + } + } + }, + ChatGetCrossListReq: { + fields: { + channel: { + type: "ChatChannel", + id: 1 + }, + channelId: { + type: "int32", + id: 2 + } + } + }, + ChatGetCrossListResp: { + fields: { + chats: { + rule: "repeated", + type: "DBChat", + id: 1 + } + } + }, + ChatSendReq: { + fields: { + avatar: { + type: "string", + id: 1 + }, + uname: { + type: "string", + id: 2 + }, + ulv: { + type: "int32", + id: 3 + }, + channel: { + type: "ChatChannel", + id: 4 + }, + targetId: { + type: "string", + id: 5 + }, + ctype: { + type: "ChatType", + id: 6 + }, + content: { + type: "string", + id: 7 + }, + appendInt: { + type: "int64", + id: 8 + }, + appendStr: { + type: "string", + id: 9 + }, + appendBool: { + type: "string", + id: 10 + }, + appendBytes: { + type: "bytes", + id: 11 + } + } + }, + ChatSendResp: { + fields: { + issucc: { + type: "bool", + id: 1 + } + } + }, + ChatSendCrossReq: { + fields: { + avatar: { + type: "string", + id: 1 + }, + uname: { + type: "string", + id: 2 + }, + ulv: { + type: "int32", + id: 3 + }, + channel: { + type: "ChatChannel", + id: 4 + }, + targetId: { + type: "string", + id: 5 + }, + ctype: { + type: "ChatType", + id: 6 + }, + content: { + type: "string", + id: 7 + }, + appendInt: { + type: "int64", + id: 8 + }, + appendStr: { + type: "string", + id: 9 + }, + appendBool: { + type: "string", + id: 10 + }, + appendBytes: { + type: "bytes", + id: 11 + } + } + }, + ChatSendCrossResp: { + fields: { + issucc: { + type: "bool", + id: 1 + } + } + }, + DBCombatUser: { + fields: { + uid: { + type: "string", + id: 1 + }, + currlevel: { + type: "int32", + id: 2 + }, + passmanster: { + rule: "repeated", + type: "int32", + id: 3 + }, + passdrop: { + rule: "repeated", + type: "int32", + id: 4 + } + } + }, + CombatInReq: { + fields: { + id: { + type: "int32", + id: 1 + } + } + }, + CombatInResp: { + fields: { + id: { + type: "int32", + id: 1 + } + } + }, + CombatOutReq: { + fields: { + id: { + type: "int32", + id: 1 + } + } + }, + CombatOutResp: { + fields: { + id: { + type: "int32", + id: 1 + } + } + }, + CombatChallengeReq: { + fields: { + manster: { + type: "int32", + id: 1 + }, + battle: { + type: "BattleFormation", + id: 2 + } + } + }, + CombatChallengeResp: { + fields: { + code: { + type: "ErrorCode", + id: 1 + }, + manster: { + type: "int32", + id: 2 + }, + info: { + type: "BattleInfo", + id: 3 + } + } + }, + CombatChallengeReceiveReq: { + fields: { + manster: { + type: "int32", + id: 1 + }, + report: { + type: "BattleReport", + id: 2 + } + } + }, + CombatChallengeReceiveResp: { + fields: { + issucc: { + type: "bool", + id: 1 + } + } + }, + CombatDropReq: { + fields: { + drop: { + type: "int32", + id: 1 + } + } + }, + CombatDropResp: { + fields: { + code: { + type: "ErrorCode", + id: 1 + }, + atns: { + rule: "repeated", + type: "UserAssets", + id: 2 + } + } + }, EquipmentAttributeEntry: { fields: { Id: { @@ -3016,6 +3239,15 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr rule: "repeated", type: "UserAssets", id: 9 + }, + Cid: { + type: "string", + id: 10 + }, + Param: { + rule: "repeated", + type: "string", + id: 11 } } }, @@ -4033,6 +4265,36 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } } }, + ReddotGetAllReq: { + fields: {} + }, + ReddotGetAllResp: { + fields: { + reddot: { + keyType: "int32", + type: "bool", + id: 1 + } + } + }, + ReddotGetReq: { + fields: { + rids: { + rule: "repeated", + type: "int32", + id: 1 + } + } + }, + ReddotGetResp: { + fields: { + reddot: { + keyType: "int32", + type: "bool", + id: 1 + } + } + }, frtaskIds: { fields: { rtaskIds: { diff --git a/src/pb/proto/battle_db.proto b/src/pb/proto/battle_db.proto index f9eb9ec..d96b8e2 100644 --- a/src/pb/proto/battle_db.proto +++ b/src/pb/proto/battle_db.proto @@ -1,22 +1,27 @@ syntax = "proto3"; option go_package = ".;pb"; -import "hero_db.proto"; +import "comm.proto"; enum BattleType { nil = 0; pve = 1; pvp = 2; pvb = 3; + eve = 4; } //玩法类型 enum PlayType { - moonfantasy = 0; //月之秘境 - mainline = 1; //主线玩法 - pagoda = 2; //爬塔 - viking = 3; //远征 - rtask = 4; //随机任务 - hunting = 5; //狩猎 + null = 0; //无效类型 + mainline = 1; //主线玩法 + pagoda = 2; //爬塔 + rtask = 3; //随机任务战斗 + hunting = 4; //狩猎 + viking = 5; //维京远征 + moonfantasy = 6; //月之秘境 + arena = 7; //竞技场 + academy = 8; //联盟学院 + heroteaching = 9; //英雄教学 } //战斗状态 @@ -43,7 +48,9 @@ message BattleRole { int32 mainSuitSkill = 8; ///@go_tags(`bson:"mainSuitSkill"`) 主套装技能 int32 subSuitSkill = 9; ///@go_tags(`bson:"subSuitSkill"`) 副套装技能 repeated SkillData normalSkill = 10; //@go_tags(`bson:"normalSkill"`) 普通技能 - map property = 11; // 属性相关 + repeated SkillData equipSkill = 11; //@go_tags(`bson:"normalSkill"`) 普通技能 + map property = 12; // 属性相关 + bool ishelp = 13; //是否是助战英雄 } //战斗阵型信息 diff --git a/src/pb/proto/battle_msg.proto b/src/pb/proto/battle_msg.proto index 5ab3936..d05f292 100644 --- a/src/pb/proto/battle_msg.proto +++ b/src/pb/proto/battle_msg.proto @@ -1,21 +1,48 @@ syntax = "proto3"; option go_package = ".;pb"; import "battle_db.proto"; +import "hero_db.proto"; + message LineUp { string cid = 1; // 配置表id int32 star = 2; // 星级 int32 lv = 3; // 等级 } +//战斗布阵请求 +message BattleFormation { + int32 leadpos = 1; //队长位置 + repeated string format = 2; //自己英雄阵容信息 0-5 + repeated string friendformat = 3; //助战好友 +} +// pve 战斗创建请求 (此请求 为服务端间使用 客户端可忽略) +message BattleEVEReq { + PlayType ptype = 1; //玩法类型 + string title = 2; //战斗标题 + repeated int32 redformat = 3; //红方 + repeated int32 buleformat = 4; //蓝方 +} // pve 战斗创建请求 (此请求 为服务端间使用 客户端可忽略) message BattlePVEReq { - PlayType ptype = 1; //玩法类型 - string title = 2; //战斗标题 - int32 leadpos = 3; //队长位置 - repeated string teamids = 4; //阵容信息 - repeated int32 mformat = 5; //敌方增容信息 + PlayType ptype = 1; //玩法类型 + string title = 2; //战斗标题 + BattleFormation format = 4; //布阵信息 + repeated int32 mformat = 5; //敌方增容信息 } +//战斗布阵请求 +message PVPFormation { + string uid = 1; //用户id + int32 leadpos = 2; //队长位置 + repeated DBHero format = 3; //自己英雄阵容信息 0-5 +} +// pve 战斗创建请求 (此请求 为服务端间使用 客户端可忽略) +message BattlePVPReq { + PlayType ptype = 1; //玩法类型 + string title = 2; //战斗标题 + PVPFormation redformat = 4; //布阵信息 + PVPFormation buleformat = 5; //布阵信息 +} //战斗开始推送 message BattleInfo { string id = 1; //战斗id @@ -26,10 +53,13 @@ message BattleInfo { repeated DBBattleFormt redflist = 6; //红方阵型列表 string blueCompId = 7; //蓝方阵营id repeated DBBattleFormt buleflist = 8; //红方阵型列表 + repeated int32 tasks = 9; //任务列表 } //战报数据 message BattleReport { BattleInfo info = 1; int32 Costtime = 2; //战斗时长 单位ms + bytes process = 3; //战斗过程数据 + repeated int32 completetask = 4; //完成任务 } diff --git a/src/pb/proto/combat_db.proto b/src/pb/proto/combat_db.proto new file mode 100644 index 0000000..e6ff1dc --- /dev/null +++ b/src/pb/proto/combat_db.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; +option go_package = ".;pb"; + +message DBCombatUser { + string uid = 1; //uid + int32 currlevel = 2; //当前所在关卡 + repeated int32 passmanster= 3; //通关怪物列表 + repeated int32 passdrop= 4; //通关宝箱列表 +} \ No newline at end of file diff --git a/src/pb/proto/combat_msg.proto b/src/pb/proto/combat_msg.proto new file mode 100644 index 0000000..c29c80f --- /dev/null +++ b/src/pb/proto/combat_msg.proto @@ -0,0 +1,57 @@ +syntax = "proto3"; +option go_package = ".;pb"; +import "errorcode.proto"; +import "comm.proto"; +import "battle_msg.proto"; + +//关卡进入请求 +message CombatInReq { + int32 id = 1; //关卡id +} + +//关卡进入请求 +message CombatInResp { + int32 id = 1; //关卡id +} + +//关卡离开请求 +message CombatOutReq { + int32 id = 1; //关卡id +} + +//关卡离开请求 回应 +message CombatOutResp { + int32 id = 1; //关卡id +} + +//战斗请求 +message CombatChallengeReq { + int32 manster = 1; //怪物id + BattleFormation battle = 2; //布阵信息 +} + +//战斗请求 回应 +message CombatChallengeResp { + ErrorCode code = 1; //是否成功 + int32 manster = 2; + BattleInfo info = 3; +} + +//战斗奖励领取 +message CombatChallengeReceiveReq { + int32 manster = 1; + BattleReport report = 2; //战报 +} +//战斗奖励领取 +message CombatChallengeReceiveResp { bool issucc = 1; } + +//宝箱获取请求 +message CombatDropReq { + int32 drop = 1; //宝箱id +} + +//宝箱获取请求 +message CombatDropResp { + ErrorCode code = 1; //是否成功 + repeated UserAssets atns = 2; //获取物品 +} \ No newline at end of file diff --git a/src/pb/proto/mail_db.proto b/src/pb/proto/mail_db.proto index e5f17d5..606aa7b 100644 --- a/src/pb/proto/mail_db.proto +++ b/src/pb/proto/mail_db.proto @@ -12,4 +12,6 @@ message DBMailData { bool Check = 7; // 是否查看 bool Reward = 8; // 附件领取状态 repeated UserAssets Items = 9; // 附件 + string Cid = 10; // 邮件的配置表ID + repeated string Param = 11; } diff --git a/src/pb/proto/mail_msg.proto b/src/pb/proto/mail_msg.proto index ef1a5fc..88089c7 100644 --- a/src/pb/proto/mail_msg.proto +++ b/src/pb/proto/mail_msg.proto @@ -3,52 +3,36 @@ option go_package = ".;pb"; import "mail_db.proto"; import "comm.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 { - string ObjID = 1; // 返回删除邮件id + string ObjID = 1; // 返回删除邮件id } // 推送邮件 -message MailGetNewMailPush{ - DBMailData Mail = 1; // 推送新的邮件信息 +message MailGetNewMailPush { + DBMailData Mail = 1; // 推送新的邮件信息 } // 领取所有附件 -message MailGetAllMailAttachmentReq { - -} +message MailGetAllMailAttachmentReq {} message MailGetAllMailAttachmentResp { - repeated UserAssets res = 1; //资源类型 - repeated string ids = 2; // 已经领取的邮件唯一id + repeated UserAssets res = 1; //资源类型 + repeated string ids = 2; // 已经领取的邮件唯一id } \ No newline at end of file diff --git a/src/pb/proto/reddot_msg.proto b/src/pb/proto/reddot_msg.proto new file mode 100644 index 0000000..32123a6 --- /dev/null +++ b/src/pb/proto/reddot_msg.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; +option go_package = ".;pb"; + +//红点信息请求 +message ReddotGetAllReq {} + +message ReddotGetAllResp { + map reddot = 1; //红点信息 +} + +//红点信息请求 +message ReddotGetReq { + repeated int32 rids = 1; +} + +message ReddotGetResp { + map reddot = 1; //红点信息 +} \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index f54666d..4df08f9 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -25,9 +25,25 @@ const routes = [ { path: 'index', component: () => import('@/views/protocol/Index.vue'), - } + }, + + ] + }, + { + path: '/upload', + name: 'Upload', + redirect: '/upload/index', + component: layout, + meta: { title: '配置上传', icon: 'mdi-protocol' }, + children: [ + { + path: 'index', + component: () => import('@/views/upload/Index.vue'), + }, ] } + + ] diff --git a/src/utils/md5.js b/src/utils/md5.js new file mode 100644 index 0000000..f92920f --- /dev/null +++ b/src/utils/md5.js @@ -0,0 +1,18 @@ +import md5 from 'js-md5'; + +function paramsStrSort (paramsStr) { + var orsign = paramsStr.split("&").sort().join("&"); + orsign = orsign + '&key=@234%67g12q4*67m12#4l67!'; + console.log("签名:" + orsign); + return md5(orsign).toLowerCase(); +} + +export function paramsign (params) { + var arr = []; + for (var i in params) { + if (i != "Sign") + arr.push((i + "=" + params[i])); + } + params.Sign = paramsStrSort(arr.join(("&"))); + return params +} \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js new file mode 100644 index 0000000..615274f --- /dev/null +++ b/src/utils/request.js @@ -0,0 +1,108 @@ +import axios from 'axios' +import router from '@/router' +import store from '@/store' +import message from '@/components/message/' +import { paramsign } from '@/utils/md5' + +const showStatus = (status) => { + let message = '' + switch (status) { + case 400: + message = '请求错误(400)' + break + case 401: + message = '未授权,请重新登录(401)' + break + case 402: + message = '拒绝访问(402)' + break + case 404: + message = '请求出错(404)' + break + case 408: + message = '请求超时(408)' + break + case 500: + message = '服务器错误(500)' + break + case 501: + message = '服务未实现(501)' + break + case 502: + message = '网络错误(502)' + break + case 503: + message = '服务不可用(503)' + break + case 504: + message = '网络超时(504)' + break + case 505: + message = 'HTTP版本不受支持(505)' + break + default: + message = `连接出错(${status})!` + } + return `${message},请检查网络或联系管理员!` +} + +const service = axios.create({ + // 是否跨站点访问控制请求 + withCredentials: true, + baseURL: process.env.VUE_APP_BASE_API, + timeout: 5000, + validateStatus () { + // 使用async-await,处理reject情况较为繁琐,所以全部返回resolve,在业务代码中处理异常 + return true + } +}) + +// 请求拦截器 +service.interceptors.request.use( + request => { + if (request.data != null) { + request.data = paramsign(request.data) + } + if (store.getters.token != null) { + request.headers['X-Token'] = store.getters.token + console.log("X-Token" + request.headers['X-Token']) + } + console.log("req %s:%o", request.url, request.data) + return request + }, + (err) => { + message.error(res.message || '服务器异常,请联系管理员!') + return Promise.reject(err) + } +) + +// 响应拦截器 +service.interceptors.response.use( + response => { + console.log('response:%o', response) + const status = response.status + const res = response.data + if (status === 200) { + if (res.code != 0) { + if (res.code === 101) { + router.replace('/login') + return + } + message.error("exception code:" + res.code) + Promise.reject(new Error("exception code:" + res.code)) + } else { + return res + } + } else { + message.error("exception status:" + status) + return Promise.reject(new Error("exception status:" + status)) + } + }, + (err) => { + console.log(err) + message.error(res.message || '服务器异常,请联系管理员!') + return Promise.reject(err) + } +) + +export default service \ No newline at end of file diff --git a/src/utils/upload.js b/src/utils/upload.js new file mode 100644 index 0000000..48ccb1c --- /dev/null +++ b/src/utils/upload.js @@ -0,0 +1,85 @@ +import axios from 'axios' +import router from '@/router' +import store from '@/store' + +/* + 获取文件后缀 +*/ +export function getfilesuffix (file) { + //获取文件的后缀名的位置 + var index = file.name.lastIndexOf("."); + if (index == -1) { + return false; + } + //截取后缀名 + var type = file.name.substring(index + 1); + return type +} + +/* + 文件上传 +*/ +export function uploadformData (url, formData, progress) { + return new Promise((resolve, reject) => { + axios({ + method: "post", + url: url, + headers: { 'X-Token': store.getters.token }, + data: formData, + onUploadProgress: (evt) => { + if (evt.lengthComputable) { + var percent = Math.round(evt.loaded * 100 / evt.total); + progress(percent) + } + else { + progress(100) + } + } + }).then(response => { + const status = response.status + const res = response.data + console.log('response:%o', response) + if (status === 200) { + if (res.code != 0) { + if (res.code === 101) { + router.replace('/login') + return + } + return reject(new Error("exception code:" + res.code)) + } else { + return resolve(res) + } + } else { + return reject(new Error("exception status:" + status)) + } + }).catch(err => { + reject(err) + }) + }) +} + +///校验文件格式 +export function validateFileType (files, types) { + if (files == null || types == null) { + return false + } + for (var i = 0; i < files.length; i++) { + var file = files[i] + if (file.name == "" || file.name == null) { + return false; + } + //获取文件的后缀名的位置 + var index = file.name.lastIndexOf("."); + if (index == -1) { + return false; + } + //截取后缀名 + var type = file.name.substring(index + 1); + for (var i = 0; i < types.length; i++) { + if (type == types[i]) { + return true + } + } + return false + } +} diff --git a/src/views/protocol/Index.vue b/src/views/protocol/Index.vue index 93c75d2..35e3853 100644 --- a/src/views/protocol/Index.vue +++ b/src/views/protocol/Index.vue @@ -225,6 +225,8 @@ export default defineComponent({ { mainType: 'hunting', subs: [] }, { mainType: 'horoscope', subs: [] }, { mainType: 'pay', subs: [] }, + { mainType: 'reddot', subs: [] }, + { mainType: 'combat', subs: [] }, ]) for (const v of Object.keys(proto)) { for (const v1 of proto_models) { diff --git a/src/views/upload/Index.vue b/src/views/upload/Index.vue new file mode 100644 index 0000000..dfb539b --- /dev/null +++ b/src/views/upload/Index.vue @@ -0,0 +1,194 @@ + + + + + \ No newline at end of file diff --git a/vue.config.js b/vue.config.js index 2a4b770..cf585c0 100644 --- a/vue.config.js +++ b/vue.config.js @@ -6,5 +6,22 @@ module.exports = defineConfig({ vuetify: { // https://github.com/vuetifyjs/vuetify-loader/tree/next/packages/vuetify-loader } - } + }, + + devServer: { + open: true, + + proxy: { + '/api': { + target: 'http://127.0.0.1:8000',//要代理的本地api地址,也可以换成线上测试地址 + changeOrigin: true,//允许跨域 + pathRewrite: { "^/api": "/api" }//将/api开头替换为/api + }, + '/upload': { + target: 'http://127.0.0.1:8000',//要代理的本地api地址,也可以换成线上测试地址 + changeOrigin: true,//允许跨域 + pathRewrite: { "^/upload": "/upload" }//将/api开头替换为/api + } + } + }, }) diff --git a/yarn.lock b/yarn.lock index bae35b9..3ab407e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2037,6 +2037,11 @@ async@^2.6.4: dependencies: lodash "^4.17.14" +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== + at-least-node@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" @@ -2054,6 +2059,14 @@ autoprefixer@^10.2.4: picocolors "^1.0.0" postcss-value-parser "^4.2.0" +axios@^0.27.2: + version "0.27.2" + resolved "https://registry.npmmirror.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" + integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ== + dependencies: + follow-redirects "^1.14.9" + form-data "^4.0.0" + babel-loader@^8.2.2: version "8.2.5" resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.2.5.tgz#d45f585e654d5a5d90f5350a779d7647c5ed512e" @@ -2425,6 +2438,13 @@ colorette@^2.0.10: resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.19.tgz#cdf044f47ad41a0f4b56b3a0d5b4e6e1a2d5a798" integrity sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ== +combined-stream@^1.0.8: + version "1.0.8" + resolved "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + commander@^2.20.0: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" @@ -2776,6 +2796,11 @@ define-properties@^1.1.4: has-property-descriptors "^1.0.0" object-keys "^1.1.1" +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== + depd@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" @@ -3364,6 +3389,20 @@ follow-redirects@^1.0.0: resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.1.tgz#0ca6a452306c9b276e4d3127483e29575e207ad5" integrity sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA== +follow-redirects@^1.14.9: + version "1.15.2" + resolved "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" + integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== + +form-data@^4.0.0: + version "4.0.0" + resolved "https://registry.npmmirror.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" + integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + forwarded@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" @@ -4239,9 +4278,9 @@ mime-db@1.52.0, "mime-db@>= 1.43.0 < 2": resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.17, mime-types@~2.1.24, mime-types@~2.1.34: +mime-types@^2.1.12, mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.17, mime-types@~2.1.24, mime-types@~2.1.34: version "2.1.35" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + resolved "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== dependencies: mime-db "1.52.0"