|
@@ -14,7 +14,7 @@ const CLICKHOUSE_EVENTS_TABLE = "events";
|
|
|
// =========================================================================
|
|
// =========================================================================
|
|
|
// !!! 必须修改这里以设置回填的起始日期 (YYYY-MM-DD 格式) !!!
|
|
// !!! 必须修改这里以设置回填的起始日期 (YYYY-MM-DD 格式) !!!
|
|
|
// 示例: 如果您的 tipCount 追踪是从 2024 年 1 月 1 日开始的,则设置为 "2024-01-01"
|
|
// 示例: 如果您的 tipCount 追踪是从 2024 年 1 月 1 日开始的,则设置为 "2024-01-01"
|
|
|
-const BACKFILL_START_DATE = "2025-01-03";
|
|
|
|
|
|
|
+const BACKFILL_START_DATE = "2025-10-08";
|
|
|
/**
|
|
/**
|
|
|
* 遍历指定日期范围,从 ClickHouse 提取 tipCount 并回填到 DoneRate 记录中。
|
|
* 遍历指定日期范围,从 ClickHouse 提取 tipCount 并回填到 DoneRate 记录中。
|
|
|
* @returns Promise<string> - 返回回填结果的摘要信息。
|
|
* @returns Promise<string> - 返回回填结果的摘要信息。
|
|
@@ -58,7 +58,7 @@ async function runBackfill() {
|
|
|
// 如果当天没有 tip 事件,但可能存在 DoneRate 记录,我们仍然需要更新它们 (如果它们是 null 或 undefined)
|
|
// 如果当天没有 tip 事件,但可能存在 DoneRate 记录,我们仍然需要更新它们 (如果它们是 null 或 undefined)
|
|
|
// 但由于 DoneRateModel 默认 tipCount: 0,所以我们只需要处理有 tip 事件的记录。
|
|
// 但由于 DoneRateModel 默认 tipCount: 0,所以我们只需要处理有 tip 事件的记录。
|
|
|
console.log(`[TipCount Backfill] No 'color_tip' events found for ${currentYYYYMMDD}. Skipping MongoDB update.`);
|
|
console.log(`[TipCount Backfill] No 'color_tip' events found for ${currentYYYYMMDD}. Skipping MongoDB update.`);
|
|
|
- continue;
|
|
|
|
|
|
|
+ // continue;
|
|
|
}
|
|
}
|
|
|
// 2. 批量更新 MongoDB 中的 DoneRate 记录
|
|
// 2. 批量更新 MongoDB 中的 DoneRate 记录
|
|
|
const bulkOps = tipResults
|
|
const bulkOps = tipResults
|