Compare commits
3 Commits
20250806-1
...
20250806-1
| Author | SHA1 | Date | |
|---|---|---|---|
| 5cc59bb505 | |||
| a3a079edd4 | |||
| 26f58eee32 |
@@ -87,11 +87,17 @@ class ChefService extends BaseService
|
||||
|
||||
$skuIds = array_column($list['data'], 'sku_id');
|
||||
$chefIds = array_column($list['data'], 'chef_id');
|
||||
$skuList = $this->skuModel->whereIn('id', $skuIds)->pluck('title', 'id')->toArray();
|
||||
$skuList = $this->skuModel->whereIn('id', $skuIds)->select('price','title','id')->get();
|
||||
if ($skuList->isNotEmpty()) {
|
||||
$skuList = array_column($skuList->toArray(), null,'id');
|
||||
}
|
||||
|
||||
$chefList = $this->adminUserModel->getChefNameByIds($chefIds);
|
||||
foreach ($list['data'] as &$v) {
|
||||
$v['sku_title'] = $skuList[$v['sku_id']] ?? '';
|
||||
$v['chef_name'] = $chefList[$v['chef_id']] ?? '';
|
||||
$v['sku_title'] = $skuList[$v['sku_id']]['title'] ?? '';
|
||||
$v['sku_price'] = $skuList[$v['sku_id']]['price'] ?? '0.00';
|
||||
$v['total_price'] = bcmul($skuList[$v['sku_id']]['price'],(string)$v['sale'],2);
|
||||
$v['chef_name'] = $chefList[$v['chef_id']]['chinese_name'] ?? '';
|
||||
}
|
||||
|
||||
return $this->return->success('success', ['list' => $list]);
|
||||
|
||||
Reference in New Issue
Block a user