xuanxuan.php 499 B

123456789101112131415
  1. <?php
  2. public function getFamily($categoryID, $type = '', $root = 0)
  3. {
  4. if($categoryID == 0 and empty($type)) return array();
  5. $category = $this->loadModel('dept')->getById($categoryID);
  6. if($category)
  7. {
  8. return $this->dao->select('id')->from(TABLE_DEPT)->where('path')->like($category->path . '%')->fetchPairs();
  9. }
  10. if(!$category)
  11. {
  12. return $this->dao->select('id')->from(TABLE_DEPT)->beginIF($root)->where('root')->eq((int)$root)->fi()->fetchPairs();
  13. }
  14. }