request->params([ ["student_id",""], ["course_id",""], ["total_hours",""], ["gift_hours",""], ["start_date",""], ["end_date",""] ]); 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-16 18:02:13"], ["end_date","2025-05-16 18:02:13"], ]); $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-16 18:02:13"], ["end_date","2025-05-16 18:02:13"], ]); $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'); } }