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
7c039f19
Commit
7c039f19
authored
Aug 10, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
H5游戏静音
parent
902884c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
98 additions
and
1 deletion
+98
-1
userProxy.proto
protocol/userProxy.proto
+13
-1
user_center_coder.go
rpc/user_center_coder.go
+2
-0
user_center_func.go
rpc/user_center_func.go
+83
-0
No files found.
protocol/userProxy.proto
View file @
7c039f19
...
@@ -377,6 +377,10 @@ message SheepMatchSuccess {
...
@@ -377,6 +377,10 @@ message SheepMatchSuccess {
User
user
=
2
;
User
user
=
2
;
User
otherUser
=
3
;
User
otherUser
=
3
;
uint64
game_id
=
4
;
uint64
game_id
=
4
;
string
channelId
=
5
;
string
token
=
6
;
uint32
agoraId
=
7
;
uint32
provider
=
8
;
}
}
message
SheepGamePlayer
{
message
SheepGamePlayer
{
...
@@ -473,4 +477,12 @@ message LobbyMatchSuccess {
...
@@ -473,4 +477,12 @@ message LobbyMatchSuccess {
User
user
=
4
;
User
user
=
4
;
User
otherUser
=
5
;
User
otherUser
=
5
;
string
gameCode
=
6
;
string
gameCode
=
6
;
}
}
\ No newline at end of file
/* id == 158 H5游戏静音 */
message
H5GameVoiceMute
{
}
/* id == 159 H5游戏打开语音 */
message
H5GameVoiceUnMute
{
}
rpc/user_center_coder.go
View file @
7c039f19
...
@@ -68,6 +68,8 @@ const (
...
@@ -68,6 +68,8 @@ const (
MsgTypeSvipUpgrade
=
151
// svip升级
MsgTypeSvipUpgrade
=
151
// svip升级
MsgTypeGroupMicChange
=
155
// 麦位变化
MsgTypeGroupMicChange
=
155
// 麦位变化
MsgTypeLobbyMatchSuccess
=
157
// 羊羊匹配成功
MsgTypeLobbyMatchSuccess
=
157
// 羊羊匹配成功
MsgTypeH5GameMute
=
158
// H5游戏静音
MsgTypeH5GameUnMute
=
159
// H5游戏开音
)
)
const
(
const
(
...
...
rpc/user_center_func.go
View file @
7c039f19
...
@@ -255,6 +255,7 @@ func SendGroupChatNotice(fromUserId uint64, userIds []uint64, senderExtId string
...
@@ -255,6 +255,7 @@ func SendGroupChatNotice(fromUserId uint64, userIds []uint64, senderExtId string
}
}
// 羊羊匹配成功
// 羊羊匹配成功
// Deprecated: missing Params
func
SendSheepMatchSuccess
(
matchId
,
myUserId
,
otherUserId
uint64
,
nick1
,
nick2
,
avatar1
,
avatar2
string
,
gameIds
...
uint64
)
error
{
func
SendSheepMatchSuccess
(
matchId
,
myUserId
,
otherUserId
uint64
,
nick1
,
nick2
,
avatar1
,
avatar2
string
,
gameIds
...
uint64
)
error
{
gameId
:=
uint64
(
0
)
gameId
:=
uint64
(
0
)
if
len
(
gameIds
)
>
0
{
if
len
(
gameIds
)
>
0
{
...
@@ -288,6 +289,40 @@ func SendSheepMatchSuccess(matchId, myUserId, otherUserId uint64, nick1, nick2,
...
@@ -288,6 +289,40 @@ func SendSheepMatchSuccess(matchId, myUserId, otherUserId uint64, nick1, nick2,
return
nil
return
nil
}
}
// 羊羊匹配成功
func
SendSheepMatchSuccessV2
(
matchId
,
myUserId
,
otherUserId
uint64
,
nick1
,
nick2
,
avatar1
,
avatar2
string
,
gameId
uint64
,
channelId
,
token
string
,
agoraId
uint32
,
provider
int
)
error
{
msg
:=
&
userProxy
.
SheepMatchSuccess
{
MatchId
:
matchId
,
User
:
&
userProxy
.
User
{
Id
:
myUserId
,
Nick
:
nick1
,
Avatar
:
avatar1
},
OtherUser
:
&
userProxy
.
User
{
Id
:
otherUserId
,
Nick
:
nick2
,
Avatar
:
avatar2
},
GameId
:
gameId
,
ChannelId
:
channelId
,
Token
:
token
,
AgoraId
:
agoraId
,
Provider
:
uint32
(
provider
),
}
if
buffer
,
err
:=
proto
.
Marshal
(
msg
);
err
==
nil
{
userIds
:=
[]
uint64
{
myUserId
}
rspUids
,
err
:=
multicast
(
userIds
,
MsgTypeSheepGameMatchSuccess
,
buffer
)
//记录socket,注意闭包问题
go
func
(
userIds
[]
uint64
,
msg
*
userProxy
.
SheepMatchSuccess
,
rspUids
[]
uint64
,
err
error
)
{
buf
,
_
:=
json
.
Marshal
(
msg
)
AddRpcLogs
(
MsgTypeSheepGameMatchSuccess
,
userIds
,
string
(
buf
[
:
]),
rspUids
,
err
)
}(
userIds
,
msg
,
rspUids
,
err
)
if
err
!=
nil
{
mylogrus
.
MyLog
.
Errorf
(
"grpc SendSheepMatchSuccess send fail"
)
return
err
}
else
{
mylogrus
.
MyLog
.
Info
(
"grpc SendSheepMatchSuccess send success"
)
}
}
else
{
return
err
}
return
nil
}
// 羊羊游戏结果
// 羊羊游戏结果
func
SendSheepGameResult
(
matchId
,
winId
,
userId1
,
userId2
uint64
,
nick1
,
nick2
,
avatar1
,
avatar2
string
,
isAiMap
map
[
uint64
]
bool
,
gameIds
...
uint64
)
error
{
func
SendSheepGameResult
(
matchId
,
winId
,
userId1
,
userId2
uint64
,
nick1
,
nick2
,
avatar1
,
avatar2
string
,
isAiMap
map
[
uint64
]
bool
,
gameIds
...
uint64
)
error
{
if
isAiMap
==
nil
{
if
isAiMap
==
nil
{
...
@@ -508,3 +543,51 @@ func SendLobbyMatchSuccess(myUserId, otherUserId uint64, nick1, nick2, avatar1,
...
@@ -508,3 +543,51 @@ func SendLobbyMatchSuccess(myUserId, otherUserId uint64, nick1, nick2, avatar1,
}
}
return
nil
return
nil
}
}
// h5游戏静音
func
SendH5GameMute
(
userId
uint64
)
error
{
msg
:=
&
userProxy
.
H5GameVoiceMute
{}
if
buffer
,
err
:=
proto
.
Marshal
(
msg
);
err
==
nil
{
rspUids
,
err
:=
multicast
([]
uint64
{
userId
},
MsgTypeH5GameMute
,
buffer
)
//记录socket,注意闭包问题
go
func
(
userId
uint64
,
msg
*
userProxy
.
H5GameVoiceMute
,
rspUids
[]
uint64
,
err
error
)
{
buf
,
_
:=
json
.
Marshal
(
msg
)
AddRpcLog
(
MsgTypeH5GameUnMute
,
userId
,
string
(
buf
[
:
]),
rspUids
,
err
)
}(
userId
,
msg
,
rspUids
,
err
)
if
err
!=
nil
{
mylogrus
.
MyLog
.
Errorf
(
"grpc SendH5GameMute send fail"
)
return
err
}
else
{
mylogrus
.
MyLog
.
Info
(
"grpc SendH5GameMute send success"
)
}
}
else
{
return
err
}
return
nil
}
// h5游戏开音
func
SendH5GameUnMute
(
userId
uint64
)
error
{
msg
:=
&
userProxy
.
H5GameVoiceUnMute
{}
if
buffer
,
err
:=
proto
.
Marshal
(
msg
);
err
==
nil
{
rspUids
,
err
:=
multicast
([]
uint64
{
userId
},
MsgTypeH5GameUnMute
,
buffer
)
//记录socket,注意闭包问题
go
func
(
userId
uint64
,
msg
*
userProxy
.
H5GameVoiceUnMute
,
rspUids
[]
uint64
,
err
error
)
{
buf
,
_
:=
json
.
Marshal
(
msg
)
AddRpcLog
(
MsgTypeH5GameUnMute
,
userId
,
string
(
buf
[
:
]),
rspUids
,
err
)
}(
userId
,
msg
,
rspUids
,
err
)
if
err
!=
nil
{
mylogrus
.
MyLog
.
Errorf
(
"grpc SendH5GameUnMute send fail"
)
return
err
}
else
{
mylogrus
.
MyLog
.
Info
(
"grpc SendH5GameUnMute 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