This commit is contained in:
2026-02-12 17:04:10 +08:00
parent c2591eec44
commit 356b422879
6 changed files with 12 additions and 9 deletions

View File

@@ -89,4 +89,5 @@ Authorization:
Upload:
FileBaseURL: "https://www.tianyuancha.cn/api/v1/upload/file" # 上传图片访问基础 URL
TempFileMaxAgeH: 24 # 临时文件保留时长小时超时自动删除0 表示默认 24
PublicBaseURL: "https://www.tianyuancha.cn"
ExtensionTime: 24 # 佣金解冻延迟时间单位24小时

View File

@@ -97,4 +97,5 @@ Authorization:
FileBaseURL: "https://www.tianyuancha.cn/api/v1/auth-docs" # 授权书文件访问基础URL
Upload:
FileBaseURL: "https://www.tianyuancha.cn/api/v1/upload/file" # 上传图片访问基础 URL行驶证等
PublicBaseURL: "https://www.tianyuancha.cn"
ExtensionTime: 24 # 佣金解冻延迟时间单位24小时

View File

@@ -26,7 +26,9 @@ type Config struct {
AdminConfig AdminConfig
AdminPromotion AdminPromotion
TaxConfig TaxConfig
ExtensionTime int64
// PublicBaseURL 前台访问域名,用于构造对外可访问链接(上传图片、回调等),例如 https://www.tianyuancha.cn
PublicBaseURL string
ExtensionTime int64
}
// JwtAuth 用于 JWT 鉴权配置

View File

@@ -8,6 +8,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
"time"
"tyc-server/app/main/api/internal/svc"
@@ -76,11 +77,9 @@ func (l *UploadImageLogic) UploadImage(req *types.UploadImageReq) (resp *types.U
func (l *UploadImageLogic) buildURL(fileName string) string {
baseURL := l.svcCtx.Config.Upload.FileBaseURL
if baseURL == "" {
baseURL = l.svcCtx.Config.AdminPromotion.URLDomain
if baseURL != "" {
baseURL = baseURL + "/api/v1/upload/file"
}
if baseURL == "" && l.svcCtx.Config.PublicBaseURL != "" {
// 兜底:如果未单独配置 Upload.FileBaseURL则使用公共域名拼接默认上传路径
baseURL = strings.TrimRight(l.svcCtx.Config.PublicBaseURL, "/") + "/api/v1/upload/file"
}
if baseURL == "" {
return ""

View File

@@ -190,7 +190,7 @@ func (l *PaySuccessNotifyUserHandler) ProcessTask(ctx context.Context, t *asynq.
if updateParamsErr != nil {
logx.Errorf("更新查询参数失败: %v", updateParamsErr)
} else {
logx.Infof("成功更新查询参数(已精简)包含授权书URL: %s", downloadURL)
logx.Infof("成功更新查询参数包含授权书URL: %s", downloadURL)
}
}
}

View File

@@ -1494,10 +1494,10 @@ func buildVehicleBody(params []byte, required, optional []string) map[string]int
}
// buildVehicleCallbackURL 生成车辆类接口的异步回调地址
// 当前使用 AdminPromotion.URLDomain 作为域名配置,路径固定为 /api/v1/tianyuan/vehicle/callback
// 使用 PublicBaseURL 作为对外域名配置,路径固定为 /api/v1/tianyuan/vehicle/callback
// 并通过查询参数携带 order_no 与 api_id 以便后端识别具体查询与模块。
func (a *ApiRequestService) buildVehicleCallbackURL(orderNo, apiID string) string {
base := strings.TrimRight(a.config.AdminPromotion.URLDomain, "/")
base := strings.TrimRight(a.config.PublicBaseURL, "/")
if base == "" {
// 兜底:如果未配置 URLDomain则使用相对路径交给网关/部署层补全域名
return fmt.Sprintf("/api/v1/tianyuan/vehicle/callback?order_no=%s&api_id=%s", orderNo, apiID)