using System.Runtime.Serialization; using StreamBox.Lib.Server.Codes; namespace StreamBox.Lib.Server.Linkage { [DataContract] public class LinkLiveService : LinkSite { [DataMember(Name = "userId")] public string UserId { get; set; } [DataMember(Name = "liveToken")] public string LiveToken { get; set; } [DataMember(Name = "linkId")] public string LinkId { get; set; } [DataMember(Name = "liveService")] public LiveServiceTp LiveService { get; set; } [DataMember(Name = "startTime", EmitDefaultValue = false)] public string StartTime { get; set; } [DataMember(Name = "chargeStartTime", EmitDefaultValue = false)] public string ChargeStartTime { get; set; } [DataMember(Name = "endTime", EmitDefaultValue = false)] public string EndTime { get; set; } [DataMember(Name = "itemCategory", EmitDefaultValue = false)] public string ItemCategory { get; set; } [DataMember(Name = "itemNo", EmitDefaultValue = false)] public string ItemNo { get; set; } [DataMember(Name = "point", EmitDefaultValue = false)] public int? Point { get; set; } [DataMember(Name = "liveSec", EmitDefaultValue = false)] public int? LiveSec { get; set; } [DataMember(Name = "chargeSec", EmitDefaultValue = false)] public int? ChargeSec { get; set; } [DataMember(Name = "comment", EmitDefaultValue = false)] public string Comment { get; set; } [DataMember(Name = "commentLen", EmitDefaultValue = false)] public int? CommentLen { get; set; } [DataMember(Name = "liverUserId", EmitDefaultValue = false)] public string LiverUserId { get; set; } [DataMember(Name = "liverUserSubId", EmitDefaultValue = false)] public string LiverUserSubId { get; set; } [DataMember(Name = "liverGiftPoint", EmitDefaultValue = false)] public short? LiverGiftPoint { get; set; } [DataMember(Name = "favorite", EmitDefaultValue = false)] public bool? Favorite { get; set; } [DataMember(Name = "unitPrice", EmitDefaultValue = false)] public int? UnitPrice { get; set; } [DataMember(Name = "unitSec", EmitDefaultValue = false)] public int? UnitSec { get; set; } [DataMember(Name = "deviceName", EmitDefaultValue = false)] public string DeviceName { get; set; } [DataMember(Name = "osVer", EmitDefaultValue = false)] public string OsVer { get; set; } [DataMember(Name = "appVer", EmitDefaultValue = false)] public string AppVer { get; set; } public LinkLiveService( LiveServiceTp liveService, string siteToken, string userId, string videoRoomToken, string linkId) : base(siteToken, allowRetry: IsAllowRetry(liveService)) { LiveService = liveService; UserId = userId; LiveToken = videoRoomToken; LinkId = linkId; } // fo redis public LinkLiveService() { } public override string ToString() { return $"service:{LiveService} linkId:{LinkId} {UserId}@{SiteToken}"; } private static bool IsAllowRetry(LiveServiceTp liveService) { return liveService == LiveServiceTp.EndVLive || liveService == LiveServiceTp.EndView || liveService == LiveServiceTp.CancelLive; } } }