/** * 编辑服务器 */ private function _edit() { if ($this->_isPost()) { $updateArr = array('send_msg_url' => $_POST['send_msg_url'], 'game_type_id' => $_POST['game_type'], 'operator_id' => $_POST['operator_id'], 'server_name' => $_POST['server_name'], 'server_url' => $_POST['server_url']); if ($_POST['modify_mark']) { $this->_utilApiSftx = $this->_getGlobalData('Util_ApiSftx', 'object'); $getArr = array('ctl' => 'serverIdentify', 'act' => 'save'); $postArr = array('identify' => $_POST['marking'], 'url' => $_POST['server_url']); $this->_utilApiSftx->addHttp($_POST['Id'], $getArr, $postArr); $this->_utilApiSftx->send(); $result = $this->_utilApiSftx->getResult(); if ($result['status'] == 1) { $updateArr['marking'] = $_POST['marking']; } else { $msg = $result['info']; } } if ($this->_modelGameSerList->update($updateArr, "Id={$_POST['Id']}")) { $this->_utilMsg->showMsg('成功.但' . $msg, 1, Tools::url(CONTROL, ACTION)); } else { $this->_utilMsg->showMsg('更新失败', -2); } } else { $data = $this->_modelGameSerList->findById($_GET['Id'], false); $gameTypeList = Model::getTtwoArrConvertOneArr($this->_modelSysconfig->getValueToCache('game_type'), 'Id', 'name'); $operatorList = $this->_modelOperatorList->findAll(); $operatorList = Model::getTtwoArrConvertOneArr($operatorList, 'Id', 'operator_name'); $this->_view->assign('data', $data); $this->_view->assign('operatorList', $operatorList); $this->_view->assign('gameTypeList', $gameTypeList); $this->_utilMsg->createNavBar(); $this->_view->set_tpl(array('body' => 'GameSerList/Edit.html')); $this->_view->display(); } }
/** * 编辑服务器 */ private function _edit() { if ($this->_isPost()) { //处理需要数据库信息的服务器 $ext = array('db_host' => trim($_POST['db_host']), 'db_name' => trim($_POST['db_name']), 'db_user' => trim($_POST['db_user']), 'db_pwd' => trim($_POST['db_pwd']), 'db_port' => trim($_POST['db_port'])); foreach ($ext as $key => $value) { if (!$value) { unset($ext[$key]); } } $data = array('game_type_id' => intval($_POST['game_type']), 'operator_id' => intval($_POST['operator_id']), 'ordinal' => intval($_POST['ordinal']), 'server_name' => trim($_POST['server_name']), 'marking' => trim($_POST['marking']), 'server_url' => trim($_POST['server_url']), 'time_zone' => trim($_POST['time_zone']), 'timezone' => trim($_POST['timezone']), 'timer' => intval($_POST['timer']), 'data_url' => trim($_POST['data_url'])); if ($ext) { $data['ext'] = serialize($ext); } if ($this->_modelGameSerList->update($data, "Id={$_POST['Id']}")) { $this->_utilMsg->showMsg(Tools::getLang('UPDATE_SUCCESS', 'Common'), 1, Tools::url(CONTROL, ACTION)); } else { $this->_utilMsg->showMsg(Tools::getLang('UPDATE_ERROR', 'Common'), -2); } } else { $data = $this->_modelGameSerList->findById($_GET['Id'], false); $gameTypeList = Model::getTtwoArrConvertOneArr($this->_modelSysconfig->getValueToCache('game_type'), 'Id', 'name'); $operatorList = $this->_modelOperatorList->findAll(); $operatorList = Model::getTtwoArrConvertOneArr($operatorList, 'Id', 'operator_name'); $data['ext'] = unserialize($data['ext']); $this->_view->assign('data', $data); $this->_view->assign('operatorList', $operatorList); $this->_view->assign('gameTypeList', $gameTypeList); $timer = array('0' => '关闭', '1' => '开启'); $this->_view->assign('timer', $timer); $this->_utilMsg->createNavBar(); $this->_view->set_tpl(array('body' => 'GameSerList/Edit.html')); $this->_view->display(); } }
/** * 删除房间内的指定服务器 */ private function _delServer() { if ($_POST['server_list'] && $this->_isPost()) { $this->_modelGameSerList = $this->_getGlobalData('Model_GameSerList', 'object'); $updateServer = implode(',', $_POST['server_list']); if ($this->_modelGameSerList->update(array('room_id' => '0'), "Id in ({$updateServer})")) { $this->_modelGameSerList->createToCache(); $this->_utilMsg->showMsg(Tools::getLang('DEL_SUCESS', 'Common')); } else { $this->_utilMsg->showMsg(Tools::getLang('DEL_ERROR', 'Common'), -2); } } }
/** * 删除房间内的指定服务器 */ private function _delServer() { if ($_POST['server_list'] && $this->_isPost()) { $this->_modelGameSerList = $this->_getGlobalData('Model_GameSerList', 'object'); $updateServer = implode(',', $_POST['server_list']); if ($this->_modelGameSerList->update(array('room_id' => '0'), "Id in ({$updateServer})")) { $this->_modelGameSerList->createToCache(); $this->_utilMsg->showMsg('删除指定服务器列表成功'); } else { $this->_utilMsg->showMsg('删除指定服务器列表失败.', -2); } } }