diff --git a/VideoAnalysis/appsettings.json b/VideoAnalysis/appsettings.json index f834152..8e29b8d 100644 --- a/VideoAnalysis/appsettings.json +++ b/VideoAnalysis/appsettings.json @@ -57,6 +57,8 @@ }, "DB": { "ConnectionString": "AllowLoadLocalInfile=true;Server=192.168.2.9;User ID=root;Password=qwe123!@#;Port=3306;Database=learn.videoanalysis;CharSet=utf8mb4;pooling=true;SslMode=None", + //"ConnectionString": "AllowLoadLocalInfile=true;Server=rm-2vc20nd3d11g0oh6g2o.rwlb.cn-chengdu.rds.aliyuncs.com;User ID=marking;Password=poiuytPOIUYT098765)(*&^%;Port=3306;Database=learn.videoanalysis;CharSet=utf8mb4;pooling=true;SslMode=None", + "SqlType": "MySql", "UpdateTable": false }, diff --git a/VideoAnalysisCore/Controllers/LJZK_Controller.cs b/VideoAnalysisCore/Controllers/LJZK_Controller.cs index 866d8db..26644c9 100644 --- a/VideoAnalysisCore/Controllers/LJZK_Controller.cs +++ b/VideoAnalysisCore/Controllers/LJZK_Controller.cs @@ -19,6 +19,7 @@ using VideoAnalysisCore.AICore.GPT.Dto; using VideoAnalysisCore.Model; using VideoAnalysisCore.Controllers.Dto; using VideoAnalysisCore.Model.Dto; +using VideoAnalysisCore.Model.蓝鲸智库; namespace VideoAnalysisCore.Controllers { @@ -32,6 +33,7 @@ namespace VideoAnalysisCore.Controllers private readonly IMapper mp; private readonly Repository nodesubscriptionDB; private readonly Repository videoTaskDB; + private readonly Repository courseInfoDB; private readonly Repository videoKonwPointDB; private readonly Repository nodePackageInfoDB; private readonly Repository videoQuestionDB; @@ -39,7 +41,7 @@ namespace VideoAnalysisCore.Controllers public LJZK_Controller(IMapper mp, Repository nodesubscriptionDB, Repository videoTaskDB = null, Repository videoKonwPointDB = null - , Repository nodePackageInfoDB = null, Repository videoQuestionDB = null, Repository videoQuestionKonwDB = null) + , Repository nodePackageInfoDB = null, Repository videoQuestionDB = null, Repository videoQuestionKonwDB = null, Repository courseInfoDB = null) { this.mp = mp; this.nodesubscriptionDB = nodesubscriptionDB; @@ -48,6 +50,7 @@ namespace VideoAnalysisCore.Controllers this.nodePackageInfoDB = nodePackageInfoDB; this.videoQuestionDB = videoQuestionDB; this.videoQuestionKonwDB = videoQuestionKonwDB; + this.courseInfoDB = courseInfoDB; } @@ -66,11 +69,16 @@ namespace VideoAnalysisCore.Controllers var videos = new List(reqArr.Count()); var nodePackages = new List(reqArr.Count()); var videoIdArr = videoTaskDB.AsQueryable().Select(v => v.TagId).Distinct().ToArray(); + var courseArr = await courseInfoDB.AsQueryable().ToArrayAsync(); foreach (var sGroup in reqArr.GroupBy(s => s.ContentId)) { var s = sGroup.FirstOrDefault(s => s.VideoType == VideoType.摄像头); if (s is null) return BadRequest("无有效的老师授课视频"); + var stageId = s.StageId.GetHashCode(); + var subjectId = s.SubjectId.GetHashCode(); + var course = courseArr.FirstOrDefault(x => stageId == x.Stage_Id && subjectId == x.Subject_Id); + if (course == null) continue; var sPPT = sGroup.FirstOrDefault(s => s.VideoType == VideoType.PPT课件); var np = new NodePackageInfo() { @@ -78,7 +86,7 @@ namespace VideoAnalysisCore.Controllers MaterialId = s.MaterialId, AttachmentId = s.AttachmentId, Stage = s.StageId, - CourseId = s.CourseId, + CourseId = course.Id, SubjectType = s.SubjectId, VideoUrl = s.VideoUrl, CourseType = s.CourseType, @@ -87,8 +95,7 @@ namespace VideoAnalysisCore.Controllers HostIP = s.HostIP, }; nodePackages.Add(np); - if (videoIdArr.Contains(s.VideoCode)) - continue; + if (videoIdArr.Contains(s.VideoCode)) continue; var pptCode = sPPT != null ? sPPT.VideoCode : string.Empty; videos.Add(new VideoTask() { @@ -96,7 +103,7 @@ namespace VideoAnalysisCore.Controllers ComeFrom = GetClientIpAddress(), ApiToken = "", EducationStage = s.StageId, - CourseId = s.CourseId, + CourseId = course.Id, Subject = s.SubjectId, TagId = s.VideoCode, MediaUrl = s.VideoUrl, diff --git a/VideoAnalysisCore/Model/钃濋哺鏅哄簱/CourseInfo.cs b/VideoAnalysisCore/Model/钃濋哺鏅哄簱/CourseInfo.cs new file mode 100644 index 0000000..40ef962 --- /dev/null +++ b/VideoAnalysisCore/Model/钃濋哺鏅哄簱/CourseInfo.cs @@ -0,0 +1,45 @@ +锘縰sing SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VideoAnalysisCore.Model.钃濋哺鏅哄簱 +{ + [SugarTable(TableDescription = "璇剧▼琛", TableName = "courseinfo")] + [Tenant("1001")] + public class CourseInfo + { + /// + /// 涓婚敭Id 杩欓噷浣跨敤鏁版嵁鏉ユ簮Id + /// + [SugarColumn(IsPrimaryKey = true, ColumnDescription = "Id 涓婚敭", ColumnName = "id")] //璁剧疆涓婚敭 + public long Id { get; set; } + /// + /// 瀛︾Id + /// + [SugarColumn(ColumnDescription = "瀛︾Id", ColumnName = "subject_id")] + public long Subject_Id { get; set; } + /// + /// 璇剧▼鍚嶇О + /// + [SugarColumn(ColumnDataType = "varchar(500)", ColumnDescription = "璇剧▼鍚嶇О", ColumnName = "name")] + public string Name { get; set; } + /// + /// 瀛︽ID + /// + [SugarColumn(ColumnDescription = "瀛︽ID", ColumnName = "stage_id", IsNullable = true)] + public long? Stage_Id { get; set; } + /// + /// 鍒涘缓鏃堕棿 + /// + [SugarColumn(ColumnDescription = "瀛︾缃戞暟鎹垱寤烘椂闂", ColumnName = "create_time", IsNullable = true)] + public DateTime? Create_Time { get; set; } + /// + /// 鏇存柊鏃堕棿 + /// + [SugarColumn(ColumnDescription = "瀛︾缃戞暟鎹洿鏂版椂闂", ColumnName = "update_time", IsNullable = true)] + public DateTime? Update_Time { get; set; } + } +}