12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- class Message {
-
- /**
- * 消息ID
- */
- msgId = "";
- /**
- * 消息类型
- */
- msgType = 1;
- /**
- * 消息类型
- */
- code = "";
- /**
- * 认证通行证
- */
- token = "";
- /**
- * 消息数据
- */
- data = "";
- /**
- * 确认帧ID
- */
- askId = "";
- /**
- * 需要对方确认应答
- */
- ask = false;
- /**
- * 是否回复数据
- */
- reply = false;
-
- /**
- * 其他数据
- */
- remark = "";
-
-
-
- /**
- *
- * @param {Object} data 消息数据
- * @param {Object} MsgType 消息类型 1: 普通包文 ,2:消息确认帧
- * @param {Object} code 消息类型[]
- * @param {Object} ask 需要对方确认应答
- * @param {Object} isReply 是否应答数据
- */
- constructor(data = '',code = '',ask = false,MsgType = 1,isReply = false) {
- this.data = data;
- this.msgType = MsgType;
- this.code = code;
- this.ask = ask;
- this.reply = isReply;
- }
-
-
- getJson() {
- return JSON.stringify(this.getData());
- }
-
- getData(){
-
- return {
- data : this.data,
- msgType : this.msgType,
- code : this.code,
- ask : this.ask,
- reply : this.reply,
- msgId : this.msgId,
- askId : this.askId,
- remark : this.remark
- };
- }
- }
- export default Message
|