From 2db06063ee1bbe21248d9fb91174355875cea215 Mon Sep 17 00:00:00 2001
From: ABAPPLO <1134226402@qq.com>
Date: Thu, 8 Oct 2026 14:30:36 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E9=87=87=E9=9B=86=E5=A4=B1=E8=B4=A5?=
=?UTF-8?q?=E4=B8=8D=E9=99=8D=E7=BA=A7=E6=9C=89=E6=95=B0=E6=8D=AE=E5=88=86?=
=?UTF-8?q?=E8=A1=8C+=E4=BB=BB=E5=8A=A1=E9=A2=86=E5=8F=96=E8=AE=A1?=
=?UTF-8?q?=E6=95=B0=E5=AF=B9=E9=BD=90=E5=AE=9E=E9=99=85=E5=88=86=E5=8F=91?=
=?UTF-8?q?=E8=A1=8C=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 采集失败时按 latest_likes 分流:无数据才标 failed,已有历史数据保持
success 并注明沿用上次数据,collection_updated_at 不动;run 行照实记失败
- 种子 seedIfEmpty 末尾统一对账 claimed_quantity,杜绝演示数据口径漂移
- 新增 mysql/0021 对账迁移,修复 0020 物理合并遗留的生产计数漂移
- 运营端展示全面改读实时 dist_total(任务卡双面板/项目树/概览/进度),
project-service 查询补 dist_total 子查询
- 走查实证:卡片 7/18 vs 详情已领取 2 两处口径打架;保存采集计划补采
失败会把历史成功行改写为 failed
---
app/admin-app.tsx | 24 +++++-----
lib/collection-service.ts | 19 ++++++--
lib/mvp-db.ts | 12 +++++
lib/project-service.ts | 2 +
mysql/0021_reconcile_claimed_quantity.sql | 13 ++++++
tests/claimed-quantity.test.mjs | 53 +++++++++++++++++++++++
tests/collection-schedule.test.mjs | 22 ++++++++++
7 files changed, 131 insertions(+), 14 deletions(-)
create mode 100644 mysql/0021_reconcile_claimed_quantity.sql
create mode 100644 tests/claimed-quantity.test.mjs
diff --git a/app/admin-app.tsx b/app/admin-app.tsx
index 6b6cd87..3e19eb3 100644
--- a/app/admin-app.tsx
+++ b/app/admin-app.tsx
@@ -2927,6 +2927,7 @@ type ProjectTaskItem = {
task_chat_id: string;
recovery_enabled: number;
recovery_due_at: string;
+ dist_total: number;
recovery_submitted: number;
};
@@ -3025,7 +3026,10 @@ function ProjectSection({
}, [project.id, setToast]);
const tasksSignature = tasks
- .map((task) => `${task.id}:${task.claimed_quantity}:${task.status}`)
+ .map(
+ (task) =>
+ `${task.id}:${task.dist_total}:${task.dist_submitted}:${task.status}`,
+ )
.join("|");
useEffect(() => {
@@ -3266,11 +3270,11 @@ function ProjectSection({
- {task.claimed_quantity} / {task.quantity}
+ {task.dist_total} / {task.quantity}
|
{Number(task.recovery_enabled) === 1
- ? `已收 ${task.recovery_submitted} / ${task.claimed_quantity}`
+ ? `已收 ${task.recovery_submitted} / ${task.dist_total}`
: "—"}
|
@@ -3937,7 +3941,7 @@ function OverviewPage({
{
label: "正在分发任务",
value: stats.activeTasks,
- hint: `${tasks.reduce((sum, task) => sum + task.claimed_quantity, 0)} 篇已被领取`,
+ hint: `${tasks.reduce((sum, task) => sum + (task.dist_total ?? 0), 0)} 篇已被领取`,
tone: "green",
},
{
@@ -4006,7 +4010,7 @@ function OverviewPage({
02
- KOC领取{tasks.reduce((sum, task) => sum + task.claimed_quantity, 0)} 篇
+ KOC领取{tasks.reduce((sum, task) => sum + (task.dist_total ?? 0), 0)} 篇
@@ -4036,7 +4040,7 @@ function OverviewPage({
{tasks.map((task) => {
- const progress = Math.round((task.claimed_quantity / task.quantity) * 100);
+ const progress = Math.round(((task.dist_total ?? 0) / task.quantity) * 100);
return (
@@ -4053,7 +4057,7 @@ function OverviewPage({
- {task.claimed_quantity}/{task.quantity} 篇已领取
+ {task.dist_total ?? 0}/{task.quantity} 篇已领取
{formatDate(task.due_at)}截止
@@ -4400,7 +4404,7 @@ function TaskRowCard({
{task.quantity} 篇内容
- {panelMetric(task.claimed_quantity, task.quantity, "已领取", "publish")}
+ {panelMetric(task.dist_total ?? 0, task.quantity, "已领取", "publish")}
{panelChat(task, "任务群")}
@@ -4416,11 +4420,11 @@ function TaskRowCard({
{task.recovery_due_at && task.recovery_due_at !== task.due_at
? `截止 ${formatDate(task.recovery_due_at)}`
- : `${task.claimed_quantity} 份截图`}
+ : `${task.dist_total ?? 0} 份截图`}
- {panelMetric(task.dist_submitted ?? 0, task.claimed_quantity, "已收取", "recovery")}
+ {panelMetric(task.dist_submitted ?? 0, task.dist_total ?? 0, "已收取", "recovery")}
|