- 新增我的课程列表API接口 - 支持按学习状态筛选(全部/学习中/已完结) - 支持分页查询 - 包含课程基本信息、学习进度等数据 - 添加Apifox接口文档配置指南 文件变更: - server/api/admin/mycourse/mycourse.go - API接口定义 - server/internal/controller/admin/mycourse/mycourse.go - 控制器层 - server/internal/service/mycourse.go - 服务层(模拟数据) - server/internal/router/admin.go - 路由配置 - docs/apifox_config.md - 接口文档
67 lines
1.7 KiB
Go
67 lines
1.7 KiB
Go
// Package sys
|
|
// @Link https://github.com/bufanyun/hotgo
|
|
// @Copyright Copyright (c) 2025 HotGo CLI
|
|
// @Author Ms <133814250@qq.com>
|
|
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
|
// @AutoGenerate Version 2.17.8
|
|
package sys
|
|
|
|
import (
|
|
"context"
|
|
"hotgo/api/admin/lesson"
|
|
"hotgo/internal/model/input/sysin"
|
|
"hotgo/internal/service"
|
|
)
|
|
|
|
var (
|
|
Lesson = cLesson{}
|
|
)
|
|
|
|
type cLesson struct{}
|
|
|
|
// List 查看课程管理列表
|
|
func (c *cLesson) List(ctx context.Context, req *lesson.ListReq) (res *lesson.ListRes, err error) {
|
|
list, totalCount, err := service.SysLesson().List(ctx, &req.LessonListInp)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
if list == nil {
|
|
list = []*sysin.LessonListModel{}
|
|
}
|
|
|
|
res = new(lesson.ListRes)
|
|
res.List = list
|
|
res.PageRes.Pack(req, totalCount)
|
|
return
|
|
}
|
|
|
|
// Export 导出课程管理列表
|
|
func (c *cLesson) Export(ctx context.Context, req *lesson.ExportReq) (res *lesson.ExportRes, err error) {
|
|
err = service.SysLesson().Export(ctx, &req.LessonListInp)
|
|
return
|
|
}
|
|
|
|
// Edit 更新课程管理
|
|
func (c *cLesson) Edit(ctx context.Context, req *lesson.EditReq) (res *lesson.EditRes, err error) {
|
|
err = service.SysLesson().Edit(ctx, &req.LessonEditInp)
|
|
return
|
|
}
|
|
|
|
// View 获取指定课程管理信息
|
|
func (c *cLesson) View(ctx context.Context, req *lesson.ViewReq) (res *lesson.ViewRes, err error) {
|
|
data, err := service.SysLesson().View(ctx, &req.LessonViewInp)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
res = new(lesson.ViewRes)
|
|
res.LessonViewModel = data
|
|
return
|
|
}
|
|
|
|
// Delete 删除课程管理
|
|
func (c *cLesson) Delete(ctx context.Context, req *lesson.DeleteReq) (res *lesson.DeleteRes, err error) {
|
|
err = service.SysLesson().Delete(ctx, &req.LessonDeleteInp)
|
|
return
|
|
} |