find ( array ( 'asArray' => TRUE ) ); foreach ($list as $key=>$value){ $list [$key] ['pidKey'] = $XDeode->encode ( $value ['pid'] ); $list [$key] ['staffCount']=$staff->count(array ('where' => 'positionId = "' . $value ['pid'] . '"')); } return $list; } /** * 根据ID获取相关信息 * @param number $sid 用户ID */ public function getPositionByPid($pid = 0) { Doo::loadClass ( 'XDeode' ); $XDeode = new XDeode ( 5 ); if (!is_numeric($pid)){ $pid = $XDeode->decode ( $pid ); } $detail = array (); if (! empty ( $pid )){ Doo::loadModel ( 'staff' ); $staff = new staff (); $detail = $this->getOne ( array ( 'where' => "pid= '" . $pid . "'", 'asArray' => TRUE ) ); if (!empty($detail)){ $detail ['pidKey'] = $XDeode->encode ( $detail ['pid'] ); $detail ['staffCount']=$staff->count(array ('where' => 'positionId = "' . $detail ['pid'] . '"')); } } return $detail; } //public function getPositionByPid } ?>