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
2cc919d6
Commit
2cc919d6
authored
Aug 22, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refact:优化遍历麦位
parent
323f59ee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
2 deletions
+3
-2
on_mic.go
cron/mic_cron/on_mic.go
+1
-1
factory.go
domain/model/group_m/factory.go
+1
-1
mic.go
domain/model/group_m/mic.go
+1
-0
No files found.
cron/mic_cron/on_mic.go
View file @
2cc919d6
...
...
@@ -21,7 +21,7 @@ func OnMicCheck() {
}
for
_
,
groupId
:=
range
groupIds
{
//遍历每个麦位
for
i
:=
1
;
i
<=
30
;
i
++
{
for
i
:=
1
;
i
<=
group_m
.
MaxMicNum
;
i
++
{
micUser
,
err
:=
group_m
.
GetMicUser
(
model
,
groupId
,
i
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"cron micIn group_m.GetMicUser err:%v"
,
err
)
...
...
domain/model/group_m/factory.go
View file @
2cc919d6
...
...
@@ -432,7 +432,7 @@ func GetMicUserByExternalId(model *domain.Model, externalId string) (*MicUser, e
//麦位上没人,返回nil
func
GetMicUser
(
model
*
domain
.
Model
,
groupUuid
string
,
i
int
)
(
*
MicUser
,
error
)
{
if
i
<
1
||
i
>
30
{
if
i
<
1
||
i
>
MaxMicNum
{
return
nil
,
myerr
.
NewSysErrorF
(
"麦序不对,不在范围值内 i:%v"
,
i
)
}
str
,
err
:=
redisCli
.
GetRedis
()
.
Get
(
context
.
Background
(),
redis_key
.
GetPrefixGroupMicUser
(
groupUuid
,
i
))
.
Result
()
...
...
domain/model/group_m/mic.go
View file @
2cc919d6
...
...
@@ -843,6 +843,7 @@ func GetMicHasInGroups() ([]string, error) {
if
err
!=
nil
{
return
nil
,
myerr
.
WrapErr
(
err
)
}
return
groupUuids
,
nil
// 不需要下面的逐个麦位的判断了
//
resultGroupUuids
:=
make
([]
string
,
0
,
len
(
groupUuids
))
//循环lua判断是否, 最后的保证,(猜想:真正麦上有人的群没有很多)
...
...
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