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

108 lines
3.0 KiB

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\course;
use core\base\BaseAdminController;
use app\service\admin\course\CourseService;
/**
* 课程控制器
* Class Course
* @package app\adminapi\controller\course
*/
class Course extends BaseAdminController
{
/**
* 获取课程列表
* @return \think\Response
*/
public function lists(){
$data = $this->request->params([
["course_name",""],
["course_type",""],
["duration",""],
["session_count",""],
["single_session_count",""],
["price",""],
["internal_reminder",""],
["customer_reminder",""],
["remarks",""]
]);
return success((new CourseService())->getPage($data));
}
/**
* 课程详情
* @param int $id
* @return \think\Response
*/
public function info(int $id){
return success((new CourseService())->getInfo($id));
}
/**
* 添加课程
* @return \think\Response
*/
public function add(){
$data = $this->request->params([
["course_name",""],
["course_type",""],
["duration",0],
["session_count",0],
["single_session_count",0],
["price",0.00],
["internal_reminder",0],
["customer_reminder",0],
["remarks",""],
]);
$this->validate($data, 'app\validate\course\Course.add');
$id = (new CourseService())->add($data);
return success('ADD_SUCCESS', ['id' => $id]);
}
/**
* 课程编辑
* @param $id 课程id
* @return \think\Response
*/
public function edit(int $id){
$data = $this->request->params([
["course_name",""],
["course_type",""],
["duration",0],
["session_count",0],
["single_session_count",0],
["price",0.00],
["internal_reminder",0],
["customer_reminder",0],
["remarks",""],
]);
$this->validate($data, 'app\validate\course\Course.edit');
(new CourseService())->edit($id, $data);
return success('EDIT_SUCCESS');
}
/**
* 课程删除
* @param $id 课程id
* @return \think\Response
*/
public function del(int $id){
(new CourseService())->del($id);
return success('DELETE_SUCCESS');
}
}