Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-common
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-common
Commits
7f41bbcf
Commit
7f41bbcf
authored
Jul 24, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发送socket的麦位变化
parent
942b88f5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
117 additions
and
0 deletions
+117
-0
userProxy.proto
protocol/userProxy.proto
+63
-0
user_center_coder.go
rpc/user_center_coder.go
+1
-0
user_center_func.go
rpc/user_center_func.go
+53
-0
No files found.
protocol/userProxy.proto
View file @
7f41bbcf
...
@@ -412,3 +412,66 @@ message SvipUpgrade {
...
@@ -412,3 +412,66 @@ message SvipUpgrade {
uint32
svip_level
=
2
;
uint32
svip_level
=
2
;
string
group_id
=
3
;
string
group_id
=
3
;
}
}
/* id == 152 用户进房 上行 */
message
EnterRoom
{
string
group_id
=
1
;
}
/* id == 153 用户离房 上行 */
message
LeaveRoom
{
string
group_id
=
1
;
}
/* id == 154 房间心跳 上行 */
message
RoomHeartBeat
{
string
group_id
=
1
;
}
/* id == 155 麦位变化 下行 */
message
GroupMicChange
{
string
seqId
=
1
;
string
group_id
=
2
;
uint32
i
=
3
;
bool
lock
=
4
;
bool
forbid
=
5
;
bool
micForbid
=
6
;
string
externalId
=
7
;
string
agoraId
=
8
;
int64
timestamp
=
9
;
MicUserData
user
=
10
;
}
/* id == 156 麦位变化确认 上行 */
message
GroupMicChangeRsp
{
string
seqId
=
1
;
}
message
MicUserData
{
uint64
id
=
1
;
string
externalId
=
2
;
string
avatar
=
3
;
string
nick
=
4
;
uint32
sex
=
5
;
string
code
=
6
;
bool
isVip
=
7
;
uint32
noble
=
8
;
string
headwearPicUrl
=
9
;
string
headwearEffectUrl
=
10
;
string
headwearReverseEffectUrl
=
11
;
int32
svipLevel
=
12
;
string
micEffect
=
14
;
string
headwearIcon
=
15
;
}
message
CvSvip
{
int32
svipLevel
=
1
;
repeated
CVSvipPrivilege
privileges
=
2
;
}
message
CVSvipPrivilege
{
int32
type
=
1
;
bool
canSwitch
=
2
;
bool
userSwitch
=
3
;
string
mysteryCode
=
4
;
}
\ No newline at end of file
rpc/user_center_coder.go
View file @
7f41bbcf
...
@@ -66,6 +66,7 @@ const (
...
@@ -66,6 +66,7 @@ const (
MsgTypeCpInvite
=
149
// cp邀请
MsgTypeCpInvite
=
149
// cp邀请
MsgTypeCpUpgrade
=
150
// cp升级
MsgTypeCpUpgrade
=
150
// cp升级
MsgTypeSvipUpgrade
=
151
// svip升级
MsgTypeSvipUpgrade
=
151
// svip升级
MsgTypeGroupMicChange
=
155
// 麦位变化
)
)
const
(
const
(
...
...
rpc/user_center_func.go
View file @
7f41bbcf
...
@@ -6,6 +6,7 @@ import (
...
@@ -6,6 +6,7 @@ import (
"git.hilo.cn/hilo-common/protocol/userProxy"
"git.hilo.cn/hilo-common/protocol/userProxy"
"git.hilo.cn/hilo-common/utils"
"git.hilo.cn/hilo-common/utils"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/proto"
"time"
)
)
func
SendFruitMachine
(
date
string
,
round
uint32
)
error
{
func
SendFruitMachine
(
date
string
,
round
uint32
)
error
{
...
@@ -397,3 +398,55 @@ func SendSvipUpgrade(nick, avatar string, svipLevel uint32, txGroupId string) er
...
@@ -397,3 +398,55 @@ func SendSvipUpgrade(nick, avatar string, svipLevel uint32, txGroupId string) er
}
}
return
nil
return
nil
}
}
// 发送socket的麦位变化
// todo fix
func
SendSocketMicChange
(
userId
uint64
)
error
{
var
msg
=
&
userProxy
.
GroupMicChange
{
SeqId
:
"todo"
,
GroupId
:
"todo"
,
I
:
1
,
Lock
:
true
,
Forbid
:
false
,
MicForbid
:
false
,
ExternalId
:
"1234"
,
AgoraId
:
"todotodo"
,
Timestamp
:
time
.
Now
()
.
Unix
(),
User
:
&
userProxy
.
MicUserData
{
Id
:
1
,
ExternalId
:
""
,
Avatar
:
""
,
Nick
:
""
,
Sex
:
0
,
Code
:
""
,
IsVip
:
false
,
Noble
:
0
,
HeadwearPicUrl
:
""
,
HeadwearEffectUrl
:
""
,
HeadwearReverseEffectUrl
:
""
,
SvipLevel
:
0
,
MicEffect
:
""
,
HeadwearIcon
:
"1231"
,
},
}
if
buffer
,
err
:=
proto
.
Marshal
(
msg
);
err
==
nil
{
userIds
:=
[]
uint64
{
userId
}
rspUids
,
err
:=
multicast
(
userIds
,
MsgTypeGroupMicChange
,
buffer
)
//记录socket,注意闭包问题
go
func
(
userIds
[]
uint64
,
msg
*
userProxy
.
GroupMicChange
,
rspUids
[]
uint64
,
err
error
)
{
buf
,
_
:=
json
.
Marshal
(
msg
)
AddRpcLogs
(
MsgTypeGroupMicChange
,
userIds
,
string
(
buf
[
:
]),
rspUids
,
err
)
}(
userIds
,
msg
,
rspUids
,
err
)
if
err
!=
nil
{
mylogrus
.
MyLog
.
Errorf
(
"grpc SendSocketMicChange send fail"
)
return
err
}
else
{
mylogrus
.
MyLog
.
Info
(
"grpc SendSocketMicChange send success"
)
}
}
else
{
return
err
}
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