sync: 对齐小程序 v1.0.2 生产代码并脱敏
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// package system
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @Author Lxj <li@example.com>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package system
|
||||
|
||||
@@ -9,6 +9,12 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"mime"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/consts"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/dao"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/library/contexts"
|
||||
@@ -19,12 +25,6 @@ import (
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/request"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/utility/hash"
|
||||
"mime"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gogf/gf/v2/crypto/gmd5"
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
@@ -439,6 +439,16 @@ func (s *sSysOss) buildLocalFileURL(ctx context.Context, fullFilePath string) st
|
||||
if fullFilePath == "" {
|
||||
return ""
|
||||
}
|
||||
uploadPath := strings.TrimSpace(g.Cfg().MustGet(ctx, "system.upload.local.path").String())
|
||||
publicURL := strings.TrimSpace(os.Getenv("IOTLCM_UPLOAD_PUBLIC_URL"))
|
||||
if publicURL == "" {
|
||||
publicURL = strings.TrimSpace(g.Cfg().MustGet(ctx, "system.upload.local.publicUrl", "").String())
|
||||
}
|
||||
if publicURL != "" {
|
||||
if fileURL, ok := localFileURLByBase(fullFilePath, uploadPath, publicURL); ok {
|
||||
return fileURL
|
||||
}
|
||||
}
|
||||
configValue := ""
|
||||
configType, err := service.SysConfig().GetConfigByKey(ctx, consts.ConfigOssUrlPath)
|
||||
if err == nil && configType != nil {
|
||||
@@ -448,7 +458,6 @@ func (s *sSysOss) buildLocalFileURL(ctx context.Context, fullFilePath string) st
|
||||
return url
|
||||
}
|
||||
|
||||
uploadPath := strings.TrimSpace(g.Cfg().MustGet(ctx, "system.upload.local.path").String())
|
||||
baseURL := localFileURLFallbackBase(configValue)
|
||||
if baseURL != "" {
|
||||
if url, ok := localFileURLByBase(fullFilePath, uploadPath, baseURL); ok {
|
||||
|
||||
Reference in New Issue
Block a user