Compare commits

..

3 Commits

Author SHA1 Message Date
sugarBecomer 16692177d4 🐛 学习通列表 2025-12-10 15:10:39 +08:00
sugarBecomer 5f81a7ba5e 🐛 学习通刷课修复 2025-12-09 23:36:13 +08:00
sugarBecomer 58fb282fe8 🐛 学习通优化 2025-12-09 22:06:07 +08:00
4 changed files with 1224 additions and 345 deletions
@@ -169,7 +169,7 @@ type AttachmentSetting struct {
Defaults map[string]interface{} `json:"defaults"`
}
// ChapterPoints 章节所有任务点集合
// ChapterPoints 章节所有任务点集合(旧版,保留兼容)
type ChapterPoints struct {
Videos []PointVideoDto
Documents []PointDocumentDto
@@ -178,6 +178,75 @@ type ChapterPoints struct {
Lives []PointLiveDto
}
// ChapterPointType 任务点类型枚举
type ChapterPointType int
const (
ChapterPointTypeVideo ChapterPointType = 1 // 视频
ChapterPointTypeDocument ChapterPointType = 2 // 文档
ChapterPointTypeWork ChapterPointType = 3 // 作业
ChapterPointTypeHyperlink ChapterPointType = 4 // 外链
ChapterPointTypeLive ChapterPointType = 5 // 直播
)
// ChapterPoint 统一的章节任务点结构(与Card一一对应)
type ChapterPoint struct {
CardIndex int // 对应的卡片索引
Type ChapterPointType // 任务点类型
KnowledgeID int // 知识点ID
CourseID string // 课程ID
ClassID string // 班级ID
Cpi string // cpi
JobID string // 任务ID
ObjectID string // 对象ID
Title string // 标题
IsJob bool // 是否是任务点
IsPassed bool // 是否已完成
// 视频相关字段
FID int
DToken string
PlayTime int
Duration int
OtherInfo string
RT float64
VideoFaceCaptureEnc string
RandomCaptureTime string
AttDurationEnc string
Enc string
Mid string
// 文档相关字段
Jtoken string
DocumentType string // document / insertbook
// 作业相关字段
WorkID string
SchoolID string
PUID string
KToken string
// 外链相关字段
LinkType int
// 直播相关字段
UserId string
Live bool
LiveId string
Vdoid string
StreamName string
LiveStatusStr string
LiveStatusCode int
VideoDuration int
Aid string
Module string
AuthEnc string
LiveDragEnc string
LiveSetEnc string
LiveSwDsEnc string
VideoCompletePercent float64
}
// QuestionType 题目类型
type QuestionType int
File diff suppressed because it is too large Load Diff
@@ -97,33 +97,6 @@ func TestFetchChapterCards(t *testing.T) {
if targetChapterID == 0 {
t.Fatal("没有找到有任务点的章节")
}
// 获取任务点卡片
cards, points, err := courseAction.FetchChapterCards(context.Background(), course, targetChapterID)
utils.OkOrPanic(err)
t.Logf("卡片数量: %d", len(cards))
if points != nil {
t.Logf("视频数量: %d, 文档数量: %d, 作业数量: %d, 外链数量: %d, 直播数量: %d",
len(points.Videos), len(points.Documents), len(points.Works),
len(points.Hyperlinks), len(points.Lives))
for _, video := range points.Videos {
t.Logf("视频任务点: JobID=%s, ObjectID=%s", video.JobID, video.ObjectID)
}
for _, doc := range points.Documents {
t.Logf("文档任务点: JobID=%s, Type=%s", doc.JobID, doc.Type)
}
for _, work := range points.Works {
t.Logf("作业任务点: JobID=%s, WorkID=%s", work.JobID, work.WorkID)
}
for _, link := range points.Hyperlinks {
t.Logf("外链任务点: JobID=%s", link.JobID)
}
for _, live := range points.Lives {
t.Logf("直播任务点: JobID=%s, LiveId=%s, Title=%s", live.JobID, live.LiveId, live.Title)
}
}
}
// TestAutoStudyByCourseID 测试通过课程ID刷课(定时任务使用)
+1 -1
View File
@@ -29,7 +29,7 @@ type CourseServiceV1 struct {
func (s CourseServiceV1) List(ctx context.Context, req *v1.CourseListReq) *utils.Response[[]*ent.CourseEntity] {
user := utils.GetUserInfoFromCtx(ctx)
query := db2.Global.CourseEntity.Query().
Where(courseentity.HasSysUserWith(sysuser.ID(user.ID))).
Where(courseentity.HasSysUserWith(sysuser.ID(user.ID)), courseentity.TypeEQ(courseentity.TypeXxt)).
Order(ent.Desc(courseentity.FieldCreateTime))
if req.Type != "" {