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.
105 lines
2.8 KiB
105 lines
2.8 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\adminapi\controller\venue;
|
|
|
|
use core\base\BaseAdminController;
|
|
use app\service\admin\venue\VenueService;
|
|
|
|
|
|
/**
|
|
* 场地控制器
|
|
* Class Venue
|
|
* @package app\adminapi\controller\venue
|
|
*/
|
|
class Venue extends BaseAdminController
|
|
{
|
|
/**
|
|
* 获取场地列表
|
|
* @return \think\Response
|
|
*/
|
|
public function lists(){
|
|
$data = $this->request->params([
|
|
["campus_id",""],
|
|
["venue_name",""],
|
|
["capacity",""],
|
|
["availability_status",""],
|
|
["time_range_type",""],
|
|
["created_at",""],
|
|
["updated_at",""]
|
|
]);
|
|
return success((new VenueService())->getPage($data));
|
|
}
|
|
|
|
/**
|
|
* 场地详情
|
|
* @param int $id
|
|
* @return \think\Response
|
|
*/
|
|
public function info(int $id){
|
|
return success((new VenueService())->getInfo($id));
|
|
}
|
|
|
|
/**
|
|
* 添加场地
|
|
* @return \think\Response
|
|
*/
|
|
public function add(){
|
|
$data = $this->request->params([
|
|
["campus_id",0],
|
|
["venue_name",""],
|
|
["capacity",0],
|
|
["availability_status",0],
|
|
["time_range_type",""],
|
|
["fixed_time_ranges",""],
|
|
|
|
]);
|
|
$this->validate($data, 'app\validate\venue\Venue.add');
|
|
$id = (new VenueService())->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_name",""],
|
|
["capacity",0],
|
|
["availability_status",0],
|
|
["time_range_type",""],
|
|
["fixed_time_ranges",""],
|
|
|
|
]);
|
|
$this->validate($data, 'app\validate\venue\Venue.edit');
|
|
(new VenueService())->edit($id, $data);
|
|
return success('EDIT_SUCCESS');
|
|
}
|
|
|
|
/**
|
|
* 场地删除
|
|
* @param $id 场地id
|
|
* @return \think\Response
|
|
*/
|
|
public function del(int $id){
|
|
(new VenueService())->del($id);
|
|
return success('DELETE_SUCCESS');
|
|
}
|
|
|
|
|
|
public function getCampusAll(){
|
|
return success(( new VenueService())->getCampusAll());
|
|
}
|
|
|
|
}
|
|
|