model = new Teachermodel; parent::_initialize(); //判断登录用户是否是员工 } /** * @ApiTitle( 老师详情) * @ApiSummary(老师详情) * @ApiRoute(/api/school/teacher/detail) * @ApiMethod(GET) * @ApiParams(name = "id", type = "int",required=true,description = "老师id") * @ApiReturn({ * *}) */ public function detail(){ $id = $this->request->get('id/d',''); if(empty($id)){ $this->error(__('缺少必要参数')); } try { $res = $this->model->detail($id); } catch (\Exception $e){ // Log::log($e->getMessage()); $this->error($e->getMessage(),['errcode'=>$e->getCode()]); } $this->success('获取成功', ['detail' => $res]); } }