mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
T10: TimerConfig CURD - task management with run_type/status editing,
manual trigger button, task_name read-only, no add/delete
T11: TimerLog CURD - read-only log viewer with filters and color badges
T12: Host list enhanced - is_master column, setMaster button
46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace base\admin\controller\system;
|
|
|
|
use app\admin\service\annotation\ControllerAnnotation;
|
|
use app\common\controller\AdminController;
|
|
use think\App;
|
|
|
|
/**
|
|
* @ControllerAnnotation(title="system_host")
|
|
*/
|
|
class HostBase extends AdminController
|
|
{
|
|
use \app\admin\traits\Curd;
|
|
|
|
public function __construct(App $app)
|
|
{
|
|
parent::__construct($app);
|
|
|
|
$this->model = new \app\admin\model\SystemHost();
|
|
|
|
$this->assign('select_list_status', $this->model::SELECT_LIST_STATUS, true);
|
|
$this->assign('select_list_is_master', $this->model::SELECT_LIST_IS_MASTER, true);
|
|
}
|
|
|
|
/**
|
|
* 设置主节点.
|
|
*
|
|
* @auth true
|
|
*/
|
|
public function setMaster()
|
|
{
|
|
$nodeId = $this->request->param('node_id', '');
|
|
if (empty($nodeId)) {
|
|
$this->error('参数错误');
|
|
}
|
|
|
|
$result = \app\common\service\HostService::setMasterNode($nodeId);
|
|
if ($result) {
|
|
$this->success('主节点切换成功');
|
|
} else {
|
|
$this->error('节点不存在');
|
|
}
|
|
}
|
|
}
|