request->params([ ["title",""], ["status",""], ["create_time",["",""]], ["update_time",["",""]], ["table_type",1] ]); return success((new LessonCourseTeachingService())->getPage($data)); } /** * 添加教研管理 * @return \think\Response */ public function add(){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["table_type",1], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $id = (new LessonCourseTeachingService())->add($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 教研管理编辑 * @param $id 教研管理id * @return \think\Response */ public function edit(int $id){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); (new LessonCourseTeachingService())->edit($id, $data); return success('EDIT_SUCCESS'); } /** * 获取跳绳教案库列表 * @return \think\Response */ public function jumpLists(){ $data = $this->request->params([ ["title",""], ["status",""], ["create_time",["",""]], ["update_time",["",""]], ["table_type",2] ]); return success((new LessonCourseTeachingService())->jumpPetPage($data)); } /** * 添加跳绳教案库 * @return \think\Response */ public function jumpAdd(){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["table_type",2], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $id = (new LessonCourseTeachingService())->jumpAdd($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 跳绳教案库编辑 * @param $id 教研管理id * @return \think\Response */ public function jumpEdit(int $id){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); (new LessonCourseTeachingService())->jumpEdit($id, $data); return success('EDIT_SUCCESS'); } /** * 获取增高教案库列表 * @return \think\Response */ public function enLists(){ $data = $this->request->params([ ["title",""], ["status",""], ["create_time",["",""]], ["update_time",["",""]], ["table_type",3] ]); return success((new LessonCourseTeachingService())->enPetPage($data)); } /** * 添加增高教案库 * @return \think\Response */ public function enAdd(){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["table_type",3], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $id = (new LessonCourseTeachingService())->enAdd($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 跳绳增高教案库 * @param $id 教研管理id * @return \think\Response */ public function enEdit(int $id){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); (new LessonCourseTeachingService())->enEdit($id, $data); return success('EDIT_SUCCESS'); } /** * 获取篮球教案库列表 * @return \think\Response */ public function basketballLists(){ $data = $this->request->params([ ["title",""], ["status",""], ["create_time",["",""]], ["update_time",["",""]], ["table_type",4] ]); return success((new LessonCourseTeachingService())->basketballPetPage($data)); } /** * 添加篮球教案库 * @return \think\Response */ public function basketballAdd(){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["table_type",4], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $id = (new LessonCourseTeachingService())->basketballAdd($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 跳绳篮球教案库 * @param $id 教研管理id * @return \think\Response */ public function basketballEdit(int $id){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); (new LessonCourseTeachingService())->basketballEdit($id, $data); return success('EDIT_SUCCESS'); } /** * 获取强化教案库列表 * @return \think\Response */ public function strengLists(){ $data = $this->request->params([ ["title",""], ["status",""], ["create_time",["",""]], ["update_time",["",""]], ["table_type",5] ]); return success((new LessonCourseTeachingService())->strengPetPage($data)); } /** * 添加强化教案库 * @return \think\Response */ public function strengAdd(){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["table_type",5], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $id = (new LessonCourseTeachingService())->strengAdd($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 跳绳强化教案库 * @param $id 教研管理id * @return \think\Response */ public function strengEdit(int $id){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); (new LessonCourseTeachingService())->strengEdit($id, $data); return success('EDIT_SUCCESS'); } /** * 获取空中忍者教案库列表 * @return \think\Response */ public function ninjaLists(){ $data = $this->request->params([ ["title",""], ["status",""], ["create_time",["",""]], ["update_time",["",""]], ["table_type",6] ]); return success((new LessonCourseTeachingService())->ninjaPetPage($data)); } /** * 添加空中忍者教案库 * @return \think\Response */ public function ninjaAdd(){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["table_type",6], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $id = (new LessonCourseTeachingService())->ninjaAdd($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 跳绳空中忍者教案库 * @param $id 教研管理id * @return \think\Response */ public function ninjaEdit(int $id){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); (new LessonCourseTeachingService())->ninjaEdit($id, $data); return success('EDIT_SUCCESS'); } /** * 获取空中忍者教案库列表 * @return \think\Response */ public function securityLists(){ $data = $this->request->params([ ["title",""], ["status",""], ["create_time",["",""]], ["update_time",["",""]], ["table_type",7] ]); return success((new LessonCourseTeachingService())->securityPetPage($data)); } /** * 添加空中忍者教案库 * @return \think\Response */ public function securityAdd(){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["table_type",7], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $id = (new LessonCourseTeachingService())->securityAdd($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 跳绳空中忍者教案库 * @param $id 教研管理id * @return \think\Response */ public function securityEdit(int $id){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); (new LessonCourseTeachingService())->securityEdit($id, $data); return success('EDIT_SUCCESS'); } /** * 获取体能教案库列表 * @return \think\Response */ public function physicalLists(){ $data = $this->request->params([ ["title",""], ["status",""], ["create_time",["",""]], ["update_time",["",""]], ["table_type",8] ]); return success((new LessonCourseTeachingService())->physicalPetPage($data)); } /** * 添加体能教案库 * @return \think\Response */ public function physicalAdd(){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["table_type",8], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $id = (new LessonCourseTeachingService())->physicalAdd($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 跳绳体能教案库 * @param $id 教研管理id * @return \think\Response */ public function physicalEdit(int $id){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); (new LessonCourseTeachingService())->physicalEdit($id, $data); return success('EDIT_SUCCESS'); } /** * 获取体能教案库列表 * @return \think\Response */ public function actionLists(){ $data = $this->request->params([ ["title",""], ["status",""], ["create_time",["",""]], ["update_time",["",""]], ["table_type",9] ]); return success((new LessonCourseTeachingService())->actionPetPage($data)); } /** * 热身动作 * @return \think\Response */ public function actionAdd(){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["table_type",9], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $id = (new LessonCourseTeachingService())->actionAdd($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 热身动作 * @param $id 教研管理id * @return \think\Response */ public function actionEdit(int $id){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); (new LessonCourseTeachingService())->actionEdit($id, $data); return success('EDIT_SUCCESS'); } /** * 获取体能教案库列表 * @return \think\Response */ public function fitnessLists(){ $data = $this->request->params([ ["title",""], ["status",""], ["create_time",["",""]], ["update_time",["",""]], ["table_type",10] ]); return success((new LessonCourseTeachingService())->fitnessPetPage($data)); } /** * 热身动作 * @return \think\Response */ public function fitnessAdd(){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["table_type",10], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $id = (new LessonCourseTeachingService())->fitnessAdd($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 热身动作 * @param $id 教研管理id * @return \think\Response */ public function fitnessEdit(int $id){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); (new LessonCourseTeachingService())->fitnessEdit($id, $data); return success('EDIT_SUCCESS'); } /** * 获取体能教案库列表 * @return \think\Response */ public function gamesLists(){ $data = $this->request->params([ ["title",""], ["status",""], ["create_time",["",""]], ["update_time",["",""]], ["table_type",11] ]); return success((new LessonCourseTeachingService())->gamesPetPage($data)); } /** * 热身动作 * @return \think\Response */ public function gamesAdd(){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["table_type",11], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $id = (new LessonCourseTeachingService())->gamesAdd($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 热身动作 * @param $id 教研管理id * @return \think\Response */ public function gamesEdit(int $id){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); (new LessonCourseTeachingService())->gamesEdit($id, $data); return success('EDIT_SUCCESS'); } /** * 获取体能教案库列表 * @return \think\Response */ public function relaxationLists(){ $data = $this->request->params([ ["title",""], ["status",""], ["create_time",["",""]], ["update_time",["",""]], ["table_type",12] ]); return success((new LessonCourseTeachingService())->relaxationPetPage($data)); } /** * 热身动作 * @return \think\Response */ public function relaxationAdd(){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["table_type",12], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $id = (new LessonCourseTeachingService())->relaxationAdd($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 热身动作 * @param $id 教研管理id * @return \think\Response */ public function relaxationEdit(int $id){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); (new LessonCourseTeachingService())->relaxationEdit($id, $data); return success('EDIT_SUCCESS'); } public function publicLists(){ $data = $this->request->params([ ["title",""], ["status",""], ["create_time",["",""]], ["update_time",["",""]], ["table_type",0], ]); return success((new LessonCourseTeachingService())->publicPetPage($data)); } public function publicAdd(){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["table_type",0], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $id = (new LessonCourseTeachingService())->publicAdd($data); return success('ADD_SUCCESS', ['id' => $id]); } public function publicEdit(int $id){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["url",''],["exam_papers_id",""] ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); (new LessonCourseTeachingService())->publicEdit($id, $data); return success('EDIT_SUCCESS'); } public function setBindingModule(int $id){ $data = $this->request->params([ ["user_permission",""], ["user_permission_name",""], ["table_type",0], ["id",0], ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $id = (new LessonCourseTeachingService())->bindingModuleAdd($id, $data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 教研管理详情 * @param int $id * @return \think\Response */ public function info(int $id){ return success((new LessonCourseTeachingService())->getInfo($id)); } /** * 教研管理删除 * @param $id 教研管理id * @return \think\Response */ public function del(int $id){ (new LessonCourseTeachingService())->del($id); return success('DELETE_SUCCESS'); } public function getPersonnelDataAll(){ $data = $this->request->params([ ["name",""], ["phone",""], ["role_id",""], ["dept_id",""] ]); return success((new LessonCourseTeachingService())->getPersonnelDataAll($data)); } public function getTestPaperList(){ $data = $this->request->params([ ["total_score",""], ["selection_mode",""] ]); return success((new LessonCourseTeachingService())->getTestPaperList($data)); } public function bindingTestModule(int $id){ $data = $this->request->params([ ["exam_papers_id",""], ["id",0], ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $id = (new LessonCourseTeachingService())->bindingTestModule($id, $data); return success('ADD_SUCCESS', ['id' => $id]); } // =================== 统一API接口:支持所有模块类型 =================== /** * 统一查询接口 - 根据table_type参数返回对应类型的数据 * @return \think\Response */ public function unifiedList(){ $data = $this->request->params([ ["title",""], ["status",""], ["create_time",["",""]], ["update_time",["",""]], ["table_type",""] // 必填参数,用于区分模块类型 ]); // 验证table_type参数 if (empty($data['table_type'])) { return error('table_type参数不能为空'); } return success((new LessonCourseTeachingService())->getPage($data)); } /** * 统一新增接口 - 支持所有模块类型的数据新增 * @return \think\Response */ public function unifiedAdd(){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["table_type",""], // 必填参数,用于区分模块类型 ["url",""], ["exam_papers_id",""], ["user_permission",[]] // 支持数组格式的权限数据 ]); // 验证table_type参数 if (empty($data['table_type'])) { return error('table_type参数不能为空'); } $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $id = (new LessonCourseTeachingService())->add($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 统一编辑接口 - 支持所有模块类型的数据编辑 * @param int $id * @return \think\Response */ public function unifiedEdit(int $id){ $data = $this->request->params([ ["title",""], ["image",""], ["type",0], ["content",""], ["status",0], ["url",""], ["exam_papers_id",""], ["user_permission",[]] // 支持数组格式的权限数据 ]); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); (new LessonCourseTeachingService())->edit($id, $data); return success('EDIT_SUCCESS'); } /** * 统一删除接口 - 支持所有模块类型的数据删除 * @param int $id * @return \think\Response */ public function unifiedDel(int $id){ (new LessonCourseTeachingService())->del($id); return success('DELETE_SUCCESS'); } /** * 统一详情接口 - 支持所有模块类型的数据详情获取 * @param int $id * @return \think\Response */ public function unifiedInfo(int $id){ return success((new LessonCourseTeachingService())->getInfo($id)); } /** * 获取模块配置接口 - 返回所有可用的模块配置 * @return \think\Response */ public function getModuleConfigs(){ $config = config('teaching_management.teaching_management.module_configs', []); // 按order排序并格式化返回数据 $modules = []; foreach ($config as $key => $moduleConfig) { $modules[] = [ 'key' => $key, 'table_type' => $moduleConfig['table_type'], 'name' => $moduleConfig['name'], 'auto_distribute' => $moduleConfig['auto_distribute'] ?? false, 'order' => $moduleConfig['order'] ?? 99 ]; } // 按order字段排序 usort($modules, function($a, $b) { return $a['order'] <=> $b['order']; }); return success([ 'modules' => $modules, 'coach_department_id' => config('teaching_management.teaching_management.coach_department_id', 24) ]); } /** * 批量更新人员权限接口 - 手动触发教练部人员权限同步 * @return \think\Response */ public function batchUpdatePersonnel(){ $data = $this->request->params([ ["table_types",[]] // 可选:指定要更新的table_type数组,为空则更新所有自动分发的模块 ]); $tableTypes = !empty($data['table_types']) ? $data['table_types'] : null; $result = (new LessonCourseTeachingService())->batchUpdatePersonnelPermissions($tableTypes); if ($result['failed'] > 0) { return error('部分更新失败', $result); } return success('批量更新完成', $result); } /** * 手动执行教研人员同步定时任务 - 测试定时任务功能 * @return \think\Response */ public function testSyncTask(){ try { $job = new \app\job\schedule\TeachingPersonnelSync(); $result = $job->doJob(); return success('定时任务执行完成', ['result' => $result]); } catch (\Exception $e) { return error('定时任务执行失败: ' . $e->getMessage()); } } }