cache->refresh( $scope, $parameters, fn () => $this->resolve($scope, $parameters) ); } private function resolve(string $scope, array $parameters): mixed { $filters = (array) ($parameters['filters'] ?? []); $page = max((int) ($parameters['page'] ?? 1), 1); $maxLimit = ! empty($parameters['export']) ? 5000 : 100; $limit = min(max((int) ($parameters['limit'] ?? 25), 1), $maxLimit); $storeName = isset($filters['shop_name']) ? (string) $filters['shop_name'] : (isset($filters['store_name']) ? (string) $filters['store_name'] : null); $fromDate = isset($filters['from']) ? (string) $filters['from'] : null; $toDate = isset($filters['to']) ? (string) $filters['to'] : null; $flowType = isset($filters['flow_type']) ? (string) $filters['flow_type'] : null; $flowType = in_array($flowType, ['income', 'expense'], true) ? $flowType : null; $productType = isset($filters['product_type']) ? (string) $filters['product_type'] : null; $month = isset($filters['month']) ? (string) $filters['month'] : null; return match ($scope) { 'edge-banding.prices' => $this->edgeBanding->prices($filters, $page, $limit), 'edge-banding.details' => $this->edgeBanding->details($filters, $page, $limit), 'edge-banding.payables' => $this->edgeBanding->payables($filters, $page, $limit), 'goods.list' => $this->goods->list($filters, $page, $limit), 'goods.summary' => $this->goods->summary($filters), 'goods.options' => $this->goods->filterOptions(), 'inventory.board-details' => $this->inventory->boardInventoryDetails($filters, $page, $limit), 'marketing-account-bills.alibaba.list' => $this->alibaba->paginate( $storeName, $productType, $fromDate, $toDate, $page, $limit, ), 'marketing-account-bills.alibaba.summary' => $this->alibaba->summary( $storeName, $productType, $fromDate, $toDate, ), 'marketing-account-bills.alibaba.options' => $this->alibaba->filterOptions(), 'raw-board.prices' => $this->rawBoardPayables->prices($filters, $page, $limit), 'raw-board.reconciliations' => $this->rawBoardPayables->reconciliations($filters, $page, $limit), 'pinduoduo-bills.list' => ($parameters['view'] ?? null) === 'monthly-balances' ? $this->pinduoduo->paginateMonthlyBalances($storeName, $month, $page, $limit) : $this->pinduoduo->paginate( $storeName, $fromDate, $toDate, $flowType, $page, $limit ), 'pinduoduo-bills.summary' => $this->pinduoduo->summary( $storeName, $fromDate, $toDate, $flowType ), 'pinduoduo-bills.options' => $this->pinduoduo->storeOptions(), 'jd-wallet-bills.recharge.list' => $this->jdWallet->paginateRecharge( $storeName, $fromDate, $toDate, $page, $limit, ), 'jd-wallet-bills.recharge.summary' => $this->jdWallet->summaryRecharge( $storeName, $fromDate, $toDate, ), 'jd-wallet-bills.consumption.list' => $this->jdWallet->paginateConsumption( $storeName, $fromDate, $toDate, $page, $limit, ), 'jd-wallet-bills.consumption.summary' => $this->jdWallet->summaryConsumption( $storeName, $fromDate, $toDate, ), 'jd-wallet-bills.options' => $this->jdWallet->shopOptions(), 'taobao-alipay-bills.list' => ($parameters['view'] ?? null) === 'monthly-balances' ? $this->taobaoAlipay->paginateMonthlyBalances($storeName, $month, $page, $limit) : $this->taobaoAlipay->paginate( $storeName, $fromDate, $toDate, $flowType, $page, $limit ), 'taobao-alipay-bills.summary' => $this->taobaoAlipay->summary( $storeName, $fromDate, $toDate, $flowType ), 'taobao-alipay-bills.options' => $this->taobaoAlipay->storeOptions(), 'supplier-payables.board-deductions.list' => $this->supplierPayableReports->boardDeductions( $filters, $page, $limit, ), 'supplier-payables.report.list' => $this->supplierPayableReports->supplierPayables( $filters, $page, $limit, ), 'return-reconciliations.list' => $this->supplier->returnReconciliations($filters, $page, $limit), 'return-reconciliations.summary' => $this->supplier->returnReconciliationSummary($filters), 'return-reconciliations.options' => $this->supplier->filterOptionsForReturn(), 'invoice-deductions.list' => $this->supplier->invoiceDeductions($filters, $page, $limit), 'invoice-deductions.summary' => $this->supplier->invoiceDeductionSummary($filters), 'invoice-deductions.options' => $this->supplier->filterOptionsForInvoice(), 'compensation-details.list' => $this->supplier->compensationDetails($filters, $page, $limit), 'compensation-details.summary' => $this->supplier->compensationDetailSummary($filters), 'compensation-details.options' => $this->supplier->filterOptionsForCompensation(), 'advance-details.list' => $this->supplier->advanceDetails($filters, $page, $limit), 'advance-details.summary' => $this->supplier->advanceDetailSummary($filters), 'advance-details.options' => $this->supplier->filterOptionsForAdvance(), 'delivery-unpriced.list' => $this->supplier->deliveryUnpriced($filters, $page, $limit), 'delivery-unpriced.summary' => $this->supplier->deliveryUnpricedSummary($filters), 'delivery-unpriced.options' => $this->supplier->filterOptionsForDeliveryUnpriced(), 'return-unpriced.list' => $this->supplier->returnUnpriced($filters, $page, $limit), 'return-unpriced.summary' => $this->supplier->returnUnpricedSummary($filters), 'return-unpriced.options' => $this->supplier->filterOptionsForReturnUnpriced(), 'sample-deductions.list' => $this->supplier->sampleDeductions($filters, $page, $limit), 'sample-deductions.summary' => $this->supplier->sampleDeductionSummary($filters), 'sample-deductions.options' => $this->supplier->filterOptionsForSample(), 'other-adjustments.list' => $this->supplier->otherAdjustments($filters, $page, $limit), 'other-adjustments.summary' => $this->supplier->otherAdjustmentsSummary($filters), 'other-adjustments.options' => $this->supplier->filterOptionsForOtherAdjustments(), 'dropshipping-express.list' => $this->supplier->dropshippingExpress($filters, $page, $limit), 'dropshipping-express.summary' => $this->supplier->dropshippingExpressSummary($filters), 'dropshipping-express.options' => $this->supplier->filterOptionsForDropshippingExpress(), default => throw new InvalidArgumentException('未知的上游快照类型:' . $scope), }; } }