优化 文件包订阅时候额外的异常处理
This commit is contained in:
parent
de72788ca8
commit
2050d06ba9
|
|
@ -66,12 +66,12 @@ namespace VideoAnalysisCore.Controllers
|
|||
var videos = new List<VideoTask>(reqArr.Count());
|
||||
var nodePackages = new List<NodePackageInfo>(reqArr.Count());
|
||||
var videoIdArr = videoTaskDB.AsQueryable().Select(v => v.TagId).Distinct().ToArray();
|
||||
foreach (var sGroup in reqArr.GroupBy(s=>s.ContentId))
|
||||
foreach (var sGroup in reqArr.GroupBy(s => s.ContentId))
|
||||
{
|
||||
var s= sGroup.FirstOrDefault(s=>s.VideoType==VideoType.ÉãÏñÍ·);
|
||||
if(s is null)
|
||||
var s = sGroup.FirstOrDefault(s => s.VideoType == VideoType.ÉãÏñÍ·);
|
||||
if (s is null)
|
||||
return BadRequest("无有效的老师授课视频");
|
||||
var sPPT= sGroup.FirstOrDefault(s=>s.VideoType==VideoType.PPT¿Î¼þ);
|
||||
var sPPT = sGroup.FirstOrDefault(s => s.VideoType == VideoType.PPT¿Î¼þ);
|
||||
var np = new NodePackageInfo()
|
||||
{
|
||||
VideoCode = s.VideoCode,
|
||||
|
|
@ -80,16 +80,16 @@ namespace VideoAnalysisCore.Controllers
|
|||
Stage = s.StageId,
|
||||
CourseId = s.CourseId,
|
||||
SubjectType = s.SubjectId,
|
||||
VideoUrl =s.VideoUrl,
|
||||
VideoUrl = s.VideoUrl,
|
||||
CourseType = s.CourseType,
|
||||
CallBackUrl=s.CallBackUrl,
|
||||
CallBackUrl = s.CallBackUrl,
|
||||
Area = s.Area,
|
||||
HostIP = s.HostIP,
|
||||
};
|
||||
nodePackages.Add(np);
|
||||
if (videoIdArr.Contains(s.VideoCode))
|
||||
continue;
|
||||
var pptCode = sPPT!=null ? sPPT.VideoCode : string.Empty;
|
||||
var pptCode = sPPT != null ? sPPT.VideoCode : string.Empty;
|
||||
videos.Add(new VideoTask()
|
||||
{
|
||||
Id = YitIdHelper.NextId(),
|
||||
|
|
@ -99,9 +99,9 @@ namespace VideoAnalysisCore.Controllers
|
|||
CourseId = s.CourseId,
|
||||
Subject = s.SubjectId,
|
||||
TagId = s.VideoCode,
|
||||
MediaUrl =s.VideoUrl,
|
||||
MediaUrl = s.VideoUrl,
|
||||
PPTVideoCode = pptCode,
|
||||
VideoType =s.CourseType
|
||||
VideoType = s.CourseType
|
||||
});
|
||||
}
|
||||
await nodePackageInfoDB.InsertRangeAsync(nodePackages);
|
||||
|
|
@ -155,12 +155,12 @@ namespace VideoAnalysisCore.Controllers
|
|||
[HttpGet(Name = "TaskKnowInfo")]
|
||||
public async Task<IActionResult> TaskKnowInfo(string? tagId)
|
||||
{
|
||||
if ( string.IsNullOrEmpty(tagId))
|
||||
if (string.IsNullOrEmpty(tagId))
|
||||
return BadRequest();
|
||||
long taskId = 0;
|
||||
var taskIdOK = long.TryParse(tagId,out taskId);
|
||||
var taskIdOK = long.TryParse(tagId, out taskId);
|
||||
var task = await videoTaskDB.AsQueryable()
|
||||
.Where(s=> s.TagId == tagId || s.PPTVideoCode== tagId || (taskIdOK&& s.Id == taskId))
|
||||
.Where(s => s.TagId == tagId || s.PPTVideoCode == tagId || (taskIdOK && s.Id == taskId))
|
||||
.FirstAsync();
|
||||
if (task is null)
|
||||
return BadRequest("无效任务");
|
||||
|
|
|
|||
Loading…
Reference in New Issue