feat : order info
This commit is contained in:
@@ -12,6 +12,8 @@ namespace App\Service\Api\Order;
|
||||
|
||||
use App\Cache\Redis\Api\SiteCache;
|
||||
use App\Exception\ErrException;
|
||||
use App\Model\AdminUser;
|
||||
use App\Model\Chef;
|
||||
use App\Model\Order;
|
||||
use App\Model\OrderGood;
|
||||
use App\Model\Sku;
|
||||
@@ -50,6 +52,12 @@ class OrderInfoService extends BaseService
|
||||
#[Inject]
|
||||
protected Spu $spuModel;
|
||||
|
||||
/**
|
||||
* @var AdminUser
|
||||
*/
|
||||
#[Inject]
|
||||
protected AdminUser $adminUserModel;
|
||||
|
||||
/**
|
||||
* @var SiteCache
|
||||
*/
|
||||
@@ -106,9 +114,11 @@ class OrderInfoService extends BaseService
|
||||
|
||||
$spuIds = array_unique(array_column($skuList,'spu_id'));
|
||||
$spuList = $this->spuModel->getDataArrByIds($spuIds);
|
||||
$spuList = array_column($skuList, null,'id');
|
||||
$spuList = array_column($spuList, null,'id');
|
||||
|
||||
$chefId = array_unique(array_column($spuList,'chef_id'));
|
||||
$chefList = $this->adminUserModel->getDataArrByIds($chefId);
|
||||
$chefList = array_column($chefList, null,'id');
|
||||
|
||||
$orderCopiesList = [];
|
||||
for ($i = 1; $i <= ($orderInfo['copies'] ?? 0); $i++) {
|
||||
@@ -117,7 +127,6 @@ class OrderInfoService extends BaseService
|
||||
'total_price' => '0.00',
|
||||
'total_quantity' => 0,
|
||||
'sku_list' => [],
|
||||
// 'image_list' => [],
|
||||
'take_food_code' => '', //todo 取餐码
|
||||
];
|
||||
|
||||
@@ -135,8 +144,7 @@ class OrderInfoService extends BaseService
|
||||
'unit_price' => $item['unit_price'],
|
||||
'quantity' => $item['quantity'],
|
||||
'price' => bcmul($item['unit_price'], $item['quantity'], 2),
|
||||
'chef_name' => '123',
|
||||
'spu_title' => $spuList[$skuList[$item['sku_id']]['spu_id']]['title'] ?? '',
|
||||
'chef_name' => $chefList[$spuList[$skuList[$item['sku_id']['spu_id']]['chef_id']]]['chinese_name'] ?? '',
|
||||
];
|
||||
$oneCopiesInfo['total_price'] = bcadd($oneCopiesInfo['total_price'], bcmul($item['unit_price'],(string)$item['quantity'],2), 2);
|
||||
$oneCopiesInfo['total_quantity'] += $item['quantity'];
|
||||
@@ -147,7 +155,5 @@ class OrderInfoService extends BaseService
|
||||
|
||||
$orderInfo['copies_list'] = $orderCopiesList;
|
||||
$orderInfo['site'] = $this->siteCache->getSiteInfo($orderInfo['site_id']);
|
||||
|
||||
//todo coupon
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user