From ca89c90070fbebe2ff141454c3f6094baa8b62ac Mon Sep 17 00:00:00 2001 From: zhangwei <894646498@qq.com> Date: Fri, 8 Sep 2023 17:35:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=98=E7=AE=97=E8=81=94=E5=8A=A8api?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 7c356c3c5fcd5ed06fdbf8904c6a683c7cea3999 --- .../storelink/getlinkimagelisthandler.go | 28 +++++++++++++++++ .../storelink/uploadlinkimagehandler.go | 28 +++++++++++++++++ .../logic/storelink/getlinkimagelistlogic.go | 30 +++++++++++++++++++ .../logic/storelink/uploadlinkimagelogic.go | 30 +++++++++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 api/internal/handler/storelink/getlinkimagelisthandler.go create mode 100644 api/internal/handler/storelink/uploadlinkimagehandler.go create mode 100644 api/internal/logic/storelink/getlinkimagelistlogic.go create mode 100644 api/internal/logic/storelink/uploadlinkimagelogic.go diff --git a/api/internal/handler/storelink/getlinkimagelisthandler.go b/api/internal/handler/storelink/getlinkimagelisthandler.go new file mode 100644 index 00000000..fd2ace10 --- /dev/null +++ b/api/internal/handler/storelink/getlinkimagelisthandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" +) + +func GetLinkImageListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetLinkImageListReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewGetLinkImageListLogic(r.Context(), svcCtx) + resp, err := l.GetLinkImageList(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storelink/uploadlinkimagehandler.go b/api/internal/handler/storelink/uploadlinkimagehandler.go new file mode 100644 index 00000000..a87b7535 --- /dev/null +++ b/api/internal/handler/storelink/uploadlinkimagehandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" +) + +func UploadLinkImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UploadLinkImageReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewUploadLinkImageLogic(r.Context(), svcCtx) + resp, err := l.UploadLinkImage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/logic/storelink/getlinkimagelistlogic.go b/api/internal/logic/storelink/getlinkimagelistlogic.go new file mode 100644 index 00000000..4fbe66e8 --- /dev/null +++ b/api/internal/logic/storelink/getlinkimagelistlogic.go @@ -0,0 +1,30 @@ +package storelink + +import ( + "context" + + "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetLinkImageListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetLinkImageListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetLinkImageListLogic { + return &GetLinkImageListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetLinkImageListLogic) GetLinkImageList(req *types.GetLinkImageListReq) (resp *types.GetLinkImageListResp, err error) { + // todo: add your logic here and delete this line + + return +} diff --git a/api/internal/logic/storelink/uploadlinkimagelogic.go b/api/internal/logic/storelink/uploadlinkimagelogic.go new file mode 100644 index 00000000..46bc1a34 --- /dev/null +++ b/api/internal/logic/storelink/uploadlinkimagelogic.go @@ -0,0 +1,30 @@ +package storelink + +import ( + "context" + + "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UploadLinkImageLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewUploadLinkImageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UploadLinkImageLogic { + return &UploadLinkImageLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UploadLinkImageLogic) UploadLinkImage(req *types.UploadLinkImageReq) (resp *types.UploadLinkImageImageResp, err error) { + // todo: add your logic here and delete this line + + return +}