Merge pull request '修改兼容查询' (#23) from fix_admin_product_count into main

Reviewed-on: #23
This commit is contained in:
mkm 2024-06-27 10:38:23 +08:00
commit 2861cf39d7

View File

@ -61,7 +61,9 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI
//2或者1
$where[]=['cate_id','=',$class_all];
}
$this->searchWhere[]=$where;
if($where){
$this->searchWhere[]=$where;
}
return StoreBranchProduct::where($this->searchWhere)
->field(['id','store_id','product_id', 'image', 'store_name', 'cate_id', 'price', 'sales', 'stock', 'unit', 'cost','purchase', 'status','batch','vip_price','manufacturer_information'])
->when(!empty($this->adminInfo['store_id']), function ($query) {
@ -99,6 +101,7 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI
*/
public function count(): int
{
$status = $this->params['status'] ?? '';
return StoreBranchProduct::where($this->searchWhere)
->when(!empty($this->adminInfo['store_id']), function ($query) {
$query->where('store_id', $this->adminInfo['store_id']);