From 1be2d54c25d221c55703c590f68bb06227514ae5 Mon Sep 17 00:00:00 2001 From: a7458969 <290198252@qq.com> Date: Sun, 29 Dec 2019 17:42:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E5=83=8F=E4=B8=8A=E4=BC=A0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=96=B0=E5=A2=9E=E6=A0=BC=E5=BC=8F=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/file.go | 8 ++++---- deploy.bat | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/controller/file.go b/controller/file.go index 822850b..cefd869 100644 --- a/controller/file.go +++ b/controller/file.go @@ -44,7 +44,7 @@ func (this *FileController) OnUpload(c *gin.Context) { defer out.Close() out.Write(bytes) log.Print(len(bytes)) - c.JSON(200, map[string] interface{}{"url":uid.String()}) + c.JSON(200, map[string] interface{}{"url":uid.String() + ".jpg" }) } if strings.Contains(types,"png"){ defer file.Close() @@ -55,7 +55,7 @@ func (this *FileController) OnUpload(c *gin.Context) { defer out.Close() out.Write(bytes) log.Print(len(bytes)) - c.JSON(200, map[string] interface{}{"url":uid.String()}) + c.JSON(200, map[string] interface{}{"url":uid.String() + ".png" }) } if strings.Contains(types,"gif"){ defer file.Close() @@ -66,7 +66,7 @@ func (this *FileController) OnUpload(c *gin.Context) { defer out.Close() out.Write(bytes) log.Print(len(bytes)) - c.JSON(200, map[string] interface{}{"url":uid.String()}) + c.JSON(200, map[string] interface{}{"url":uid.String() + ".gif" } ) } } @@ -79,7 +79,7 @@ func (this *FileController) OnDownLoad(c *gin.Context) { return } - file,e := os.Open("/home/ubuntu/api/bin/image/" +fileName + ".jpg") + file,e := os.Open("/home/ubuntu/api/bin/image/" +fileName) if nil != e{ log.Print(e.Error()) c.JSON(200,resp) diff --git a/deploy.bat b/deploy.bat index fa9aa90..a74f768 100644 --- a/deploy.bat +++ b/deploy.bat @@ -3,7 +3,6 @@ SET GOOS=linux SET GOARCH=amd64 go build ./ -ssh -t -i ./id_rsa ubuntu@118.24.238.198 'pkill userapi' ssh -t -i ./id_rsa ubuntu@118.24.238.198 'rm /home/ubuntu/api/bin/userapi'