修复了GoodsclassLists中的一个bug,优化了查询条件
This commit is contained in:
parent
6ea09b4cb3
commit
195db1130e
@ -39,7 +39,8 @@ class IndexController extends BaseApiController
|
|||||||
// foreach($arr as $k=>$v){
|
// foreach($arr as $k=>$v){
|
||||||
// Goodsclass::where('id',$k)->update(['children'=>json_encode($v,true)]);
|
// Goodsclass::where('id',$k)->update(['children'=>json_encode($v,true)]);
|
||||||
// }
|
// }
|
||||||
// $a=Goodsclass::where('pid','>',0)->where('children','<>',null)->column('id');
|
$a=Goodsclass::where('pid',0)->where('children','<>',null)->column('id');
|
||||||
|
d ($a);
|
||||||
// $arr = [];
|
// $arr = [];
|
||||||
// foreach ($a as $k => $v) {
|
// foreach ($a as $k => $v) {
|
||||||
// $pid = Goodsclass::where('id', $v)->value('pid');
|
// $pid = Goodsclass::where('id', $v)->value('pid');
|
||||||
|
@ -46,12 +46,14 @@ class GoodsclassLists extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
if($pid==0){
|
if($pid==0){
|
||||||
$lists = Goodsclass::where($this->searchWhere)
|
$lists = Goodsclass::where($this->searchWhere)
|
||||||
->where('pid', 0)
|
->where('pid', 0)
|
||||||
|
->where('children','<>',null)
|
||||||
->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])
|
->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['sort' => 'desc','id' => 'desc'])
|
->order(['sort' => 'desc','id' => 'desc'])
|
||||||
->select()->toArray();
|
->select()->toArray();
|
||||||
}else{
|
}else{
|
||||||
$lists = Goodsclass::where($this->searchWhere)
|
$lists = Goodsclass::where($this->searchWhere)
|
||||||
|
->where('children','<>',null)
|
||||||
->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])
|
->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['sort' => 'desc','id' => 'desc'])
|
->order(['sort' => 'desc','id' => 'desc'])
|
||||||
@ -82,9 +84,11 @@ class GoodsclassLists extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
$pid=Request()->get('pid',0);
|
$pid=Request()->get('pid',0);
|
||||||
if($pid==0){
|
if($pid==0){
|
||||||
return Goodsclass::where($this->searchWhere)->where('pid', 0)
|
return Goodsclass::where($this->searchWhere)->where('pid', 0)
|
||||||
|
->where('children','<>',null)
|
||||||
->count();
|
->count();
|
||||||
}else{
|
}else{
|
||||||
return Goodsclass::where($this->searchWhere)
|
return Goodsclass::where($this->searchWhere)
|
||||||
|
->where('children','<>',null)
|
||||||
->count();
|
->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user