同步协议代码

This commit is contained in:
liwei1dao 2022-07-01 10:08:18 +08:00
parent 0c3cf4b7a1
commit f10707b45d
14 changed files with 570 additions and 451 deletions

BIN
dist.rar Normal file

Binary file not shown.

52
package-lock.json generated
View File

@ -16,7 +16,9 @@
"protobufjs": "^6.11.3",
"roboto-fontface": "*",
"vue": "^3.2.13",
"vue-json-editor": "^1.4.3",
"vue-router": "^4.0.3",
"vue3-json-editor": "^1.1.5",
"vuetify": "npm:@vuetify/nightly@next",
"vuex": "^4.0.0",
"vuex-persistedstate": "^4.1.0",
@ -11645,6 +11647,23 @@
"dev": true,
"license": "MIT"
},
"node_modules/vue-json-editor": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/vue-json-editor/-/vue-json-editor-1.4.3.tgz",
"integrity": "sha512-st9HdXBgCnyEmmfWrZQiKzp4KuYXzmYVUNDn5h6Fa18MrrGS1amnyUFyv7hQFsNBDW27B7BKkdGOqszYT1srAg==",
"dependencies": {
"vue": "^2.2.6"
},
"engines": {
"node": ">= 4.0.0",
"npm": ">= 3.0.0"
}
},
"node_modules/vue-json-editor/node_modules/vue": {
"version": "2.6.14",
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.14.tgz",
"integrity": "sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ=="
},
"node_modules/vue-loader": {
"version": "17.0.0",
"resolved": "https://registry.npmmirror.com/vue-loader/-/vue-loader-17.0.0.tgz",
@ -11791,6 +11810,15 @@
"dev": true,
"license": "MIT"
},
"node_modules/vue3-json-editor": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/vue3-json-editor/-/vue3-json-editor-1.1.5.tgz",
"integrity": "sha512-p+hbl5SdMifA9brPt9TsG2HYB7Xy7xy98b61zcIusVpwhGtS5a0IwWPKM7BXcj9poIdc/bPs4AFchQOHIBq++w==",
"dependencies": {
"core-js": "^3.21.1",
"vue": "^3.2.31"
}
},
"node_modules/vuetify": {
"name": "@vuetify/nightly",
"version": "3.0.0-next-20220621.0",
@ -20694,6 +20722,21 @@
"integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==",
"dev": true
},
"vue-json-editor": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/vue-json-editor/-/vue-json-editor-1.4.3.tgz",
"integrity": "sha512-st9HdXBgCnyEmmfWrZQiKzp4KuYXzmYVUNDn5h6Fa18MrrGS1amnyUFyv7hQFsNBDW27B7BKkdGOqszYT1srAg==",
"requires": {
"vue": "^2.2.6"
},
"dependencies": {
"vue": {
"version": "2.6.14",
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.14.tgz",
"integrity": "sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ=="
}
}
},
"vue-loader": {
"version": "17.0.0",
"resolved": "https://registry.npmmirror.com/vue-loader/-/vue-loader-17.0.0.tgz",
@ -20799,6 +20842,15 @@
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
"dev": true
},
"vue3-json-editor": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/vue3-json-editor/-/vue3-json-editor-1.1.5.tgz",
"integrity": "sha512-p+hbl5SdMifA9brPt9TsG2HYB7Xy7xy98b61zcIusVpwhGtS5a0IwWPKM7BXcj9poIdc/bPs4AFchQOHIBq++w==",
"requires": {
"core-js": "^3.21.1",
"vue": "^3.2.31"
}
},
"vuetify": {
"version": "npm:@vuetify/nightly@3.0.0-next-20220621.0",
"resolved": "https://registry.npmmirror.com/@vuetify/nightly/-/nightly-3.0.0-next-20220621.0.tgz",

View File

@ -16,7 +16,9 @@
"protobufjs": "^6.11.3",
"roboto-fontface": "*",
"vue": "^3.2.13",
"vue-json-editor": "^1.4.3",
"vue-router": "^4.0.3",
"vue3-json-editor": "^1.1.5",
"vuetify": "npm:@vuetify/nightly@next",
"vuex": "^4.0.0",
"vuex-persistedstate": "^4.1.0",

View File

@ -364,7 +364,13 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr
}
},
EquipmentEquipResp: {
fields: {}
fields: {
Equipments: {
rule: "repeated",
type: "DB_Equipment",
id: 1
}
}
},
EquipmentUpgradeReq: {
fields: {
@ -375,7 +381,17 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr
}
},
EquipmentUpgradeResp: {
fields: {}
fields: {
IsSucc: {
type: "bool",
id: 1
},
Equipment: {
rule: "repeated",
type: "DB_Equipment",
id: 2
}
}
},
DBFriend: {
fields: {
@ -658,8 +674,6 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr
}
}
},
pb: {
nested: {
SkillData: {
fields: {
skillID: {
@ -712,12 +726,12 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr
id: 9
},
property: {
keyType: "int32",
keyType: "string",
type: "int32",
id: 10
},
addProperty: {
keyType: "int32",
keyType: "string",
type: "int32",
id: 11
},
@ -976,19 +990,15 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr
}
}
},
HeroJuexingReq: {
HeroAwakenReq: {
fields: {
heroObjID: {
type: "string",
id: 1
},
costItmes: {
type: "ItemData",
id: 2
}
}
},
HeroJuexingResp: {
HeroAwakenResp: {
fields: {
hero: {
type: "DBHero",
@ -997,7 +1007,13 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr
}
},
HeroChoukaReq: {
fields: {}
fields: {
heroIds: {
rule: "repeated",
type: "int32",
id: 1
}
}
},
HeroChoukaResp: {
fields: {
@ -1015,18 +1031,16 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr
id: 1
},
property: {
keyType: "int32",
keyType: "string",
type: "int32",
id: 2
},
addProperty: {
keyType: "int32",
keyType: "string",
type: "int32",
id: 3
}
}
}
}
},
DB_UserItemData: {
fields: {
@ -1038,28 +1052,28 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr
type: "string",
id: 2
},
isEmpty: {
type: "bool",
id: 3
},
itemId: {
type: "int32",
id: 4
id: 3
},
amount: {
type: "uint32",
id: 5
id: 4
},
cTime: {
type: "int64",
id: 6
id: 5
},
eTime: {
type: "int64",
id: 7
id: 6
},
isNewItem: {
type: "bool",
id: 7
},
lastopt: {
type: "int64",
id: 8
}
}
@ -1330,6 +1344,10 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr
exp: {
type: "int32",
id: 14
},
created: {
type: "bool",
id: 15
}
}
},
@ -1395,6 +1413,30 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr
},
UserCreateRsp: {
fields: {}
},
UserAddResReq: {
fields: {
resType: {
type: "string",
id: 1
},
count: {
type: "int32",
id: 2
}
}
},
UserAddResResp: {
fields: {
resType: {
type: "string",
id: 1
},
count: {
type: "int32",
id: 2
}
}
}
});

View File

@ -3,31 +3,31 @@ option go_package = ".;pb";
import "equipment_db.proto";
//
message EquipmentGetListReq {
}
message EquipmentGetListReq {}
//
message EquipmentGetListResp {
repeated DB_Equipment Equipments = 1; //
}
//
message EquipmentEquipReq{
message EquipmentEquipReq {
string HeroCardId = 1; //Id
repeated string EquipmentId = 2; //Id 0-5
}
//
message EquipmentEquipResp{
message EquipmentEquipResp {
repeated DB_Equipment Equipments = 1; //
}
//
message EquipmentUpgradeReq{
message EquipmentUpgradeReq {
string EquipmentId = 1; //Id
}
//
message EquipmentUpgradeResp{
message EquipmentUpgradeResp {
bool IsSucc = 1;
repeated DB_Equipment Equipment =
2; //
}

View File

@ -1,6 +1,5 @@
syntax = "proto3";
option go_package = ".;pb";
package pb;
message SkillData {
int32 skillID = 1;
@ -17,8 +16,8 @@ message DBHero {
int32 juexingLv = 7; //@go_tags(`bson:"juexingLv"`)
int32 captainSkill = 8; //@go_tags(`bson:"captainSkill"`)
repeated SkillData normalSkill = 9; //@go_tags(`bson:"normalSkill"`)
map<int32, int32> property = 10; //
map<int32, int32> addProperty =
map<string, int32> property = 10; //
map<string, int32> addProperty =
11; //@go_tags(`bson:"addProperty"`)
int32 formation = 12; //
int32 cardType =

View File

@ -1,6 +1,5 @@
syntax = "proto3";
option go_package = ".;pb";
package pb;
import "hero_db.proto";
//
@ -66,7 +65,7 @@ message HeroStrengthenUpSkillResp {
message HeroResonanceReq {
string heroObjID = 1; // ID
string costObjID = 2; //
int32 amount = 3;//
int32 amount = 3; //
}
message HeroResonanceResp {
@ -97,24 +96,23 @@ message HeroResonanceUseEnergyResp {
}
//
message HeroJuexingReq {
message HeroAwakenReq {
string heroObjID = 1; // ID
ItemData costItmes = 2; //
}
//
message HeroJuexingResp {
message HeroAwakenResp {
DBHero hero = 1; //
}
//
message HeroChoukaReq {}
message HeroChoukaReq { repeated int32 heroIds = 1; }
message HeroChoukaResp { repeated DBHero heroes = 1; }
//
message HeroProperty {
string heroId = 1; //ID
map<int32, int32> property = 2; //
map<int32, int32> addProperty = 3; //
map<string, int32> property = 2; //
map<string, int32> addProperty = 3; //
}

View File

@ -6,10 +6,10 @@ option go_package = ".;pb";
message DB_UserItemData {
string gridId = 1; //@go_tags(`bson:"_id"`) Id
string uId = 2; //@go_tags(`bson:"uid"`) id
bool isEmpty = 3; //@go_tags(`bson:"isEmpty"`)
int32 itemId = 4; //@go_tags(`bson:"itemId"`) Id
uint32 amount = 5; //@go_tags(`bson:"amount"`)
int64 cTime = 6; //@go_tags(`bson:"cTime"`)
int64 eTime = 7; //@go_tags(`bson:"eTime"`)
bool isNewItem = 8; //@go_tags(`bson:"isNewItem"`)
int32 itemId = 3; //@go_tags(`bson:"itemId"`) Id
uint32 amount = 4; //@go_tags(`bson:"amount"`)
int64 cTime = 5; //@go_tags(`bson:"cTime"`)
int64 eTime = 6; //@go_tags(`bson:"eTime"`)
bool isNewItem = 7; //@go_tags(`bson:"isNewItem"`)
int64 lastopt = 8; //@go_tags(`bson:"lastopt"`)
}

View File

@ -20,9 +20,7 @@ message ItemsUseItemReq {
}
//使
message ItemsUseItemResp {
}
message ItemsUseItemResp {}
//sailitem
message ItemsSellItemReq {
@ -32,6 +30,4 @@ message ItemsSellItemReq {
}
//
message ItemsSellItemResp {
}
message ItemsSellItemResp {}

View File

@ -2,38 +2,22 @@ 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; }

View File

@ -2,11 +2,10 @@ syntax = "proto3";
option go_package = ".;pb";
import "errorcode.proto";
//
//
message NotifyErrorNotifyPush {
string ReqMainType = 1; // :user user的模块
string ReqSubType = 2; // :login user的模块中
// api_login
string ReqMainType =1; // :user user的模块
string ReqSubType = 2; // :login user的模块中 api_login
ErrorCode Code = 3; // errorcode.proto
string Message = 4; //
string Data = 6; //

View File

@ -23,4 +23,5 @@ message DBUser {
int32 avatar = 12; //@go_tags(`bson:"avatar"`)
int32 gold = 13; //@go_tags(`bson:"gold"`)
int32 exp = 14; //@go_tags(`bson:"exp"`)
bool created = 15; //@go_tags(`bson:"created"`)
}

View File

@ -29,3 +29,14 @@ message UserCreateReq {
}
message UserCreateRsp {}
//
message UserAddResReq {
string resType = 1; //
int32 count = 2; //
}
message UserAddResResp {
string resType = 1; //
int32 count = 2; //
}

View File

@ -56,7 +56,12 @@
<v-col v-for="item in reqproto"
:key="item.FieldName"
cols="4">
<v-text-field color="tertiary"
<v-card>
<v-card-title>{{item.FieldName}}</v-card-title>
<v-card-text>
<v-text-field v-if="item.FieldType != 'Object'"
color="tertiary"
v-model="item.FieldValue"
:label="item.FieldName"
:type="item.FieldType"
@ -64,6 +69,17 @@
:disabled="!isconnect"
outlined
clearable></v-text-field>
<Vue3JsonEditor v-else
v-model="item.FieldValue"
@json-change="(v)=>{item.FieldValue = v}"
:showBtns="false"
:mode="'code'"
lang="zh"
:expandedOnStart="false"></Vue3JsonEditor>
</v-card-text>
</v-card>
</v-col>
</v-row>
<v-row class="mt-5">
@ -145,11 +161,12 @@ import md5 from 'js-md5'
import { reactive } from 'vue'
import proto from '@/pb/proto'
import { socket } from '@/utils/socket'
import { Vue3JsonEditor } from 'vue3-json-editor'
import { defineComponent } from 'vue'
export default defineComponent({
name: 'Protocol',
components: {},
components: { Vue3JsonEditor },
data() {
return {
ws_url: 'ws://localhost:7891/gateway',
@ -168,6 +185,7 @@ export default defineComponent({
logs: [],
isshow: true,
showdata: { name: 'liwei1dao', aog: 123 },
resultInfo: { li: 123 },
}
},
computed: {},
@ -183,8 +201,8 @@ export default defineComponent({
])
for (const v of Object.keys(proto)) {
for (const v1 of proto_models) {
// console.log('protoName', v)
let protoName = v.toLowerCase()
// console.log('protoName', protoName)
//
let index = protoName.indexOf(v1.mainType)
if (index == 0) {
@ -208,7 +226,7 @@ export default defineComponent({
subType: sub,
reqproto: proto[v],
})
console.log(sub + 'Req')
// console.log(sub + 'Req')
}
}
if (respindex != -1) {
@ -229,7 +247,7 @@ export default defineComponent({
subType: sub,
respproto: proto[v],
})
console.log(sub + 'Resp')
// console.log(sub + 'Resp')
}
}
if (pushindex != -1) {
@ -250,7 +268,7 @@ export default defineComponent({
subType: sub,
pushproto: proto[v],
})
console.log(sub + 'Resp')
// console.log(sub + 'Resp')
}
}
}
@ -300,11 +318,11 @@ export default defineComponent({
this.reqproto = []
},
subSelectUpdate(v) {
console.log(v)
this.reqproto = []
let keys = Object.keys(this.subSelect.reqproto.fields)
for (const v of keys) {
let ftype = this.subSelect.reqproto.fields[v].type
console.log('ftype', ftype)
let fvalue = null
switch (this.subSelect.reqproto.fields[v].type) {
case 'int32':
@ -316,9 +334,14 @@ export default defineComponent({
ftype = 'number'
fvalue = 0
break
default:
case 'string':
ftype = 'text'
fvalue = ''
break
default:
ftype = 'Object'
fvalue = {}
break
}
this.reqproto.push({
@ -372,6 +395,13 @@ export default defineComponent({
.decode(message.data.value)
messageobj = proto.lookup(v1.pushName).toObject(protoobj)
}
if (v1.pushName && v1.pushName == 'NotifyErrorNotifyPush') {
this.pushlog(
'error',
`错误信息通知: ${mainType}-${subType}-resp`,
messageobj
)
} else {
this.pushlog(
'success',
`收到回应消息: ${mainType}-${subType}-resp`,
@ -380,6 +410,7 @@ export default defineComponent({
}
}
}
}
if (iskeep) {
break
}
@ -449,6 +480,10 @@ export default defineComponent({
isshow: false,
})
},
onJsonChange(value) {
console.log('value:', value)
},
},
})
</script>