You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
2.9 KiB
105 lines
2.9 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\adminapi\controller\exam_answers;
|
|
|
|
use core\base\BaseAdminController;
|
|
use app\service\admin\exam_answers\ExamAnswersService;
|
|
|
|
|
|
/**
|
|
* 答题记录控制器
|
|
* Class ExamAnswers
|
|
* @package app\adminapi\controller\exam_answers
|
|
*/
|
|
class ExamAnswers extends BaseAdminController
|
|
{
|
|
/**
|
|
* 获取答题记录列表
|
|
* @return \think\Response
|
|
*/
|
|
public function lists(){
|
|
$data = $this->request->params([
|
|
["campus_id",""]
|
|
]);
|
|
return success((new ExamAnswersService())->getPage($data));
|
|
}
|
|
|
|
/**
|
|
* 答题记录详情
|
|
* @param int $id
|
|
* @return \think\Response
|
|
*/
|
|
public function info(int $id){
|
|
return success((new ExamAnswersService())->getInfo($id));
|
|
}
|
|
|
|
/**
|
|
* 添加答题记录
|
|
* @return \think\Response
|
|
*/
|
|
public function add(){
|
|
$data = $this->request->params([
|
|
["campus_id",0],
|
|
["user_id",0],
|
|
["question_id",0],
|
|
["answer",""],
|
|
["is_correct",0],
|
|
|
|
]);
|
|
$this->validate($data, 'app\validate\exam_answers\ExamAnswers.add');
|
|
$id = (new ExamAnswersService())->add($data);
|
|
return success('ADD_SUCCESS', ['id' => $id]);
|
|
}
|
|
|
|
/**
|
|
* 答题记录编辑
|
|
* @param $id 答题记录id
|
|
* @return \think\Response
|
|
*/
|
|
public function edit(int $id){
|
|
$data = $this->request->params([
|
|
["campus_id",0],
|
|
["user_id",0],
|
|
["question_id",0],
|
|
["answer",""],
|
|
["is_correct",0],
|
|
|
|
]);
|
|
$this->validate($data, 'app\validate\exam_answers\ExamAnswers.edit');
|
|
(new ExamAnswersService())->edit($id, $data);
|
|
return success('EDIT_SUCCESS');
|
|
}
|
|
|
|
/**
|
|
* 答题记录删除
|
|
* @param $id 答题记录id
|
|
* @return \think\Response
|
|
*/
|
|
public function del(int $id){
|
|
(new ExamAnswersService())->del($id);
|
|
return success('DELETE_SUCCESS');
|
|
}
|
|
|
|
|
|
public function getCampusAll(){
|
|
return success(( new ExamAnswersService())->getCampusAll());
|
|
}
|
|
|
|
public function getPersonnelAll(){
|
|
return success(( new ExamAnswersService())->getPersonnelAll());
|
|
}
|
|
|
|
public function getExamQuestionsAll(){
|
|
return success(( new ExamAnswersService())->getExamQuestionsAll());
|
|
}
|
|
|
|
}
|
|
|