检查文件是否存在handler提交

Former-commit-id: bcfeb8fda6d956b7f03f038c91d54705fbedbd0f
This commit is contained in:
zhangwei 2023-05-30 09:07:06 +08:00
parent fcf8fe884a
commit 4b28b15bb1
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
package image
import (
"net/http"
"PCM/adaptor/PCM-CORE/api/internal/logic/image"
"PCM/adaptor/PCM-CORE/api/internal/svc"
"PCM/adaptor/PCM-CORE/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func CheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CheckReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := image.NewCheckLogic(r.Context(), svcCtx)
resp, err := l.Check(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}