2], null, '*', null, true); if (!empty($list)) { foreach ($list as $shop) { $shopId = $shop->id ?? 0; $mainId = $shop->mainId ?? 0; $shopName = $shop->shopName ?? ''; $customList = CustomClass::getAllByCondition(['ownMainId' => $mainId], null, '*', null, true); $customDebt = 0; if (!empty($customList)) { foreach ($customList as $custom) { $debtAmount = $custom->debtAmount ?? 0; $customDebt = bcadd($customDebt, $debtAmount, 2); } } $orderDebt = 0; $orderList = OrderClass::getAllByCondition(['shopId' => $shopId], null, '*', null, true); if (!empty($orderList)) { foreach ($orderList as $order) { $remainDebtPrice = $order->remainDebtPrice ?? 0; $orderDebt = bcadd($remainDebtPrice, $orderDebt, 2); } } if (floatval($customDebt) != floatval($orderDebt)) { echo "门店:{$shopName} 订单和客户欠款不一致 \n"; } //$lsShopId = $shop->lsShopId ?? 0; } } } }