Ejemplo n.º 1
0
 private function _operatorInfoAdd()
 {
     $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' => '对方');
     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';
         $AddData = Tools::fieldFilter($NeedField, $_POST);
         $this->_modelLyOperatorInfo = $this->_getGlobalData('Model_LyOperatorInfo', 'object');
         if ($this->_modelLyOperatorInfo->add($AddData)) {
             $this->_utilMsg->showMsg('添加成功', 1, $this->_url['operator_info'], 1);
         } else {
             $this->_utilMsg->showMsg('添加失败', -1);
         }
     }
     $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();
 }