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

104 lines
3.0 KiB

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\student_courses;
use core\base\BaseAdminController;
use app\service\admin\student_courses\StudentCoursesService;
/**
* 学员课程控制器
* Class StudentCourses
* @package app\adminapi\controller\student_courses
*/
class StudentCourses extends BaseAdminController
{
/**
* 获取学员课程列表
* @return \think\Response
*/
public function lists(){
$data = $this->request->params([
["student_id",""],
["course_id",""]
]);
return success((new StudentCoursesService())->getPage($data));
}
/**
* 学员课程详情
* @param int $id
* @return \think\Response
*/
public function info(int $id){
return success((new StudentCoursesService())->getInfo($id));
}
/**
* 添加学员课程
* @return \think\Response
*/
public function add(){
$data = $this->request->params([
["student_id",0],
["course_id",0],
["total_hours",0],
["gift_hours",0],
["start_date","2025-05-19 15:41:16"],
["end_date","2025-05-19 15:41:16"],
]);
$this->validate($data, 'app\validate\student_courses\StudentCourses.add');
$id = (new StudentCoursesService())->add($data);
return success('ADD_SUCCESS', ['id' => $id]);
}
/**
* 学员课程编辑
* @param $id 学员课程id
* @return \think\Response
*/
public function edit(int $id){
$data = $this->request->params([
["student_id",0],
["course_id",0],
["total_hours",0],
["gift_hours",0],
["start_date","2025-05-19 15:41:16"],
["end_date","2025-05-19 15:41:16"],
]);
$this->validate($data, 'app\validate\student_courses\StudentCourses.edit');
(new StudentCoursesService())->edit($id, $data);
return success('EDIT_SUCCESS');
}
/**
* 学员课程删除
* @param $id 学员课程id
* @return \think\Response
*/
public function del(int $id){
(new StudentCoursesService())->del($id);
return success('DELETE_SUCCESS');
}
public function getStudentAll(){
return success(( new StudentCoursesService())->getStudentAll());
}
public function getCourseAll(){
return success(( new StudentCoursesService())->getCourseAll());
}
}