fix:上传logo--debug模式

This commit is contained in:
momo
2023-10-30 12:04:12 +08:00
parent a216dd11e3
commit 2594714709
5 changed files with 341 additions and 0 deletions

View File

@@ -52,6 +52,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/api/upload/up-logo",
Handler: UploadLogoHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/upload/up-logo-debug",
Handler: UploadLogoDebugHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/upload/upload-file-base",

View File

@@ -0,0 +1,35 @@
package handler
import (
"net/http"
"reflect"
"fusenapi/utils/basic"
"fusenapi/server/upload/internal/logic"
"fusenapi/server/upload/internal/svc"
"fusenapi/server/upload/internal/types"
)
func UploadLogoDebugHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UploadLogoDebugReq
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewUploadLogoDebugLogic(r, svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.UploadLogoDebug(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)
}
}
}