36 lines
763 B
Go
36 lines
763 B
Go
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/zeromicro/go-zero/rest/httpx"
|
|
|
|
"fusenapi/utils/basic"
|
|
|
|
"fusenapi/server/upload/internal/logic"
|
|
"fusenapi/server/upload/internal/svc"
|
|
"fusenapi/server/upload/internal/types"
|
|
)
|
|
|
|
func UploadFileBackendHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var req types.RequestUploadFileBackend
|
|
|
|
// 解析upload文件类型
|
|
err = basic.RequestFileParse(r, &req)
|
|
if err != nil {
|
|
httpx.OkJsonCtx(r.Context(), w, &basic.Response{
|
|
Code: 510,
|
|
Message: err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 创建一个业务逻辑层实例
|
|
l := logic.NewUploadFileBackendLogic(r.Context(), svcCtx)
|
|
resp := l.UploadFileBackend(&req, userinfo)
|
|
|
|
}
|
|
}
|