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
ba802a38
Commit
ba802a38
authored
Aug 30, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用redisCluster中的zset代替,只是取出大于100的
parent
b6f697a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
userRoomVisit.go
domain/cache/room_c/userRoomVisit.go
+15
-0
No files found.
domain/cache/room_c/userRoomVisit.go
View file @
ba802a38
...
...
@@ -8,6 +8,7 @@ import (
"git.hilo.cn/hilo-common/resource/redisCli"
"github.com/bluele/gcache"
redis2
"github.com/go-redis/redis/v8"
"github.com/spf13/cast"
"hilo-group/_const/redis_key"
"strconv"
"time"
...
...
@@ -86,6 +87,20 @@ func MGetRoomVisitCount(groupIds []string) (map[string]string, error) {
if
len
(
groupIds
)
<=
0
{
return
visit
,
nil
}
// 用redisCluster中的zset代替,只是取出大于100的
zKey
:=
redis_key
.
GetPrefixRoomVisitCountZset
()
zRes
,
err
:=
redisCli
.
GetClusterRedis
()
.
ZRevRangeByScoreWithScores
(
context
.
Background
(),
zKey
,
&
redis2
.
ZRangeBy
{
Min
:
fmt
.
Sprintf
(
"%d"
,
100
),
// 100人数以上的。
Max
:
"+inf"
,
})
.
Result
()
if
err
!=
nil
{
mylogrus
.
MyLog
.
Errorf
(
"MGetRoomVisitCount zset fail:%v"
,
err
)
return
visit
,
err
}
for
_
,
v
:=
range
zRes
{
visit
[
cast
.
ToString
(
v
.
Member
)]
=
cast
.
ToString
(
v
.
Score
)
}
return
visit
,
nil
var
miss
[]
string
for
_
,
groupId
:=
range
groupIds
{
...
...
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