Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-group
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
hujiebin
hilo-group
Commits
b28ebb47
Commit
b28ebb47
authored
Aug 28, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去掉查询,redis性能
parent
80137d5c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
userRoomVisit.go
domain/cache/room_c/userRoomVisit.go
+3
-1
No files found.
domain/cache/room_c/userRoomVisit.go
View file @
b28ebb47
...
@@ -59,7 +59,10 @@ func ProcessUserRoomVisit(userId uint64, groupId string) error {
...
@@ -59,7 +59,10 @@ func ProcessUserRoomVisit(userId uint64, groupId string) error {
}
}
// 查询用户访问过的房间及其时间
// 查询用户访问过的房间及其时间
// todo 去掉查询,redis性能
func
GetUserRoomVisit
(
userId
uint64
)
(
map
[
string
]
int64
,
error
)
{
func
GetUserRoomVisit
(
userId
uint64
)
(
map
[
string
]
int64
,
error
)
{
result
:=
make
(
map
[
string
]
int64
,
0
)
return
result
,
nil
key
:=
redis_key
.
GetUserEnterRoomKey
(
userId
)
key
:=
redis_key
.
GetUserEnterRoomKey
(
userId
)
ret
,
err
:=
redisCli
.
GetRedis
()
.
ZRangeWithScores
(
context
.
Background
(),
key
,
0
,
-
1
)
.
Result
()
ret
,
err
:=
redisCli
.
GetRedis
()
.
ZRangeWithScores
(
context
.
Background
(),
key
,
0
,
-
1
)
.
Result
()
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -67,7 +70,6 @@ func GetUserRoomVisit(userId uint64) (map[string]int64, error) {
...
@@ -67,7 +70,6 @@ func GetUserRoomVisit(userId uint64) (map[string]int64, error) {
}
}
//mylogrus.MyLog.Infof("GetUserRoomVisit, ZRangeWithScores %s, return %v", key, ret)
//mylogrus.MyLog.Infof("GetUserRoomVisit, ZRangeWithScores %s, return %v", key, ret)
result
:=
make
(
map
[
string
]
int64
,
0
)
for
_
,
i
:=
range
ret
{
for
_
,
i
:=
range
ret
{
result
[
i
.
Member
.
(
string
)]
=
int64
(
i
.
Score
)
result
[
i
.
Member
.
(
string
)]
=
int64
(
i
.
Score
)
}
}
...
...
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