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