root 1 年之前
父节点
当前提交
3c2deb75e6
共有 1 个文件被更改,包括 7 次插入19 次删除
  1. 7 19
      node/message.js

+ 7 - 19
node/message.js

@@ -616,7 +616,7 @@ us.send = function (response, messageinfo) {
                         _messagelist[_messagearr[j].receiveId] = [_message];
                     }
                     us.cscl[_messagearr[j].receiveId] && us.cscl[_messagearr[j].receiveId].history.push(_message);
-                    us.updatecscl(_message.messageInfo, _messagearr[j].receiveId);
+                    us.updatecscl(_message.messageInfo, _messagearr[j].receiveId, _messagearr[j].type);
                 }
                 // console.log(_messagelist)
                 // console.log(_messagearr)
@@ -739,12 +739,11 @@ us.updatemindNetwork = function (messageInfo) {
 * 更新后台未来课堂内容
 * @param {object} message 消息信息
 */
-us.updatecscl = function (messageInfo, classId) {
+us.updatecscl = function (messageInfo, classId, ty) {
     messageInfo = messageInfo;
     console.log("------------s------------");
     //console.log(us.cscl[classId]);
-    console.log(messageInfo.type);
-
+    console.log(ty);
     if (us.cscl[classId]) {
         var i, j, _is;
         var _obj = us.cscl[classId].content;
@@ -752,22 +751,11 @@ us.updatecscl = function (messageInfo, classId) {
         _obj.edges = _obj.edges || [];
         _obj.nodes = _obj.nodes || [];
 
-        switch (messageInfo.type) { // 判断消息种类
-            case 'update':
-                us.updateEditorLine(messageInfo, $); //修改
-                break;
-
-
-            case 'delete':
-                us.deleteEditorLine(messageInfo, $); //删除
-                break;
-        }
-
         for (j = 0; j < messageInfo.edges.length; j++) {
             _is = true;
             for (i = 0; i < _obj.edges.length; i++) {
                 if (_obj.edges[i].id == messageInfo.edges[j].id) {
-                    if (messageInfo.type == "update") {
+                    if (ty == "update") {
                         _obj.edges[i] = messageInfo.edges[j];
                     }
                     else {
@@ -777,7 +765,7 @@ us.updatecscl = function (messageInfo, classId) {
                     break;
                 }
             }
-            if (_is && messageInfo.type == "update") {
+            if (_is && ty == "update") {
                 _obj.edges.push(messageInfo.edges[j])
             }
         }
@@ -786,7 +774,7 @@ us.updatecscl = function (messageInfo, classId) {
             _is = true;
             for (i = 0; i < _obj.nodes.length; i++) {
                 if (_obj.nodes[i].id == messageInfo.nodes[j].id) {
-                    if (messageInfo.type == "update") {
+                    if (ty == "update") {
                         _obj.nodes[i] = messageInfo.nodes[j];
                     }
                     else {
@@ -796,7 +784,7 @@ us.updatecscl = function (messageInfo, classId) {
                     break;
                 }
             }
-            if (_is && messageInfo.type == "update") {
+            if (_is && ty == "update") {
                 _obj.nodes.push(messageInfo.nodes[j])
             }
         }