request->params([ ["title",""], ["question_type",""], ["created_at",["",""]] ]); return success((new ExamQuestionsService())->getPage($data)); } /** * 试题详情 * @param int $id * @return \think\Response */ public function info(int $id){ return success((new ExamQuestionsService())->getInfo($id)); } /** * 添加试题 * @return \think\Response */ public function add(){ $data = $this->request->params([ ["title",""], ["question_type",""], ["question_content_type",""], ["question_content",""], ["option_json",[]] ]); $this->validate($data, 'app\validate\exam_questions\ExamQuestions.add'); $id = (new ExamQuestionsService())->add($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 试题编辑 * @param $id 试题id * @return \think\Response */ public function edit(int $id){ $data = $this->request->params([ ["title",""], ["question_type",""], ["question_content_type",""], ["question_content",""], ["option_json",[]] ]); $this->validate($data, 'app\validate\exam_questions\ExamQuestions.edit'); (new ExamQuestionsService())->edit($id, $data); return success('EDIT_SUCCESS'); } /** * 试题删除 * @param $id 试题id * @return \think\Response */ public function del(int $id){ (new ExamQuestionsService())->del($id); return success('DELETE_SUCCESS'); } }