diff --git a/app/Service/Api/Order/OrderInfoService.php b/app/Service/Api/Order/OrderInfoService.php index 066624e..4c47da4 100644 --- a/app/Service/Api/Order/OrderInfoService.php +++ b/app/Service/Api/Order/OrderInfoService.php @@ -101,10 +101,8 @@ class OrderInfoService extends BaseService unset($orderSkuList); $skuList = $this->skuModel->getDataArrByIds($skuIds); - $imageIdArr = array_column($skuList,'image_ids'); $skuList = array_column($skuList, null,'id'); - $imageIds = array_unique(explode(',',implode(',',$imageIdArr))); - $imageList = $this->getOssObjects($imageIds); + $imageList = $this->getOssObjects(array_column($skuList,'image_ids')); $orderCopiesList = []; for ($i = 1; $i <= ($orderInfo['copies'] ?? 0); $i++) { @@ -113,9 +111,8 @@ class OrderInfoService extends BaseService 'total_price' => '0.00', 'total_quantity' => 0, 'sku_list' => [], - 'image_list' => [], +// 'image_list' => [], 'take_food_code' => '', //todo 取餐码 -// 'copies_type' => 0, ]; foreach ($newOrderSkuList[$i] as $item) { @@ -123,24 +120,13 @@ class OrderInfoService extends BaseService $skuInfo = $skuList[$item['sku_id']] ?? []; $imageId = !empty($skuInfo) && !empty(explode(',',$skuInfo['image_ids'])[0]) ? explode(',',$skuInfo['image_ids'])[0] : []; - $oneCopiesInfo['total_price'] = bcadd($oneCopiesInfo['total_price'], bcmul($item['unit_price'],(string)$item['quantity'],2), 2); - $oneCopiesInfo['total_quantity'] += $item['quantity']; $skuInfo['url'] = $imageList[$imageId]['url'] ?? ''; - $oneCopiesInfo['sku_list'][] = $skuInfo; $oneCopiesInfo['image_list'][] = $imageList[$imageId] ?? []; -// if ($oneCopiesInfo['copies_type'] == 0) $oneCopiesInfo['copies_type'] = $item['type']; + $oneCopiesInfo['sku_list'][] = $skuInfo; + $oneCopiesInfo['total_price'] = bcadd($oneCopiesInfo['total_price'], bcmul($item['unit_price'],(string)$item['quantity'],2), 2); + $oneCopiesInfo['total_quantity'] += $item['quantity']; } -// foreach ($newOrderSkuList as $item) { -// if ($item['order_id'] != $order['id'] || $item['copies'] != $i) continue; -// -// $skuInfo = $skuList[$item['sku_id']] ?? []; -// $imageId = !empty($skuInfo) && !empty(explode(',',$skuInfo['image_ids'])[0]) ? explode(',',$skuInfo['image_ids'])[0] : []; -// $oneCopiesInfo['total_price'] = bcadd($oneCopiesInfo['total_price'], bcmul($item['unit_price'],$item['quantity'],2), 2); -// $oneCopiesInfo['total_quantity'] += $item['quantity']; -// $oneCopiesInfo['sku_list'][] = $skuInfo; -// $oneCopiesInfo['image_list'][] = $imageList[$imageId] ?? []; -// } $orderCopiesList[] = $oneCopiesInfo; }