更新订单查询

This commit is contained in:
yaooo 2023-09-27 20:12:53 +08:00
parent 1efbe4f84b
commit b247f940b8
2 changed files with 10 additions and 9 deletions

View File

@ -65,15 +65,16 @@ class SpuDao extends BaseDao
$query->whereIn('P.mer_id',$where['mer_ids']); $query->whereIn('P.mer_id',$where['mer_ids']);
}) })
->when(isset($where['keyword']) && $where['keyword'] !== '',function($query)use($where){ ->when(isset($where['keyword']) && $where['keyword'] !== '',function($query)use($where){
if (is_numeric($where['keyword'])) {
$query->whereLike("S.store_name|S.keyword|S.product_id", "%{$where['keyword']}%"); $query->whereLike("S.store_name|S.keyword|S.product_id", "%{$where['keyword']}%");
if (is_numeric($where['keyword'])) {
// $query->whereLike("S.store_name|S.keyword|S.product_id", "%{$where['keyword']}%");
} else { } else {
$word = app()->make(VicWordService::class)->getWord($where['keyword']); // $word = app()->make(VicWordService::class)->getWord($where['keyword']);
$query->where(function ($query) use ($word) { // $query->where(function ($query) use ($word) {
foreach ($word as $item) { // foreach ($word as $item) {
$query->whereOr('S.store_name|S.keyword', 'LIKE', "%$item%"); // $query->whereOr('S.store_name|S.keyword', 'LIKE', "%$item%");
} // }
}); // });
} }
}) })
->when(isset($where['is_trader']) && $where['is_trader'] !== '',function($query)use($where){ ->when(isset($where['is_trader']) && $where['is_trader'] !== '',function($query)use($where){

View File

@ -42,7 +42,7 @@ class StoreSpu extends BaseController
public function lst() public function lst()
{ {
[$page, $limit] = $this->getPage(); [$page, $limit] = $this->getPage();
$typeStoreId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeStore'])->value('mer_type_id'); $typeTownSupplyChainId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeTownSupplyChain'])->value('mer_type_id');
$where = $this->request->params([ $where = $this->request->params([
'keyword', 'keyword',
'cate_id', 'cate_id',
@ -63,7 +63,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['mer_ids'] = Merchant::getInstance()->where('type_id', $typeTownSupplyChainId)
->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);