/** * 运营商列表 */ private function _index() { $operatorList = $this->_modelOperatorList->findAll(false); foreach ($operatorList as &$value) { $value['url_edit'] = Tools::url(CONTROL, ACTION, array('Id' => $value['Id'], 'doaction' => 'edit')); $value['url_del'] = Tools::url(CONTROL, ACTION, array('Id' => $value['Id'], 'doaction' => 'del')); } $this->_view->assign('dataList', $operatorList); $this->_utilMsg->createNavBar(); $this->_view->set_tpl(array('body' => 'GameOperator/Index.html')); $this->_view->display(); }
/** * 添加服务器 */ private function _add() { if ($this->_isPost()) { if ($_POST['batch_add']) { $start = Tools::coerceInt($_POST['start']); $end = Tools::coerceInt($_POST['end']); $addArrs = array(); for ($i = $start; $i <= $end; $i++) { $addArrs[$i] = array('game_type_id' => intval($_POST['game_type']), 'operator_id' => intval($_POST['operator_id']), 'ordinal' => $i, 'server_name' => str_replace('{$var}', $i, $_POST['server_name']), 'marking' => str_replace('{$var}', $i, $_POST['marking']), 'server_url' => str_replace('{$var}', $i, $_POST['server_url']), 'timezone' => trim($_POST['timezone']), 'time_zone' => trim($_POST['time_zone']), 'timer' => intval($_POST['timer']), 'data_url' => str_replace('{$var}', $i, $_POST['data_url'])); } $reuslt = $this->_modelGameSerList->adds($addArrs); } else { $addArr = 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']), 'timezone' => trim($_POST['timezone']), 'time_zone' => trim($_POST['time_zone']), 'timer' => intval($_POST['timer']), 'data_url' => trim($_POST['data_url'])); $reuslt = $this->_modelGameSerList->add($addArr); } if ($reuslt) { $this->_utilMsg->showMsg(Tools::getLang('ADD_SUCCESS', 'Common'), 1, Tools::url(CONTROL, ACTION)); } else { $this->_utilMsg->showMsg(Tools::getLang('ADD_ERROR', 'Common'), -2); } } else { $gameTypeList = Model::getTtwoArrConvertOneArr($this->_modelSysconfig->getValueToCache('game_type'), 'Id', 'name'); $operatorList = $this->_modelOperatorList->findAll(); $operatorList = Model::getTtwoArrConvertOneArr($operatorList, 'Id', 'operator_name'); $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/Add.html')); $this->_view->display(); } }
/** * 添加服务器 */ private function _add() { if ($this->_isPost()) { $addArr = array('game_type_id' => $_POST['game_type'], 'operator_id' => $_POST['operator_id'], 'server_name' => $_POST['server_name'], 'marking' => $_POST['marking'], 'server_url' => $_POST['server_url'], 'send_msg_url' => $_POST['send_msg_url']); if ($this->_modelGameSerList->add($addArr)) { $this->_utilMsg->showMsg('添加成功', 1, Tools::url(CONTROL, ACTION)); } else { $this->_utilMsg->showMsg('添加失败', -2); } } else { $gameTypeList = Model::getTtwoArrConvertOneArr($this->_modelSysconfig->getValueToCache('game_type'), 'Id', 'name'); $operatorList = $this->_modelOperatorList->findAll(); $operatorList = Model::getTtwoArrConvertOneArr($operatorList, 'Id', 'operator_name'); $this->_view->assign('operatorList', $operatorList); $this->_view->assign('gameTypeList', $gameTypeList); $this->_utilMsg->createNavBar(); $this->_view->set_tpl(array('body' => 'GameSerList/Add.html')); $this->_view->display(); } }