feat: 采集失败KOC补交截图闭环 + 任务中心分发详情弹窗

公开数据补交闭环(F1):
- distributions 新增 public_metrics_screenshot_key(mysql/0022 迁移)
- KOC 门户:链接已回填但采集失败时展示补交数据截图入口(kind=public-metrics)
- 运营端:回收队列"核对补录"支持公开互动数据(赞/藏/评),按补交截图补录后采集状态置成功
- 企微催办:采集失败纳入待办(公开数据待补交)
- task-result-image 支持 kind=publish 输出发布截图

门户文案(F2):
- 自动采集数据明确"由系统每天自动采集,无需你填写",仅识别失败时才手动填写曝光/阅读

任务中心分发详情:
- 任务中心/数据回收的分发表行可点击,弹窗查看详情
- 详情按任务类型适配:发布阶段/数据回收(自动采集)/创作者数据(第7天)/截图回收四区块三段式布局
This commit is contained in:
ABAPPLO
2026-10-09 17:02:46 +08:00
parent c686003cfb
commit c11afd5f99
15 changed files with 1250 additions and 67 deletions

View File

@@ -656,19 +656,62 @@ export async function POST(request: Request) {
const forbidden = await distributionOwnerGate(body.distributionId);
if (forbidden) return forbidden;
const distributionId = String(body.distributionId ?? "");
const exposure = Math.max(0, numberValue(body.exposure));
const views = Math.max(0, numberValue(body.views));
const hasCreatorMetrics =
body.exposure !== undefined &&
body.exposure !== null &&
body.views !== undefined &&
body.views !== null;
const exposure = hasCreatorMetrics
? Math.max(0, numberValue(body.exposure))
: null;
const views = hasCreatorMetrics ? Math.max(0, numberValue(body.views)) : null;
// 采集失败兜底:运营按 KOC 补交的数据截图核对补录公开互动数据
const hasPublicMetrics =
body.publicLikes !== undefined ||
body.publicCollects !== undefined ||
body.publicComments !== undefined;
const publicLikes = Math.max(0, numberValue(body.publicLikes));
const publicCollects = Math.max(0, numberValue(body.publicCollects));
const publicComments = Math.max(0, numberValue(body.publicComments));
await db
.prepare(
`UPDATE distributions SET
exposure = ?,
views = ?,
ocr_status = 'manual',
exposure = CASE WHEN ? THEN ? ELSE exposure END,
views = CASE WHEN ? THEN ? ELSE views END,
ocr_status = CASE WHEN ? THEN 'manual' ELSE ocr_status END,
status = CASE WHEN exposure IS NOT NULL AND views IS NOT NULL THEN 'complete' ELSE status END,
latest_likes = CASE WHEN ? THEN ? ELSE latest_likes END,
latest_collects = CASE WHEN ? THEN ? ELSE latest_collects END,
latest_comments = CASE WHEN ? THEN ? ELSE latest_comments END,
collection_status = CASE WHEN ? THEN 'success' ELSE collection_status END,
collection_status_description = CASE
WHEN ? THEN '运营已按补交截图核对补录'
ELSE collection_status_description
END,
collection_updated_at = CASE
WHEN ? THEN CURRENT_TIMESTAMP
ELSE collection_updated_at
END,
updated_at = CURRENT_TIMESTAMP
WHERE id = ?`,
)
.bind(exposure, views, distributionId)
.bind(
hasCreatorMetrics ? 1 : 0,
exposure,
hasCreatorMetrics ? 1 : 0,
views,
hasCreatorMetrics ? 1 : 0,
hasPublicMetrics ? 1 : 0,
publicLikes,
hasPublicMetrics ? 1 : 0,
publicCollects,
hasPublicMetrics ? 1 : 0,
publicComments,
hasPublicMetrics ? 1 : 0,
hasPublicMetrics ? 1 : 0,
hasPublicMetrics ? 1 : 0,
distributionId,
)
.run();
const ownerTask = await db
.prepare("SELECT task_id FROM distributions WHERE id = ?")