更新查询

This commit is contained in:
yaooo 2023-09-28 13:04:14 +08:00
parent 24200a926d
commit 2209bac2f0

View File

@ -64,7 +64,7 @@ class StoreSpu extends BaseController
$where['is_gift_bag'] = 0; $where['is_gift_bag'] = 0;
$where['product_type'] = 0; $where['product_type'] = 0;
$where['order'] = $where['order'] ?: 'star'; $where['order'] = $where['order'] ?: 'star';
$where['mer_ids'] = Merchant::getInstance()->whereNotIn('type_id', $implode(',', $typeIdArray ?? []))->where(['status' => 1, 'mer_state' => 1, 'is_del' => 0])->column('mer_id'); $where['mer_ids'] = Merchant::getInstance()->whereIn('type_id', implode(',', $typeIdArray ?? []))->where(['status' => 1, 'mer_state' => 1, 'is_del' => 0])->column('mer_id');
if ($where['is_trader'] != 1) unset($where['is_trader']); if ($where['is_trader'] != 1) unset($where['is_trader']);
$data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo); $data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo);
return app('json')->success($data); return app('json')->success($data);
@ -100,7 +100,7 @@ class StoreSpu extends BaseController
$where['is_gift_bag'] = 0; $where['is_gift_bag'] = 0;
$where['product_type'] = 0; $where['product_type'] = 0;
$where['order'] = $where['order'] ?: 'star'; $where['order'] = $where['order'] ?: 'star';
$where['mer_ids'] = Merchant::getInstance()->whereNotIn('type_id', $implode(',', $typeIdArray ?? []))->where('street_id', $id) $where['mer_ids'] = Merchant::getInstance()->whereIn('type_id', implode(',', $typeIdArray ?? []))->where('street_id', $id)
->where(['status' => 1, 'mer_state' => 1, 'is_del' => 0])->column('mer_id'); ->where(['status' => 1, 'mer_state' => 1, 'is_del' => 0])->column('mer_id');
if ($where['is_trader'] != 1) unset($where['is_trader']); if ($where['is_trader'] != 1) unset($where['is_trader']);
$data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo); $data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo);
@ -144,14 +144,14 @@ class StoreSpu extends BaseController
if ($where['action']) unset($where['product_type']); if ($where['action']) unset($where['product_type']);
$currentMerchant = Db::name('merchant')->where('mer_id',$id)->field('category_id,street_id')->find(); $currentMerchant = Db::name('merchant')->where('mer_id',$id)->field('category_id,street_id')->find();
$typeIdArray = Db::name('MerchantType')->whereNotIn('type_code', Merchant::TypeCode['TypeCloudWarehouse'] . ',' .Merchant::TypeCode['TypeSupplyChain'])->column('mer_type_id'); $typeIdArray = Db::name('MerchantType')->whereNotIn('type_code', Merchant::TypeCode['TypeCloudWarehouse'] . ',' .Merchant::TypeCode['TypeSupplyChain'])->column('mer_type_id');
$merIdArray = Db::name('merchant') $merIdArray = Db::name('merchant')
->where('street_id',$currentMerchant['street_id']) ->where('street_id',$currentMerchant['street_id'])
->where('mer_state',1) ->where('mer_state',1)
->where('status',1) ->where('status',1)
->where('category_id',$currentMerchant['category_id']) ->where('category_id',$currentMerchant['category_id'])
->whereNotIn('type_id', $implode(',', $typeIdArray ?? [])) ->whereIn('type_id', implode(',', $typeIdArray))
->column('mer_id'); ->column('mer_id');
$where['mer_array_id'] = $merIdArray; $where['mer_array_id'] = $merIdArray;
$where['mer_rand_id'] = $id; $where['mer_rand_id'] = $id;
$where['entry_mer_id'] = $id; $where['entry_mer_id'] = $id;
@ -196,7 +196,7 @@ class StoreSpu extends BaseController
} }
$where['product_type'] = 0; $where['product_type'] = 0;
$where['is_stock'] = 1; $where['is_stock'] = 1;
$where['mer_ids'] = Merchant::getInstance()->whereNotIn('type_id', $implode(',', $typeIdArray ??[])) $where['mer_ids'] = Merchant::getInstance()->whereIn('type_id', implode(',', $typeIdArray ??[]))
->where(['status' => 1, 'mer_state' => 1, 'is_del' => 0])->column('mer_id'); ->where(['status' => 1, 'mer_state' => 1, 'is_del' => 0])->column('mer_id');
$data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo); $data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo);
return app('json')->success($data); return app('json')->success($data);