This commit is contained in:
shengchanzhe 2023-12-23 18:20:23 +08:00
parent eedcccff1c
commit 8846b6b4a8

View File

@ -45,9 +45,13 @@ class CloudWarehouse extends BaseController
*/
public function index($street_code, $page = 1, $category_id = 0, $location = '')
{
$cloud_product = Db::name('cloud_product')
$cloud_product_arr = Db::name('cloud_product')
->where('cate_id', $category_id)
->where('street_code', $street_code)->where('status', 1)->page($page)->column('product_id');
->whereOR('street_code', $street_code)->whereOR('mer_labels', ',6,')->where('status', 1)->page($page)->field('product_id,mer_labels')->select();
$cloud_product = [];
foreach ($cloud_product_arr as $key => $value) {
$cloud_product[] = $value['product_id'];
}
$where = [
'is_show' => 1,
'is_used' => 1,
@ -60,11 +64,22 @@ class CloudWarehouse extends BaseController
if (!$cloud_product && $category_id == 0) {
return app('json')->success(['count' => 0, 'list' => []]);
}
$count = Db::name('cloud_product')->where('street_code', $street_code)->where('status', 1)->count();
$count = Db::name('cloud_product')->whereOR('street_code', $street_code)->whereOR('mer_labels', ',6,')->where('status', 1)->count();
$products = $this->spuRepository->getApiSearch($where, $page, 10, false, true);
if ($products['list']) {
$list = $products['list'];
foreach ($cloud_product_arr as $key => $value) {
foreach ($list as $k => $v) {
if ($value['product_id'] == $v['product_id']) {
if ($value['mer_labels'] == ',6,') {
$list[$k]['mer_labels_name'] = '五日达';
} else {
$list[$k]['mer_labels_name'] = '次日达';
}
}
}
}
}
return app('json')->success(['count' => $count, 'list' => $list]);
}