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
41061989
Commit
41061989
authored
Nov 10, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
f4c599f3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
im-center/app/base/utils/redisClient.js
+7
-3
im-center/app/config/socket.server2.js
+3
-3
No files found.
im-center/app/base/utils/redisClient.js
View file @
41061989
...
...
@@ -64,11 +64,15 @@ class RedisClient {
if
(
channel
==
"brc"
)
{
//如果是广播频道,则发送广播到客户端
self
.
chatserver
.
server
.
emit
(
"brc"
,
message
);
}
else
if
(
self
.
chatserver
.
users
[
channel
])
{
if
(
!
message
.
type
||
message
.
type
==
"single"
)
{
self
.
chatserver
.
users
[
channel
].
client
.
emit
(
"chatmsg"
,
message
);
if
(
!
message
.
toType
||
message
.
toType
==
"single"
||
message
.
toType
==
"sys"
)
{
if
(
message
.
toType
&&
message
.
toType
==
"sys"
)
{
self
.
chatserver
.
users
[
channel
].
client
.
emit
(
"backtofront"
,
message
);
}
else
{
self
.
chatserver
.
users
[
channel
].
client
.
emit
(
"chatmsg"
,
message
);
}
//self.chatserver.users[channel].client.emit(message.type, message.data);
}
else
{
if
(
message
.
type
==
"many"
)
{
if
(
message
.
t
oT
ype
==
"many"
)
{
//说明channel是房间名称,查续出房间中的人员uks,然后遍历后发送消息
let
cs
=
await
self
.
chatserver
.
rooms
.
clientsByRoom
(
channel
)
for
(
c
of
cs
)
{
...
...
im-center/app/config/socket.server2.js
View file @
41061989
...
...
@@ -151,7 +151,7 @@ class MsgHandler {
content
:
msg
.
content
,
isAcceptedFrom
:
msg
.
isAcceptedFrom
?
msg
.
isAcceptedFrom
:
false
,
isAcceptedTo
:
msg
.
isAcceptedTo
?
msg
.
isAcceptedTo
:
false
,
company
_
id
:
companyid
companyid
:
companyid
};
msghistoryCtl
.
service
.
saveMsg
(
msgH
).
then
((
m
)
=>
{
redisClient
.
publish
(
to
,
JSON
.
stringify
(
msg
));
...
...
@@ -224,10 +224,10 @@ class SocketServer {
content
:
msg
.
content
,
isAcceptedFrom
:
msg
.
isAcceptedFrom
?
msg
.
isAcceptedFrom
:
false
,
isAcceptedTo
:
msg
.
isAcceptedTo
?
msg
.
isAcceptedTo
:
false
,
company
_
id
:
companyid
companyid
:
companyid
};
msghistoryCtl
.
service
.
saveMsg
(
msgH
).
then
((
m
)
=>
{
redisClient
.
publish
(
to
,
JSON
.
stringify
(
msg
));
redisClient
.
publish
(
to
,
JSON
.
stringify
(
msg
H
));
}).
catch
(
e
=>
{
console
.
log
(
e
);
});
...
...
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