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
5253543a
Commit
5253543a
authored
Jul 21, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:forbid传入
parent
19ce63ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
mic.go
domain/model/group_m/mic.go
+2
-2
group_mic.go
domain/service/group_mic_s/group_mic.go
+7
-3
No files found.
domain/model/group_m/mic.go
View file @
5253543a
...
@@ -269,7 +269,7 @@ func (mic *Mic) In(userId uint64, externalId string) error {
...
@@ -269,7 +269,7 @@ func (mic *Mic) In(userId uint64, externalId string) error {
//上麦(自己),
//上麦(自己),
//规则:1:加锁了不能上麦 2:麦上有人,不能上麦
//规则:1:加锁了不能上麦 2:麦上有人,不能上麦
//cpUserId如果有
//cpUserId如果有
func
(
mic
*
Mic
)
Update
(
userId
uint64
,
externalId
string
,
cpUserId
uint64
)
(
err
error
)
{
func
(
mic
*
Mic
)
Update
(
userId
uint64
,
externalId
string
,
cpUserId
uint64
,
forbid
bool
)
(
err
error
)
{
defer
func
()
{
defer
func
()
{
if
err
!=
nil
{
if
err
!=
nil
{
mic
.
model
.
Log
.
Errorf
(
"MicUpdate fail,userId:%v,cpUserId:%v,err:%v"
,
userId
,
cpUserId
,
err
)
mic
.
model
.
Log
.
Errorf
(
"MicUpdate fail,userId:%v,cpUserId:%v,err:%v"
,
userId
,
cpUserId
,
err
)
...
@@ -300,7 +300,7 @@ func (mic *Mic) Update(userId uint64, externalId string, cpUserId uint64) (err e
...
@@ -300,7 +300,7 @@ func (mic *Mic) Update(userId uint64, externalId string, cpUserId uint64) (err e
ExternalId
:
externalId
,
ExternalId
:
externalId
,
UserId
:
userId
,
UserId
:
userId
,
CpUserId
:
cpUserId
,
CpUserId
:
cpUserId
,
Forbid
:
f
alse
,
Forbid
:
f
orbid
,
Timestamp
:
time
.
Now
()
.
Unix
(),
Timestamp
:
time
.
Now
()
.
Unix
(),
})
})
if
err
!=
nil
{
if
err
!=
nil
{
...
...
domain/service/group_mic_s/group_mic.go
View file @
5253543a
...
@@ -346,9 +346,11 @@ func (s *GroupMicService) CheckCpOnMic(groupUuid string) {
...
@@ -346,9 +346,11 @@ func (s *GroupMicService) CheckCpOnMic(groupUuid string) {
// userId->micIndex
// userId->micIndex
var
userMicIndex
=
make
(
map
[
uint64
]
int
)
var
userMicIndex
=
make
(
map
[
uint64
]
int
)
var
userIds
[]
uint64
var
userIds
[]
uint64
forbidMap
:=
make
(
map
[
uint64
]
bool
)
for
_
,
u
:=
range
micUsers
{
for
_
,
u
:=
range
micUsers
{
userMicIndex
[
u
.
UserId
]
=
u
.
I
userMicIndex
[
u
.
UserId
]
=
u
.
I
userIds
=
append
(
userIds
,
u
.
UserId
)
userIds
=
append
(
userIds
,
u
.
UserId
)
forbidMap
[
u
.
UserId
]
=
u
.
Forbid
}
}
cpPairs
,
err
:=
rpc
.
MGetUserCpPairs
(
model
,
userIds
)
cpPairs
,
err
:=
rpc
.
MGetUserCpPairs
(
model
,
userIds
)
// 更新麦上cp的信息
// 更新麦上cp的信息
...
@@ -374,7 +376,7 @@ func (s *GroupMicService) CheckCpOnMic(groupUuid string) {
...
@@ -374,7 +376,7 @@ func (s *GroupMicService) CheckCpOnMic(groupUuid string) {
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
return
mic
.
Update
(
userId
,
users
[
userId
]
.
ExternalId
,
cpUserId
)
return
mic
.
Update
(
userId
,
users
[
userId
]
.
ExternalId
,
cpUserId
,
forbidMap
[
userId
]
)
})
})
redisLock
(
redis_key
.
GetPrefixGroupMicUserInLock
(
cpUserId
),
uuid
.
NewV4
()
.
String
(),
time
.
Second
*
2
,
func
()
error
{
redisLock
(
redis_key
.
GetPrefixGroupMicUserInLock
(
cpUserId
),
uuid
.
NewV4
()
.
String
(),
time
.
Second
*
2
,
func
()
error
{
model
:=
domain
.
CreateModel
(
s
.
svc
.
CtxAndDb
)
model
:=
domain
.
CreateModel
(
s
.
svc
.
CtxAndDb
)
...
@@ -382,7 +384,7 @@ func (s *GroupMicService) CheckCpOnMic(groupUuid string) {
...
@@ -382,7 +384,7 @@ func (s *GroupMicService) CheckCpOnMic(groupUuid string) {
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
return
mic
.
Update
(
cpUserId
,
users
[
cpUserId
]
.
ExternalId
,
userId
)
return
mic
.
Update
(
cpUserId
,
users
[
cpUserId
]
.
ExternalId
,
userId
,
forbidMap
[
cpUserId
]
)
})
})
}
}
return
return
...
@@ -403,11 +405,13 @@ func (s *GroupMicService) CheckCpLeaveMic(groupUuid string, leaveUid uint64) {
...
@@ -403,11 +405,13 @@ func (s *GroupMicService) CheckCpLeaveMic(groupUuid string, leaveUid uint64) {
// userId->micIndex
// userId->micIndex
var
userMicIndex
=
make
(
map
[
uint64
]
int
)
var
userMicIndex
=
make
(
map
[
uint64
]
int
)
var
cpUserId
uint64
var
cpUserId
uint64
forbidMap
:=
make
(
map
[
uint64
]
bool
)
for
_
,
u
:=
range
micUsers
{
for
_
,
u
:=
range
micUsers
{
if
u
.
UserId
==
leaveUid
{
if
u
.
UserId
==
leaveUid
{
cpUserId
=
u
.
CpUserId
cpUserId
=
u
.
CpUserId
}
}
userMicIndex
[
u
.
UserId
]
=
u
.
I
userMicIndex
[
u
.
UserId
]
=
u
.
I
forbidMap
[
u
.
UserId
]
=
u
.
Forbid
}
}
if
cpUserId
<=
0
{
if
cpUserId
<=
0
{
return
return
...
@@ -423,7 +427,7 @@ func (s *GroupMicService) CheckCpLeaveMic(groupUuid string, leaveUid uint64) {
...
@@ -423,7 +427,7 @@ func (s *GroupMicService) CheckCpLeaveMic(groupUuid string, leaveUid uint64) {
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
return
mic
.
Update
(
cpUserId
,
user
.
ExternalId
,
0
)
return
mic
.
Update
(
cpUserId
,
user
.
ExternalId
,
0
,
forbidMap
[
cpUserId
]
)
})
})
return
return
}
}
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