diff --git a/application/controllers/Api/Cage.php b/application/controllers/Api/Cage.php index dec925b..39dd637 100644 --- a/application/controllers/Api/Cage.php +++ b/application/controllers/Api/Cage.php @@ -9,10 +9,12 @@ class Api_CageController extends Ctrl_Api{ public $Cagemodel; public $POST; public $Cagecolormodel; + public $Usermodel; public function init() { $this->Cagemodel = new CageModel(); $this->POST =json_decode(file_get_contents('php://input'),true); $this->Cagecolormodel = new CagecolorModel(); + $this->Usermodel = new UserModel(); } /** * 鼠笼列表接口 @@ -110,5 +112,13 @@ class Api_CageController extends Ctrl_Api{ $data = $this->Cagecolormodel->getModelList($params); Tool_Fnc::apiMsg('获取成功', '200',$data); } + /** + * 获取负责人接口 + */ + public function getUserAction(){ + $uid = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['uid']; + $data = $this->Usermodel->getUser($uid); + Tool_Fnc::apiMsg('获取成功', '200',$data); + } } diff --git a/application/models/User.php b/application/models/User.php index 41ebc04..896ec97 100644 --- a/application/models/User.php +++ b/application/models/User.php @@ -16,8 +16,8 @@ class UserModel extends Orm_Base{ 'is_delete' => array('type' => "int(11)",'comment' => '是否删除'), ); public $pk = 'id'; - public function getModelList(){ - + public function getUser($uid){ + return $this->field('id,realname')->where("id!='{getUser}' and is_delete=0 and status=1")->fList(); } }