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('节点不存在'); } } }