弹幕数据附加主播自身信息
This commit is contained in:
@@ -102,6 +102,11 @@ namespace BarrageGrab.Modles.JsonEntity
|
||||
/// </summary>
|
||||
public MsgUser User { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主播简要信息
|
||||
/// </summary>
|
||||
public RoomAnchorInfo Onwer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消息内容
|
||||
/// </summary>
|
||||
@@ -134,6 +139,37 @@ namespace BarrageGrab.Modles.JsonEntity
|
||||
public int Level { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 直播间主播信息
|
||||
/// </summary>
|
||||
public class RoomAnchorInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户ID
|
||||
/// </summary>
|
||||
public string UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// SecUid
|
||||
/// </summary>
|
||||
public string SecUid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 昵称
|
||||
/// </summary>
|
||||
public string Nickname { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 头像地址
|
||||
/// </summary>
|
||||
public string HeadUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关注状态 0未关注,1已关注,...
|
||||
/// </summary>
|
||||
public int FollowStatus { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用户弹幕信息
|
||||
/// </summary>
|
||||
|
||||
@@ -256,6 +256,25 @@ namespace BarrageGrab
|
||||
OnPackMessage(this, arg);
|
||||
}
|
||||
|
||||
//附加房间信息
|
||||
private void AttachRoomInfo(Msg msg)
|
||||
{
|
||||
if(msg==null) return;
|
||||
var roomInfo = AppRuntime.RoomCaches.GetCachedWebRoomInfo(msg.RoomId.ToString());
|
||||
if (roomInfo != null)
|
||||
{
|
||||
msg.Onwer = new RoomAnchorInfo()
|
||||
{
|
||||
Nickname = roomInfo.Owner.Nickname,
|
||||
HeadUrl = roomInfo.Owner.HeadUrl,
|
||||
FollowStatus = roomInfo.Owner.FollowStatus,
|
||||
SecUid = roomInfo.Owner.SecUid,
|
||||
UserId = roomInfo.Owner.UserId
|
||||
};
|
||||
msg.WebRoomId = roomInfo.WebRoomId;
|
||||
}
|
||||
}
|
||||
|
||||
//粉丝团
|
||||
private void Grab_OnFansclubMessage(object sender, WssBarrageGrab.RoomMessageEventArgs<FansclubMessage> e)
|
||||
{
|
||||
@@ -273,6 +292,7 @@ namespace BarrageGrab
|
||||
enty.Level = enty.User.FansClub.Level;
|
||||
|
||||
var msgType = PackMsgType.粉丝团消息;
|
||||
AttachRoomInfo(enty);
|
||||
FirePack(enty, msgType);
|
||||
PrintMsg(enty, msgType);
|
||||
Broadcast(new BarrageMsgPack(enty.ToJson(), msgType, e.Process));
|
||||
@@ -297,6 +317,7 @@ namespace BarrageGrab
|
||||
};
|
||||
|
||||
var msgType = PackMsgType.直播间统计;
|
||||
AttachRoomInfo(enty);
|
||||
FirePack(enty, msgType);
|
||||
PrintMsg(enty, msgType);
|
||||
var pack = new BarrageMsgPack(enty.ToJson(), msgType, e.Process);
|
||||
@@ -391,6 +412,7 @@ namespace BarrageGrab
|
||||
}
|
||||
|
||||
var msgType = PackMsgType.礼物消息;
|
||||
AttachRoomInfo(enty);
|
||||
FirePack(enty, msgType);
|
||||
PrintMsg(enty, msgType);
|
||||
var pack = new BarrageMsgPack(enty.ToJson(), PackMsgType.礼物消息, e.Process);
|
||||
@@ -413,6 +435,7 @@ namespace BarrageGrab
|
||||
};
|
||||
|
||||
var msgType = PackMsgType.关注消息;
|
||||
AttachRoomInfo(enty);
|
||||
FirePack(enty, msgType);
|
||||
PrintMsg(enty, msgType);
|
||||
var pack = new BarrageMsgPack(enty.ToJson(), msgType, e.Process);
|
||||
@@ -443,6 +466,7 @@ namespace BarrageGrab
|
||||
};
|
||||
|
||||
var msgType = PackMsgType.直播间分享;
|
||||
AttachRoomInfo(enty);
|
||||
FirePack(enty, msgType);
|
||||
PrintMsg(enty, msgType);
|
||||
|
||||
@@ -469,6 +493,7 @@ namespace BarrageGrab
|
||||
};
|
||||
|
||||
var msgType = PackMsgType.进直播间;
|
||||
AttachRoomInfo(enty);
|
||||
FirePack(enty, msgType);
|
||||
PrintMsg(enty, msgType);
|
||||
var pack = new BarrageMsgPack(enty.ToJson(), msgType, e.Process);
|
||||
@@ -494,6 +519,7 @@ namespace BarrageGrab
|
||||
};
|
||||
|
||||
var msgType = PackMsgType.点赞消息;
|
||||
AttachRoomInfo(enty);
|
||||
FirePack(enty, msgType);
|
||||
PrintMsg(enty, msgType);
|
||||
var pack = new BarrageMsgPack(enty.ToJson(), msgType, e.Process);
|
||||
@@ -516,6 +542,7 @@ namespace BarrageGrab
|
||||
};
|
||||
|
||||
var msgType = PackMsgType.弹幕消息;
|
||||
AttachRoomInfo(enty);
|
||||
FirePack(enty, msgType);
|
||||
PrintMsg(enty, msgType);
|
||||
|
||||
@@ -542,6 +569,7 @@ namespace BarrageGrab
|
||||
};
|
||||
|
||||
var msgType = PackMsgType.下播;
|
||||
AttachRoomInfo(enty);
|
||||
FirePack(enty, msgType);
|
||||
PrintMsg(enty, msgType);
|
||||
pack = new BarrageMsgPack(enty.ToJson(), PackMsgType.下播, e.Process);
|
||||
|
||||
Reference in New Issue
Block a user