feat : order list

This commit is contained in:
2025-04-07 10:03:14 +08:00
parent 09ff94cae5
commit 6925fe7b23
5 changed files with 31 additions and 15 deletions

View File

@@ -97,9 +97,9 @@ class ChefService
$orderGoods = $orderGoods->toArray();
$skuIds = array_unique(array_column($orderGoods, 'sku_id'));
$skuInfo = $this->skuModel->whereIn('id',$skuIds)->pluck('spu_id','id')->toArray();
if (empty($skuInfo)) throw new Exception('skuInfoError:dataNull');
$spuInfo = $this->spuModel->whereIn('id',array_unique(array_values($skuInfo)))->pluck('chef_id','id')->toArray();
$chefList = $this->skuModel->whereIn('id',$skuIds)->pluck('chef_id','id')->toArray();
if (empty($chefList)) throw new Exception('chefInfoError:dataNull');
$currentDate = date('Y-m-d H:i:s');
@@ -108,7 +108,7 @@ class ChefService
if (empty($insertData[$orderGood['sku_id']])) {
$insertData[$orderGood['sku_id']] = [
'date' => $cycle->dates,
'chef_id' => $spuInfo[$skuInfo[$orderGood['sku_id']]]['chef_id'] ?? 0,
'chef_id' => $chefList[$orderGood['sku_id']] ?? 0,
'sku_id' => $orderGood['sku_id'],
'cycle_id' => $this->cycleId,
'kitchen_id' => $this->kitchenId,