Refactor Qiniu upload integration and remove legacy handlers
- Replaced common upload handler and service with Qiniu-specific implementations in main.go and route registration. - Deleted outdated upload_handler.go and qiniu_service.go files to streamline the codebase. - Updated route definitions to utilize the new Qiniu upload handler for improved file upload management.
This commit is contained in:
+4
-4
@@ -6,16 +6,16 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"wx_service/internal/common/service"
|
||||
qiniuservice "wx_service/internal/common/qiniu/service"
|
||||
"wx_service/internal/middleware"
|
||||
"wx_service/internal/model"
|
||||
)
|
||||
|
||||
type UploadHandler struct {
|
||||
qiniuService *service.QiniuService
|
||||
qiniuService *qiniuservice.QiniuService
|
||||
}
|
||||
|
||||
func NewUploadHandler(qiniuService *service.QiniuService) *UploadHandler {
|
||||
func NewUploadHandler(qiniuService *qiniuservice.QiniuService) *UploadHandler {
|
||||
return &UploadHandler{qiniuService: qiniuService}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ func (h *UploadHandler) QiniuToken(c *gin.Context) {
|
||||
|
||||
token, err := h.qiniuService.CreateUploadToken(user.MiniProgramID, user.ID, req.Filename)
|
||||
if err != nil {
|
||||
if errors.Is(err, service.ErrQiniuNotConfigured) {
|
||||
if errors.Is(err, qiniuservice.ErrQiniuNotConfigured) {
|
||||
c.JSON(http.StatusServiceUnavailable, model.Error(http.StatusServiceUnavailable, "未配置七牛上传服务,请联系管理员"))
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user