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

140 lines
3.9 KiB

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\course_schedule;
use core\base\BaseAdminController;
use app\service\admin\course_schedule\CourseScheduleService;
/**
* 课程安排控制器
* Class CourseSchedule
* @package app\adminapi\controller\course_schedule
*/
class CourseSchedule extends BaseAdminController
{
/**
* 获取课程安排列表
* @return \think\Response
*/
public function lists()
{
$data = $this->request->params([
["campus_id", ""],
["venue_id", ""],
["course_date", ""],
["time_slot", ""],
["course_id", ""],
["coach_id", ""],
["participants", ""],
["student_ids", ""],
["available_capacity", ""],
["status", ""]
]);
return success((new CourseScheduleService())->getPage($data));
}
/**
* 课程安排详情
* @param mixed $id
* @return \think\Response
*/
public function info($id)
{
// 确保 $id 是整数类型
$id = intval($id);
return success((new CourseScheduleService())->getInfo($id));
}
/**
* 添加课程安排
* @return \think\Response
*/
public function add()
{
$data = $this->request->params([
["campus_id", 0],
["venue_id", 0],
["course_date", "2025-05-16 17:28:06"],
["time_slot", ""],
["course_id", 0],
["coach_id", 0],
["participants", ""],
["student_ids", ""],
["available_capacity", 0],
["status", ""],
['auto_schedule', 1]
]);
$this->validate($data, 'app\validate\course_schedule\CourseSchedule.add');
$id = (new CourseScheduleService())->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],
["venue_id", 0],
["course_date", "2025-05-16 17:28:06"],
["time_slot", ""],
["course_id", 0],
["coach_id", 0],
["participants", ""],
["student_ids", ""],
["available_capacity", 0],
["status", ""],
['auto_schedule', 1]
]);
$this->validate($data, 'app\validate\course_schedule\CourseSchedule.edit');
(new CourseScheduleService())->edit($id, $data);
return success('EDIT_SUCCESS');
}
/**
* 课程安排删除
* @param $id 课程安排id
* @return \think\Response
*/
public function del(int $id)
{
(new CourseScheduleService())->del($id);
return success('DELETE_SUCCESS');
}
/**
* 获取课程表数据
* @return \think\Response
*/
public function timetables()
{
$data = $this->request->params([
["start_date", ""],
["end_date", ""],
["campus_id", ""],
["venue_id", ""]
]);
return success((new CourseScheduleService())->getTimetables($data));
}
public function getCampusVenue()
{
$data = $this->request->params([
["campus_id", ""],
]);
return success((new CourseScheduleService())->getCampusVenue($data));
}
}