| 123456789101112131415161718192021222324 |
- package handler
- import (
- "net/http"
- "slow_wild_api/apps/internal/logic"
- "slow_wild_api/apps/internal/response"
- "slow_wild_api/apps/internal/svc"
- "github.com/zeromicro/go-zero/rest/httpx"
- )
- func attachmentUploadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- file, header, errFile := r.FormFile("file")
- if errFile != nil {
- httpx.ErrorCtx(r.Context(), w, errFile)
- return
- }
- defer file.Close()
- l := logic.NewAttachmentUploadLogic(r.Context(), svcCtx)
- resp, err := l.AttachmentUpload(file, header)
- response.Response(w, resp, err)
- }
- }
|