add qygl23t7

This commit is contained in:
2025-07-30 00:51:22 +08:00
parent 83530c0f9b
commit 723c418a1b
38 changed files with 999 additions and 785 deletions

View File

@@ -13,6 +13,7 @@ import (
"tyapi-server/internal/domains/api/services/processors/qygl"
"tyapi-server/internal/domains/api/services/processors/yysy"
"tyapi-server/internal/domains/product/services"
"tyapi-server/internal/infrastructure/external/tianyancha"
"tyapi-server/internal/infrastructure/external/westdex"
"tyapi-server/internal/infrastructure/external/yushan"
"tyapi-server/internal/shared/interfaces"
@@ -27,16 +28,18 @@ var (
type ApiRequestService struct {
// 可注入依赖,如第三方服务、模型等
westDexService *westdex.WestDexService
yushanService *yushan.YushanService
validator interfaces.RequestValidator
processorDeps *processors.ProcessorDependencies
combService *comb.CombService
westDexService *westdex.WestDexService
yushanService *yushan.YushanService
tianYanChaService *tianyancha.TianYanChaService
validator interfaces.RequestValidator
processorDeps *processors.ProcessorDependencies
combService *comb.CombService
}
func NewApiRequestService(
westDexService *westdex.WestDexService,
yushanService *yushan.YushanService,
tianYanChaService *tianyancha.TianYanChaService,
validator interfaces.RequestValidator,
productManagementService *services.ProductManagementService,
) *ApiRequestService {
@@ -44,17 +47,18 @@ func NewApiRequestService(
combService := comb.NewCombService(productManagementService)
// 创建处理器依赖容器
processorDeps := processors.NewProcessorDependencies(westDexService, yushanService, validator, combService)
processorDeps := processors.NewProcessorDependencies(westDexService, yushanService, tianYanChaService, validator, combService)
// 统一注册所有处理器
registerAllProcessors(combService)
return &ApiRequestService{
westDexService: westDexService,
yushanService: yushanService,
validator: validator,
processorDeps: processorDeps,
combService: combService,
westDexService: westDexService,
yushanService: yushanService,
tianYanChaService: tianYanChaService,
validator: validator,
processorDeps: processorDeps,
combService: combService,
}
}
@@ -89,6 +93,7 @@ func registerAllProcessors(combService *comb.CombService) {
"QYGL6F2D": qygl.ProcessQYGL6F2DRequest,
"QYGL8271": qygl.ProcessQYGL8271Request,
"QYGLB4C0": qygl.ProcessQYGLB4C0Request,
"QYGL23T7": qygl.ProcessQYGL23T7Request, // 企业三要素验证
// YYSY系列处理器
"YYSYD50F": yysy.ProcessYYSYD50FRequest,
@@ -128,8 +133,8 @@ var RequestProcessors map[string]processors.ProcessorFunc
func (a *ApiRequestService) PreprocessRequestApi(ctx context.Context, apiCode string, params []byte, options *commands.ApiCallOptions) ([]byte, error) {
if processor, exists := RequestProcessors[apiCode]; exists {
// 设置Options到依赖容器
depsWithOptions := a.processorDeps.WithOptions(options)
return processor(ctx, params, depsWithOptions)
deps := a.processorDeps.WithOptions(options)
return processor(ctx, params, deps)
}
return nil, fmt.Errorf("%w: %s", ErrSystem, "api请求, 未找到相应的处理程序")
return nil, fmt.Errorf("%s: 未找到处理器: %s", ErrSystem, apiCode)
}