fix : order pick code box num
This commit is contained in:
@@ -11,8 +11,10 @@ declare(strict_types=1);
|
||||
namespace App\Service\Api\Order;
|
||||
|
||||
use App\Cache\Redis\Api\SiteCache;
|
||||
use App\Cache\Redis\Common\ConfigCache;
|
||||
use App\Constants\Common\GoodCode;
|
||||
use App\Constants\Common\OrderCode;
|
||||
use App\Constants\ConfigCode;
|
||||
use App\Exception\ErrException;
|
||||
use App\Model\AdminUser;
|
||||
use App\Model\Chef;
|
||||
@@ -69,6 +71,12 @@ class OrderInfoService extends BaseService
|
||||
#[Inject]
|
||||
protected SiteCache $siteCache;
|
||||
|
||||
/**
|
||||
* @var ConfigCache
|
||||
*/
|
||||
#[Inject]
|
||||
protected ConfigCache $configCache;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
@@ -147,11 +155,20 @@ class OrderInfoService extends BaseService
|
||||
}
|
||||
|
||||
for ($i = 1; $i <= (count($newOrderSkuList) ?? 0); $i++) {
|
||||
|
||||
$pickupCodeOneCopies = $pickupCodeArrList[$order['id']][$i]['pickup_code'] ?? null;
|
||||
$boxNum = 0;
|
||||
if (!empty($pickupCodeOneCopies)) {
|
||||
$pickupCodeOneCopiesArr = explode('-', $pickupCodeOneCopies);
|
||||
$boxNum = ceil(end($pickupCodeOneCopiesArr) ?? '0' / (int)$this->configCache->getConfigValueByKey(ConfigCode::MAXIMUM_VALUE_IN_FULL_BOX));
|
||||
}
|
||||
|
||||
$oneCopiesInfo = [
|
||||
'total_price' => '0.00',
|
||||
'total_quantity' => 0,
|
||||
'sku_list' => [],
|
||||
'pickup_code' => $pickupCodeList[$i] ?? '', //取餐码
|
||||
'pickup_code' => $pickupCodeOneCopies ?? '', // 取餐码
|
||||
'box_num' => $boxNum,
|
||||
'is_add_staple_food' => GoodCode::IS_NOT_ADD_STAPLE_FOOD,
|
||||
];
|
||||
|
||||
|
||||
@@ -11,8 +11,10 @@ declare(strict_types=1);
|
||||
namespace App\Service\Api\Order;
|
||||
|
||||
use App\Cache\Redis\Api\SiteCache;
|
||||
use App\Cache\Redis\Common\ConfigCache;
|
||||
use App\Constants\Common\GoodCode;
|
||||
use App\Constants\Common\OrderCode;
|
||||
use App\Constants\ConfigCode;
|
||||
use App\Model\Order;
|
||||
use App\Model\OrderGood;
|
||||
use App\Model\PickupCode;
|
||||
@@ -61,6 +63,12 @@ class OrderListService extends BaseService
|
||||
#[Inject]
|
||||
protected SiteCache $siteCache;
|
||||
|
||||
/**
|
||||
* @var ConfigCache
|
||||
*/
|
||||
#[Inject]
|
||||
protected ConfigCache $configCache;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
@@ -164,6 +172,7 @@ class OrderListService extends BaseService
|
||||
'total_price' => '0.00',
|
||||
'total_quantity' => 0,
|
||||
'pickup_code' => '', //这个没有取餐码
|
||||
'box_num' => 0,
|
||||
'image_list' => [],
|
||||
'is_add_staple_food' => GoodCode::IS_ADD_STAPLE_FOOD,
|
||||
];
|
||||
@@ -171,11 +180,18 @@ class OrderListService extends BaseService
|
||||
|
||||
for ($i = 1; $i <= (count($newOrderSkuList[$order['id']]) ?? 0); $i++) {
|
||||
$breakFlag = 0;
|
||||
$pickupCodeOneCopies = $pickupCodeArrList[$order['id']][$i]['pickup_code'] ?? null;
|
||||
$boxNum = 0;
|
||||
if (!empty($pickupCodeOneCopies)) {
|
||||
$pickupCodeOneCopiesArr = explode('-', $pickupCodeOneCopies);
|
||||
$boxNum = ceil(end($pickupCodeOneCopiesArr) ?? '0' / (int)$this->configCache->getConfigValueByKey(ConfigCode::MAXIMUM_VALUE_IN_FULL_BOX));
|
||||
}
|
||||
$oneCopiesInfo = [
|
||||
'total_price' => '0.00',
|
||||
'total_quantity' => 0,
|
||||
'image_list' => [],
|
||||
'pickup_code' => $pickupCodeArrList[$order['id']][$i]['pickup_code'] ?? '', // 取餐码
|
||||
'pickup_code' => $pickupCodeOneCopies ?? '', // 取餐码
|
||||
'box_num' => $boxNum,
|
||||
'is_add_staple_food' => GoodCode::IS_NOT_ADD_STAPLE_FOOD,
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user