commit
5a27841a02
@ -12,7 +12,7 @@ class ProductController extends BaseApiController{
|
||||
*/
|
||||
public function lists(){
|
||||
|
||||
return $this->dataLists(new ProductLists(),1);
|
||||
return $this->dataLists(new ProductLists());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,44 +92,23 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li
|
||||
$this->searchWhere[] = ['store_id', '=', $store_id];
|
||||
}
|
||||
$class_all = $this->request->get('class_all');
|
||||
$where=[];
|
||||
if ($class_all) {
|
||||
//查3级别的
|
||||
$arr = Cate::where('pid', $class_all)->column('id');
|
||||
if ($arr) {
|
||||
$arr2 = Cate::where('pid', 'in', $arr)->column('id');
|
||||
$where[]=['cate_id','in',array_merge($arr,$arr2)];
|
||||
$this->searchWhere[] = ['cate_id', 'in', array_merge($arr, $arr2)];
|
||||
}
|
||||
}
|
||||
if(empty($where) && $class_all){
|
||||
//2或者1
|
||||
$where[]=['cate_id','=',$class_all];
|
||||
}
|
||||
|
||||
|
||||
$this->searchWhere[] = ['status', '=', 1];
|
||||
$this->searchWhere[] = ['stock', '>', 0];
|
||||
$M_store_id=$this->request->__get('store_id');
|
||||
if($M_store_id){
|
||||
$where[]=['store_id','=',$M_store_id];
|
||||
$data = StoreBranchProduct::where($this->searchWhere)->where($where)
|
||||
$data = StoreBranchProduct::where($this->searchWhere)
|
||||
->field(['id', 'product_id', 'cate_id', 'store_name', 'cost', 'store_id', 'price', 'bar_code', 'image', 'sales', 'store_info', 'delete_time', 'unit', 'batch'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->with(['className', 'unitName'])
|
||||
->order($this->sortOrder)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
}else{
|
||||
$data = StoreBranchProduct::where($this->searchWhere)->where($where)
|
||||
->field(['id', 'product_id','cate_id','store_name','cost', 'store_id','price', 'bar_code','image','sales','store_info','delete_time','unit','batch'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->with(['className','unitName'])
|
||||
->order($this->sortOrder)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
}
|
||||
->select()?->toArray();
|
||||
// $check = DictType::where('type','activities')->find();
|
||||
// foreach ($data as &$value){
|
||||
// if(isset($check) && $check['status'] == 1){
|
||||
@ -143,7 +122,6 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li
|
||||
// }
|
||||
// }
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -188,13 +166,10 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li
|
||||
$where[] = ['store_id', '=', $M_store_id];
|
||||
$data = StoreBranchProduct::where($this->searchWhere)->where($where)
|
||||
->count();
|
||||
|
||||
} else {
|
||||
$data = StoreBranchProduct::where($this->searchWhere)->where($where)
|
||||
->count();
|
||||
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user