Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
644f065e
Commit
644f065e
authored
Oct 15, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
28ad33e2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
10 deletions
+6
-10
im-center/app/base/db/models/msg/msgnotice.js
+2
-1
im-center/app/config/socket.server2.js
+4
-9
No files found.
im-center/app/base/db/models/msg/msgnotice.js
View file @
644f065e
...
...
@@ -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
,
},
{
...
...
im-center/app/config/socket.server2.js
View file @
644f065e
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment