数据引擎-快手平台数据抽取bug修复

This commit is contained in:
2026-06-16 10:44:10 +08:00
parent e5133eea34
commit b4fc6f54af
22 changed files with 1324 additions and 487 deletions

View File

@@ -27,13 +27,16 @@ func StartAutoSync(ctx context.Context) {
func runAutoSync(ctx context.Context) {
logrus.Info("=== 开始自动同步 ===")
// 从配置读取同步租户 ID运维部署时配置
tenantId := g.Cfg().MustGet(ctx, "sync.default_tenant_id", 1).Uint64()
// 注入用户上下文ORM 框架需要用于租户隔离)
ctx = context.WithValue(ctx, "user", &beans.User{UserName: "admin", TenantId: 1})
ctx = context.WithValue(ctx, "user", &beans.User{UserName: "admin", TenantId: tenantId})
// 查询所有 ACTIVE 平台
platforms, _, err := dao.DatasourcePlatform.List(ctx, &dto.ListDatasourcePlatformReq{
Status: "ACTIVE",
})
}, tenantId)
if err != nil {
logrus.Errorf("查询平台列表失败: %v", err)
return
@@ -42,9 +45,9 @@ func runAutoSync(ctx context.Context) {
for _, p := range platforms {
// 查询该平台下有 table_definition 的接口
interfaces, _, err := dao.ApiInterface.List(ctx, &dto.ListApiInterfaceReq{
PlatformId: p.ID,
PlatformId: p.Id,
Status: "active",
})
}, tenantId)
if err != nil {
logrus.Errorf("查询接口列表失败 [platform=%s]: %v", p.PlatformCode, err)
continue