find ( array ( 'select' => 'position,birthday,sid,username,isadmin,cid,othercid,category,othercategory,gender,qq,phone,telephone,email,avatar,hiredate,nature', 'where' => "username= '" . $uid . "' and passwork = '" . md5 ( $passwork ) . "'", 'asArray' => TRUE ) ); } public function getStaffByName($username = '') { return $this->getOne ( array ( 'asc' => 'sid', 'where' => "username= '" . $username . "'", 'asArray' => TRUE ) ); } /** * * @return string */ public function getStaff($admin=false) { Doo::loadClass ( 'XDeode' ); $XDeode = new XDeode ( 5 ); Doo::loadModel ( 'department' ); $department = new department (); $condition = array ( 'asc' => 'jobNumber', 'asArray' => TRUE ); if ($admin) $condition += array ( 'where' => "isadmin = 0", ); $list = $this->find ( $condition); foreach ( $list as $key => $value ) { $list [$key] ['departmentName'] =''; if($value['departmentID']!=0){ $list [$key] ['departmentName'] =$department->getDepartmentByDid($value['departmentID']); } $list [$key] ['sidKey'] = $XDeode->encode ( $value ['sid'] ); } return $list; } public function getStaffInCid($cid = '') { if (empty ( $cid )) return array (); $list = $this->find ( array ( 'asc' => 'sid', 'where' => "cid in(" . $cid . ")", 'asArray' => TRUE ) ); Doo::loadClass ( 'XDeode' ); $XDeode = new XDeode ( 5 ); foreach ( $list as $key => $value ) { $list [$key] ['sidKey'] = $XDeode->encode ( $value ['sid'] ); } return $list; } public function getStaffByCid($cid = 0) { $list = $this->find ( array ( 'asc' => 'sid', 'where' => "cid= '" . $cid . "'", 'asArray' => TRUE ) ); Doo::loadClass ( 'XDeode' ); $XDeode = new XDeode ( 5 ); foreach ( $list as $key => $value ) { $list [$key] ['sidKey'] = $XDeode->encode ( $value ['sid'] ); } return $list; } public function getUserById($sid = 0) { $list =$this->find ( array ( 'asc' => 'sid', 'where' => "sid= '" . $sid . "'", 'asArray' => TRUE ) ); Doo::loadClass ( 'XDeode' ); $XDeode = new XDeode ( 5 ); foreach ( $list as $key => $value ) { $list [$key] ['sidKey'] = $XDeode->encode ( $value ['sid'] ); } return $list; } public function getUserByIdList($puid) { Doo::loadClass ( 'XDeode' ); $XDeode = new XDeode ( 5 ); $puid = $XDeode->decode ( $puid ); $list=$this->find ( array ( 'where' => "sid= '" . $puid . "'", 'asArray' => TRUE ) ); foreach ($list as $key=>$value){ $list[$key]['sidKey']=$XDeode->encode ( $value ['sid'] ); } return $list; } /** * * @param number $nature */ public function getStaffJobNumberByNature($nature=1){ $detail=$this->getOne ( array ( 'where' => "nature= '" . $nature . "'", 'desc' => 'jobNumber', 'asArray' => TRUE ) ); return $detail; } /** * 根据用户ID获取相关信息 * @param number $sid 用户ID */ public function getStaffBySid($sid = 0) { $detail = array (); if (! empty ( $sid )) $detail = $this->getOne ( array ( 'where' => "sid= '" . $sid . "'", 'asArray' => TRUE ) ); return $detail; } public function getStaffByWxid($wxid = '') { // echo "wxid in ( " . $wxid . ")"; if (empty ( $wxid )) return array (); return $this->find ( array ( 'select' => 'sid,wxid', 'where' => "wxid in ( " . $wxid . ")", 'asArray' => TRUE ) ); } } ?>