@@ -50,6 +50,8 @@ const ( | |||||
AliyunOssAccessKeySecret = "oss_access_key_secret" | AliyunOssAccessKeySecret = "oss_access_key_secret" | ||||
AliyunOssDomain = "oss_domain" | AliyunOssDomain = "oss_domain" | ||||
AliyunOptions = "oss_options" | AliyunOptions = "oss_options" | ||||
AliyunOssAccountId = "oss_account_id" | |||||
AliyunOssRoleName = "oss_role_name" | |||||
) | ) | ||||
func (gt AliyunOss) String() string { | func (gt AliyunOss) String() string { | ||||
@@ -68,6 +70,10 @@ func (gt AliyunOss) String() string { | |||||
return "oss域名" | return "oss域名" | ||||
case AliyunOptions: | case AliyunOptions: | ||||
return "文件上传类型" | return "文件上传类型" | ||||
case AliyunOssAccountId: | |||||
return "阿里云账户id" | |||||
case AliyunOssRoleName: | |||||
return "oss RAM角色名称" | |||||
default: | default: | ||||
return "未知" | return "未知" | ||||
@@ -30,6 +30,17 @@ func ImageFormatWithBucketNew(scheme, domain, name string) string { | |||||
return name | return name | ||||
} | } | ||||
name = strings.ReplaceAll(name, "{{host}}", "") | |||||
name = strings.ReplaceAll(name, "{{tempHost}}", "") | |||||
return fmt.Sprintf("%s://%s/%s", scheme, domain, name) | return fmt.Sprintf("%s://%s/%s", scheme, domain, name) | ||||
} | } | ||||
// ImageFormatWithBucketForDataInfo is 格式化成oss 域名 (只格式化内容中的 url) | |||||
func ImageFormatWithBucketForDataInfo(scheme, domain, name string) string { | |||||
if strings.Contains(name, "http") { | |||||
return name | |||||
} | |||||
prefix := fmt.Sprintf("%s://%s/", scheme, domain) | |||||
name = strings.ReplaceAll(name, "{{tempHost}}", prefix) | |||||
return name | |||||
} |