完成教学案例的实现逻辑

This commit is contained in:
2025-10-31 14:18:08 +08:00
parent 55b2e201f8
commit 5995563bc6
17 changed files with 159 additions and 143 deletions

View File

@@ -1,46 +0,0 @@
// 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"),
)
}

View File

@@ -6,13 +6,13 @@ package video_case
import (
"net/http"
"github.com/JACKYMYPERSON/hldrCenter/config"
"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 {
func CreateVideoCaseHandler(cfg *config.Config) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateVideoCaseReq
if err := httpx.Parse(r, &req); err != nil {

View File

@@ -6,13 +6,13 @@ package video_case
import (
"net/http"
"github.com/JACKYMYPERSON/hldrCenter/config"
"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 {
func DeleteVideoCaseHandler(cfg *config.Config) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteVideoCaseReq
if err := httpx.Parse(r, &req); err != nil {

View File

@@ -6,13 +6,13 @@ package video_case
import (
"net/http"
"github.com/JACKYMYPERSON/hldrCenter/config"
"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 {
func GetVideoCaseHandler(cfg *config.Config) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetVideoCaseReq
if err := httpx.Parse(r, &req); err != nil {

View File

@@ -6,13 +6,13 @@ package video_case
import (
"net/http"
"github.com/JACKYMYPERSON/hldrCenter/config"
"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 {
func ListVideoCaseHandler(cfg *config.Config) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ListVideoCaseReq
if err := httpx.Parse(r, &req); err != nil {

View File

@@ -6,13 +6,13 @@ package video_case
import (
"net/http"
"github.com/JACKYMYPERSON/hldrCenter/config"
"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 {
func UpdateVideoCaseHandler(cfg *config.Config) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UpdateVideoCaseReq
if err := httpx.Parse(r, &req); err != nil {