Platform upgrade: login auth fix, OCR/OSS upload, system menus and dicts, weather dashboard, weighing and invoice modules

This commit is contained in:
2026-08-14 01:12:33 +08:00
parent c377421a3e
commit 8099ebae0a
75 changed files with 5611 additions and 473 deletions
+10 -2
View File
@@ -81,8 +81,15 @@ builder.Services.AddSingleton<IFileStorage>(sp =>
? sp.GetRequiredService<OssFileStorage>()
: sp.GetRequiredService<LocalFileStorage>());
// ---------- OCR 识别(默认占位,接入阿里云/百度 OCR 时替换实现 ----------
builder.Services.AddSingleton<IOcrService, DisabledOcrService>();
// ---------- OCR 识别(阿里云市场身份证识别:Ocr:Provider=aliyun 时启用,否则占位提示 ----------
builder.Services.AddHttpClient("ocr", c => c.Timeout = TimeSpan.FromSeconds(30));
builder.Services.AddSingleton<IOcrService>(sp =>
{
var cfg = sp.GetRequiredService<IConfiguration>();
return string.Equals(cfg["Ocr:Provider"], "aliyun", StringComparison.OrdinalIgnoreCase)
? new AliyunOcrService(cfg, sp.GetRequiredService<IHttpClientFactory>(), sp.GetRequiredService<IFileStorage>())
: new DisabledOcrService(cfg);
});
// ---------- 手机传图上传会话 ----------
builder.Services.AddSingleton<MobileUploadSessionStore>();
@@ -107,6 +114,7 @@ try
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
db.Database.EnsureCreated();
await SchemaMigrator.EnsureColumnsAsync(db);
await SchemaMigrator.EnsureSystemTablesAsync(db);
await SchemaMigrator.EnsureRegionsTableAsync(db);
DbSeeder.Seed(db);
app.Logger.LogInformation("数据库初始化完成");