This commit is contained in:
Mrx
2026-01-30 11:39:28 +08:00
parent c64b22ab05
commit 76784c3c1b
19 changed files with 717 additions and 46 deletions

View File

@@ -11,6 +11,7 @@ import (
"regexp"
"strings"
paylogic "tyc-server/app/main/api/internal/logic/pay"
"tyc-server/app/main/api/internal/service"
"tyc-server/app/main/api/internal/svc"
"tyc-server/app/main/api/internal/types"
"tyc-server/app/main/model"
@@ -142,10 +143,19 @@ func (l *PaySuccessNotifyUserHandler) ProcessTask(ctx context.Context, t *asynq.
}
}
// 调用API请求服务
responseData, err := l.svcCtx.ApiRequestService.ProcessRequests(decryptData, product.Id)
if err != nil {
return l.handleError(ctx, err, order, query)
// 调用API请求服务(开发环境下不调用其它产品,使用默认空报告;测试支付 order.PaymentPlatform=="test" 也走空报告)
var responseData []service.APIResponseData
isEmptyReportMode := env == "development" || order.PaymentPlatform == "test"
if isEmptyReportMode {
// 开发环境 / 测试支付:生成仅包含基本信息的默认空报告,不调用外部 API
logx.Infof("空报告模式:订单 %s (ID: %d) 跳过API调用生成空报告", order.OrderNo, order.Id)
responseData = []service.APIResponseData{}
} else {
var processErr error
responseData, processErr = l.svcCtx.ApiRequestService.ProcessRequests(decryptData, product.Id)
if processErr != nil {
return l.handleError(ctx, processErr, order, query)
}
}
// 计算成功模块的总成本价