All checks were successful
Build and Deploy / deploy (push) Successful in 1m8s
补 normalize-key 与 stream,兼容带或不带 admin 前缀的 COS 路径。 Co-authored-by: Cursor <cursoragent@cursor.com>
70 lines
2.6 KiB
C#
70 lines
2.6 KiB
C#
using System.Diagnostics;
|
||
using Fake;
|
||
using Fake.EventBus.RabbitMQ;
|
||
using Fake.Modularity;
|
||
using Fake.ObjectMapping.AutoMapper;
|
||
using FreeRedis;
|
||
using Microsoft.Extensions.Configuration;
|
||
using Microsoft.Extensions.DependencyInjection;
|
||
using Oms.Application.Helpers;
|
||
using Oms.Application.Integrations.SmallBagTrack;
|
||
using Oms.Application.Integrations.Itfx;
|
||
using Oms.Application.Integrations.PlatformShop;
|
||
using Oms.Application.Labeling;
|
||
using Oms.Application.Labeling.Hiprint;
|
||
using Oms.Application.Services.Storage;
|
||
using Oms.Application.Shared;
|
||
using Oms.Application.Workers;
|
||
using Oms.Domain;
|
||
|
||
namespace Oms.Application;
|
||
|
||
/// <summary>
|
||
/// OMS 应用层模块注册。
|
||
/// 对象存储由 Api 宿主注册 Fake.ObjectStorage(Local / TencentCos);文件元数据走 Fake.FileManagement。
|
||
/// </summary>
|
||
[DependsOn(
|
||
typeof(OmsDomainModule),
|
||
typeof(FakeObjectMappingAutoMapperModule),
|
||
typeof(FakeEventBusRabbitMqModule)
|
||
)]
|
||
public class OmsApplicationModule : FakeModule
|
||
{
|
||
/// <inheritdoc />
|
||
public override void ConfigureServices(ServiceConfigurationContext context)
|
||
{
|
||
var configuration = context.Services.GetConfiguration();
|
||
|
||
context.Services.Configure<FakeAutoMapperOptions>(options =>
|
||
{
|
||
options.ScanProfiles<OmsApplicationModule>();
|
||
});
|
||
|
||
var redisOptions = configuration.GetSection("Redis").Get<ConnectionStringBuilder>();
|
||
if (redisOptions == null || string.IsNullOrWhiteSpace(redisOptions.Host))
|
||
{
|
||
throw new FakeException("未找到Redis相关配置,请检查配置文件中是否包含名为Redis的节点(且包含 Host)");
|
||
}
|
||
|
||
RedisHelper.Init(redisOptions, showLogInfo: Debugger.IsAttached);
|
||
|
||
// 面单 PDF:显式注册接口,避免约定注册未暴露 ILabelPdfRenderer 导致激活失败
|
||
context.Services.AddTransient<HiprintTemplateParser>();
|
||
context.Services.AddTransient<ILabelPdfRenderer, QuestPdfLabelRenderer>();
|
||
context.Services.AddTransient<LabelPdfGenerationService>();
|
||
|
||
context.Services.AddHttpClient(FileStorageService.UrlFetchClientName, client =>
|
||
{
|
||
client.Timeout = TimeSpan.FromSeconds(60);
|
||
});
|
||
|
||
context.Services.AddOmsSmallBagTrack(configuration);
|
||
context.Services.AddOmsItfxIntegration(configuration);
|
||
context.Services.AddOmsPlatformShopIntegration(configuration);
|
||
context.Services.AddOmsOrderBatchMessaging(configuration);
|
||
context.Services.AddAiLlmClient();
|
||
context.Services.AddHostedService<XhsScheduledPublishWorker>();
|
||
context.Services.AddHostedService<MarketingBackgroundWorker>();
|
||
}
|
||
}
|