|
@@ -11,6 +11,7 @@ import ( |
|
|
enum2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" |
|
|
enum2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" |
|
|
"github.com/aliyun/aliyun-oss-go-sdk/oss" |
|
|
"github.com/aliyun/aliyun-oss-go-sdk/oss" |
|
|
"github.com/gin-gonic/gin" |
|
|
"github.com/gin-gonic/gin" |
|
|
|
|
|
"strings" |
|
|
"time" |
|
|
"time" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
@@ -55,6 +56,7 @@ func GetOssUrl(c *gin.Context) { |
|
|
ossBucketScheme := cfgMap[enum2.AliyunOssBucketScheme] |
|
|
ossBucketScheme := cfgMap[enum2.AliyunOssBucketScheme] |
|
|
accessKeyID := cfgMap[enum2.AliyunOssAccessKeyID] |
|
|
accessKeyID := cfgMap[enum2.AliyunOssAccessKeyID] |
|
|
accessKeySecret := cfgMap[enum2.AliyunOssAccessKeySecret] |
|
|
accessKeySecret := cfgMap[enum2.AliyunOssAccessKeySecret] |
|
|
|
|
|
aliyunOptions := cfgMap[enum2.AliyunOptions] |
|
|
|
|
|
|
|
|
// 创建OSSClient实例。 |
|
|
// 创建OSSClient实例。 |
|
|
client, err := oss.New(ossBucketScheme+"://"+endpoint, accessKeyID, accessKeySecret) |
|
|
client, err := oss.New(ossBucketScheme+"://"+endpoint, accessKeyID, accessKeySecret) |
|
@@ -70,7 +72,15 @@ func GetOssUrl(c *gin.Context) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
signedURL, err := bucket.SignURL(args.FileName, oss.HTTPPut, 60*5) |
|
|
|
|
|
|
|
|
optionsList := strings.Split(aliyunOptions, ",") |
|
|
|
|
|
|
|
|
|
|
|
var options []oss.Option |
|
|
|
|
|
|
|
|
|
|
|
for _, option := range optionsList { |
|
|
|
|
|
options = append(options, oss.ContentType(option)) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
signedURL, err := bucket.SignURL(args.FileName, oss.HTTPPut, 60*5, options...) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
e.OutErr(c, e.ERR_AES_ENCODE, err.Error()) |
|
|
e.OutErr(c, e.ERR_AES_ENCODE, err.Error()) |
|
|
return |
|
|
return |
|
|