|
|
@@ -32,36 +32,40 @@ func GetBasic(c *gin.Context) { |
|
|
|
for _, cfg := range *sysCfg { |
|
|
|
cfgMap[cfg.Key] = cfg.Val |
|
|
|
} |
|
|
|
endpoint, ok := cfgMap[enum2.AliyunOss(enum2.AliyunOssEndpoint).String()] |
|
|
|
endpoint, ok := cfgMap[enum2.AliyunOssEndpoint] |
|
|
|
if !ok { |
|
|
|
sysCfgDb.SysCfgInsert(enum2.AliyunOss(enum2.AliyunOssEndpoint).String(), "", "oss地域节点") |
|
|
|
sysCfgDb.SysCfgInsert(enum2.AliyunOssEndpoint, "", enum2.AliyunOss(enum2.AliyunOssEndpoint).String()) |
|
|
|
endpoint = "" |
|
|
|
} |
|
|
|
bucketName, ok := cfgMap[enum2.AliyunOss(enum2.AliyunOssBucketName).String()] |
|
|
|
bucketName, ok := cfgMap[enum2.AliyunOssBucketName] |
|
|
|
if !ok { |
|
|
|
sysCfgDb.SysCfgInsert(enum2.AliyunOss(enum2.AliyunOssBucketName).String(), "", "oss存储桶名称") |
|
|
|
sysCfgDb.SysCfgInsert(enum2.AliyunOssBucketName, "", enum2.AliyunOss(enum2.AliyunOssBucketName).String()) |
|
|
|
bucketName = "" |
|
|
|
} |
|
|
|
bucketScheme, ok := cfgMap[enum2.AliyunOss(enum2.AliyunOssBucketScheme).String()] |
|
|
|
bucketScheme, ok := cfgMap[enum2.AliyunOssBucketScheme] |
|
|
|
if !ok { |
|
|
|
sysCfgDb.SysCfgInsert(enum2.AliyunOss(enum2.AliyunOssBucketScheme).String(), "", "oss上传方式") |
|
|
|
sysCfgDb.SysCfgInsert(enum2.AliyunOssBucketScheme, "", enum2.AliyunOss(enum2.AliyunOssBucketScheme).String()) |
|
|
|
bucketScheme = "" |
|
|
|
} |
|
|
|
accessKeyID, ok := cfgMap[enum2.AliyunOss(enum2.AliyunOssAccessKeyID).String()] |
|
|
|
accessKeyID, ok := cfgMap[enum2.AliyunOssAccessKeyID] |
|
|
|
if !ok { |
|
|
|
sysCfgDb.SysCfgInsert(enum2.AliyunOss(enum2.AliyunOssAccessKeyID).String(), "", "oss访问秘钥id") |
|
|
|
sysCfgDb.SysCfgInsert(enum2.AliyunOssAccessKeyID, "", enum2.AliyunOss(enum2.AliyunOssAccessKeyID).String()) |
|
|
|
accessKeyID = "" |
|
|
|
} |
|
|
|
accessKeySecret, ok := cfgMap[enum2.AliyunOss(enum2.AliyunOssAccessKeySecret).String()] |
|
|
|
accessKeySecret, ok := cfgMap[enum2.AliyunOssAccessKeySecret] |
|
|
|
if !ok { |
|
|
|
sysCfgDb.SysCfgInsert(enum2.AliyunOss(enum2.AliyunOssAccessKeySecret).String(), "", "oss访问秘钥") |
|
|
|
sysCfgDb.SysCfgInsert(enum2.AliyunOssAccessKeySecret, "", enum2.AliyunOss(enum2.AliyunOssAccessKeySecret).String()) |
|
|
|
accessKeySecret = "" |
|
|
|
} |
|
|
|
domain, ok := cfgMap[enum2.AliyunOss(enum2.AliyunOssDomain).String()] |
|
|
|
domain, ok := cfgMap[enum2.AliyunOssDomain] |
|
|
|
if !ok { |
|
|
|
sysCfgDb.SysCfgInsert(enum2.AliyunOss(enum2.AliyunOssDomain).String(), "", "oss域名") |
|
|
|
sysCfgDb.SysCfgInsert(enum2.AliyunOssDomain, "", enum2.AliyunOss(enum2.AliyunOssDomain).String()) |
|
|
|
domain = "" |
|
|
|
} |
|
|
|
options, ok := cfgMap[enum2.AliyunOptions] |
|
|
|
if !ok { |
|
|
|
sysCfgDb.SysCfgInsert(enum2.AliyunOptions, "", enum2.AliyunOss(enum2.AliyunOptions).String()) |
|
|
|
} |
|
|
|
|
|
|
|
resp := md.GetBasicResp{ |
|
|
|
OssEndpoint: endpoint, |
|
|
@@ -70,6 +74,7 @@ func GetBasic(c *gin.Context) { |
|
|
|
OssAccessKeyId: accessKeyID, |
|
|
|
OssAccessKeySecret: accessKeySecret, |
|
|
|
OssObjectDomain: domain, |
|
|
|
OssOption: options, |
|
|
|
} |
|
|
|
|
|
|
|
e.OutSuc(c, resp, nil) |
|
|
@@ -97,22 +102,25 @@ func SetBasic(c *gin.Context) { |
|
|
|
cfgDb := implement.NewSysCfgDb(db.Db, redisConn) |
|
|
|
|
|
|
|
if req.OssAccessKeyId != "" { |
|
|
|
cfgDb.SysCfgUpdate(enum2.AliyunOss(enum2.AliyunOssAccessKeyID).String(), req.OssAccessKeyId) |
|
|
|
cfgDb.SysCfgUpdate(enum2.AliyunOssAccessKeyID, req.OssAccessKeyId) |
|
|
|
} |
|
|
|
if req.OssAccessKeySecret != "" { |
|
|
|
cfgDb.SysCfgUpdate(enum2.AliyunOss(enum2.AliyunOssAccessKeySecret).String(), req.OssAccessKeySecret) |
|
|
|
cfgDb.SysCfgUpdate(enum2.AliyunOssAccessKeySecret, req.OssAccessKeySecret) |
|
|
|
} |
|
|
|
if req.OssBucketScheme != "" { |
|
|
|
cfgDb.SysCfgUpdate(enum2.AliyunOss(enum2.AliyunOssBucketScheme).String(), req.OssBucketScheme) |
|
|
|
cfgDb.SysCfgUpdate(enum2.AliyunOssBucketScheme, req.OssBucketScheme) |
|
|
|
} |
|
|
|
if req.OssObjectDomain != "" { |
|
|
|
cfgDb.SysCfgUpdate(enum2.AliyunOss(enum2.AliyunOssDomain).String(), req.OssObjectDomain) |
|
|
|
cfgDb.SysCfgUpdate(enum2.AliyunOssDomain, req.OssObjectDomain) |
|
|
|
} |
|
|
|
if req.OssBucketName != "" { |
|
|
|
cfgDb.SysCfgUpdate(enum2.AliyunOss(enum2.AliyunOssBucketName).String(), req.OssBucketName) |
|
|
|
cfgDb.SysCfgUpdate(enum2.AliyunOssBucketName, req.OssBucketName) |
|
|
|
} |
|
|
|
if req.OssEndpoint != "" { |
|
|
|
cfgDb.SysCfgUpdate(enum2.AliyunOss(enum2.AliyunOssEndpoint).String(), req.OssEndpoint) |
|
|
|
cfgDb.SysCfgUpdate(enum2.AliyunOssEndpoint, req.OssEndpoint) |
|
|
|
} |
|
|
|
if req.OssOption != "" { |
|
|
|
cfgDb.SysCfgUpdate(enum2.AliyunOptions, req.OssEndpoint) |
|
|
|
} |
|
|
|
e.OutSuc(c, "success", nil) |
|
|
|
} |