public async Task <BoardCastRoomModel> GetLiveRoomByStreamName(string streamName) { try { BoardCastRoomEntity entity = await BoardcastRoomDao.GetBoardCastRoomBySteamName(streamName.ToLower()); if (entity == null) { return(null); } return(new BoardCastRoomModel() { Id = entity.Id, Domain = entity.Domain, Name = entity.Name, AppName = entity.AppName, ExpireTime = entity.ExpireTime, PlayEndUrl = entity.PlayEndNotifyUrl, PlayNotifyUrl = entity.PlayNotifyUrl, PublishEndUrl = entity.PublishEndNotifyUrl, PublishNotifyUrl = entity.PublishNotifyUrl, StreamName = entity.StreamName, State = entity.State, }); } catch (Exception e) { LogHelper.Error(e.Message, e); return(null); } }
public async Task <ServiceResultMessage> CreateLiveRoom(string userId, BoardCastRoomModel model) { if (model == null) { return new ServiceResultMessage() { code = ServiceResultCode.UnDefineError, Message = "传入对象为空,请检查参数.." } } ; try { // var domain = DomainDao.GetDomainCount(userId);//通过Domain 确定是否存在DomainNode var entity = new BoardCastRoomEntity() { Id = model.Id, Domain = model.Domain, Name = model.Name, AppName = string.IsNullOrEmpty(model.AppName) ? "live" : model.AppName, ExpireTime = model.ExpireTime.Equals(new DateTime()) ? DateTime.Now.AddDays(2) : model.ExpireTime, PlayEndNotifyUrl = model.PlayEndUrl, PlayNotifyUrl = model.PlayNotifyUrl, PublishEndNotifyUrl = model.PublishEndUrl, PublishNotifyUrl = model.PublishNotifyUrl, StreamName = model.StreamName.ToLower(), State = 1, }; DaoResultMessage daoresult = await BoardcastRoomDao.CreateRoom(entity); return((ServiceResultMessage)ServiceResultBase.DaoResult2ServiceResult(daoresult)); } catch (Exception e) { LogHelper.Error(e.Message, e); return(null); } }