'commit'
continuous-integration/drone/push Build is passing Details

master
黄海 4 years ago
parent 32515fbdcb
commit 4f0f7524ff

Binary file not shown.

@ -15,10 +15,20 @@ import (
"io/ioutil" "io/ioutil"
"log" "log"
"net/http" "net/http"
"net/url"
"os" "os"
"strings" "strings"
) )
/**
*/
func getFileDownLoadUrl(key string, originName string) string {
infix := "?response-content-disposition=attachment%3BfileName%2A%3DUTF-8%27%27"
downloadUrl := ConfigUtil.Download_prefix + ConfigUtil.Minio_bucket + "/" + key + infix + url.QueryEscape(url.QueryEscape(originName))
return downloadUrl
}
// @title 东师理想智慧校园支撑系统 // @title 东师理想智慧校园支撑系统
// @version 2.0 // @version 2.0
// @description // @description
@ -88,6 +98,9 @@ func main() {
log.Fatalln(err) log.Fatalln(err)
} }
//返回
s := getFileDownLoadUrl(trueName[0:2]+"/"+trueName, file.Filename)
//判断扩展名是不是图片 //判断扩展名是不是图片
if ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".bmp" { if ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".bmp" {
//读取本地文件 //读取本地文件
@ -119,10 +132,10 @@ func main() {
os.Remove(filename) os.Remove(filename)
//删除缩略图文件 //删除缩略图文件
os.Remove(thumbTrueName) os.Remove(thumbTrueName)
//返回
c.JSON(200, gin.H{ c.JSON(200, gin.H{
"success": true, "success": true,
"url": ConfigUtil.Download_prefix+trueName[0:2] + "/" + trueName, "url": s,
"thumbContent": sourceString, "thumbContent": sourceString,
"size": size, "size": size,
}) })
@ -131,7 +144,7 @@ func main() {
os.Remove(filename) os.Remove(filename)
c.JSON(200, gin.H{ c.JSON(200, gin.H{
"success": true, "success": true,
"url": ConfigUtil.Download_prefix+trueName[0:2] + "/" + trueName, "url": s,
"size": size, "size": size,
}) })
} }

Loading…
Cancel
Save