ソースを参照

Merge branch 'beta' into HK

lsc 1 年間 前
コミット
12ffe4c837
5 ファイル変更276 行追加136 行削除
  1. 34 0
      js/Desktop/DeskTop.js
  2. 2 2
      js/Desktop/Onload.js
  3. 34 12
      js/Office/Poll.js
  4. 200 117
      node/message.js
  5. 6 5
      uform.js

+ 34 - 0
js/Desktop/DeskTop.js

@@ -1097,6 +1097,17 @@ U.MD.D.I.initDesktopIcons = function(el, type) {
         )
     }
 
+    if (_org == 'c95e0a56-c205-11ed-8d51-005056b86db5') {
+        _teacherDesktopIconInfo.push(
+            { "Name": "知识建构", "Url": "futureClass", "style": { "cssText": "background-image:url(/img/icon/futureClass.png)" } },
+            { "Name": "数据看板", "Url": "dataBoard", "style": { "cssText": "background-image:url(/img/icon/dataBoard.png)" } },
+        )
+        _studentDesktopIconInfo.push(
+            { "Name": "知识建构", "Url": "futureClass", "style": { "cssText": "background-image:url(/img/icon/futureClass.png)" } },
+        )
+        
+    }
+
     if (_oid == '1c3b9def-8fbe-11ed-b13d-005056b86db5') {
         _studentDesktopIconInfo3 = _studentDesktopIconInfo3.filter((el) => {
             if (el.Name == '項目管理') {
@@ -2458,6 +2469,11 @@ window.addEventListener('message', function(e) { // 監聽 message 事件
             typed:e.data.typed || '',
         }
         U.MD.D.I.openInApplication("index", _data)
+    } else if (e.data.tools && e.data.tools == "openDataClass") {
+        let _data = {
+            classid:e.data.classid || '',
+        }
+        U.MD.D.I.openInApplication("dataClass", _data)
     }
 
 });
@@ -2626,6 +2642,24 @@ U.MD.D.I.openInApplication = function(str, data, screenType, tType) {
                     _taskbar = { "id": str + _formdiv.id, "style": { "backgroundImage": "url(/img/icon/studentCourse.png)" }, "name": "課程中心", "forms": _formdiv, "click": function() { U.MD.D.I.openApplication(str, obj, info); } }
                     break;
                 }
+            case "dataClass":
+                    if (!_userinfo || Object.keys(_userinfo).length === 0) {
+                        setTimeout(() => {
+                            U.MD.U.L.login();
+                        }, 2000);
+                    } else {
+                        _formdiv = new U.UF.UI.form(
+                            "数据报告",
+                            $$("iframe", { "allow": "camera *; microphone *;display-capture;midi;encrypted-media;", "webkitallowfullscreen": "", "mozallowfullscreen": "", "allowfullscreen": "", "frameborder": "no", "border": "0", "scrolling ": "no", "style": { "cssText": "border:0;width:100%;height:100%" }, "src": US.Config.bpbl + "/pbl-teacher-table/dist/#/worksReport?userid=" + _userid + "&oid=" + _oid + "&org=" + _org + "&cid=" + _classId + "&checkid="+  data.classid }), {
+                                "id": "dataClass",
+                                "style": { "width": "90%", "height": "90%", "overflow": 'hidden' },
+                                "onresize": function() {}
+                            }, {
+                                closecallback: function() {}
+                            }, { "style": { "height": "36px" } }).form; //创建窗体
+                        _taskbar = { "id": str + _formdiv.id, "style": { "backgroundImage": "url(/img/icon/evaluation.png)" }, "name": "数据报告", "forms": _formdiv, "click": function() { U.MD.D.I.openApplication(str, obj, info); } }
+                        break;
+                    }
     }
 
 }

+ 2 - 2
js/Desktop/Onload.js

@@ -452,7 +452,7 @@ U.MD.D.getuser = function () {
                                 $(".userName")[0].style.display = "block";
                                 $(".userName")[0].innerHTML = US.userInfo.username || US.userInfo.alias;
                                 $(".exit")[0].style.display = "block";
-                                if(res.value[0][0].org == 'c95e0a56-c205-11ed-8d51-005056b86db5'){
+                                if(res.value[0][0].type === 1 && res.value[0][0].org == 'c95e0a56-c205-11ed-8d51-005056b86db5'){
                                     U.MD.D.I.ModeCheck(2)
                                 }else{
                                     U.MD.D.I.initDesktopIcons($("#U_MD_D_K")[0], 1);
@@ -676,7 +676,7 @@ U.MD.D.getuser2 = function (userid, cid) {
         $(".userName")[0].style.display = "block";
         $(".userName")[0].innerHTML = US.userInfo.username || US.userInfo.alias;
         $(".exit")[0].style.display = "block";
-        if(res.value[0][0].org == 'c95e0a56-c205-11ed-8d51-005056b86db5'){
+        if(res.value[0][0].type === 1 && res.value[0][0].org == 'c95e0a56-c205-11ed-8d51-005056b86db5'){
             U.MD.D.I.ModeCheck(2)
         }else{
             U.MD.D.I.initDesktopIcons($("#U_MD_D_K")[0], 1);

+ 34 - 12
js/Office/Poll.js

@@ -22,31 +22,53 @@ U.MD.O.P.connect = function () {
     }
 };
 
+
+/*
+* 数据处理
+*/
+U.MD.O.P.dataAsyn = function () {
+
+
+}
+
 /*
 * 发送请求进入轮训
 */
 U.MD.O.P.polling = function (params) {
     params = params || ["polling", US.userInfo.userid, US.pageId, US.systemId]
     var start = 0;
-    var time = null;
+    var delimiter = "\r\n"
+    var end = 0;
+    var text = "";
     var xhr = new XMLHttpRequest();
     var data = "";
     xhr.open("POST", US.SCOKET, true);
     xhr.onreadystatechange = function () {
         //获取数据
         if (xhr.readyState == 3 && xhr.status == 200) {
-            clearTimeout(time);
-            var len = xhr.responseText.length;
-            data += xhr.responseText.substring(start, len);
-            start = len;
-            time = setTimeout(function () {
-                clearTimeout(time);
-                try {
-                    U.MD.O.P.pollingAsyn({ value: JSON.parse(data) })
+            text = xhr.responseText;
+            var istrue = true;
+            while (start < text.length && istrue) {
+                end = text.indexOf(delimiter, start);//获取数据的是否已经结束
+                if (end) {
+                    data += text.substring(start, end);
+                    start = end + delimiter.length;
+                    try {
+                        U.MD.O.P.pollingAsyn({ value: JSON.parse(data) })
+                    }
+                    catch (e) {
+                        console.log(e);
+                    }
+                    data = "";
+                }
+                else {
+                    istrue = false;
                 }
-                catch (e) { }
-                data = "";
-            }, 100);
+            }
+            //clearTimeout(time);
+
+            //只有抓取到数据结束后才执行,防止网络太卡或者数据太大的不完整的获取导致后续无法执行
+
         }
         //结束重连
         else if (xhr.readyState == 4) {

+ 200 - 117
node/message.js

@@ -5,6 +5,11 @@ us.qs = require("querystring"); //引用文件解析包
 us.http = require("http"); //引用http server服务
 us.mysql = require("./mysql.js"); //引用执行存储过程包
 
+/**
+* 保持知识建构的时间变量
+**/
+us.savecscltime = null;
+
 /**
 * 用户的链接池集合,以用户id作为搜索键
 **/
@@ -235,6 +240,9 @@ us.server = us.http.createServer(function (requset, response) {
                 case 'quitOffice':
                     us.quitOffice(response, _param[0]);
                     break;
+                case 'quitcscl':
+                    us.quitcscl(response, _param[0]);
+                    break;
                 case 'newWordSave':
                     us.newWordSave(response, _param[0], _param[1], _param[2], _param[3], _param[4]);
                     break;
@@ -477,7 +485,7 @@ us.unifyDispose = function (req, res, cb) {
     res.setTimeout(30000, function () {
         try {
             //console.log("响应超时.");
-            //res.end("false"); //返回值
+            res.end(""); //返回值
         }
         catch (e) {
             console.error('process error is:', e.message);
@@ -488,7 +496,6 @@ us.unifyDispose = function (req, res, cb) {
     req.on("error", function (e) {
         try {
             console.log(e);
-            //res.end("false");
         }
         catch (e) {
             console.error('process error is:', e.message);
@@ -520,79 +527,93 @@ us.login = function (requset, response, userid, pageid, username, type) {
 }
 
 /**
-* 用户下线
-* @param {object} response 响应对象
-* @param {string} userid   用户ID
-* @param {string} pageid   页面ID(唯一识别ID)
+* 用户下线,清理用户的数据
 */
-us.offLine = function (response, userid, pageid) {
-    var i, j, z; //定义循环变量
-    var _userid, _fileid, _message, _docinfo, _messageinfo,
-        _csclids = us.offLineMessage[pageid].cscl,
-        _wordids = us.offLineMessage[pageid].word, //得到加入的所有word
-        _excelids = us.offLineMessage[pageid].excel; //得到加入的所有excel
-    console.log(pageid)
-    console.log(us.offLineMessage[pageid])
-    //删除用户连接
-    delete us.connect[userid][pageid];
-
-    //删除用户离校消息记录
-    delete us.offLineMessage[pageid];
-
-    //取消用户
-    if (us.connect[userid]) {
-        for (z in us.connect[userid]) { break }
-        if (!z) {
-            //用户登录数据清理,用于已经下线
-            delete us.user[userid];
-            delete us.connect[userid];
+us.deluser = function (userid, pageid) {
+    if (pageid && us.offLineMessage[pageid]) {
+        var i, j, z; //定义循环变量
+        var _userid, _fileid, _message, _docinfo, _messageinfo,
+            _csclids = us.offLineMessage[pageid].cscl;
+        //其他应用的数据
+        // _wordids = us.offLineMessage[pageid].word, //得到加入的所有word
+        // _excelids = us.offLineMessage[pageid].excel; //得到加入的所有excel
+
+        console.log(pageid)
+        console.log(us.offLineMessage[pageid])
+        //删除用户离校消息记录
+        delete us.offLineMessage[pageid];
+        console.log("1111111111111")
+        console.log(_csclids)
+        //知识架构的下线的处理
+        for (i = 0; i < _csclids.length; i++) { //循环处理每一个文档
+            _docinfo = us.cscl[_csclids[i]]; //记录文档信息
+            if (_docinfo) { //如果存在文档信息
+                _fileid = _csclids[i];
+                _userid = us.quitUserList(_docinfo, userid, pageid); //将用户在协同列表中删除
+            }
         }
-    }
-    console.log("1111111111111")
-    console.log(_csclids)
-    //知识架构的下线的处理
-    for (i = 0; i < _csclids.length; i++) { //循环处理每一个文档
-        _docinfo = us.cscl[_csclids[i]]; //记录文档信息
-        if (_docinfo) { //如果存在文档信息
-            _fileid = _csclids[i];
-            _userid = us.quitUserList(_docinfo, userid, pageid); //将用户在协同列表中删除
+        console.log(_userid)
+        //下线后通知所有的用户
+        if (_userid) {
+            _message = {};
+            var _messageinfo = us.message(userid, 'us.cscl', {
+                id: us.createGuid(),
+                type: "delUser",
+                userinfo: us.user[_userid],
+                docId: _fileid
+            });
+            _message[_fileid] = [_messageinfo];
+            console.log(_message)
+            us.broadcast(_message, pageid, "cscl");
         }
     }
-    console.log(_userid)
-    //下线后通知所有的用户
-    if (_userid) {
-        _message = {};
-        var _messageinfo = us.message(userid, 'us.cscl', {
-            id: us.createGuid(),
-            type: "delUser",
-            userid: _userid,
-            docId: _fileid
-        });
-        _message[_fileid] = [_messageinfo];
-        console.log(_message)
-        us.broadcast(_message, pageid, "cscl");
-    }
+    //其他应用的处理
+    // //word的下线的处理
+    // for (i = 0; i < _wordids.length; i++) { //循环处理每一个文档
+    //     _docinfo = us.word[_wordids[i]]; //记录文档信息
+    //     if (_docinfo) { //如果存在文档信息
+    //         us.quitUserList(_docinfo, userid, pageid); //将用户在协同列表中删除
+    //         us.insertHistory(_docinfo, 'word'); //插入历史
+    //     }
+    // }
+    // //excel的下线的处理
+    // for (j = 0; i < _excelids.length; j++) {
+    //     _docinfo = us.excel[_excelids[j]]; //记录文档信息
+    //     if (_docinfo) { //如果存在文档信息
+    //         us.quitUserList(_docinfo, userid, pageid); //将用户在协同列表中删除
+    //         us.insertHistory(_docinfo, 'excel'); //插入历史
+    //     }
+    // }
+}
 
-    //word的下线的处理
-    for (i = 0; i < _wordids.length; i++) { //循环处理每一个文档
-        _docinfo = us.word[_wordids[i]]; //记录文档信息
-        if (_docinfo) { //如果存在文档信息
-            us.quitUserList(_docinfo, userid, pageid); //将用户在协同列表中删除
-            us.insertHistory(_docinfo, 'word'); //插入历史
+/**
+* 用户下线,用计时器实时的监控用户是否在线
+*/
+us.offLine = function () {
+    var i, j, istrue = true;
+    var _user, _connect = us.connect;
+    console.log(_connect)
+    //循环目前所有的连接用户
+    for (i in _connect) {
+        _user = _connect[i];
+        for (j in _user) {
+            console.log(j)
+            //console.log(_user[j].response.connection)
+            //判断用户已下线
+            if (_user[j].response.connection == null || _user[j].response.connection.destroyed) {
+                us.deluser(i, j); //删除用户的数据
+                delete _user[j]
+            }
         }
-    }
-
-    //excel的下线的处理
-    for (j = 0; i < _excelids.length; j++) {
-        _docinfo = us.excel[_excelids[j]]; //记录文档信息
-        if (_docinfo) { //如果存在文档信息
-            us.quitUserList(_docinfo, userid, pageid); //将用户在协同列表中删除
-            us.insertHistory(_docinfo, 'excel'); //插入历史
+        for (j in _user) { istrue = false; break }
+        //这个用户下所有的连接用户都不在了
+        if (istrue) {
+            //用户登录数据清理,用于已经下线
+            delete us.user[i];
+            delete us.connect[i];
         }
+        istrue = true;
     }
-
-
-
 }
 
 /**
@@ -604,20 +625,21 @@ us.offLine = function (response, userid, pageid) {
 **/
 us.polling = function (requset, response, userid, pageid, type) {
     // 监听请求的close事件
-    requset.on('close', () => {
-        console.log("--------" + userid + "-------------" + pageid);
-        //us.offLine(response, userid, pageid)
-    });
+    // requset.on('close', () => {
+    //     console.log("--------" + userid + "-------------" + pageid);
+    //     //us.offLine(response, userid, pageid)
+    // });
+
     //判断轮询的用户是否在连接池中
     if (us.connect[userid]) {
         var _userarray = us.connect[userid], //用户连接池,获取制定用户连接的数量,
-            _messagearray = us.offLineMessage[pageid] //用户离校消
+            _messagearray = us.offLineMessage[pageid] //用户离线信
             ;
         //获取当前连接的用户,如果获取成功那么直接修改用户的连接
         if (_userarray[pageid]) {
             _userarray[pageid].response = response;
             if (_messagearray && _messagearray.message.length > 0) {
-                response.write(JSON.stringify(_messagearray.message));
+                response.write(JSON.stringify(_messagearray.message) + "\r\n");
                 _messagearray.message = [];
             }
             else {
@@ -859,21 +881,17 @@ us.updatecscl = function (messageInfo, classId, ty) {
                 _obj.nodes.push(messageInfo.nodes[j])
             }
         }
-        console.log(_obj);
         //如果不存在则去数据库查找
-        us.mysql.usselect(['172.16.12.5', 'pbl', 'updateRoomData', JSON.stringify(_obj), classId],
-            function (ret) {
-            });
-
-
-        //"nodes":[{"id":"9f6d7459-d376-4c0c-944b-a6b140085903","type":"icon-start","x":625,"y":145,"properties":{},"zIndex":1002,"text":{"x":625,"y":145,"value":"起始"}},{"id":"16e18308-7517-4162-8b32-a877b7cf42a0","type":"icon-card","x":325,"y":445,"properties":{},"zIndex":1002},{"id":"5c492b0d-092d-4d84-bd70-4d5734de9266","type":"icon-select","x":970,"y":510,"properties":{},"zIndex":1002}],
-        //"edges":[],
-        //"backgroundUrl":"img/bg.ccee1c62.png"
-
+        try {
+            clearTimeout(us.savecscltime);
+        }
+        catch (e) {
 
-        // if (_obj) {
-        //     _obj[messageInfo.id] = messageInfo.content;
-        // }
+        }
+        //每次修改每隔五秒保存一次数据,防止数据操作频繁导致数据库太卡
+        us.savecscltime = setTimeout(function () {
+            us.mysql.usselect(['172.16.12.5', 'pbl', 'updateRoomData', JSON.stringify(_obj), classId], function (ret) { });
+        }, 5000)
     }
 }
 
@@ -1515,7 +1533,7 @@ us.broadcast = function (messageinfo, pageid, type) {
         _issend, // 是否发送
         _userconnect = us.connect; //用户连接池
     for (i in messageinfo) {
-        _messageinfo = messageinfo[i]; //记录消息消息
+        _messageinfo = messageinfo[i]; //记录消息消息b
         _users = us[type][i] ? us[type][i].user : {}; //记录用户集合
         for (j in _users) { //循环处理每个用户处理 给每个用户集合下的用户发送消息
             _pageids = _users[j]; //记录当前用户在每个端登录的页面唯一识别ID
@@ -1525,8 +1543,9 @@ us.broadcast = function (messageinfo, pageid, type) {
                     try {
                         if (_userconnect[j] && _userconnect[j][_recievedpageid]) {
                             console.log(_recievedpageid);
-                            _issend = _userconnect[j][_recievedpageid].response.write(JSON.stringify(_messageinfo)); //发送消息
-                            if (!_issend) { //如果用户下线了,那么发送消息就会失败
+                            _issend = _userconnect[j][_recievedpageid].response.write(JSON.stringify(_messageinfo) + "\r\n"); //发送消息
+                            //用户在轮询切换的时候的中间,会产生数据无法接受,这里是存储数据
+                            if (!_issend) {
                                 us.offLineMessage[_recievedpageid].message.push(_messageinfo); //将消息加入用户离线消息中
                             }
                         }
@@ -1581,7 +1600,7 @@ us.addWord = function (response, wordinfo) {
 * @param  {string} wordinfo 文档信息
 **/
 us.quitOffice = function (response, wordinfo) {
-    //获取用户参数  
+    //获取用户参数
     wordinfo = JSON.parse(wordinfo);
     var _docid = wordinfo.docId,
         _userid = wordinfo.userId,
@@ -1605,15 +1624,61 @@ us.quitOffice = function (response, wordinfo) {
     response.end('quitOffice'); //响应退出请求
 }
 
+/**
+* 退出知识建构
+*
+* @param  {object} response 用户相应对象
+* @param  {string} wordinfo 文档信息
+**/
+us.quitcscl = function (response, info) {
+    console.log(info)
+    //获取用户参数
+    info = JSON.parse(info);
+    var _docid = info.docId,
+        _userid = info.userId,
+        _pageid = info.pageId,
+        _type = info.type,
+        _messagetype = 'us.cscl';
+    var _docinfo = us[_type][_docid]; //获取文档信息
+    //判断是否存在文档信息
+    if (_docinfo) {
+        _userid = us.quitUserList(_docinfo, _userid, _pageid); //将用户在协同列表中删除
+        console.log(_userid)
+        //下线后通知所有的用户
+        if (_userid) {
+            _message = {};
+            var _messageinfo = us.message(_userid, 'us.cscl', {
+                id: us.createGuid(),
+                type: "delUser",
+                userinfo: us.user[_userid],
+                docId: _docid
+            });
+            _message[_docid] = [_messageinfo];
+            console.log(_message)
+            us.broadcast(_message, _pageid, "cscl");
+        }
+
+        // var _j, //创建循环变量
+        //     _message = us.offLineMessage[_pageid] ? us.offLineMessage[_pageid].message : []; //获取该用户的离线消息
+        // for (_j = _message.length - 1; _j > -1; _j--) { //循环移除该文档的离线消息
+        //     if (_message[_j].type == _messagetype && _message[_j].messageInfo.docId == _docid) { //判断是否为word文档
+        //         _message.splice(_j, 1); //删除记录
+        //     }
+        // }
+    }
+    response.end('quitcscl'); //响应退出请求
+}
+
 /**
 * 将用户在协同列表中删除
-* 
+*
 * @param {object} docinfo 文档信息
 * @param {string} userid 用户ID
 * @param {string} pageid 用户页面唯一识别ID
 */
 us.quitUserList = function (docinfo, userid, pageid) {
     var _users = docinfo.user[userid]; //记录文档的用户列表
+    console.log(_users)
     //获取用户在文档用户列表的位置
     if (_users) {
         var _index = _users.indexOf(pageid);
@@ -1673,31 +1738,47 @@ us.insertHistory = function (docinfo, docid, type) {
 * @param {string} pageid 用户页面唯一识别ID
 */
 us.logout = function (response, userid, pageid) {
-    var i, j, _docinfo,
-        _wordids = us.offLineMessage[pageid].word, //得到加入的所有word
-        _excelids = us.offLineMessage[pageid].excel; //得到加入的所有excel
+    console.log("234566666666666666")
+    console.log(userid)
+    var j, istrue = true;
+    var _user = us.connect[userid];
+    //循环目前所有的连接用户
+    us.deluser(userid, pageid); //删除用户的数据
+    delete _user[pageid]
+    for (j in _user) { istrue = false; break }
+    //这个用户下所有的连接用户都不在了
+    if (istrue) {
+        //用户登录数据清理,用于已经下线
+        delete us.user[userid];
+        delete us.connect[userid];
+    }
+    console.log(pageid)
+    response.end('logout'); //响应退出请求
 
-    us.connect[userid][pageid].offLineTime = new Date();
+    // var i, j, _docinfo,
+    //     _wordids = us.offLineMessage[pageid].word, //得到加入的所有word
+    //     _excelids = us.offLineMessage[pageid].excel; //得到加入的所有excel
 
-    for (i = 0; i < _wordids.length; i++) { //循环处理每一个文档
-        _docinfo = us.word[_wordids[i]]; //记录文档信息
-        if (_docinfo) { //如果存在文档信息
-            us.quitUserList(_docinfo, userid, pageid); //将用户在协同列表中删除
-            delete us.offLineMessage[pageid]; //删除用户离线消息记录
-            us.insertHistory(_docinfo, 'word'); //插入历史
-        }
-    }
+    // us.connect[userid][pageid].offLineTime = new Date();
 
-    for (j = 0; i < _excelids.length; j++) {
-        _docinfo = us.excel[_excelids[j]]; //记录文档信息
-        if (_docinfo) { //如果存在文档信息
-            us.quitUserList(_docinfo, userid, pageid); //将用户在协同列表中删除
-            delete us.offLineMessage[pageid]; //删除用户离线消息记录
-            us.insertHistory(_docinfo, 'excel'); //插入历史
-        }
-    }
+    // for (i = 0; i < _wordids.length; i++) { //循环处理每一个文档
+    //     _docinfo = us.word[_wordids[i]]; //记录文档信息
+    //     if (_docinfo) { //如果存在文档信息
+    //         us.quitUserList(_docinfo, userid, pageid); //将用户在协同列表中删除
+    //         delete us.offLineMessage[pageid]; //删除用户离线消息记录
+    //         us.insertHistory(_docinfo, 'word'); //插入历史
+    //     }
+    // }
+
+    // for (j = 0; i < _excelids.length; j++) {
+    //     _docinfo = us.excel[_excelids[j]]; //记录文档信息
+    //     if (_docinfo) { //如果存在文档信息
+    //         us.quitUserList(_docinfo, userid, pageid); //将用户在协同列表中删除
+    //         delete us.offLineMessage[pageid]; //删除用户离线消息记录
+    //         us.insertHistory(_docinfo, 'excel'); //插入历史
+    //     }
+    // }
 
-    response.end('logout'); //响应退出请求
 }
 
 
@@ -2091,14 +2172,14 @@ us.getcscl = function (response, calssid, pageid, userid) {
                 var _user = us.getuserbytype(us.cscl[calssid].user); //获取当前项目下所有的用户信息
                 var _data = us.cscl[calssid].content; //保存在内存的知识建构数据
                 if (ret) {
-                    console.log("eeee");
-                    console.log(us.offLineMessage[pageid]);
+                    //console.log("eeee");
+                    //console.log(us.offLineMessage[pageid]);
                     ret[0][0].user = _user; //这里是项目当前所有用户
                     ret[0][0].data = _data; //把思维网格的内容转化成数组
                     if (userid && us.user[userid]) {
                         us.sendUser(us.user[userid], "cscl", pageid, calssid); //加入知识建构项目后通知所有的用户
                     }
-                    console.log(ret[0][0].user)
+                    //console.log(ret[0][0].user)
                     response.end(JSON.stringify(ret)); //返回文档内容
                 }
                 else {
@@ -2120,8 +2201,8 @@ us.getcscl = function (response, calssid, pageid, userid) {
             function (ret) {
                 var _user = us.getuserbytype(us.cscl[calssid].user);
                 if (ret) {
-                    console.log("bbbbbbbbbbbbbbb");
-                    console.log(us.offLineMessage[pageid]);
+                    //console.log("bbbbbbbbbbbbbbb");
+                    //console.log(us.offLineMessage[pageid]);
                     ret[0][0].user = _user; //这里是项目当前所有用户
                     us.cscl[calssid].content = JSON.parse(ret[0][0].data); //把思维网格的内容转化成数组
                     //us.sendUser(us.user[userid], "cscl", pageid, calssid); //加入知识建构项目后通知所有的用户
@@ -2434,6 +2515,8 @@ us.createGuid = function () {
 *
 **/
 us.server.listen('1473', '', function () {
+    //用户下线监控
+    setInterval(function () { us.offLine() }, 10000);
     //在控制台输出监听提示
     console.log("开始监听" + us.server.address().port + "......");
 });

+ 6 - 5
uform.js

@@ -11690,7 +11690,7 @@ U.MD.U.L.defaultCallBack = function (r, iscookie) {
                     U.UF.CI.getUserLocation(U.MD.U.L.addUserAccess); //客户端信息加载,好像只加载了新浪ip地址?
                 }
                 _userinfo = U.MD.U.L.setUserInfo(r); //设置用户基本信息,包括用户信息,好友信息
-                U.MD.U.L.getLoginUserInfo(_username || US.userInfo.username); //去获取用户详细信息
+                U.MD.U.L.getLoginUserInfo(_username || US.userInfo.UserName); //去获取用户详细信息
                 if ($("#U_MD_D_BDI")[0] && U.selectEl('#U_MD_D_BG')[0]) {
                     //登录有用户的信息展示到页面中,包括背景图片、用户头像等
                     U.MD.U.L.printUserInfo(); //用户头部头像个人信息
@@ -11897,7 +11897,7 @@ U.MD.U.L.initUserLogin = function () {
 U.MD.U.L.addUserAccess = function () {
     //如果用户的城市信息不存在,则添加用户用户城市信息,应该不只是单单判断地址,此处逻辑还需要整理!
     if (US.city.userAllLocation) {
-        U.A.Request(US.USER, ["RecordUserClientInfo", US.userInfo.username, "", "", US.city.userAllLocation, ""],
+        U.A.Request(US.USER, ["RecordUserClientInfo", US.userInfo.UserName, "", "", US.city.userAllLocation, ""],
             function () { }); //异步添加地址信息
     }
 }
@@ -11960,10 +11960,11 @@ U.MD.U.LO.logoutSystem = function (callback) {
     if (US.userInfo.userid) {
         //弹出退出登录的提示
         U.UF.UI.confirm("是否退出" + US.userInfo.username + "账号", function () {
-            // U.MD.U.LO.logout(callback);
             U.A.Request(US.Config.server + "logout", [], function (res) {
-                U.alert("退出成功!")
-                window.location.reload();
+                U.A.Request(US.SCOKET, ["logout", US.userInfo.userid, US.pageId], function () {
+                    U.alert("退出成功!")
+                    window.location.reload();
+                }, [], { "type": "POST", "withCredentials": true }); //在状态服务退出
             }, [], { "type": "POST", "withCredentials": true });
         });
     }