更新查询
This commit is contained in:
parent
7b83e6119d
commit
24200a926d
@ -52,13 +52,13 @@ class SpuDao extends BaseDao
|
|||||||
$query->where('P.is_del',$where['is_del']);
|
$query->where('P.is_del',$where['is_del']);
|
||||||
})
|
})
|
||||||
->when(isset($where['product_id']) && $where['product_id'] !== '',function($query)use($where){
|
->when(isset($where['product_id']) && $where['product_id'] !== '',function($query)use($where){
|
||||||
// $query->where('P.product_id','in',$where['product_id']);
|
$query->where('P.product_id','in',$where['product_id']);
|
||||||
})
|
})
|
||||||
->when(isset($where['mer_id']) && $where['mer_id'] !== '',function($query)use($where){
|
->when(isset($where['mer_id']) && $where['mer_id'] !== '',function($query)use($where){
|
||||||
// $query->where('P.mer_id',$where['mer_id']);
|
$query->where('P.mer_id',$where['mer_id']);
|
||||||
})
|
})
|
||||||
->when(isset($where['mer_array_id']),function($query)use($where){
|
->when(isset($where['mer_array_id']),function($query)use($where){
|
||||||
// $query->whereIn('P.mer_id',$where['mer_array_id']);
|
$query->whereIn('P.mer_id',$where['mer_array_id']);
|
||||||
})
|
})
|
||||||
->when(isset($where['mer_ids']) && $where['mer_ids'] !== '',function($query)use($where){
|
->when(isset($where['mer_ids']) && $where['mer_ids'] !== '',function($query)use($where){
|
||||||
$query->whereIn('P.mer_id',$where['mer_ids']);
|
$query->whereIn('P.mer_id',$where['mer_ids']);
|
||||||
|
@ -46,11 +46,11 @@ class CloudWarehouse extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$typeTownSupplyChainId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeTownSupplyChain'])->value('mer_type_id');
|
$typeIdArray = Db::name('MerchantType')->whereNotIn('type_code', Merchant::TypeCode['TypeCloudWarehouse'] . ',' .Merchant::TypeCode['TypeSupplyChain'])->column('mer_type_id');
|
||||||
$params = $this->request->params(['category_id', 'street_code', 'order', ['product_type', 0], 'keyword']);
|
$params = $this->request->params(['category_id', 'street_code', 'order', ['product_type', 0], 'keyword']);
|
||||||
$search = [
|
$search = [
|
||||||
'street_id' => $params['street_code'],
|
'street_id' => $params['street_code'],
|
||||||
'type_id' => $typeTownSupplyChainId,
|
'type_id' => $typeIdArray ?? [],
|
||||||
'status' => 1,
|
'status' => 1,
|
||||||
'is_del' => 0,
|
'is_del' => 0,
|
||||||
'mer_state' => 1,
|
'mer_state' => 1,
|
||||||
|
@ -43,7 +43,7 @@ class StoreSpu extends BaseController
|
|||||||
{
|
{
|
||||||
[$page, $limit] = $this->getPage();
|
[$page, $limit] = $this->getPage();
|
||||||
// 除了市级供应链都可以查询
|
// 除了市级供应链都可以查询
|
||||||
$typeSupplyChainId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeSupplyChain'])->value('mer_type_id');
|
$typeIdArray = Db::name('MerchantType')->whereNotIn('type_code', Merchant::TypeCode['TypeCloudWarehouse'] . ',' .Merchant::TypeCode['TypeSupplyChain'])->column('mer_type_id');
|
||||||
$where = $this->request->params([
|
$where = $this->request->params([
|
||||||
'keyword',
|
'keyword',
|
||||||
'cate_id',
|
'cate_id',
|
||||||
@ -64,8 +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', (string)$typeSupplyChainId)
|
$where['mer_ids'] = Merchant::getInstance()->whereNotIn('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');
|
|
||||||
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);
|
||||||
@ -80,7 +79,7 @@ class StoreSpu extends BaseController
|
|||||||
public function streetLst($id)
|
public function streetLst($id)
|
||||||
{
|
{
|
||||||
[$page, $limit] = $this->getPage();
|
[$page, $limit] = $this->getPage();
|
||||||
$typeStoreId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeStore'])->value('mer_type_id');
|
$typeIdArray = Db::name('MerchantType')->whereNotIn('type_code', Merchant::TypeCode['TypeCloudWarehouse'] . ',' .Merchant::TypeCode['TypeSupplyChain'])->column('mer_type_id');
|
||||||
$where = $this->request->params([
|
$where = $this->request->params([
|
||||||
'keyword',
|
'keyword',
|
||||||
'cate_id',
|
'cate_id',
|
||||||
@ -101,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()->where('type_id', $typeStoreId)->where('street_id', $id)
|
$where['mer_ids'] = Merchant::getInstance()->whereNotIn('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);
|
||||||
@ -109,7 +108,7 @@ class StoreSpu extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO 商户的商品搜索列表
|
* TODO 商户的商品搜索列表 new
|
||||||
* @param $id
|
* @param $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @author Qinii
|
* @author Qinii
|
||||||
@ -144,13 +143,13 @@ 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();
|
||||||
$typeSupplyChainId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeSupplyChain'])->value('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', (string)$typeSupplyChainId)
|
->whereNotIn('type_id', $implode(',', $typeIdArray ?? []))
|
||||||
->column('mer_id');
|
->column('mer_id');
|
||||||
|
|
||||||
$where['mer_array_id'] = $merIdArray;
|
$where['mer_array_id'] = $merIdArray;
|
||||||
@ -171,7 +170,7 @@ class StoreSpu extends BaseController
|
|||||||
{
|
{
|
||||||
[$page, $limit] = $this->getPage();
|
[$page, $limit] = $this->getPage();
|
||||||
$where = $this->request->params(['common','mer_id']);
|
$where = $this->request->params(['common','mer_id']);
|
||||||
$typeSupplyChainId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeSupplyChain'])->value('mer_type_id');
|
$typeIdArray = Db::name('MerchantType')->whereNotIn('type_code', Merchant::TypeCode['TypeCloudWarehouse'] . ',' .Merchant::TypeCode['TypeSupplyChain'])->column('mer_type_id');
|
||||||
$where['is_gift_bag'] = 0;
|
$where['is_gift_bag'] = 0;
|
||||||
//1:星级
|
//1:星级
|
||||||
//2:用户收藏
|
//2:用户收藏
|
||||||
@ -197,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', (string)$typeSupplyChainId)
|
$where['mer_ids'] = Merchant::getInstance()->whereNotIn('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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user