修复查询异常

This commit is contained in:
yaooo 2023-09-28 10:55:17 +08:00
parent 20b4a49638
commit 094fa73cb7
3 changed files with 4 additions and 4 deletions

View File

@ -56,13 +56,13 @@ class SpuDao extends BaseDao
$query->where('P.product_id','in',$where['product_id']);
})
->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){
$query->whereIn('P.mer_id',$where['mer_array_id']);
})
->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']);
})
->when(isset($where['keyword']) && $where['keyword'] !== '',function($query)use($where){
$query->whereLike("S.store_name|S.keyword|S.product_id", "%{$where['keyword']}%");

View File

@ -1023,6 +1023,7 @@ class ProductRepository extends BaseRepository
public function getApiSearch($merId, array $where, int $page, int $limit, $userInfo)
{
$where = array_merge($where, $this->dao->productShow());
halt($where);
//搜索记录
if (isset($where['keyword']) && !empty($where['keyword']))
app()->make(UserVisitRepository::class)->searchProduct(

View File

@ -144,7 +144,7 @@ class SpuRepository extends BaseRepository
}
$where = array_merge(Product::searchEnable(), $where);
$query = $this->dao->search($where);
$query->with([
'merchant' => function ($query) {
$query->field($this->merchantFiled)->with(['type_name']);
@ -154,7 +154,6 @@ class SpuRepository extends BaseRepository
]);
$productMake = app()->make(ProductRepository::class);
$count = $query->count();
$list = $query->page($page, $limit)->setOption('field', [])->field($this->productFiled)->select();
$append = ['stop_time','svip_price','show_svip_info','is_svip_price'];
if ($productMake->getUserIsPromoter($userInfo))