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.
119 lines
3.3 KiB
119 lines
3.3 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\adminapi\controller\assignment;
|
|
|
|
use core\base\BaseAdminController;
|
|
use app\service\admin\assignment\AssignmentService;
|
|
|
|
|
|
/**
|
|
* 作业管理控制器
|
|
* Class Assignment
|
|
* @package app\adminapi\controller\assignment
|
|
*/
|
|
class Assignment extends BaseAdminController
|
|
{
|
|
/**
|
|
* 获取作业管理列表
|
|
* @return \think\Response
|
|
*/
|
|
public function lists(){
|
|
$data = $this->request->params([
|
|
["class_id",""],
|
|
["course_id",""],
|
|
["personnel_id",""],
|
|
["student_id",""],
|
|
["status",""]
|
|
]);
|
|
return success((new AssignmentService())->getPage($data));
|
|
}
|
|
|
|
/**
|
|
* 作业管理详情
|
|
* @param int $id
|
|
* @return \think\Response
|
|
*/
|
|
public function info(int $id){
|
|
return success((new AssignmentService())->getInfo($id));
|
|
}
|
|
|
|
/**
|
|
* 添加作业管理
|
|
* @return \think\Response
|
|
*/
|
|
public function add(){
|
|
$data = $this->request->params([
|
|
["class_id",0],
|
|
["course_id",0],
|
|
["personnel_id",0],
|
|
["student_id",""],
|
|
["description",""],
|
|
["content_type",""],
|
|
["content_text",""],
|
|
["status",0],
|
|
|
|
]);
|
|
$this->validate($data, 'app\validate\assignment\Assignment.add');
|
|
$id = (new AssignmentService())->add($data);
|
|
return success('ADD_SUCCESS', ['id' => $id]);
|
|
}
|
|
|
|
/**
|
|
* 作业管理编辑
|
|
* @param $id 作业管理id
|
|
* @return \think\Response
|
|
*/
|
|
public function edit(int $id){
|
|
$data = $this->request->params([
|
|
["class_id",0],
|
|
["course_id",0],
|
|
["personnel_id",0],
|
|
["student_id",""],
|
|
["description",""],
|
|
["content_type",""],
|
|
["content_text",""],
|
|
["status",0],
|
|
|
|
]);
|
|
$this->validate($data, 'app\validate\assignment\Assignment.edit');
|
|
(new AssignmentService())->edit($id, $data);
|
|
return success('EDIT_SUCCESS');
|
|
}
|
|
|
|
/**
|
|
* 作业管理删除
|
|
* @param $id 作业管理id
|
|
* @return \think\Response
|
|
*/
|
|
public function del(int $id){
|
|
(new AssignmentService())->del($id);
|
|
return success('DELETE_SUCCESS');
|
|
}
|
|
|
|
|
|
public function getClassGradeAll(){
|
|
return success(( new AssignmentService())->getClassGradeAll());
|
|
}
|
|
|
|
public function getCourseAll(){
|
|
return success(( new AssignmentService())->getCourseAll());
|
|
}
|
|
|
|
public function getPersonnelAll(){
|
|
return success(( new AssignmentService())->getPersonnelAll());
|
|
}
|
|
|
|
public function getStudentAll(){
|
|
return success(( new AssignmentService())->getStudentAll());
|
|
}
|
|
|
|
}
|
|
|