Files

80 lines
2.8 KiB
Plaintext
Raw Permalink Normal View History

2025-10-31 14:05:48 +08:00
// 视频案例请求结构体
type CreateVideoCaseReq {
Title string `json:"title" validate:"required"` // 视频案例标题
Intro string `json:"intro"` // 视频简介
VideoUrl string `json:"video_url" validate:"required"` // 视频播放地址
DesignerNames string `json:"designer_names" validate:"required"` // 设计人员名单(逗号分隔)
TutorNames string `json:"tutor_names" validate:"required"` // 指导老师名单(逗号分隔)
Sort int `json:"sort" default:"0"` // 排序
}
type UpdateVideoCaseReq {
Id int `json:"id" validate:"required"` // 视频案例ID
Title string `json:"title"` // 视频案例标题
Intro string `json:"intro"` // 视频简介
VideoUrl string `json:"video_url"` // 视频播放地址
DesignerNames string `json:"designer_names"` // 设计人员名单
TutorNames string `json:"tutor_names"` // 指导老师名单
Sort int `json:"sort"` // 排序
}
type GetVideoCaseReq {
Id int `json:"id" validate:"required" uri:"id"` // 视频案例ID
}
type DeleteVideoCaseReq {
Id int `json:"id" validate:"required" uri:"id"` // 视频案例ID
}
type ListVideoCaseReq {
Page int `json:"page" default:"1"` // 页码
Size int `json:"size" default:"10"` // 每页数量
Keyword string `json:"keyword"` // 搜索关键词(标题/设计人员/指导老师)
Sort int `json:"sort"` // 排序筛选
}
// 视频案例响应结构体
type VideoCaseResp {
Id int `json:"id"` // 视频案例ID
Title string `json:"title"` // 视频案例标题
Intro string `json:"intro"` // 视频简介
VideoUrl string `json:"video_url"` // 视频播放地址
DesignerNames string `json:"designer_names"` // 设计人员名单
TutorNames string `json:"tutor_names"` // 指导老师名单
Sort int `json:"sort"` // 排序
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
}
type ListVideoCaseResp {
Total int64 `json:"total"` // 总条数
List []VideoCaseResp `json:"list"` // 视频案例列表
}
type BaseResp {
Code int `json:"code"` // 状态码0成功非0失败
Msg string `json:"msg"` // 提示信息
}
@server (
group: video_case
prefix: /api/video-case
)
service video_case_api {
@handler CreateVideoCaseHandler
post /api/video-cases (CreateVideoCaseReq) returns (BaseResp)
@handler UpdateVideoCaseHandler
put /api/video-cases (UpdateVideoCaseReq) returns (BaseResp)
@handler GetVideoCaseHandler
get /api/video-cases/:id (GetVideoCaseReq) returns (VideoCaseResp)
@handler DeleteVideoCaseHandler
delete /api/video-cases/:id (DeleteVideoCaseReq) returns (BaseResp)
@handler ListVideoCaseHandler
get /api/video-cases (ListVideoCaseReq) returns (ListVideoCaseResp)
}