data_center/app/adminapi/controller/systems/SystemController.php

55 lines
1.6 KiB
PHP

<?php
namespace app\adminapi\controller\systems;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\systems\SystemLists;
use app\adminapi\logic\systems\SystemLogic;
use app\common\validate\systems\SystemValidate;
use think\response\Json;
class SystemController extends BaseAdminController
{
// 子系统列表
public function lists(): Json
{
return $this->dataLists(new SystemLists());
}
//新增子系统
public function add(): Json
{
$params = (new SystemValidate())->post()->goCheck('add');
$result = SystemLogic::add($params);
return $result ? $this->success('添加成功', [], 1, 1) : $this->fail(SystemLogic::getError());
}
//删除子系统
public function delete(): Json
{
$params = (new SystemValidate())->post()->goCheck('delete');
$result = SystemLogic::delete($params);
if (true === $result) {
return $this->success('删除成功', [], 1, 1);
}
return $this->fail(SystemLogic::getError());
}
// 修改子系统
public function edit(): Json
{
$params = (new SystemValidate())->post()->goCheck('edit');
$result = SystemLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(SystemLogic::getError());
}
// 子系统详情
public function detail(): Json
{
$params = (new SystemValidate())->goCheck('detail');
$result = SystemLogic::detail($params);
return $this->data($result);
}
}