🎨 更新环境配置,添加 Dockerfile,优化代码结构
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
commonReq "git.echol.cn/loser/Go-Web-Template/server/model/common/request"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/model/common/response"
|
||||
commonRes "git.echol.cn/loser/Go-Web-Template/server/model/common/response"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/utils"
|
||||
"git.echol.cn/loser/Go-Web-Template/server/utils/upload"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
"strconv"
|
||||
@@ -32,7 +34,13 @@ func (b *FileUploadAndDownloadApi) UploadFile(c *gin.Context) {
|
||||
response.FailWithMessage("接收文件失败", c)
|
||||
return
|
||||
}
|
||||
file, err = fileUploadAndDownloadService.UploadFile(header, noSave, classId) // 文件上传后拿到文件路径
|
||||
// 从系统 JWT 中获取管理员 ID
|
||||
var adminID uint
|
||||
if claims := utils.GetUserInfo(c); claims != nil {
|
||||
adminID = claims.BaseClaims.ID
|
||||
}
|
||||
uploadCtx := upload.UploadContext{Source: upload.SourceAdmin, UserID: adminID}
|
||||
file, err = fileUploadAndDownloadService.UploadFile(header, noSave, classId, uploadCtx)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("上传文件失败!", zap.Error(err))
|
||||
response.FailWithMessage("上传文件失败", c)
|
||||
|
||||
Reference in New Issue
Block a user