智慧教务系统
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.
 
 
 
 
 
 

91 lines
2.5 KiB

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\exam_papers;
use core\base\BaseAdminController;
use app\service\admin\exam_papers\ExamPapersService;
/**
* 试卷控制器
* Class ExamPapers
* @package app\adminapi\controller\exam_papers
*/
class ExamPapers extends BaseAdminController
{
/**
* 获取试卷列表
* @return \think\Response
*/
public function lists(){
$data = $this->request->params([
["selection_mode",""],
["total_score",""],
["passing_score",""]
]);
return success((new ExamPapersService())->getPage($data));
}
/**
* 试卷详情
* @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([
["selection_mode",""],
["total_score",0.00],
["passing_score",0.00],
]);
$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([
["selection_mode",""],
["total_score",0.00],
["passing_score",0.00],
]);
$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');
}
}