model = new ClassesLib; parent::_initialize(); //判断登录用户是否是员工 } public function index() { } /** * @ApiTitle(课程详情接口) * @ApiSummary(课程详情接口) * @ApiRoute(/api/school/classes/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]); } /** * @ApiTitle(课程参与者和报名者) * @ApiSummary(课程参与者和报名者) * @ApiRoute(/api/school/classes/people) * @ApiMethod(GET) * @ApiParams(name = "id", type = "int",required=true,description = "课程id") * @ApiReturn({ unpaid_user_data 参与中 paid_user_data 已报名 }) */ public function people(){ $id = $this->request->get('id/d',''); if(empty($id)){ $this->error(__('缺少必要参数')); } try { $res = $this->model->virtualParticipants($id); } catch (\Exception $e){ // Log::log($e->getMessage()); $this->error($e->getMessage(),['errcode'=>$e->getCode()]); } $this->success('获取成功', $res); } /** * @ApiTitle(课程课时规格) * @ApiSummary(课程课时规格) * @ApiRoute(/api/school/classes/spec) * @ApiMethod(GET) * @ApiParams(name = "id", type = "int",required=true,description = "课程id") * @ApiReturn({ spec 课时规格 }) */ public function spec(){ $id = $this->request->get('id/d',''); if(empty($id)){ $this->error(__('缺少必要参数')); } try { $res = $this->model->spec($id); } catch (\Exception $e){ // Log::log($e->getMessage()); $this->error($e->getMessage(),['errcode'=>$e->getCode()]); } $this->success('获取成功', ['spec'=>$res]); } }