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