From 928e7f979941f083073ea7456df6f01475ae04fa Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Fri, 27 Dec 2024 18:45:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=96=87=E4=BB=B6=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dao/file.go | 2 +- handler/tool.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dao/file.go b/dao/file.go index 2fad62a..06ffc79 100644 --- a/dao/file.go +++ b/dao/file.go @@ -45,7 +45,7 @@ func FindFileByNames(fileName string, auth_id int) File { func FindFileByName(fileName string) File { var file File - DB.Where("file_name = ?", fileName).First(&file) + DB.Where("file_store_name = ?", fileName).First(&file) return file } diff --git a/handler/tool.go b/handler/tool.go index 39d512e..c6f85d6 100644 --- a/handler/tool.go +++ b/handler/tool.go @@ -164,7 +164,14 @@ func UploadFile(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"error": "save file info failed", "code": proto.SaveFileInfoFailed, "message": "failed"}) return } - c.JSON(http.StatusOK, gin.H{"code": proto.SuccessCode, "message": "success", "data": fileID}) + ret := map[string]interface{}{ + "file_id": fileID, + "file_store_name": fileStoreName, + "file_name": fileName, + "file_size": fileSize, + "file_type": fileType, + } + c.JSON(http.StatusOK, gin.H{"code": proto.SuccessCode, "message": "success", "data": ret}) }