完成教学案例的实现逻辑
This commit is contained in:
@@ -1,46 +0,0 @@
|
|||||||
// 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"),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -4,15 +4,18 @@
|
|||||||
package teaching_case
|
package teaching_case
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/JACKYMYPERSON/hldrCenter/config"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/logic/teaching_case"
|
"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/model"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreateTeachingCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func CreateTeachingCaseHandler(cfg *config.Config) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.CreateTeachingCaseReq
|
var req types.CreateTeachingCaseReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
@@ -20,7 +23,23 @@ func CreateTeachingCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := teaching_case.NewCreateTeachingCaseLogic(r.Context(), svcCtx)
|
mysqlCfg := cfg.MySQL
|
||||||
|
dsn := fmt.Sprintf(
|
||||||
|
"%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=true&loc=Local",
|
||||||
|
mysqlCfg.Username,
|
||||||
|
mysqlCfg.Password,
|
||||||
|
mysqlCfg.Host,
|
||||||
|
mysqlCfg.Port,
|
||||||
|
mysqlCfg.Database,
|
||||||
|
mysqlCfg.Charset,
|
||||||
|
)
|
||||||
|
fmt.Println("接收到articlePost请求")
|
||||||
|
|
||||||
|
conn := sqlx.NewSqlConn("mysql", dsn)
|
||||||
|
|
||||||
|
teaching_caseModel := model.NewTeachingCaseModel(conn)
|
||||||
|
|
||||||
|
l := teaching_case.NewCreateTeachingCaseLogic(r.Context(), cfg, teaching_caseModel)
|
||||||
resp, err := l.CreateTeachingCase(&req)
|
resp, err := l.CreateTeachingCase(&req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
httpx.ErrorCtx(r.Context(), w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
|||||||
@@ -4,15 +4,18 @@
|
|||||||
package teaching_case
|
package teaching_case
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/JACKYMYPERSON/hldrCenter/config"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/logic/teaching_case"
|
"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/model"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
)
|
)
|
||||||
|
|
||||||
func DeleteTeachingCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func DeleteTeachingCaseHandler(cfg *config.Config) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.DeleteTeachingCaseReq
|
var req types.DeleteTeachingCaseReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
@@ -20,7 +23,23 @@ func DeleteTeachingCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := teaching_case.NewDeleteTeachingCaseLogic(r.Context(), svcCtx)
|
mysqlCfg := cfg.MySQL
|
||||||
|
dsn := fmt.Sprintf(
|
||||||
|
"%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=true&loc=Local",
|
||||||
|
mysqlCfg.Username,
|
||||||
|
mysqlCfg.Password,
|
||||||
|
mysqlCfg.Host,
|
||||||
|
mysqlCfg.Port,
|
||||||
|
mysqlCfg.Database,
|
||||||
|
mysqlCfg.Charset,
|
||||||
|
)
|
||||||
|
fmt.Println("接收到articlePost请求")
|
||||||
|
|
||||||
|
conn := sqlx.NewSqlConn("mysql", dsn)
|
||||||
|
|
||||||
|
teaching_caseModel := model.NewTeachingCaseModel(conn)
|
||||||
|
|
||||||
|
l := teaching_case.NewDeleteTeachingCaseLogic(r.Context(), cfg, teaching_caseModel)
|
||||||
resp, err := l.DeleteTeachingCase(&req)
|
resp, err := l.DeleteTeachingCase(&req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
httpx.ErrorCtx(r.Context(), w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
|||||||
@@ -4,15 +4,18 @@
|
|||||||
package teaching_case
|
package teaching_case
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/JACKYMYPERSON/hldrCenter/config"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/logic/teaching_case"
|
"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/model"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetTeachingCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func GetTeachingCaseHandler(cfg *config.Config) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.GetTeachingCaseReq
|
var req types.GetTeachingCaseReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
@@ -20,7 +23,23 @@ func GetTeachingCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := teaching_case.NewGetTeachingCaseLogic(r.Context(), svcCtx)
|
mysqlCfg := cfg.MySQL
|
||||||
|
dsn := fmt.Sprintf(
|
||||||
|
"%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=true&loc=Local",
|
||||||
|
mysqlCfg.Username,
|
||||||
|
mysqlCfg.Password,
|
||||||
|
mysqlCfg.Host,
|
||||||
|
mysqlCfg.Port,
|
||||||
|
mysqlCfg.Database,
|
||||||
|
mysqlCfg.Charset,
|
||||||
|
)
|
||||||
|
fmt.Println("接收到articlePost请求")
|
||||||
|
|
||||||
|
conn := sqlx.NewSqlConn("mysql", dsn)
|
||||||
|
|
||||||
|
teaching_caseModel := model.NewTeachingCaseModel(conn)
|
||||||
|
|
||||||
|
l := teaching_case.NewGetTeachingCaseLogic(r.Context(), cfg, teaching_caseModel)
|
||||||
resp, err := l.GetTeachingCase(&req)
|
resp, err := l.GetTeachingCase(&req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
httpx.ErrorCtx(r.Context(), w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
|||||||
@@ -4,15 +4,18 @@
|
|||||||
package teaching_case
|
package teaching_case
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/JACKYMYPERSON/hldrCenter/config"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/logic/teaching_case"
|
"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/model"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ListTeachingCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func ListTeachingCaseHandler(cfg *config.Config) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.ListTeachingCaseReq
|
var req types.ListTeachingCaseReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
@@ -20,7 +23,23 @@ func ListTeachingCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := teaching_case.NewListTeachingCaseLogic(r.Context(), svcCtx)
|
mysqlCfg := cfg.MySQL
|
||||||
|
dsn := fmt.Sprintf(
|
||||||
|
"%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=true&loc=Local",
|
||||||
|
mysqlCfg.Username,
|
||||||
|
mysqlCfg.Password,
|
||||||
|
mysqlCfg.Host,
|
||||||
|
mysqlCfg.Port,
|
||||||
|
mysqlCfg.Database,
|
||||||
|
mysqlCfg.Charset,
|
||||||
|
)
|
||||||
|
fmt.Println("接收到articlePost请求")
|
||||||
|
|
||||||
|
conn := sqlx.NewSqlConn("mysql", dsn)
|
||||||
|
|
||||||
|
teaching_caseModel := model.NewTeachingCaseModel(conn)
|
||||||
|
|
||||||
|
l := teaching_case.NewListTeachingCaseLogic(r.Context(), cfg, teaching_caseModel)
|
||||||
resp, err := l.ListTeachingCase(&req)
|
resp, err := l.ListTeachingCase(&req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
httpx.ErrorCtx(r.Context(), w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
|||||||
@@ -4,23 +4,41 @@
|
|||||||
package teaching_case
|
package teaching_case
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/JACKYMYPERSON/hldrCenter/config"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/logic/teaching_case"
|
"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/model"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
)
|
)
|
||||||
|
|
||||||
func UpdateTeachingCaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func UpdateTeachingCaseHandler(cfg *config.Config) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.UpdateTeachingCaseReq
|
var req types.UpdateTeachingCaseReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
httpx.ErrorCtx(r.Context(), w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
mysqlCfg := cfg.MySQL
|
||||||
|
dsn := fmt.Sprintf(
|
||||||
|
"%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=true&loc=Local",
|
||||||
|
mysqlCfg.Username,
|
||||||
|
mysqlCfg.Password,
|
||||||
|
mysqlCfg.Host,
|
||||||
|
mysqlCfg.Port,
|
||||||
|
mysqlCfg.Database,
|
||||||
|
mysqlCfg.Charset,
|
||||||
|
)
|
||||||
|
fmt.Println("接收到articlePost请求")
|
||||||
|
|
||||||
l := teaching_case.NewUpdateTeachingCaseLogic(r.Context(), svcCtx)
|
conn := sqlx.NewSqlConn("mysql", dsn)
|
||||||
|
|
||||||
|
teaching_caseModel := model.NewTeachingCaseModel(conn)
|
||||||
|
|
||||||
|
l := teaching_case.NewUpdateTeachingCaseLogic(r.Context(), cfg, teaching_caseModel)
|
||||||
resp, err := l.UpdateTeachingCase(&req)
|
resp, err := l.UpdateTeachingCase(&req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
httpx.ErrorCtx(r.Context(), w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ package teaching_case
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/svc"
|
"github.com/JACKYMYPERSON/hldrCenter/config"
|
||||||
|
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/model"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
@@ -14,15 +15,17 @@ import (
|
|||||||
|
|
||||||
type CreateTeachingCaseLogic struct {
|
type CreateTeachingCaseLogic struct {
|
||||||
logx.Logger
|
logx.Logger
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
svcCtx *svc.ServiceContext
|
cfg *config.Config
|
||||||
|
model model.TeachingCaseModel
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCreateTeachingCaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateTeachingCaseLogic {
|
func NewCreateTeachingCaseLogic(ctx context.Context, cfg *config.Config, model model.TeachingCaseModel) *CreateTeachingCaseLogic {
|
||||||
return &CreateTeachingCaseLogic{
|
return &CreateTeachingCaseLogic{
|
||||||
Logger: logx.WithContext(ctx),
|
Logger: logx.WithContext(ctx),
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
svcCtx: svcCtx,
|
cfg: cfg,
|
||||||
|
model: model,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ package teaching_case
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/svc"
|
"github.com/JACKYMYPERSON/hldrCenter/config"
|
||||||
|
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/model"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
@@ -14,15 +15,17 @@ import (
|
|||||||
|
|
||||||
type DeleteTeachingCaseLogic struct {
|
type DeleteTeachingCaseLogic struct {
|
||||||
logx.Logger
|
logx.Logger
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
svcCtx *svc.ServiceContext
|
cfg *config.Config
|
||||||
|
model model.TeachingCaseModel
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDeleteTeachingCaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteTeachingCaseLogic {
|
func NewDeleteTeachingCaseLogic(ctx context.Context, cfg *config.Config, model model.TeachingCaseModel) *DeleteTeachingCaseLogic {
|
||||||
return &DeleteTeachingCaseLogic{
|
return &DeleteTeachingCaseLogic{
|
||||||
Logger: logx.WithContext(ctx),
|
Logger: logx.WithContext(ctx),
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
svcCtx: svcCtx,
|
cfg: cfg,
|
||||||
|
model: model,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ package teaching_case
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/svc"
|
"github.com/JACKYMYPERSON/hldrCenter/config"
|
||||||
|
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/model"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
@@ -14,15 +15,17 @@ import (
|
|||||||
|
|
||||||
type GetTeachingCaseLogic struct {
|
type GetTeachingCaseLogic struct {
|
||||||
logx.Logger
|
logx.Logger
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
svcCtx *svc.ServiceContext
|
cfg *config.Config
|
||||||
|
model model.TeachingCaseModel
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGetTeachingCaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTeachingCaseLogic {
|
func NewGetTeachingCaseLogic(ctx context.Context, cfg *config.Config, model model.TeachingCaseModel) *GetTeachingCaseLogic {
|
||||||
return &GetTeachingCaseLogic{
|
return &GetTeachingCaseLogic{
|
||||||
Logger: logx.WithContext(ctx),
|
Logger: logx.WithContext(ctx),
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
svcCtx: svcCtx,
|
cfg: cfg,
|
||||||
|
model: model,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ package teaching_case
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/svc"
|
"github.com/JACKYMYPERSON/hldrCenter/config"
|
||||||
|
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/model"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
@@ -14,15 +15,17 @@ import (
|
|||||||
|
|
||||||
type ListTeachingCaseLogic struct {
|
type ListTeachingCaseLogic struct {
|
||||||
logx.Logger
|
logx.Logger
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
svcCtx *svc.ServiceContext
|
cfg *config.Config
|
||||||
|
model model.TeachingCaseModel
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewListTeachingCaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListTeachingCaseLogic {
|
func NewListTeachingCaseLogic(ctx context.Context, cfg *config.Config, model model.TeachingCaseModel) *ListTeachingCaseLogic {
|
||||||
return &ListTeachingCaseLogic{
|
return &ListTeachingCaseLogic{
|
||||||
Logger: logx.WithContext(ctx),
|
Logger: logx.WithContext(ctx),
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
svcCtx: svcCtx,
|
cfg: cfg,
|
||||||
|
model: model,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ package teaching_case
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/svc"
|
"github.com/JACKYMYPERSON/hldrCenter/config"
|
||||||
|
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/model"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
"github.com/JACKYMYPERSON/hldrCenter/internal/teaching_case/internal/types"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
@@ -14,15 +15,16 @@ import (
|
|||||||
|
|
||||||
type UpdateTeachingCaseLogic struct {
|
type UpdateTeachingCaseLogic struct {
|
||||||
logx.Logger
|
logx.Logger
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
svcCtx *svc.ServiceContext
|
cfg *config.Config
|
||||||
|
model model.TeachingCaseModel
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewUpdateTeachingCaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateTeachingCaseLogic {
|
func NewUpdateTeachingCaseLogic(ctx context.Context, cfg *config.Config, model model.TeachingCaseModel) *UpdateTeachingCaseLogic {
|
||||||
return &UpdateTeachingCaseLogic{
|
return &UpdateTeachingCaseLogic{
|
||||||
Logger: logx.WithContext(ctx),
|
Logger: logx.WithContext(ctx),
|
||||||
ctx: ctx,
|
cfg: cfg,
|
||||||
svcCtx: svcCtx,
|
model: model,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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"),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -6,13 +6,13 @@ package video_case
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"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/logic/video_case"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/svc"
|
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types"
|
"github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types"
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"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) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.CreateVideoCaseReq
|
var req types.CreateVideoCaseReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ package video_case
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"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/logic/video_case"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/svc"
|
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types"
|
"github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types"
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"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) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.DeleteVideoCaseReq
|
var req types.DeleteVideoCaseReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ package video_case
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"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/logic/video_case"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/svc"
|
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types"
|
"github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types"
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"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) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.GetVideoCaseReq
|
var req types.GetVideoCaseReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ package video_case
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"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/logic/video_case"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/svc"
|
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types"
|
"github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types"
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"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) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.ListVideoCaseReq
|
var req types.ListVideoCaseReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ package video_case
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"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/logic/video_case"
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/svc"
|
|
||||||
"github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types"
|
"github.com/JACKYMYPERSON/hldrCenter/internal/video_case/internal/types"
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"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) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.UpdateVideoCaseReq
|
var req types.UpdateVideoCaseReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user