改造成api

This commit is contained in:
2025-07-02 14:51:23 +08:00
parent c8a81d0f49
commit 39e91e85ba
27 changed files with 665 additions and 519 deletions

View File

@@ -1,25 +1,16 @@
package upload
import (
v1 "management/internal/erpserver/service/v1"
"management/internal/pkg/config"
"management/internal/pkg/render"
"management/internal/tasks"
"github.com/drhin/logger"
"github.com/gin-gonic/gin"
)
type Config struct {
Conf *config.Config
Log *logger.Logger
Render render.Renderer
TaskDistributor tasks.TaskDistributor
MenuService v1.MenuService
Log *logger.Logger
}
func Routes(r *gin.RouterGroup, cfg Config) {
app := newApp(cfg.Log, cfg.Render)
app := newApp(cfg.Log)
r.Group("/upload", func(ctx *gin.Context) {
r.POST("/img", app.img)

View File

@@ -5,21 +5,18 @@ import (
fileutil "management/internal/pkg/file"
"management/internal/pkg/gin/gu"
"management/internal/pkg/render"
"github.com/drhin/logger"
"github.com/gin-gonic/gin"
)
type app struct {
log *logger.Logger
render render.Renderer
log *logger.Logger
}
func newApp(log *logger.Logger, render render.Renderer) *app {
func newApp(log *logger.Logger) *app {
return &app{
log: log,
render: render,
log: log,
}
}