Files
tiku-backend.net/docs/migration/phase-5-backoffice-worker-operations.md

48 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 第五阶段:后台能力与 Worker 基座
状态:已完成第一轮底座实现。
## 目标
- 参考 yudao 后台能力,重建权限、菜单、审计、交易运营和 Worker 基座。
- 微信生态统一使用 `Senparc.Weixin.*`
- 业务层继续只依赖 Application 接口,不直接引用第三方 SDK。
## 结果
- 微信支付切换到 `Senparc.Weixin.TenPayV3`
- 生产代码禁止 `SKIT.FlurlHttpClient.Wechat.*`
- 新增平台/租户后台权限、菜单、角色和用户角色绑定模型。
- 菜单只控制 UI 展示,不作为 API 鉴权依据。
- 角色、权限、菜单和用户角色绑定写操作落 `AuditLog`
- 租户交易运营补齐退款、对账批次、对账 issue 和事件记录。
- 新增 `BackgroundJob` 统一任务模型。
- Worker 基于 `Microsoft.Extensions.Hosting` + `BackgroundService`
- 任务处理器骨架覆盖 `content_export``content_import``asset_security_scan``statistics_aggregation``commerce_reconciliation``tenant_domain_recheck`
- PostgreSQL tenant guard 统一放入集中 SQL helper由 migration 调用。
## 固定 SDK
- OSS`AlibabaCloud.OSS.V2`
- 阿里云短信:`AlibabaCloud.SDK.Dysmsapi20170525`
- 支付宝:`AlipaySDKNet.Standard`
- 微信公众号:`Senparc.Weixin.MP`
- 微信小程序:`Senparc.Weixin.WxOpen`
- 微信支付 V3`Senparc.Weixin.TenPayV3`
## 验收
- platform token / tenant token 后台权限不能串用。
- 高风险写操作都有审计。
- 租户 A 不能查询或处理租户 B 交易数据。
- Worker 必须通过 `ITenantExecutionScope` 初始化租户或 System Scope。
- 架构扫描禁止 Supabase、SKIT 微信支付、业务层第三方 SDK、`IgnoreQueryFilters``FromSql``ExecuteSql`、直接 `NpgsqlCommand`
```bash
dotnet build TIKU-BACKEND.slnx --no-restore
dotnet test Tiku.UnitTests/Tiku.UnitTests.csproj --no-build
dotnet test Tiku.IntegrationTests/Tiku.IntegrationTests.csproj --no-build
dotnet ef migrations script --project Tiku.Infrastructure --startup-project Tiku.DbMigrator
git diff --check
```