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'