业绩明细同步:订单实付命中即算订单存在,修复部分订单被误判「订单表无此单」

部分订单(退款流程 / 拆单 / 商品明细未同步)在订单侧只有订单头与实付、没有商品明细行,原匹配逻辑仅按商品明细判断订单存在性导致误判。改为实付命中同样计入订单存在性;商品金额仍只由商品明细构建(无明细时保持为空)。实跑修复 8 月 1791 行(得物 57 / 京喜 497 / 抖音 46 / 京东 153 / 拼多多 1038)。
This commit is contained in:
yueyang 2026-10-12 17:11:59 +08:00
parent 20eccf616c
commit a90736592a

View File

@ -606,6 +606,14 @@ class SyncStoreReceiptOrderMatches extends Command
$shopKey = self::normalizeShop((string) ($row['shop_name'] ?? ''));
$key = $shopKey . '|' . $core;
$orderPaid[$key] = ($orderPaid[$key] ?? 0.0) + (float) $row['paid'];
// 订单实付命中同样算「订单侧存在」:部分订单(退款流程 / 拆单 / 商品明细未同步)没有商品明细行,
// 若只按商品明细判断存在性,这些单会被误判「订单表无此单」(实付明明在)。
// 商品金额数组仍只由商品明细构建:无明细时商品金额保持为空、按口径标「订单无商品金额」。
$orderSeen[$key] = true;
$coreSeen[$core] = true;
if ($shopKey !== '') {
$coresByCore[$core][$shopKey] = true;
}
}
foreach ($orderRows as $row) {