|
@@ -606,8 +606,10 @@ us.send = function (response, messageinfo) {
|
|
|
_messagearr = _messageobj[i]; //获取word消息
|
|
|
//得到word所有的用户
|
|
|
for (j = 0; j < _messagearr.length; j++) {
|
|
|
+ _messagearr[j].messageInfo.type = _messagearr[j].type;
|
|
|
//生成发送的消息结构体
|
|
|
_message = us.message(_messagearr[j].sendId, "us.cscl", _messagearr[j].messageInfo);
|
|
|
+ _message.ttype = _messagearr[j].type;
|
|
|
//添加消息列表
|
|
|
if (_messagelist[_messagearr[j].receiveId]) {
|
|
|
_messagelist[_messagearr[j].receiveId].push(_message);
|
|
@@ -618,7 +620,7 @@ us.send = function (response, messageinfo) {
|
|
|
us.cscl[_messagearr[j].receiveId] && us.cscl[_messagearr[j].receiveId].history.push(_message);
|
|
|
us.updatecscl(_message.messageInfo, _messagearr[j].receiveId, _messagearr[j].type);
|
|
|
}
|
|
|
- // console.log(_messagelist)
|
|
|
+ console.log(_messagelist)
|
|
|
// console.log(_messagearr)
|
|
|
//调用群发函数
|
|
|
_messagearr[0] && us.broadcast(_messagelist, _messagearr[0].pageId, 'cscl');
|
|
@@ -740,10 +742,7 @@ us.updatemindNetwork = function (messageInfo) {
|
|
|
* @param {object} message 消息信息
|
|
|
*/
|
|
|
us.updatecscl = function (messageInfo, classId, ty) {
|
|
|
- messageInfo = messageInfo;
|
|
|
- console.log("------------s------------");
|
|
|
- //console.log(us.cscl[classId]);
|
|
|
- //console.log(ty);
|
|
|
+ //messageInfo = messageInfo;
|
|
|
if (us.cscl[classId]) {
|
|
|
var i, j, _is;
|
|
|
var _obj = us.cscl[classId].content;
|
|
@@ -769,7 +768,10 @@ us.updatecscl = function (messageInfo, classId, ty) {
|
|
|
_obj.edges.push(messageInfo.edges[j])
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ console.log("------------s------------");
|
|
|
+ console.log(messageInfo.nodes);
|
|
|
+ console.log(_obj.nodes);
|
|
|
+ console.log(ty);
|
|
|
for (j = 0; j < messageInfo.nodes.length; j++) {
|
|
|
_is = true;
|
|
|
for (i = 0; i < _obj.nodes.length; i++) {
|
|
@@ -788,7 +790,7 @@ us.updatecscl = function (messageInfo, classId, ty) {
|
|
|
_obj.nodes.push(messageInfo.nodes[j])
|
|
|
}
|
|
|
}
|
|
|
- //console.log(_obj);
|
|
|
+ console.log(_obj);
|
|
|
//如果不存在则去数据库查找
|
|
|
us.mysql.usselect(['172.16.12.5', 'pbl', 'updateRoomData', JSON.stringify(_obj), classId],
|
|
|
function (ret) {
|
|
@@ -1446,18 +1448,18 @@ us.broadcast = function (messageinfo, pageid, type) {
|
|
|
for (i in messageinfo) {
|
|
|
_messageinfo = messageinfo[i]; //记录消息消息
|
|
|
_users = us[type][i] ? us[type][i].user : {}; //记录用户集合
|
|
|
- console.log("=================a=============");
|
|
|
- console.log(_users);
|
|
|
+ // console.log("=================a=============");
|
|
|
+ // console.log(_users);
|
|
|
for (j in _users) { //循环处理每个用户处理 给每个用户集合下的用户发送消息
|
|
|
_pageids = _users[j]; //记录当前用户在每个端登录的页面唯一识别ID
|
|
|
- console.log("=================g=============");
|
|
|
- console.log(_pageids);
|
|
|
+ // console.log("=================g=============");
|
|
|
+ // console.log(_pageids);
|
|
|
for (o = 0; o < _pageids.length; o++) { //循环发送给当前用户在每个端登录的用户
|
|
|
_recievedpageid = _pageids[o]; //记录接受者页面唯一识别ID 用于区分是否是发送用户
|
|
|
if (_recievedpageid != pageid) { //如果接受用户不等于发送用户则发送消息
|
|
|
try {
|
|
|
- console.log("=================b=============");
|
|
|
- console.log(_userconnect[j]);
|
|
|
+ // console.log("=================b=============");
|
|
|
+ // console.log(_userconnect[j]);
|
|
|
if (_userconnect[j] && _userconnect[j][_recievedpageid]) {
|
|
|
_issend = _userconnect[j][_recievedpageid].response.end(JSON.stringify(_messageinfo)); //发送消息
|
|
|
if (!_issend) { //如果用户下线了,那么发送消息就会失败
|
|
@@ -2007,9 +2009,9 @@ us.addExcel = function (response, excelinfo) {
|
|
|
us.getcscl = function (response, calssid, pageid, userid) {
|
|
|
//判断文档是否已在内层中存在
|
|
|
if (us.cscl[calssid]) {
|
|
|
- console.log("------------------------ssss----------")
|
|
|
- console.log(userid)
|
|
|
- console.log(us.cscl[calssid].user[userid])
|
|
|
+ // console.log("------------------------ssss----------")
|
|
|
+ // console.log(userid)
|
|
|
+ // console.log(us.cscl[calssid].user[userid])
|
|
|
//如果存在则直接返回内层的文档
|
|
|
if (!us.cscl[calssid].user[userid]) {
|
|
|
us.cscl[calssid].user[userid] = [pageid];
|
|
@@ -2046,8 +2048,8 @@ us.getcscl = function (response, calssid, pageid, userid) {
|
|
|
if (us.offLineMessage[pageid]) {
|
|
|
us.offLineMessage[pageid].cscl.indexOf(calssid) == -1 && us.offLineMessage[pageid].cscl.push(calssid); //添加到用户离线消息的连接wrod记录中
|
|
|
}
|
|
|
- console.log("------------------------ggggg----------");
|
|
|
- console.log(us.cscl[calssid])
|
|
|
+ // console.log("------------------------ggggg----------");
|
|
|
+ // console.log(us.cscl[calssid])
|
|
|
//如果不存在则去数据库查找
|
|
|
us.mysql.usselect(['172.16.12.5', 'pbl', 'select_room', calssid],
|
|
|
function (ret) {
|