diff --git a/server/internal/teaching_case/handler/routes.go b/server/internal/teaching_case/handler/routes.go new file mode 100644 index 00000000..949f7114 --- /dev/null +++ b/server/internal/teaching_case/handler/routes.go @@ -0,0 +1,46 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.9.2 + +package handler + +import ( + "net/http" + + teaching_case2 "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/handler/teaching_case" + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/svc" + + "github.com/zeromicro/go-zero/rest" +) + +func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodPost, + Path: "/api/teaching-cases", + Handler: teaching_case2.CreateTeachingCaseHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/api/teaching-cases", + Handler: teaching_case2.UpdateTeachingCaseHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/api/teaching-cases", + Handler: teaching_case2.ListTeachingCaseHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/api/teaching-cases/:id", + Handler: teaching_case2.GetTeachingCaseHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/api/teaching-cases/:id", + Handler: teaching_case2.DeleteTeachingCaseHandler(serverCtx), + }, + }, + rest.WithPrefix("/api/teaching-case"), + ) +} diff --git a/server/internal/teaching_case/handler/teaching_case/createteachingcasehandler.go b/server/internal/teaching_case/handler/teaching_case/createteachingcasehandler.go new file mode 100644 index 00000000..ba8db9a5 --- /dev/null +++ b/server/internal/teaching_case/handler/teaching_case/createteachingcasehandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package teaching_case + +import ( + "net/http" + + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/logic/teaching_case" + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func CreateTeachingCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateTeachingCaseReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := teaching_case.NewCreateTeachingCaseLogic(r.Context(), svcCtx) + resp, err := l.CreateTeachingCase(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/server/internal/teaching_case/handler/teaching_case/deleteteachingcasehandler.go b/server/internal/teaching_case/handler/teaching_case/deleteteachingcasehandler.go new file mode 100644 index 00000000..bd3c013c --- /dev/null +++ b/server/internal/teaching_case/handler/teaching_case/deleteteachingcasehandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package teaching_case + +import ( + "net/http" + + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/logic/teaching_case" + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func DeleteTeachingCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteTeachingCaseReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := teaching_case.NewDeleteTeachingCaseLogic(r.Context(), svcCtx) + resp, err := l.DeleteTeachingCase(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/server/internal/teaching_case/handler/teaching_case/getteachingcasehandler.go b/server/internal/teaching_case/handler/teaching_case/getteachingcasehandler.go new file mode 100644 index 00000000..3f6e9343 --- /dev/null +++ b/server/internal/teaching_case/handler/teaching_case/getteachingcasehandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package teaching_case + +import ( + "net/http" + + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/logic/teaching_case" + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func GetTeachingCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetTeachingCaseReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := teaching_case.NewGetTeachingCaseLogic(r.Context(), svcCtx) + resp, err := l.GetTeachingCase(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/server/internal/teaching_case/handler/teaching_case/listteachingcasehandler.go b/server/internal/teaching_case/handler/teaching_case/listteachingcasehandler.go new file mode 100644 index 00000000..38cd90a0 --- /dev/null +++ b/server/internal/teaching_case/handler/teaching_case/listteachingcasehandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package teaching_case + +import ( + "net/http" + + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/logic/teaching_case" + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func ListTeachingCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListTeachingCaseReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := teaching_case.NewListTeachingCaseLogic(r.Context(), svcCtx) + resp, err := l.ListTeachingCase(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/server/internal/teaching_case/handler/teaching_case/updateteachingcasehandler.go b/server/internal/teaching_case/handler/teaching_case/updateteachingcasehandler.go new file mode 100644 index 00000000..1c248cd9 --- /dev/null +++ b/server/internal/teaching_case/handler/teaching_case/updateteachingcasehandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package teaching_case + +import ( + "net/http" + + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/logic/teaching_case" + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func UpdateTeachingCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateTeachingCaseReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := teaching_case.NewUpdateTeachingCaseLogic(r.Context(), svcCtx) + resp, err := l.UpdateTeachingCase(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/server/internal/teaching_case/internal/logic/teaching_case/createteachingcaselogic.go b/server/internal/teaching_case/internal/logic/teaching_case/createteachingcaselogic.go new file mode 100644 index 00000000..1f337ac8 --- /dev/null +++ b/server/internal/teaching_case/internal/logic/teaching_case/createteachingcaselogic.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package teaching_case + +import ( + "context" + + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateTeachingCaseLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewCreateTeachingCaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateTeachingCaseLogic { + return &CreateTeachingCaseLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreateTeachingCaseLogic) CreateTeachingCase(req *types.CreateTeachingCaseReq) (resp *types.BaseResp, err error) { + // todo: add your logic here and delete this line + + return +} diff --git a/server/internal/teaching_case/internal/logic/teaching_case/deleteteachingcaselogic.go b/server/internal/teaching_case/internal/logic/teaching_case/deleteteachingcaselogic.go new file mode 100644 index 00000000..55dcd414 --- /dev/null +++ b/server/internal/teaching_case/internal/logic/teaching_case/deleteteachingcaselogic.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package teaching_case + +import ( + "context" + + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteTeachingCaseLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewDeleteTeachingCaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteTeachingCaseLogic { + return &DeleteTeachingCaseLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *DeleteTeachingCaseLogic) DeleteTeachingCase(req *types.DeleteTeachingCaseReq) (resp *types.BaseResp, err error) { + // todo: add your logic here and delete this line + + return +} diff --git a/server/internal/teaching_case/internal/logic/teaching_case/getteachingcaselogic.go b/server/internal/teaching_case/internal/logic/teaching_case/getteachingcaselogic.go new file mode 100644 index 00000000..0ef409ce --- /dev/null +++ b/server/internal/teaching_case/internal/logic/teaching_case/getteachingcaselogic.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package teaching_case + +import ( + "context" + + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetTeachingCaseLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetTeachingCaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTeachingCaseLogic { + return &GetTeachingCaseLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetTeachingCaseLogic) GetTeachingCase(req *types.GetTeachingCaseReq) (resp *types.TeachingCaseResp, err error) { + // todo: add your logic here and delete this line + + return +} diff --git a/server/internal/teaching_case/internal/logic/teaching_case/listteachingcaselogic.go b/server/internal/teaching_case/internal/logic/teaching_case/listteachingcaselogic.go new file mode 100644 index 00000000..5004b976 --- /dev/null +++ b/server/internal/teaching_case/internal/logic/teaching_case/listteachingcaselogic.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package teaching_case + +import ( + "context" + + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ListTeachingCaseLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewListTeachingCaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListTeachingCaseLogic { + return &ListTeachingCaseLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ListTeachingCaseLogic) ListTeachingCase(req *types.ListTeachingCaseReq) (resp *types.ListTeachingCaseResp, err error) { + // todo: add your logic here and delete this line + + return +} diff --git a/server/internal/teaching_case/internal/logic/teaching_case/updateteachingcaselogic.go b/server/internal/teaching_case/internal/logic/teaching_case/updateteachingcaselogic.go new file mode 100644 index 00000000..939a3e4f --- /dev/null +++ b/server/internal/teaching_case/internal/logic/teaching_case/updateteachingcaselogic.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package teaching_case + +import ( + "context" + + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateTeachingCaseLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewUpdateTeachingCaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateTeachingCaseLogic { + return &UpdateTeachingCaseLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UpdateTeachingCaseLogic) UpdateTeachingCase(req *types.UpdateTeachingCaseReq) (resp *types.BaseResp, err error) { + // todo: add your logic here and delete this line + + return +} diff --git a/server/internal/teaching_case/internal/types/types.go b/server/internal/teaching_case/internal/types/types.go new file mode 100644 index 00000000..1ab4e61c --- /dev/null +++ b/server/internal/teaching_case/internal/types/types.go @@ -0,0 +1,63 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.9.2 + +package types + +type BaseResp struct { + Code int `json:"code"` // 状态码(0成功,非0失败) + Msg string `json:"msg"` // 提示信息 +} + +type CreateTeachingCaseReq struct { + Title string `json:"title" validate:"required"` // 案例标题 + TutorName string `json:"tutor_name" validate:"required"` // 导师姓名 + TutorTitle string `json:"tutor_title"` // 导师头衔 + StudentNames string `json:"student_names" validate:"required"` // 学生姓名(逗号分隔) + Content string `json:"content" validate:"required"` // 案例内容 + CoverUrl string `json:"cover_url"` // 案例封面图URL + Sort int `json:"sort" default:"0"` // 排序 +} + +type DeleteTeachingCaseReq struct { + Id int `json:"id" validate:"required" uri:"id"` // 案例ID +} + +type GetTeachingCaseReq struct { + Id int `json:"id" validate:"required" uri:"id"` // 案例ID +} + +type ListTeachingCaseReq struct { + Page int `json:"page" default:"1"` // 页码 + Size int `json:"size" default:"10"` // 每页数量 + Keyword string `json:"keyword"` // 搜索关键词(标题/导师姓名) + Sort int `json:"sort"` // 排序筛选 +} + +type ListTeachingCaseResp struct { + Total int64 `json:"total"` // 总条数 + List []TeachingCaseResp `json:"list"` // 案例列表 +} + +type TeachingCaseResp struct { + Id int `json:"id"` // 案例ID + Title string `json:"title"` // 案例标题 + TutorName string `json:"tutor_name"` // 导师姓名 + TutorTitle string `json:"tutor_title"` // 导师头衔 + StudentNames string `json:"student_names"` // 学生姓名 + Content string `json:"content"` // 案例内容 + CoverUrl string `json:"cover_url"` // 封面图URL + Sort int `json:"sort"` // 排序 + CreateTime string `json:"create_time"` // 创建时间 + UpdateTime string `json:"update_time"` // 更新时间 +} + +type UpdateTeachingCaseReq struct { + Id int `json:"id" validate:"required"` // 案例ID + Title string `json:"title"` // 案例标题 + TutorName string `json:"tutor_name"` // 导师姓名 + TutorTitle string `json:"tutor_title"` // 导师头衔 + StudentNames string `json:"student_names"` // 学生姓名(逗号分隔) + Content string `json:"content"` // 案例内容 + CoverUrl string `json:"cover_url"` // 案例封面图URL + Sort int `json:"sort"` // 排序 +} diff --git a/server/internal/video_case/handler/routes.go b/server/internal/video_case/handler/routes.go new file mode 100644 index 00000000..1db2465a --- /dev/null +++ b/server/internal/video_case/handler/routes.go @@ -0,0 +1,46 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.9.2 + +package handler + +import ( + "net/http" + + video_case2 "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/handler/video_case" + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/svc" + + "github.com/zeromicro/go-zero/rest" +) + +func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodPost, + Path: "/api/video-cases", + Handler: video_case2.CreateVideoCaseHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/api/video-cases", + Handler: video_case2.UpdateVideoCaseHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/api/video-cases", + Handler: video_case2.ListVideoCaseHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/api/video-cases/:id", + Handler: video_case2.GetVideoCaseHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/api/video-cases/:id", + Handler: video_case2.DeleteVideoCaseHandler(serverCtx), + }, + }, + rest.WithPrefix("/api/video-case"), + ) +} diff --git a/server/internal/video_case/handler/video_case/createvideocasehandler.go b/server/internal/video_case/handler/video_case/createvideocasehandler.go new file mode 100644 index 00000000..422f67d7 --- /dev/null +++ b/server/internal/video_case/handler/video_case/createvideocasehandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package video_case + +import ( + "net/http" + + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/logic/video_case" + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func CreateVideoCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateVideoCaseReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := video_case.NewCreateVideoCaseLogic(r.Context(), svcCtx) + resp, err := l.CreateVideoCase(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/server/internal/video_case/handler/video_case/deletevideocasehandler.go b/server/internal/video_case/handler/video_case/deletevideocasehandler.go new file mode 100644 index 00000000..b411bc67 --- /dev/null +++ b/server/internal/video_case/handler/video_case/deletevideocasehandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package video_case + +import ( + "net/http" + + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/logic/video_case" + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func DeleteVideoCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteVideoCaseReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := video_case.NewDeleteVideoCaseLogic(r.Context(), svcCtx) + resp, err := l.DeleteVideoCase(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/server/internal/video_case/handler/video_case/getvideocasehandler.go b/server/internal/video_case/handler/video_case/getvideocasehandler.go new file mode 100644 index 00000000..9d992066 --- /dev/null +++ b/server/internal/video_case/handler/video_case/getvideocasehandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package video_case + +import ( + "net/http" + + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/logic/video_case" + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func GetVideoCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetVideoCaseReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := video_case.NewGetVideoCaseLogic(r.Context(), svcCtx) + resp, err := l.GetVideoCase(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/server/internal/video_case/handler/video_case/listvideocasehandler.go b/server/internal/video_case/handler/video_case/listvideocasehandler.go new file mode 100644 index 00000000..635207ad --- /dev/null +++ b/server/internal/video_case/handler/video_case/listvideocasehandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package video_case + +import ( + "net/http" + + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/logic/video_case" + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func ListVideoCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListVideoCaseReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := video_case.NewListVideoCaseLogic(r.Context(), svcCtx) + resp, err := l.ListVideoCase(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/server/internal/video_case/handler/video_case/updatevideocasehandler.go b/server/internal/video_case/handler/video_case/updatevideocasehandler.go new file mode 100644 index 00000000..504b0f96 --- /dev/null +++ b/server/internal/video_case/handler/video_case/updatevideocasehandler.go @@ -0,0 +1,31 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package video_case + +import ( + "net/http" + + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/logic/video_case" + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func UpdateVideoCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateVideoCaseReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := video_case.NewUpdateVideoCaseLogic(r.Context(), svcCtx) + resp, err := l.UpdateVideoCase(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/server/internal/video_case/internal/logic/video_case/createvideocaselogic.go b/server/internal/video_case/internal/logic/video_case/createvideocaselogic.go new file mode 100644 index 00000000..fcfe4a05 --- /dev/null +++ b/server/internal/video_case/internal/logic/video_case/createvideocaselogic.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package video_case + +import ( + "context" + + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateVideoCaseLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewCreateVideoCaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateVideoCaseLogic { + return &CreateVideoCaseLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreateVideoCaseLogic) CreateVideoCase(req *types.CreateVideoCaseReq) (resp *types.BaseResp, err error) { + // todo: add your logic here and delete this line + + return +} diff --git a/server/internal/video_case/internal/logic/video_case/deletevideocaselogic.go b/server/internal/video_case/internal/logic/video_case/deletevideocaselogic.go new file mode 100644 index 00000000..8797327d --- /dev/null +++ b/server/internal/video_case/internal/logic/video_case/deletevideocaselogic.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package video_case + +import ( + "context" + + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteVideoCaseLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewDeleteVideoCaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteVideoCaseLogic { + return &DeleteVideoCaseLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *DeleteVideoCaseLogic) DeleteVideoCase(req *types.DeleteVideoCaseReq) (resp *types.BaseResp, err error) { + // todo: add your logic here and delete this line + + return +} diff --git a/server/internal/video_case/internal/logic/video_case/getvideocaselogic.go b/server/internal/video_case/internal/logic/video_case/getvideocaselogic.go new file mode 100644 index 00000000..3cc52c15 --- /dev/null +++ b/server/internal/video_case/internal/logic/video_case/getvideocaselogic.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package video_case + +import ( + "context" + + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetVideoCaseLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetVideoCaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetVideoCaseLogic { + return &GetVideoCaseLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetVideoCaseLogic) GetVideoCase(req *types.GetVideoCaseReq) (resp *types.VideoCaseResp, err error) { + // todo: add your logic here and delete this line + + return +} diff --git a/server/internal/video_case/internal/logic/video_case/listvideocaselogic.go b/server/internal/video_case/internal/logic/video_case/listvideocaselogic.go new file mode 100644 index 00000000..3262087a --- /dev/null +++ b/server/internal/video_case/internal/logic/video_case/listvideocaselogic.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package video_case + +import ( + "context" + + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ListVideoCaseLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewListVideoCaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListVideoCaseLogic { + return &ListVideoCaseLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ListVideoCaseLogic) ListVideoCase(req *types.ListVideoCaseReq) (resp *types.ListVideoCaseResp, err error) { + // todo: add your logic here and delete this line + + return +} diff --git a/server/internal/video_case/internal/logic/video_case/updatevideocaselogic.go b/server/internal/video_case/internal/logic/video_case/updatevideocaselogic.go new file mode 100644 index 00000000..75b4c15c --- /dev/null +++ b/server/internal/video_case/internal/logic/video_case/updatevideocaselogic.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.9.2 + +package video_case + +import ( + "context" + + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/svc" + "github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateVideoCaseLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewUpdateVideoCaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateVideoCaseLogic { + return &UpdateVideoCaseLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UpdateVideoCaseLogic) UpdateVideoCase(req *types.UpdateVideoCaseReq) (resp *types.BaseResp, err error) { + // todo: add your logic here and delete this line + + return +} diff --git a/server/internal/video_case/internal/types/types.go b/server/internal/video_case/internal/types/types.go new file mode 100644 index 00000000..1a1ed5df --- /dev/null +++ b/server/internal/video_case/internal/types/types.go @@ -0,0 +1,60 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.9.2 + +package types + +type BaseResp struct { + Code int `json:"code"` // 状态码(0成功,非0失败) + Msg string `json:"msg"` // 提示信息 +} + +type CreateVideoCaseReq struct { + 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 DeleteVideoCaseReq struct { + Id int `json:"id" validate:"required" uri:"id"` // 视频案例ID +} + +type GetVideoCaseReq struct { + Id int `json:"id" validate:"required" uri:"id"` // 视频案例ID +} + +type ListVideoCaseReq struct { + Page int `json:"page" default:"1"` // 页码 + Size int `json:"size" default:"10"` // 每页数量 + Keyword string `json:"keyword"` // 搜索关键词(标题/设计人员/指导老师) + Sort int `json:"sort"` // 排序筛选 +} + +type ListVideoCaseResp struct { + Total int64 `json:"total"` // 总条数 + List []VideoCaseResp `json:"list"` // 视频案例列表 +} + +type UpdateVideoCaseReq struct { + 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 VideoCaseResp struct { + 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"` // 更新时间 +}