更新缺失代码

This commit is contained in:
liu 2024-03-14 09:49:12 +08:00
parent 5335d8341e
commit a3b21b5bca
2 changed files with 21 additions and 0 deletions

View File

@ -86,6 +86,21 @@ 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 需要检测的数据

View File

@ -78,6 +78,12 @@ trait CategoresRepository
} }
public function getApiTwolist($merID,$status = null)
{
return formatCategory($this->dao->getTwoAll($merID,$status)->hidden(['path','level','mer_id','create_time'])->toArray(), $this->dao->getPk());
}
/** /**
* 根据ID 查询是否存在 * 根据ID 查询是否存在
* @param int $merId * @param int $merId