root 2 years ago
parent
commit
ddb8e614ca
1 changed files with 13 additions and 3 deletions
  1. 13 3
      node/message.js

+ 13 - 3
node/message.js

@@ -1792,7 +1792,17 @@ us.getMindNetwork = function (response, docid, pageid, userid) {
             us.mindNetwork[docid].user[userid].push(pageid);
         }
         us.offLineMessage[pageid].mindNetwork.indexOf(docid) == -1 && us.offLineMessage[pageid].mindNetwork.push(docid); //添加到用户离线消息的连接wrod记录中
-        response.end(us.mindNetwork[docid].content);
+        //如果不存在则去数据库查找
+        us.mysql.usselect(['172.16.12.5', 'pbl', 'select_room', docid],
+            function (ret) {
+                if (ret) {
+                    ret[0][0].data = us.mindNetwork[docid].content; //把思维网格的内容转化成数组
+                    response.end(JSON.stringify(us.mindNetwork[docid].content)); //返回文档内容
+                }
+                else {
+                    response.end(''); //返回文档内容 
+                }
+            });
     }
     else {
         us.mindNetwork[docid] = {
@@ -1808,11 +1818,11 @@ us.getMindNetwork = function (response, docid, pageid, userid) {
             function (ret) {
                 if (ret) {
                     us.mindNetwork[docid].content = JSON.parse(ret[0][0].data); //把思维网格的内容转化成数组
-                    response.end(JSON.stringify(ret)); //返回文档内容
+                    response.end(ret); //返回文档内容
                 }
                 else {
                     us.mindNetwork[docid].content = []; //创建一个空数组
-                    response.end(''); //返回文档内容 
+                    response.end('[]'); //返回文档内容 
                 }
             });
     }