Merge remote-tracking branch 'origin/dev未优化' into dev未优化
This commit is contained in:
@@ -28,10 +28,10 @@ database:
|
|||||||
timeMaintainDisabled: false # (可选)是否完全关闭时间更新特性,为true时CreatedAt/UpdatedAt/DeletedAt都将失效
|
timeMaintainDisabled: false # (可选)是否完全关闭时间更新特性,为true时CreatedAt/UpdatedAt/DeletedAt都将失效
|
||||||
model_gateway:
|
model_gateway:
|
||||||
- type: "pgsql"
|
- type: "pgsql"
|
||||||
host: "116.204.74.41"
|
host: "localhost"
|
||||||
port: "15432"
|
port: "5432"
|
||||||
user: "postgres"
|
user: "postgres"
|
||||||
pass: "Bjang09@686^*^"
|
pass: "123456"
|
||||||
name: "model-gateway"
|
name: "model-gateway"
|
||||||
prefix: ""
|
prefix: ""
|
||||||
role: "master"
|
role: "master"
|
||||||
@@ -59,6 +59,9 @@ consul:
|
|||||||
jaeger:
|
jaeger:
|
||||||
addr: 192.168.3.30:4318
|
addr: 192.168.3.30:4318
|
||||||
|
|
||||||
|
# 文件上传服务地址,与oss模块minio中的endpoint一致
|
||||||
|
filePrefix: "http://116.204.74.41:9000"
|
||||||
|
|
||||||
task:
|
task:
|
||||||
waitTimeoutSeconds: 600 # /composeMessages 同步等待最终结果的最长时间(秒)
|
waitTimeoutSeconds: 600 # /composeMessages 同步等待最终结果的最长时间(秒)
|
||||||
|
|
||||||
|
|||||||
@@ -239,8 +239,9 @@ func DownloadFile(ossURL string) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetFileBytesFromURL(ctx context.Context, fileUrl string) ([]byte, error) {
|
func GetFileBytesFromURL(ctx context.Context, fileUrl string) ([]byte, error) {
|
||||||
|
newS := strings.ReplaceAll(fileUrl, "http://cdn.redpowerfuture.com", g.Cfg().MustGet(ctx, "filePrefix").String())
|
||||||
// 使用 GoFrame 客户端(自带超时、追踪、日志等能力)
|
// 使用 GoFrame 客户端(自带超时、追踪、日志等能力)
|
||||||
resp, err := g.Client().Get(ctx, fileUrl)
|
resp, err := g.Client().Get(ctx, newS)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("下载OSS文件失败: %w", err)
|
return nil, fmt.Errorf("下载OSS文件失败: %w", err)
|
||||||
}
|
}
|
||||||
@@ -254,7 +255,7 @@ func GetFileBytesFromURL(ctx context.Context, fileUrl string) ([]byte, error) {
|
|||||||
// 读取全部内容
|
// 读取全部内容
|
||||||
allBytes, err := io.ReadAll(resp.Body)
|
allBytes, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, gerror.Wrapf(err, "failed to read response body, url: %s", fileUrl)
|
return nil, gerror.Wrapf(err, "failed to read response body, url: %s", newS)
|
||||||
}
|
}
|
||||||
|
|
||||||
return allBytes, nil
|
return allBytes, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user