request->params([ ["student_id",""], ["course_id",""] ]); return success((new StudentCoursesService())->getPage($data)); } /** * 学员课程详情 * @param int $id * @return \think\Response */ public function info(int $id){ return success((new StudentCoursesService())->getInfo($id)); } /** * 添加学员课程 * @return \think\Response */ public function add(){ $data = $this->request->params([ ["student_id",0], ["course_id",0], ["total_hours",0], ["gift_hours",0], ["start_date","2025-05-19 15:41:16"], ["end_date","2025-05-19 15:41:16"], ]); $this->validate($data, 'app\validate\student_courses\StudentCourses.add'); $id = (new StudentCoursesService())->add($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 学员课程编辑 * @param $id 学员课程id * @return \think\Response */ public function edit(int $id){ $data = $this->request->params([ ["student_id",0], ["course_id",0], ["total_hours",0], ["gift_hours",0], ["start_date","2025-05-19 15:41:16"], ["end_date","2025-05-19 15:41:16"], ]); $this->validate($data, 'app\validate\student_courses\StudentCourses.edit'); (new StudentCoursesService())->edit($id, $data); return success('EDIT_SUCCESS'); } /** * 学员课程删除 * @param $id 学员课程id * @return \think\Response */ public function del(int $id){ (new StudentCoursesService())->del($id); return success('DELETE_SUCCESS'); } public function getStudentAll(){ return success(( new StudentCoursesService())->getStudentAll()); } public function getCourseAll(){ return success(( new StudentCoursesService())->getCourseAll()); } }