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.
107 lines
3.1 KiB
107 lines
3.1 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace addon\zhjw\app\adminapi\controller\courses;
|
|
|
|
use core\base\BaseAdminController;
|
|
use addon\zhjw\app\service\admin\courses\CoursesService;
|
|
|
|
|
|
/**
|
|
* 课程管理控制器
|
|
* Class Courses
|
|
* @package addon\zhjw\app\adminapi\controller\courses
|
|
*/
|
|
class Courses extends BaseAdminController
|
|
{
|
|
/**
|
|
* 获取课程管理列表
|
|
* @return \think\Response
|
|
*/
|
|
public function lists(){
|
|
$data = $this->request->params([
|
|
["name",""],
|
|
["description",""],
|
|
["target_group",""],
|
|
["taste_price",""],
|
|
["price",""],
|
|
["is_automatic_signing",""],
|
|
["status",""]
|
|
]);
|
|
return success((new CoursesService())->getPage($data));
|
|
}
|
|
|
|
/**
|
|
* 课程管理详情
|
|
* @param int $id
|
|
* @return \think\Response
|
|
*/
|
|
public function info(int $id){
|
|
return success((new CoursesService())->getInfo($id));
|
|
}
|
|
|
|
/**
|
|
* 添加课程管理
|
|
* @return \think\Response
|
|
*/
|
|
public function add(){
|
|
$data = $this->request->params([
|
|
["name",""],
|
|
["description",""],
|
|
["thumbnail",""],
|
|
["target_group",""],
|
|
["duration",""],
|
|
["taste_price",0.00],
|
|
["price",0.00],
|
|
["is_automatic_signing",""],
|
|
["automatic_signing_time",0],
|
|
["status",""]
|
|
]);
|
|
$this->validate($data, 'addon\zhjw\app\validate\courses\Courses.add');
|
|
$id = (new CoursesService())->add($data);
|
|
return success('ADD_SUCCESS', ['id' => $id]);
|
|
}
|
|
|
|
/**
|
|
* 课程管理编辑
|
|
* @param $id 课程管理id
|
|
* @return \think\Response
|
|
*/
|
|
public function edit(int $id){
|
|
$data = $this->request->params([
|
|
["name",""],
|
|
["description",""],
|
|
["thumbnail",""],
|
|
["target_group",""],
|
|
["duration",""],
|
|
["taste_price",0.00],
|
|
["price",0.00],
|
|
["is_automatic_signing",""],
|
|
["automatic_signing_time",0],
|
|
["status",""]
|
|
]);
|
|
$this->validate($data, 'addon\zhjw\app\validate\courses\Courses.edit');
|
|
(new CoursesService())->edit($id, $data);
|
|
return success('EDIT_SUCCESS');
|
|
}
|
|
|
|
/**
|
|
* 课程管理删除
|
|
* @param $id 课程管理id
|
|
* @return \think\Response
|
|
*/
|
|
public function del(int $id){
|
|
(new CoursesService())->del($id);
|
|
return success('DELETE_SUCCESS');
|
|
}
|
|
|
|
|
|
}
|
|
|