Example #1
0
 public function actionOperatorInfoMini()
 {
     $_GET['page'] = intval(max(1, $_GET['page']));
     $gameTypes = $this->_getGlobalData('game_type');
     $gameTypes = Model::getTtwoArrConvertOneArr($gameTypes, 'Id', 'name');
     $gameTypes[0] = '全部';
     $operators = $this->_getGlobalData('operator_list');
     $operators = Model::getTtwoArrConvertOneArr($operators, 'Id', 'operator_name');
     //谁出客服
     $CsSupply = array('0' => '我方', '1' => '对方');
     //谁出服务器
     $ServerSupply = array('0' => '我方', '1' => '对方');
     $this->_modelLyOperatorInfo = $this->_getGlobalData('Model_LyOperatorInfo', 'object');
     $this->_loadCore('Help_SqlSearch');
     $helpSqlSearch = new Help_SqlSearch();
     $helpSqlSearch->set_tableName($this->_modelLyOperatorInfo->tName());
     $_GET['game_type_id'] = intval($_GET['game_type_id']);
     if ($_GET['game_type_id'] > 0) {
         $helpSqlSearch->set_conditions("game_type_id={$_GET['game_type_id']}");
     }
     //《--选择
     $selected['game_type_id'] = $_GET['game_type_id'];
     //选择--》
     $helpSqlSearch->set_orderBy('Id desc');
     $helpSqlSearch->setPageLimit($_GET['page'], PAGE_SIZE);
     $sql = $helpSqlSearch->createSql();
     $dataList = $this->_modelLyOperatorInfo->select($sql);
     $urlLenLimit = 25;
     foreach ($dataList as &$value) {
         $value['game_type_id'] = isset($gameTypes[$value['game_type_id']]) ? $gameTypes[$value['game_type_id']] : '-';
         $value['operator_id'] = isset($operators[$value['operator_id']]) ? $operators[$value['operator_id']] : '-';
         $value['cs_supply'] = isset($CsSupply[$value['cs_supply']]) ? $CsSupply[$value['cs_supply']] : '-';
         $value['server_supply'] = isset($ServerSupply[$value['server_supply']]) ? $ServerSupply[$value['server_supply']] : '-';
         $value['website_url_show'] = strlen($value['website_url']) > $urlLenLimit ? substr($value['website_url'], 0, $urlLenLimit) . '...' : $value['website_url'];
         $value['forum_url_show'] = strlen($value['forum_url']) > $urlLenLimit ? substr($value['forum_url'], 0, $urlLenLimit) . '...' : $value['forum_url'];
         $value['datum_url_show'] = strlen($value['datum_url']) > $urlLenLimit ? substr($value['datum_url'], 0, $urlLenLimit) . '...' : $value['datum_url'];
     }
     $conditions = $helpSqlSearch->get_conditions();
     $total = $this->_modelLyOperatorInfo->findCount($conditions);
     $this->_loadCore('Help_Page');
     $helpPage = new Help_Page(array('total' => $total, 'perpage' => PAGE_SIZE));
     $this->_view->assign('pageBox', $helpPage->show());
     $this->_view->assign('dataList', $dataList);
     $this->_view->assign('game_type_id', $gameTypes);
     $this->_view->assign('selected', $selected);
     $this->_utilMsg->createPackageNavBar();
     $this->_view->display();
 }
Example #2
0
 private function _operatorInfoEdit()
 {
     $gameTypes = $this->_getGlobalData('game_type');
     $gameTypes = Model::getTtwoArrConvertOneArr($gameTypes, 'Id', 'name');
     $operators = $this->_getGlobalData('operator_list');
     $operators = Model::getTtwoArrConvertOneArr($operators, 'Id', 'operator_name');
     //谁出客服
     $CsSupply = array('0' => '我方', '1' => '对方');
     //谁出服务器
     $ServerSupply = array('0' => '我方', '1' => '对方');
     $this->_modelLyOperatorInfo = $this->_getGlobalData('Model_LyOperatorInfo', 'object');
     if ($this->_isPost()) {
         if (!array_key_exists($_POST['game_type_id'], $gameTypes)) {
             $this->_utilMsg->showMsg('所选游戏不存在', -1);
         }
         if (!array_key_exists($_POST['operator_id'], $operators)) {
             $this->_utilMsg->showMsg('所选运营商不存在', -1);
         }
         if (!array_key_exists($_POST['cs_supply'], $CsSupply)) {
             $this->_utilMsg->showMsg('所选客服不存在', -1);
         }
         if (!array_key_exists($_POST['server_supply'], $ServerSupply)) {
             $this->_utilMsg->showMsg('所选服务器不存在', -1);
         }
         if ('' == trim($_POST['marking'])) {
             $this->_utilMsg->showMsg('标识必须', -1);
         }
         if ('' == trim($_POST['company_name'])) {
             $this->_utilMsg->showMsg('标识必须', -1);
         }
         $NeedField = 'game_type_id,operator_id,marking,company_name,cs_supply,server_supply,qq_group,website_url,forum_url,datum_url,principal,coupling';
         $UpdateData = Tools::fieldFilter($NeedField, $_POST);
         if ($this->_modelLyOperatorInfo->update($UpdateData, "Id = {$_GET['Id']}")) {
             $this->_utilMsg->showMsg('修改成功', 1, $this->_url['operator_info'], 1);
         } else {
             $this->_utilMsg->showMsg('修改失败', -1);
         }
     }
     $data = $this->_modelLyOperatorInfo->findById($_GET['Id']);
     $this->_view->assign('data', $data);
     $this->_view->assign('game_type_id', $gameTypes);
     $this->_view->assign('operator_id', $operators);
     $this->_view->assign('cs_supply', $CsSupply);
     $this->_view->assign('server_supply', $ServerSupply);
     $this->_utilMsg->createPackageNavBar();
     $this->_view->display();
 }