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