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
2675111c
Commit
2675111c
authored
Jun 09, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
检查cp下麦
parent
5dc1ce3a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
group_mic.go
domain/service/group_mic_s/group_mic.go
+41
-0
group_mic.go
route/group_r/group_mic.go
+2
-0
No files found.
domain/service/group_mic_s/group_mic.go
View file @
2675111c
...
@@ -331,6 +331,7 @@ func (s *GroupMicService) IncrGroupPowerOnMicExpAndTime(groupId string, userId u
...
@@ -331,6 +331,7 @@ func (s *GroupMicService) IncrGroupPowerOnMicExpAndTime(groupId string, userId u
return
nil
return
nil
}
}
// 检查cp上麦
func
(
s
*
GroupMicService
)
CheckCpOnMic
(
groupUuid
string
)
{
func
(
s
*
GroupMicService
)
CheckCpOnMic
(
groupUuid
string
)
{
model
:=
domain
.
CreateModelContext
(
s
.
svc
.
MyContext
)
model
:=
domain
.
CreateModelContext
(
s
.
svc
.
MyContext
)
// 填充cp麦位
// 填充cp麦位
...
@@ -382,3 +383,43 @@ func (s *GroupMicService) CheckCpOnMic(groupUuid string) {
...
@@ -382,3 +383,43 @@ func (s *GroupMicService) CheckCpOnMic(groupUuid string) {
}
}
return
return
}
}
// 检查cp下麦
func
(
s
*
GroupMicService
)
CheckCpLeaveMic
(
groupUuid
string
,
leaveUid
uint64
)
{
model
:=
domain
.
CreateModelContext
(
s
.
svc
.
MyContext
)
// 填充cp麦位
micNumType
,
err
:=
group_m
.
GetMicNumType
(
model
,
groupUuid
)
if
err
!=
nil
{
return
}
_
,
micUsers
,
err
:=
group_m
.
GetAllMic
(
groupUuid
,
micNumType
)
if
err
!=
nil
{
return
}
// userId->micIndex
var
userMicIndex
=
make
(
map
[
uint64
]
int
)
var
cpUserId
uint64
for
_
,
u
:=
range
micUsers
{
if
u
.
UserId
==
leaveUid
{
cpUserId
=
u
.
CpUserId
}
userMicIndex
[
u
.
UserId
]
=
u
.
I
}
if
cpUserId
<=
0
{
return
}
user
,
err
:=
user_m
.
GetUser
(
model
,
cpUserId
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"GetUser fail:%v"
,
err
)
return
}
redisLock
(
redis_key
.
GetPrefixGroupMicUserInLock
(
cpUserId
),
uuid
.
NewV4
()
.
String
(),
time
.
Second
*
2
,
func
()
error
{
model
:=
domain
.
CreateModel
(
s
.
svc
.
CtxAndDb
)
mic
,
err
:=
group_m
.
GetMic
(
model
,
groupUuid
,
userMicIndex
[
cpUserId
])
if
err
!=
nil
{
return
err
}
return
mic
.
Update
(
cpUserId
,
user
.
ExternalId
,
0
)
})
return
}
route/group_r/group_mic.go
View file @
2675111c
...
@@ -705,6 +705,8 @@ func GroupMicLeave(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -705,6 +705,8 @@ func GroupMicLeave(c *gin.Context) (*mycontext.MyContext, error) {
if
err
:=
group_mic_s
.
NewGroupPowerService
(
myContext
)
.
GroupMicLeave
(
groupId
,
i
,
userId
,
externalId
);
err
!=
nil
{
if
err
:=
group_mic_s
.
NewGroupPowerService
(
myContext
)
.
GroupMicLeave
(
groupId
,
i
,
userId
,
externalId
);
err
!=
nil
{
return
myContext
,
err
return
myContext
,
err
}
}
// check cp麦位置
go
group_mic_s
.
NewGroupPowerService
(
myContext
)
.
CheckCpLeaveMic
(
groupId
,
userId
)
resp
.
ResponseOk
(
c
,
nil
)
resp
.
ResponseOk
(
c
,
nil
)
return
myContext
,
nil
return
myContext
,
nil
}
}
...
...
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