feat : add_staple_food
This commit is contained in:
@@ -144,6 +144,7 @@ class OrderInfoService extends BaseService
|
||||
'is_add_staple_food' => GoodCode::IS_NOT_ADD_STAPLE_FOOD,
|
||||
];
|
||||
|
||||
$breakFlag = 0;
|
||||
foreach ($newOrderSkuList[$i] as $item) {
|
||||
if ($item['order_id'] != $orderInfo['id'] || $item['copies'] != $i) continue;
|
||||
|
||||
@@ -154,6 +155,7 @@ class OrderInfoService extends BaseService
|
||||
$addStapleFood['total_price'] = bcadd((string)$oneCopiesInfo['total_price'], bcmul((string)$item['unit_price'],(string)$item['quantity'],2), 2);
|
||||
$addStapleFood['total_quantity'] += $item['quantity'];
|
||||
$addStapleFood['url'] = $imageList[$imageId]['url'] ?? '';
|
||||
$breakFlag = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -173,10 +175,10 @@ class OrderInfoService extends BaseService
|
||||
$oneCopiesInfo['total_quantity'] += $item['quantity'];
|
||||
}
|
||||
|
||||
$orderCopiesList[] = $oneCopiesInfo;
|
||||
if ($breakFlag == 0) $orderCopiesList[] = $oneCopiesInfo;
|
||||
}
|
||||
|
||||
if (!empty($addStapleFood)) $orderCopiesList[] = $addStapleFood;
|
||||
if (!empty($addStapleFood) && $addStapleFood['total_quantity'] >= 0) $orderCopiesList[] = $addStapleFood;
|
||||
$orderInfo['copies_list'] = $orderCopiesList;
|
||||
$orderInfo['site'] = $this->siteCache->getSiteInfo($orderInfo['site_id']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user