瀏覽代碼

update

master
dengbiao 1 周之前
父節點
當前提交
6194cb8f41
共有 1 個檔案被更改,包括 0 行新增42 行删除
  1. +0
    -42
      svc/svc_file_img_format.go

+ 0
- 42
svc/svc_file_img_format.go 查看文件

@@ -1,42 +0,0 @@
package svc

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
"code.fnuoos.com/EggPlanet/egg_system_rules.git/enum"
"fmt"
"github.com/gomodule/redigo/redis"
"strings"
"xorm.io/xorm"
)

// ImageBucket is 获取域名
func ImageBucket(engine *xorm.Engine, conn redis.Conn) (string, string) {
sysCfgDb := implement.NewSysCfgDb(engine, conn)
res := sysCfgDb.SysCfgFindWithDb(enum.AliyunOssBucketScheme, enum.AliyunOssDomain)
return res[enum.AliyunOssBucketScheme], res[enum.AliyunOssDomain]
}

// ImageFormatWithBucket is 格式化成oss 域名
func ImageFormatWithBucket(scheme, domain, name string) string {
if strings.Contains(name, "http") || name == "" {
return name
}
return fmt.Sprintf("%s://%s/%s", scheme, domain, name)
}

// ImageFormatWithBucketNew is 格式化成oss 域名
func ImageFormatWithBucketNew(scheme, domain, name string) string {
if strings.Contains(name, "http") {
return name
}

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…
取消
儲存