新增 课程id主动获取

This commit is contained in:
小肥羊 2025-08-17 18:32:52 +08:00
parent d3764e1d33
commit eca3e9278e
3 changed files with 59 additions and 5 deletions

View File

@ -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
},

View File

@ -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<NodeSubscription> nodesubscriptionDB;
private readonly Repository<VideoTask> videoTaskDB;
private readonly Repository<CourseInfo> courseInfoDB;
private readonly Repository<VideoKonwPoint> videoKonwPointDB;
private readonly Repository<NodePackageInfo> nodePackageInfoDB;
private readonly Repository<VideoQuestion> videoQuestionDB;
@ -39,7 +41,7 @@ namespace VideoAnalysisCore.Controllers
public LJZK_Controller(IMapper mp, Repository<NodeSubscription> nodesubscriptionDB,
Repository<VideoTask> videoTaskDB = null, Repository<VideoKonwPoint> videoKonwPointDB = null
, Repository<NodePackageInfo> nodePackageInfoDB = null, Repository<VideoQuestion> videoQuestionDB = null, Repository<VideoQuestionKonw> videoQuestionKonwDB = null)
, Repository<NodePackageInfo> nodePackageInfoDB = null, Repository<VideoQuestion> videoQuestionDB = null, Repository<VideoQuestionKonw> videoQuestionKonwDB = null, Repository<CourseInfo> 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<VideoTask>(reqArr.Count());
var nodePackages = new List<NodePackageInfo>(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,

View File

@ -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
{
/// <summary>
/// 主键Id 这里使用数据来源Id
/// </summary>
[SugarColumn(IsPrimaryKey = true, ColumnDescription = "Id 主键", ColumnName = "id")] //设置主键
public long Id { get; set; }
/// <summary>
/// 学科Id
/// </summary>
[SugarColumn(ColumnDescription = "学科Id", ColumnName = "subject_id")]
public long Subject_Id { get; set; }
/// <summary>
/// 课程名称
/// </summary>
[SugarColumn(ColumnDataType = "varchar(500)", ColumnDescription = "课程名称", ColumnName = "name")]
public string Name { get; set; }
/// <summary>
/// 学段ID
/// </summary>
[SugarColumn(ColumnDescription = "学段ID", ColumnName = "stage_id", IsNullable = true)]
public long? Stage_Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDescription = "学科网数据创建时间", ColumnName = "create_time", IsNullable = true)]
public DateTime? Create_Time { get; set; }
/// <summary>
/// 更新时间
/// </summary>
[SugarColumn(ColumnDescription = "学科网数据更新时间", ColumnName = "update_time", IsNullable = true)]
public DateTime? Update_Time { get; set; }
}
}