|
@@ -3,6 +3,7 @@ package aliyun |
|
|
import ( |
|
|
import ( |
|
|
"applet/app/db" |
|
|
"applet/app/db" |
|
|
"applet/app/e" |
|
|
"applet/app/e" |
|
|
|
|
|
"applet/app/enum" |
|
|
md "applet/app/md/setCenter/oss/aliyun" |
|
|
md "applet/app/md/setCenter/oss/aliyun" |
|
|
"applet/app/utils/cache" |
|
|
"applet/app/utils/cache" |
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" |
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" |
|
@@ -31,41 +32,41 @@ func GetBasic(c *gin.Context) { |
|
|
for _, cfg := range *sysCfg { |
|
|
for _, cfg := range *sysCfg { |
|
|
cfgMap[cfg.Key] = cfg.Val |
|
|
cfgMap[cfg.Key] = cfg.Val |
|
|
} |
|
|
} |
|
|
endpoint, ok := cfgMap["oss_endpoint"] |
|
|
|
|
|
|
|
|
endpoint, ok := cfgMap[enum.AliyunOss(enum.AliyunOssEndpoint).String()] |
|
|
if !ok { |
|
|
if !ok { |
|
|
sysCfgDb.SysCfgInsert("oss_endpoint", "", "oss地域节点") |
|
|
|
|
|
|
|
|
sysCfgDb.SysCfgInsert(enum.AliyunOss(enum.AliyunOssEndpoint).String(), "", "oss地域节点") |
|
|
endpoint = "" |
|
|
endpoint = "" |
|
|
} |
|
|
} |
|
|
bucketName, ok := cfgMap["oss_bucket_name"] |
|
|
|
|
|
|
|
|
bucketName, ok := cfgMap[enum.AliyunOss(enum.AliyunOssBucketName).String()] |
|
|
if !ok { |
|
|
if !ok { |
|
|
sysCfgDb.SysCfgInsert("oss_bucket_name", "", "oss存储桶名称") |
|
|
|
|
|
|
|
|
sysCfgDb.SysCfgInsert(enum.AliyunOss(enum.AliyunOssBucketName).String(), "", "oss存储桶名称") |
|
|
bucketName = "" |
|
|
bucketName = "" |
|
|
} |
|
|
} |
|
|
objectScheme, ok := cfgMap["oss_object_scheme"] |
|
|
|
|
|
|
|
|
bucketScheme, ok := cfgMap[enum.AliyunOss(enum.AliyunOssBucketScheme).String()] |
|
|
if !ok { |
|
|
if !ok { |
|
|
sysCfgDb.SysCfgInsert("oss_object_scheme", "", "oss上传方式") |
|
|
|
|
|
objectScheme = "" |
|
|
|
|
|
|
|
|
sysCfgDb.SysCfgInsert(enum.AliyunOss(enum.AliyunOssBucketScheme).String(), "", "oss上传方式") |
|
|
|
|
|
bucketScheme = "" |
|
|
} |
|
|
} |
|
|
accessKeyID, ok := cfgMap["oss_access_key_id"] |
|
|
|
|
|
|
|
|
accessKeyID, ok := cfgMap[enum.AliyunOss(enum.AliyunOssAccessKeyID).String()] |
|
|
if !ok { |
|
|
if !ok { |
|
|
sysCfgDb.SysCfgInsert("oss_access_key_id", "", "oss访问秘钥id") |
|
|
|
|
|
|
|
|
sysCfgDb.SysCfgInsert(enum.AliyunOss(enum.AliyunOssAccessKeyID).String(), "", "oss访问秘钥id") |
|
|
accessKeyID = "" |
|
|
accessKeyID = "" |
|
|
} |
|
|
} |
|
|
accessKeySecret, ok := cfgMap["oss_access_key_secret"] |
|
|
|
|
|
|
|
|
accessKeySecret, ok := cfgMap[enum.AliyunOss(enum.AliyunOssAccessKeySecret).String()] |
|
|
if !ok { |
|
|
if !ok { |
|
|
sysCfgDb.SysCfgInsert("oss_access_key_secret", "", "oss访问秘钥") |
|
|
|
|
|
|
|
|
sysCfgDb.SysCfgInsert(enum.AliyunOss(enum.AliyunOssAccessKeySecret).String(), "", "oss访问秘钥") |
|
|
accessKeySecret = "" |
|
|
accessKeySecret = "" |
|
|
} |
|
|
} |
|
|
domain, ok := cfgMap["oss_object_domain"] |
|
|
|
|
|
|
|
|
domain, ok := cfgMap[enum.AliyunOss(enum.AliyunOssDomain).String()] |
|
|
if !ok { |
|
|
if !ok { |
|
|
sysCfgDb.SysCfgInsert("oss_object_domain", "", "oss域名") |
|
|
|
|
|
|
|
|
sysCfgDb.SysCfgInsert(enum.AliyunOss(enum.AliyunOssDomain).String(), "", "oss域名") |
|
|
domain = "" |
|
|
domain = "" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
resp := md.GetBasicResp{ |
|
|
resp := md.GetBasicResp{ |
|
|
OssEndpoint: endpoint, |
|
|
OssEndpoint: endpoint, |
|
|
OssBucketName: bucketName, |
|
|
OssBucketName: bucketName, |
|
|
OssObjectScheme: objectScheme, |
|
|
|
|
|
|
|
|
OssBucketScheme: bucketScheme, |
|
|
OssAccessKeyId: accessKeyID, |
|
|
OssAccessKeyId: accessKeyID, |
|
|
OssAccessKeySecret: accessKeySecret, |
|
|
OssAccessKeySecret: accessKeySecret, |
|
|
OssObjectDomain: domain, |
|
|
OssObjectDomain: domain, |
|
@@ -96,22 +97,22 @@ func SetBasic(c *gin.Context) { |
|
|
cfgDb := implement.NewSysCfgDb(db.Db, redisConn) |
|
|
cfgDb := implement.NewSysCfgDb(db.Db, redisConn) |
|
|
|
|
|
|
|
|
if req.OssAccessKeyId != "" { |
|
|
if req.OssAccessKeyId != "" { |
|
|
cfgDb.SysCfgUpdate("oss_access_key_id", req.OssAccessKeyId) |
|
|
|
|
|
|
|
|
cfgDb.SysCfgUpdate(enum.AliyunOss(enum.AliyunOssAccessKeyID).String(), req.OssAccessKeyId) |
|
|
} |
|
|
} |
|
|
if req.OssAccessKeySecret != "" { |
|
|
if req.OssAccessKeySecret != "" { |
|
|
cfgDb.SysCfgUpdate("oss_access_key_secret", req.OssAccessKeySecret) |
|
|
|
|
|
|
|
|
cfgDb.SysCfgUpdate(enum.AliyunOss(enum.AliyunOssAccessKeySecret).String(), req.OssAccessKeySecret) |
|
|
} |
|
|
} |
|
|
if req.OssObjectScheme != "" { |
|
|
|
|
|
cfgDb.SysCfgUpdate("oss_object_scheme", req.OssObjectScheme) |
|
|
|
|
|
|
|
|
if req.OssBucketScheme != "" { |
|
|
|
|
|
cfgDb.SysCfgUpdate(enum.AliyunOss(enum.AliyunOssBucketScheme).String(), req.OssBucketScheme) |
|
|
} |
|
|
} |
|
|
if req.OssObjectDomain != "" { |
|
|
if req.OssObjectDomain != "" { |
|
|
cfgDb.SysCfgUpdate("oss_object_domain", req.OssObjectDomain) |
|
|
|
|
|
|
|
|
cfgDb.SysCfgUpdate(enum.AliyunOss(enum.AliyunOssDomain).String(), req.OssObjectDomain) |
|
|
} |
|
|
} |
|
|
if req.OssBucketName != "" { |
|
|
if req.OssBucketName != "" { |
|
|
cfgDb.SysCfgUpdate("oss_bucket_name", req.OssBucketName) |
|
|
|
|
|
|
|
|
cfgDb.SysCfgUpdate(enum.AliyunOss(enum.AliyunOssBucketName).String(), req.OssBucketName) |
|
|
} |
|
|
} |
|
|
if req.OssEndpoint != "" { |
|
|
if req.OssEndpoint != "" { |
|
|
cfgDb.SysCfgUpdate("oss_endpoint", req.OssEndpoint) |
|
|
|
|
|
|
|
|
cfgDb.SysCfgUpdate(enum.AliyunOss(enum.AliyunOssEndpoint).String(), req.OssEndpoint) |
|
|
} |
|
|
} |
|
|
e.OutSuc(c, "success", nil) |
|
|
e.OutSuc(c, "success", nil) |
|
|
} |
|
|
} |