Commit 7f41bbcf authored by hujiebin's avatar hujiebin

发送socket的麦位变化

parent 942b88f5
......@@ -412,3 +412,66 @@ message SvipUpgrade {
uint32 svip_level = 2;
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
......@@ -66,6 +66,7 @@ const (
MsgTypeCpInvite = 149 // cp邀请
MsgTypeCpUpgrade = 150 // cp升级
MsgTypeSvipUpgrade = 151 // svip升级
MsgTypeGroupMicChange = 155 // 麦位变化
)
const (
......
......@@ -6,6 +6,7 @@ import (
"git.hilo.cn/hilo-common/protocol/userProxy"
"git.hilo.cn/hilo-common/utils"
"google.golang.org/protobuf/proto"
"time"
)
func SendFruitMachine(date string, round uint32) error {
......@@ -397,3 +398,55 @@ func SendSvipUpgrade(nick, avatar string, svipLevel uint32, txGroupId string) er
}
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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment