Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
ws-rst
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qlintonger xeno
ws-rst
Commits
717921fb
Commit
717921fb
authored
Feb 24, 2025
by
qlintonger xeno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
阐释添加额外消息发送+1
parent
7fbb3b4f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
src/handles/redis.rs
+9
-8
No files found.
src/handles/redis.rs
View file @
717921fb
...
...
@@ -16,6 +16,11 @@ lazy_static! {
// 从 Redis 的 onlineUsers 集合中移除当前用户的信息
pub
async
fn
remove_this_connection
(
from_id
:
&
str
)
->
Result
<
(),
redis
::
RedisError
>
{
{
ONLINE_USERS
.remove
(
from_id
);
println!
(
"成功从全局变量中移除用户id: {} 的信息"
,
from_id
);
}
let
mut
con
=
REDIS_POOL
.get_connection
()
.expect
(
"Failed to get Redis connection"
);
...
...
@@ -24,11 +29,6 @@ pub async fn remove_this_connection(from_id: &str) -> Result<(), redis::RedisErr
println!
(
"从 Redis 中的 onlineUsers 哈希表删除用户信息时出错: {}"
,
e
);
return
Err
(
e
);
}
{
ONLINE_USERS
.remove
(
from_id
);
println!
(
"成功从全局变量中移除用户id: {} 的信息"
,
from_id
);
}
Ok
(())
}
...
...
@@ -52,9 +52,6 @@ pub async fn insert_this_connection(
from_id
:
&
str
,
params
:
&
HashMap
<
String
,
String
>
,
)
->
Result
<
(),
redis
::
RedisError
>
{
let
mut
con
=
REDIS_POOL
.get_connection
()
.expect
(
"Failed to get Redis connection"
);
let
device_id
=
params
.get
(
"deviceID"
)
.cloned
()
.unwrap_or
(
""
.to_string
());
let
from_name
=
params
.get
(
"fromName"
)
.cloned
()
.unwrap_or
(
""
.to_string
());
...
...
@@ -84,6 +81,10 @@ pub async fn insert_this_connection(
"idle"
,
""
,
device_id
,
from_id
,
has_camera
,
has_mike
,
user_call_group
,
from_name_decoded
);
let
mut
con
=
REDIS_POOL
.get_connection
()
.expect
(
"Failed to get Redis connection"
);
if
let
Err
(
e
)
=
con
.hset
::
<&
str
,
&
str
,
&
str
,
()
>
(
"onlineUsers"
,
from_id
,
&
user_info_str
)
{
println!
(
"将用户信息添加到 Redis 中的 onlineUsers 哈希表时出错: {}"
,
...
...
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