update version

This commit is contained in:
RockYang
2025-02-27 19:29:55 +08:00
parent 6c84d2557c
commit 04b364c1cd
3 changed files with 10 additions and 6 deletions

View File

@@ -13,9 +13,10 @@ import (
"geekai/service/oss"
"geekai/store/model"
"geekai/utils/resp"
"time"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
"time"
)
type UploadHandler struct {
@@ -29,13 +30,13 @@ func NewUploadHandler(app *core.AppServer, db *gorm.DB, manager *oss.UploaderMan
func (h *UploadHandler) Upload(c *gin.Context) {
// 判断文件大小
file, err := c.FormFile("file")
f, err := c.FormFile("file")
if err != nil {
resp.ERROR(c, err.Error())
return
}
if h.App.SysConfig.MaxFileSize > 0 && file.Size > int64(h.App.SysConfig.MaxFileSize)*1024*1024 {
if h.App.SysConfig.MaxFileSize > 0 && f.Size > int64(h.App.SysConfig.MaxFileSize)*1024*1024 {
resp.ERROR(c, "文件大小超过限制")
return
}
@@ -43,6 +44,9 @@ func (h *UploadHandler) Upload(c *gin.Context) {
file, err := h.uploaderManager.GetUploadHandler().PutFile(c, "file")
if err != nil {
resp.ERROR(c, err.Error())
return
}
userId := 0
res := h.DB.Create(&model.File{
UserId: userId,