Commit 644f065e by 蒋勇

d

parent 28ad33e2
......@@ -8,7 +8,8 @@ module.exports = (db, DataTypes) => {
touser: DataTypes.STRING,//需要在后台补充
toId: DataTypes.INTEGER,
toHeadUrl: DataTypes.STRING,
isAccepted: DataTypes.BOOLEAN,
isAcceptedFrom: DataTypes.BOOLEAN,
isAcceptedTo: DataTypes.BOOLEAN,
lastMsgId: DataTypes.INTEGER,
companyid: DataTypes.INTEGER,
}, {
......
......@@ -224,7 +224,7 @@ class SocketServer {
//中间件可以在链接事件发出前调用一次
this.server.on('connection', function (client) {
console.log("connection.....socket");
client.on("login", (d) => {
client.on("login", (d, fn) => {
//匿名用户,userName--访客前端给个uuid,id也取uuid,company-id是-1,表示匿名用户
let uname = d.userName
let nickName = d.nickName ? d.nickName : uname
......@@ -242,7 +242,7 @@ class SocketServer {
let uk = uname + "_" + id + "_" + d.company.id
//作为房间key
let ukencstr = system.encriptByDes(JSON.stringify(uk))
encuk.uid = ukencstr
if (self.socketidMap[client.id] && d.company.id != -1) {//可能匿名登录过
let prevukstr = self.socketidMap[client.id]
console.log("rm ano...", prevukstr)
......@@ -259,13 +259,8 @@ class SocketServer {
self.rooms.joinRoom(ukencstr, ukencstr)
//初始化当前uk,历史未退出的房间,重新在新的节点订阅
self.rooms.reJoinRooms(ukencstr)
console.log(self.socketidMap)
})
// //
// self.of('/').adapter.clients((err, clients) => {
// console.log(clients); // an array containing all connected socket ids
// });
return fn(encuk)
});
//链接断开事件
client.on('disconnect', async function (r) {
console.log("connection.........................................dismiss.............", client.id, r);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment