dengbiao 1 周之前
父節點
當前提交
ba937bba9e
共有 2 個文件被更改,包括 24 次插入9 次删除
  1. +16
    -8
      enum/sys_cfg.go
  2. +8
    -1
      svc/svc_file_img_format.go

+ 16
- 8
enum/sys_cfg.go 查看文件

@@ -43,13 +43,16 @@ func (gt VideoReward) String() string {
type AliyunOss string

const (
AliyunOssEndpoint = "oss_endpoint"
AliyunOssBucketName = "oss_bucket_name"
AliyunOssBucketScheme = "oss_bucket_scheme"
AliyunOssAccessKeyID = "oss_access_key_id"
AliyunOssAccessKeySecret = "oss_access_key_secret"
AliyunOssDomain = "oss_domain"
AliyunOptions = "oss_options"
AliyunOssEndpoint = "oss_endpoint"
AliyunOssBucketName = "oss_bucket_name"
AliyunOssBucketScheme = "oss_bucket_scheme"
AliyunOssAccessKeyID = "oss_access_key_id"
AliyunOssAccessKeySecret = "oss_access_key_secret"
AliyunOssDomain = "oss_domain"
AliyunOptions = "oss_options"
AliyunOssAssumeRoleAccessKeyID = "oss_assume_role_access_key_id"
AliyunOssAssumeRoleAccessKeySecret = "oss_assume_role_access_key_secret"
AliyunOssAssumeRoleARN = "oss_assume_arn"
)

func (gt AliyunOss) String() string {
@@ -68,7 +71,12 @@ func (gt AliyunOss) String() string {
return "oss域名"
case AliyunOptions:
return "文件上传类型"

case AliyunOssAssumeRoleAccessKeyID:
return "oss RAM角色访问秘钥id"
case AliyunOssAssumeRoleAccessKeySecret:
return "oss RAM角色访问秘钥"
case AliyunOssAssumeRoleARN:
return "oss RAM角色ARN"
default:
return "未知"
}


+ 8
- 1
svc/svc_file_img_format.go 查看文件

@@ -30,6 +30,13 @@ func ImageFormatWithBucketNew(scheme, domain, name string) string {
return name
}

name = strings.ReplaceAll(name, "{{host}}", "")
name = strings.ReplaceAll(name, "{{tempHost}}", "")
return fmt.Sprintf("%s://%s/%s", scheme, domain, name)
}

// ImageFormatWithBucketForDataInfo is 格式化成oss 域名 (只格式化内容中的 url)
func ImageFormatWithBucketForDataInfo(scheme, domain, name string) string {
prefix := fmt.Sprintf("%s://%s/", scheme, domain)
name = strings.ReplaceAll(name, "{{tempHost}}", prefix)
return name
}

Loading…
取消
儲存