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
a824a8e4
Commit
a824a8e4
authored
Jul 24, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成推送
parent
85ea033c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
8 deletions
+56
-8
micData.go
domain/model/group_m/micData.go
+18
-7
mic_change.go
domain/service/event_s/mic_change.go
+38
-1
No files found.
domain/model/group_m/micData.go
View file @
a824a8e4
...
...
@@ -259,9 +259,9 @@ func MicAllRPush(model *domain.Model, groupUid string, externalId string) error
}
//
micContents
,
err
:=
g
etMicAllContent
(
model
,
groupUid
)
micContents
,
err
:=
G
etMicAllContent
(
model
,
groupUid
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"MicChangeRPush MicAllRPush
g
etMicAllContent err:%+v, micContents:%v groupUuid:%v, externalId:%v"
,
err
,
micContents
,
groupUid
,
externalId
)
model
.
Log
.
Errorf
(
"MicChangeRPush MicAllRPush
G
etMicAllContent err:%+v, micContents:%v groupUuid:%v, externalId:%v"
,
err
,
micContents
,
groupUid
,
externalId
)
return
err
}
for
_
,
micContent
:=
range
micContents
{
...
...
@@ -319,7 +319,7 @@ func MicRPush(model *domain.Model, txGroupId string, msg GroupSystemMsg) error {
}
//得使用旧的imGroupId
func
g
etMicAllContent
(
model
*
domain
.
Model
,
groupUid
string
)
([]
MicContent
,
error
)
{
func
G
etMicAllContent
(
model
*
domain
.
Model
,
groupUid
string
)
([]
MicContent
,
error
)
{
txGroupId
,
err
:=
ToTxGroupId
(
model
,
groupUid
)
if
err
!=
nil
{
...
...
@@ -340,6 +340,9 @@ func getMicAllContent(model *domain.Model, groupUid string) ([]MicContent, error
userIds
:=
make
([]
uint64
,
0
,
len
(
micUsers
))
for
_
,
r
:=
range
micUsers
{
userIds
=
append
(
userIds
,
r
.
UserId
)
if
r
.
CpUserId
>
0
{
userIds
=
append
(
userIds
,
r
.
CpUserId
)
}
}
model
.
Log
.
Infof
(
"MicChangeRPush getMicAllContent groupUid:%v, userIds:%+v"
,
groupUid
,
userIds
)
...
...
@@ -350,6 +353,13 @@ func getMicAllContent(model *domain.Model, groupUid string) ([]MicContent, error
micContents
:=
make
([]
MicContent
,
0
,
len
(
mics
))
for
_
,
r
:=
range
mics
{
var
micEffect
string
cpUserId
:=
micUserMap
[
r
.
I
]
.
CpUserId
micUserData
:=
micUserDataMap
[
micUserMap
[
r
.
I
]
.
UserId
]
if
cpUserId
>
0
{
micEffect
=
"https://image.whoisamy.shop/hilo/resource/svga/mic_effect_cp.svga"
micUserData
.
MicEffect
=
micEffect
}
micContents
=
append
(
micContents
,
MicContent
{
GroupId
:
txGroupId
,
I
:
r
.
I
,
...
...
@@ -359,7 +369,7 @@ func getMicAllContent(model *domain.Model, groupUid string) ([]MicContent, error
ExternalId
:
micUserMap
[
r
.
I
]
.
ExternalId
,
AgoraId
:
uint32
(
micUserMap
[
r
.
I
]
.
UserId
),
Timestamp
:
time
.
Now
()
.
UnixNano
(),
User
:
micUserData
Map
[
micUserMap
[
r
.
I
]
.
UserId
]
,
User
:
micUserData
,
})
}
return
micContents
,
nil
...
...
@@ -448,6 +458,7 @@ func getMicUserDatas(model *domain.Model, userIds []uint64) (map[uint64]*MicUser
return
nil
,
err
}
svips
,
_
:=
rpc
.
MGetUserSvip
(
model
,
userIds
)
cpRelations
,
_
:=
rpc
.
MGetUserCpRelations
(
model
,
userIds
)
micUserDataMap
:=
map
[
uint64
]
*
MicUserData
{}
for
_
,
id
:=
range
userIds
{
...
...
@@ -461,11 +472,10 @@ func getMicUserDatas(model *domain.Model, userIds []uint64) (map[uint64]*MicUser
}
var
headwearPicUrl
string
var
headwearEffectUrl
string
var
reverseHeadwear
EffectUrl
string
var
headwearReverse
EffectUrl
string
if
headwearUser
,
flag
:=
headwearMap
[
id
];
flag
{
headwearPicUrl
=
resHeadwearMap
[
headwearUser
.
HeadwearId
]
.
PicUrl
headwearEffectUrl
=
resHeadwearMap
[
headwearUser
.
HeadwearId
]
.
EffectUrl
reverseHeadwearEffectUrl
=
resHeadwearMap
[
headwearUser
.
HeadwearId
]
.
ReverseEffectUrl
}
micUserDataMap
[
id
]
=
&
MicUserData
{
Id
:
user
.
ID
,
...
...
@@ -478,9 +488,10 @@ func getMicUserDatas(model *domain.Model, userIds []uint64) (map[uint64]*MicUser
NobleLeave
:
nobleMap
[
id
],
HeadwearPicUrl
:
headwearPicUrl
,
HeadwearEffectUrl
:
headwearEffectUrl
,
HeadwearReverseEffectUrl
:
reverseHeadwear
EffectUrl
,
HeadwearReverseEffectUrl
:
headwearReverse
EffectUrl
,
SvipLevel
:
svips
[
id
]
.
SvipLevel
,
Svip
:
rpc
.
CopySimpleSvip
(
svips
[
id
]),
HeadwearIcon
:
cpRelations
[
user
.
ID
]
.
CpUserAvatar
,
}
}
return
micUserDataMap
,
nil
...
...
domain/service/event_s/mic_change.go
View file @
a824a8e4
package
event_s
import
(
"encoding/json"
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/rpc"
"hilo-group/domain/event/group_ev"
"hilo-group/domain/model/group_m"
"hilo-group/myerr/bizerr"
)
...
...
@@ -14,6 +16,41 @@ func GroupInMicChangeEvent() {
if
!
ok
{
return
bizerr
.
InvalidParameter
}
return
rpc
.
SendSocketMicChange
(
e
.
UserId
)
// todo
return
MicAllRPush
(
model
,
e
.
GroupId
,
e
.
UserId
,
e
.
ExternalId
)
})
}
func
MicAllRPush
(
model
*
domain
.
Model
,
txGroupUid
string
,
userId
uint64
,
externalId
string
)
error
{
model
.
Log
.
Infof
(
"MicChangeRPush MicAllRPush begin groupUuid:%v, externalId:%v"
,
txGroupUid
,
externalId
)
imGroupId
,
err
:=
group_m
.
ToImGroupId
(
model
,
txGroupUid
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"ToImGroupId fail:%v"
,
err
)
return
err
}
//
micContents
,
err
:=
group_m
.
GetMicAllContent
(
model
,
imGroupId
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"MicChangeRPush MicAllRPush getMicAllContent err:%+v, micContents:%v groupUuid:%v, externalId:%v"
,
err
,
micContents
,
txGroupUid
,
externalId
)
return
err
}
for
_
,
micContent
:=
range
micContents
{
//麦上是默认值,就不用推
if
micContent
.
Forbid
==
false
&&
micContent
.
User
==
nil
&&
micContent
.
AgoraId
==
0
&&
micContent
.
Lock
==
false
&&
micContent
.
ExternalId
==
""
&&
micContent
.
MicForbid
==
false
{
model
.
Log
.
Infof
(
"MicChangeRPush MicAllRPush default micContent:%v, groupUuid:%v, externalId:%v, micContent:%+v"
,
micContent
,
txGroupUid
,
externalId
,
micContent
)
continue
}
micContentStr
,
err
:=
json
.
Marshal
(
micContent
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"MicChangeRPush MicAllRPush Marshal micContent err:%+v, groupUuid:%v, externalId:%v, micContent:%+v"
,
err
,
txGroupUid
,
externalId
,
string
(
micContentStr
))
continue
}
if
err
:=
rpc
.
SendSocketMicChange
(
userId
,
externalId
,
txGroupUid
,
uint32
(
micContent
.
I
),
micContent
.
Lock
,
micContent
.
Forbid
,
micContent
.
MicForbid
,
micContent
.
AgoraId
,
micContent
.
User
.
Avatar
,
micContent
.
User
.
Nick
,
uint32
(
micContent
.
User
.
Sex
),
micContent
.
User
.
Code
,
micContent
.
User
.
IsVip
,
uint32
(
micContent
.
User
.
NobleLeave
),
micContent
.
User
.
HeadwearPicUrl
,
micContent
.
User
.
HeadwearEffectUrl
,
micContent
.
User
.
HeadwearReverseEffectUrl
,
uint32
(
micContent
.
User
.
SvipLevel
),
micContent
.
User
.
MicEffect
,
micContent
.
User
.
HeadwearIcon
);
err
!=
nil
{
model
.
Log
.
Errorf
(
"MicAllRPush err:%+v, groupUuid:%v, externalId:%v, micContent:%+v"
,
err
,
txGroupUid
,
externalId
,
string
(
micContentStr
))
}
}
model
.
Log
.
Infof
(
"MicAllRPush end groupUuid:%v, externalId:%v"
,
txGroupUid
,
externalId
)
return
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