更新
This commit is contained in:
parent
5038376e2c
commit
039d696b9b
@ -172,8 +172,19 @@ class StoreCategory extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 分类
|
* 分类
|
||||||
*/
|
*/
|
||||||
public function list_level($pid=0,$level=0){
|
public function list_level($pid=0,$level=0,$type=0){
|
||||||
$select= Db::name('store_category')->where('pid',$pid)->where('level',$level)->where('is_show',1)->where('mer_id',0)->select();
|
$where['pid']=$pid;
|
||||||
|
$where['level']=$level;
|
||||||
|
$where['is_show']=1;
|
||||||
|
$where['mer_id']=0;
|
||||||
|
if($type==0){
|
||||||
|
$select= Db::name('store_category')->where($where)->field('store_category_id,pid,cate_name,sort,pic,is_show,is_hot')->select();
|
||||||
|
}else{
|
||||||
|
unset($where['pid']);
|
||||||
|
$arr=$this->repository->getApiTwolist(0,1);
|
||||||
|
|
||||||
|
$select=formatCategory($arr,'store_category_id');
|
||||||
|
}
|
||||||
return app('json')->success($select);
|
return app('json')->success($select);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,18 @@ trait CategoresDao
|
|||||||
})->order('sort DESC,'.$this->getPk().' DESC')->select();
|
})->order('sort DESC,'.$this->getPk().' DESC')->select();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取二级分类
|
||||||
|
* @param int $mer_id
|
||||||
|
* @return mixed
|
||||||
|
* @author Qinii
|
||||||
|
*/
|
||||||
|
public function getTwoAll($mer_id = 0,$status = null)
|
||||||
|
{
|
||||||
|
return $this->getModel()::getDB()->whereIn('level',[0,1])->where('mer_id', $mer_id)->when(($status !== null),function($query)use($status){
|
||||||
|
$query->where($this->getStatus(),$status);
|
||||||
|
})->order('sort DESC,'.$this->getPk().' DESC')->select();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 通过id 获取path
|
* 通过id 获取path
|
||||||
* @param int $id 需要检测的数据
|
* @param int $id 需要检测的数据
|
||||||
|
@ -37,7 +37,10 @@ trait CategoresRepository
|
|||||||
{
|
{
|
||||||
return formatCategory($this->dao->getAll($merID,$status)->hidden(['path','level','mer_id','create_time'])->toArray(), $this->dao->getPk());
|
return formatCategory($this->dao->getAll($merID,$status)->hidden(['path','level','mer_id','create_time'])->toArray(), $this->dao->getPk());
|
||||||
}
|
}
|
||||||
|
public function getApiTwolist($merID,$status = null)
|
||||||
|
{
|
||||||
|
return formatCategory($this->dao->getTwoAll($merID,$status)->hidden(['path','level','mer_id','create_time'])->toArray(), $this->dao->getPk());
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 筛选用
|
* 筛选用
|
||||||
* @Author:Qinii
|
* @Author:Qinii
|
||||||
|
Loading…
x
Reference in New Issue
Block a user