Compare commits
5 Commits
20250806-1
...
20250806-1
| Author | SHA1 | Date | |
|---|---|---|---|
| a3a079edd4 | |||
| 26f58eee32 | |||
| 00aa36c574 | |||
| ff1ab9a008 | |||
| cf4a2d9436 |
@@ -210,7 +210,7 @@ class GoodCache
|
|||||||
|
|
||||||
foreach ($list as &$item) {
|
foreach ($list as &$item) {
|
||||||
$item['sku_list'] = $skuListArr[$item['id']] ?? [];
|
$item['sku_list'] = $skuListArr[$item['id']] ?? [];
|
||||||
$item['spu_image_url'] = $imageList[$item['image_id']] ?? '';
|
$item['spu_image_url']['url'] = $imageList[$item['image_id']]['url'] ?? '';
|
||||||
$item['image_list'] = $imageArr[$item['id']] ?? [];
|
$item['image_list'] = $imageArr[$item['id']] ?? [];
|
||||||
$item['price'] = !empty($price[$item['id']]) ? (min($price[$item['id']]) ?? 0) : 0;
|
$item['price'] = !empty($price[$item['id']]) ? (min($price[$item['id']]) ?? 0) : 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,10 +87,16 @@ class ChefService extends BaseService
|
|||||||
|
|
||||||
$skuIds = array_column($list['data'], 'sku_id');
|
$skuIds = array_column($list['data'], 'sku_id');
|
||||||
$chefIds = array_column($list['data'], 'chef_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();
|
||||||
$chefList = $this->adminUserModel->whereIn('id',$chefIds)->pluck('chinese_name','id')->toArray();
|
if ($skuList->isNotEmpty()) {
|
||||||
|
$skuList = array_column($skuList->toArray(), null,'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
$chefList = $this->adminUserModel->getChefNameByIds($chefIds);
|
||||||
foreach ($list['data'] as &$v) {
|
foreach ($list['data'] as &$v) {
|
||||||
$v['sku_title'] = $skuList[$v['sku_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']] ?? '';
|
$v['chef_name'] = $chefList[$v['chef_id']] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,9 +114,11 @@ class OptionalListService extends BaseService
|
|||||||
$favorable = [];
|
$favorable = [];
|
||||||
$skuList = [];
|
$skuList = [];
|
||||||
foreach ($data as &$item) {
|
foreach ($data as &$item) {
|
||||||
foreach ($item['sku_list'] as &$v) {
|
if (!empty($item['sku_list'])) {
|
||||||
$v['surplus_stock'] = $this->redisCache->zScore($stockKey,$v['id']) ?? 0;
|
foreach ($item['sku_list'] as &$v) {
|
||||||
$v['category_id'] = $item['category_id'];
|
$v['surplus_stock'] = $this->redisCache->zScore($stockKey,$v['id']) ?? 0;
|
||||||
|
$v['category_id'] = $item['category_id'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item['favorable'] == GoodCode::IS_FAVORABLE) {
|
if ($item['favorable'] == GoodCode::IS_FAVORABLE) {
|
||||||
@@ -136,10 +138,10 @@ class OptionalListService extends BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$res[$item['category_id']]['spu_list'][] = $item;
|
$res[$item['category_id']]['spu_list'][] = $item;
|
||||||
$skuList = array_merge($skuList, $item['sku_list']);
|
$skuList = array_merge($skuList, $item['sku_list'] ?? []);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($skuList)) throw new ErrException('数据错误');
|
if (empty($skuList)) return array_values($res);
|
||||||
$skuList = array_column($skuList,null,'id');
|
$skuList = array_column($skuList,null,'id');
|
||||||
|
|
||||||
if (!empty($purchaseData)) {
|
if (!empty($purchaseData)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user