request->params([ ["selection_mode",""], ["created_at",["",""]] ]); return success((new ExamPapersService())->getPage($data)); } public function all(){ return success((new ExamPapersService())->all()); } /** * 试卷详情 * @param int $id * @return \think\Response */ public function info(int $id){ return success((new ExamPapersService())->getInfo($id)); } /** * 添加试卷 * @return \think\Response */ public function add(){ $data = $this->request->params([ ["title",""], ["selection_mode",""], ["questions_ids",""], ["total_score",0.00], ["passing_score",0.00], ["single_choice_count",0], ["multiple_choice_count",0], ["true_false_count",0], ["every_score",0] ]); $this->validate($data, 'app\validate\exam_papers\ExamPapers.add'); $id = (new ExamPapersService())->add($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 试卷编辑 * @param $id 试卷id * @return \think\Response */ public function edit(int $id){ $data = $this->request->params([ ["title",""], ["selection_mode",""], ["questions_ids",""], ["total_score",0.00], ["passing_score",0.00], ["single_choice_count",0], ["multiple_choice_count",0], ["true_false_count",0], ["every_score",0] ]); $this->validate($data, 'app\validate\exam_papers\ExamPapers.edit'); (new ExamPapersService())->edit($id, $data); return success('EDIT_SUCCESS'); } /** * 试卷删除 * @param $id 试卷id * @return \think\Response */ public function del(int $id){ (new ExamPapersService())->del($id); return success('DELETE_SUCCESS'); } }