DiverseYouthNightSchool/application/api/controller/school/Teacher.php

58 lines
1.2 KiB
PHP

<?php
namespace app\api\controller\school;
use app\common\model\school\classes\Teacher as Teachermodel;
/**
* 教师接口
*/
class Teacher extends Base
{
protected $noNeedLogin = ["detail",'people','spec'];
protected $noNeedRight = '*';
protected $model = null;
/**
* 初始化操作
* @access protected
*/
protected function _initialize()
{
$this->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]);
}
}