mirror of
https://github.com/Gongxh0901/kunpolibrary
synced 2025-08-05 06:48:42 +00:00
1 line
3.1 KiB
JavaScript
1 line
3.1 KiB
JavaScript
|
"use strict";var $protobuf=protobuf;var $Reader=$protobuf.Reader,$Writer=$protobuf.Writer,$util=$protobuf.util;var $root=$protobuf.roots["default"]||($protobuf.roots["default"]={});$root.com=function(){var com={};com.kunpo=function(){var kunpo={};kunpo.proto=function(){var proto={};proto.CommonMessage=function(){function CommonMessage(p){if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)this[ks[i]]=p[ks[i]]}CommonMessage.prototype.cmdCode=0;CommonMessage.prototype.protocolId=0;CommonMessage.prototype.data=$util.newBuffer([]);CommonMessage.prototype.responseStatus=0;CommonMessage.prototype.msg="";CommonMessage.prototype.msgId=0;CommonMessage.encode=function encode(m,w){if(!w)w=$Writer.create();if(m.cmdCode!=null&&Object.hasOwnProperty.call(m,"cmdCode"))w.uint32(8).int32(m.cmdCode);if(m.protocolId!=null&&Object.hasOwnProperty.call(m,"protocolId"))w.uint32(16).int32(m.protocolId);if(m.data!=null&&Object.hasOwnProperty.call(m,"data"))w.uint32(26).bytes(m.data);if(m.responseStatus!=null&&Object.hasOwnProperty.call(m,"responseStatus"))w.uint32(32).sint32(m.responseStatus);if(m.msg!=null&&Object.hasOwnProperty.call(m,"msg"))w.uint32(42).string(m.msg);if(m.msgId!=null&&Object.hasOwnProperty.call(m,"msgId"))w.uint32(48).int32(m.msgId);return w};CommonMessage.decode=function decode(r,l){if(!(r instanceof $Reader))r=$Reader.create(r);var c=l===undefined?r.len:r.pos+l,m=new $root.com.kunpo.proto.CommonMessage;while(r.pos<c){var t=r.uint32();switch(t>>>3){case 1:{m.cmdCode=r.int32();break}case 2:{m.protocolId=r.int32();break}case 3:{m.data=r.bytes();break}case 4:{m.responseStatus=r.sint32();break}case 5:{m.msg=r.string();break}case 6:{m.msgId=r.int32();break}default:r.skipType(t&7);break}}return m};return CommonMessage}();proto.test=function(){var test={};test.UserInfo=function(){function UserInfo(p){if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)this[ks[i]]=p[ks[i]]}UserInfo.prototype.userId=0;UserInfo.prototype.userName="";UserInfo.prototype.nickName="";UserInfo.prototype.level=0;UserInfo.prototype.createTime=$util.Long?$util.Long.fromBits(0,0,false):0;UserInfo.encode=function encode(m,w){if(!w)w=$Writer.create();if(m.userId!=null&&Object.hasOwnProperty.call(m,"userId"))w.uint32(8).int32(m.userId);if(m.userName!=null&&Object.hasOwnProperty.call(m,"userName"))w.uint32(18).string(m.userName);if(m.nickName!=null&&Object.hasOwnProperty.call(m,"nickName"))w.uint32(26).string(m.nickName);if(m.level!=null&&Object.hasOwnProperty.call(m,"level"))w.uint32(32).int32(m.level);if(m.createTime!=null&&Object.hasOwnProperty.call(m,"createTime"))w.uint32(40).int64(m.createTime);return w};UserInfo.decode=function decode(r,l){if(!(r instanceof $Reader))r=$Reader.create(r);var c=l===undefined?r.len:r.pos+l,m=new $root.com.kunpo.proto.test.UserInfo;while(r.pos<c){var t=r.uint32();switch(t>>>3){case 1:{m.userId=r.int32();break}case 2:{m.userName=r.string();break}case 3:{m.nickName=r.string();break}case 4:{m.level=r.int32();break}case 5:{m.createTime=r.int64();break}default:r.skipType(t&7);break}}return m};return UserInfo}();return test}();return proto}();return kunpo}();return com}();module.exports=$root;
|