From 0784953cc1a36823ac00d28b9746513c8773d1b6 Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Tue, 26 Nov 2024 21:55:30 +0800 Subject: [PATCH] update --- app/hdl/comm/hdl_comm.go | 12 +++++++++++- go.mod | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/hdl/comm/hdl_comm.go b/app/hdl/comm/hdl_comm.go index 0537372..279b45a 100644 --- a/app/hdl/comm/hdl_comm.go +++ b/app/hdl/comm/hdl_comm.go @@ -11,6 +11,7 @@ import ( enum2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" "github.com/aliyun/aliyun-oss-go-sdk/oss" "github.com/gin-gonic/gin" + "strings" "time" ) @@ -55,6 +56,7 @@ func GetOssUrl(c *gin.Context) { ossBucketScheme := cfgMap[enum2.AliyunOssBucketScheme] accessKeyID := cfgMap[enum2.AliyunOssAccessKeyID] accessKeySecret := cfgMap[enum2.AliyunOssAccessKeySecret] + aliyunOptions := cfgMap[enum2.AliyunOptions] // 创建OSSClient实例。 client, err := oss.New(ossBucketScheme+"://"+endpoint, accessKeyID, accessKeySecret) @@ -70,7 +72,15 @@ func GetOssUrl(c *gin.Context) { 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 { e.OutErr(c, e.ERR_AES_ENCODE, err.Error()) return diff --git a/go.mod b/go.mod index 5093760..424f122 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( require ( code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241126123220-2fadc60eff6f - code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241126083327-1b1d0a2602a0 + code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241126134228-b1047bfb8475 code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible