From eca3e9278e532cdbb80d674861cac0efbb30a329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com> Date: Sun, 17 Aug 2025 18:32:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E8=AF=BE=E7=A8=8Bid?= =?UTF-8?q?=E4=B8=BB=E5=8A=A8=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VideoAnalysis/appsettings.json | 2 + .../Controllers/LJZK_Controller.cs | 17 ++++--- .../Model/蓝鲸智库/CourseInfo.cs | 45 +++++++++++++++++++ 3 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 VideoAnalysisCore/Model/蓝鲸智库/CourseInfo.cs 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 @@ +using 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; } + } +}