/**
  * 服务器统计页面
  */
 public function actionServerStats()
 {
     $this->_createServerList();
     if ($_REQUEST['server_id']) {
         $this->_utilFRGInterface = $this->_getGlobalData('Util_FRGInterface', 'object');
         $this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
         $this->_utilFRGInterface->setGet(array('c' => 'Index', 'a' => 'ServeSet', 'showaction' => 'UserLost'));
         $data = $this->_utilFRGInterface->callInterface();
         $this->_utilFRGInterface->clearGet();
         $this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
         $this->_utilFRGInterface->setGet(array('c' => 'Index', 'a' => 'ServeSet'));
         $onlineUser = $this->_utilFRGInterface->callInterface();
         $onlineUser = $onlineUser['data']['CheckList']['Online']['2'];
         $onlineUser = strip_tags($onlineUser);
         $this->_view->assign('onlineUserNum', $onlineUser);
         if ($data) {
             if ($data['data']['UserLostList']) {
                 ksort($data['data']['UserLostList']);
             } else {
                 $data['data']['UserLostList'] = array();
             }
             $UserLostList = $data['data']['UserLostList'];
             $FirstData = $UserLostList[1];
             for ($i = 1; $i <= count($UserLostList); $i++) {
                 $Data = $UserLostList[$i];
                 if ($i == 1 && $Data[1] == 0) {
                     break;
                 }
                 $PData = $i == 1 ? $Data : $UserLostList[$i - 1];
                 $UserLostList[$i]['data_0'] = $Data[2];
                 $UserLostList[$i]['data_1'] = $Data[1];
                 $UserLostList[$i]['data_2'] = ($PData[1] > 0 ? round(($PData[1] - $Data[1]) / $PData[1] * 100, 2) : 0) . '%';
                 $UserLostList[$i]['data_3'] = round(($FirstData[1] - $Data[1]) / $FirstData[1] * 100, 2) . '%';
                 if ($i == 1) {
                     $UserLostList[$i]['data_4'] = 0;
                     $UserLostList[$i]['data_5'] = 0;
                     $UserLostList[$i]['data_6'] = 0;
                 } else {
                     $UserLostList[$i]['data_4'] = !$data[3] && !$Data[1] ? 0 : $Data[3] / $Data[1];
                     $UserLostList[$i]['data_5'] = $Data[4];
                     $UserLostList[$i]['data_6'] = $Data[5];
                 }
             }
             $this->_view->assign('dataList', $UserLostList);
         } else {
             $this->_view->assign('errorConn', Tools::getLang('CONNECT_SERVER_ERROR', 'Common'));
         }
     }
     $this->_view->set_tpl(array('body' => self::PACKAGE . '/' . self::MASTER . '/ServerStats.html'));
     $this->_utilMsg->createPackageNavBar();
     $this->_view->display();
 }
 /**
  * 充值礼包管理
  */
 public function actionPayLibao()
 {
     switch ($_GET['doaction']) {
         case 'add':
             //增加
             if ($this->_isPost()) {
                 $_POST['ToolId'] = $_POST['Tool'];
                 $_POST['ToolIdName'] = $_POST['ToolName'];
                 $_POST['ToolIdImg'] = $_POST['ToolImg'];
                 unset($_POST['Tool'], $_POST['ToolName'], $_POST['ToolImg']);
                 $sendParams = Tools::getFilterRequestParam();
                 $this->_utilFRGInterface = $this->_getGlobalData('Util_FRGInterface', 'object');
                 $this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
                 $this->_utilFRGInterface->setGet(array('c' => 'Card', 'a' => 'PackageAdd', 'doaction' => 'Save'));
                 $this->_utilFRGInterface->setPost($sendParams);
                 $data = $this->_utilFRGInterface->callInterface();
                 if ($data) {
                     if ($data['msgno'] == 1) {
                         $this->_utilMsg->showMsg($data['message'], 1, Tools::url(CONTROL, ACTION, array('zp' => self::PACKAGE, 'server_id' => $_POST['server_id'])));
                     } else {
                         $this->_utilMsg->showMsg($data['message'], -2, 2);
                     }
                 } else {
                     $this->_utilMsg->showMsg($data['message'], -2);
                 }
             } else {
                 $this->_createServerList();
                 //					$this->_utilFRGInterface=$this->_getGlobalData('Util_FRGInterface','object');
                 //					$this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
                 //					$this->_utilFRGInterface->setGet(array('c'=>'Card','a'=>'PackageAdd'));
                 //					$data=$this->_utilFRGInterface->callInterface();
                 $this->_utilFRGInterface = $this->_getGlobalData('Util_FRGInterface', 'object');
                 $this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
                 //初始化连接url地址
                 $this->_utilFRGInterface->setGet(array('c' => 'Reward', 'a' => 'Add'));
                 $data = $this->_utilFRGInterface->callInterface();
                 if ($data) {
                     Tools::import('Util_FRGTools');
                     $this->_utilFRGTools = new Util_FRGTools($data['data']['ObjData'], $data['data']['ToolData'], $data['data']['ObjProp']);
                     $this->_view->assign('objData', json_encode($data['data']['ObjData']));
                     $this->_view->assign('toolData', json_encode($data['data']['ToolData']));
                     $this->_view->assign('effData', json_encode($this->_utilFRGTools->get_effData()));
                     $this->_view->assign('systemTime', $data['data']['SYSTEM_TIME']);
                 }
                 $this->_utilMsg->createPackageNavBar();
                 $this->_view->set_tpl(array('body' => 'HaiDao/HaiDaoMaster/PayLibaoAdd.html'));
                 $this->_view->display();
             }
             break;
         case 'edit':
             //编辑
             if ($this->_isPost()) {
                 $_POST['ToolId'] = $_POST['Tool'];
                 $_POST['ToolIdName'] = $_POST['ToolName'];
                 $_POST['ToolIdImg'] = $_POST['ToolImg'];
                 unset($_POST['Tool'], $_POST['ToolName'], $_POST['ToolImg']);
                 $sendParams = Tools::getFilterRequestParam();
                 $this->_utilFRGInterface = $this->_getGlobalData('Util_FRGInterface', 'object');
                 $this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
                 $this->_utilFRGInterface->setGet(array('c' => 'Card', 'a' => 'PackageAdd', 'doaction' => 'Save'));
                 $this->_utilFRGInterface->setPost($sendParams);
                 $data = $this->_utilFRGInterface->callInterface();
                 if ($data) {
                     if ($data['msgno'] == 1) {
                         $this->_utilMsg->showMsg($data['message'], 1, Tools::url(CONTROL, ACTION, array('zp' => self::PACKAGE, 'server_id' => $_POST['server_id'])));
                     } else {
                         $this->_utilMsg->showMsg($data['message'], -2, 2);
                     }
                 } else {
                     $this->_utilMsg->showMsg(Tools::getLang('CONNECT_SERVER_ERROR', 'Common'), -2);
                 }
             } else {
                 $this->_createServerList();
                 $this->_utilFRGInterface = $this->_getGlobalData('Util_FRGInterface', 'object');
                 $this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
                 $this->_utilFRGInterface->setGet(array('c' => 'Card', 'a' => 'PackageAdd', 'Id' => $_GET['Id']));
                 $data = $this->_utilFRGInterface->callInterface();
                 if ($data) {
                     Tools::import('Util_FRGTools');
                     $this->_utilFrgTools = new Util_FRGTools($data['data']['ObjData'], $data['data']['ToolData'], $data['data']['ObjProp']);
                     $this->_view->assign('objData', json_encode($this->_utilFrgTools->get_objData()));
                     $this->_view->assign('toolData', json_encode($this->_utilFrgTools->get_toolData()));
                     $this->_view->assign('effData', json_encode($this->_utilFrgTools->get_effData()));
                     $this->_view->assign('data', $data['data']['Reward']);
                     $this->_utilFrgTools->setEditResult($data['data']['Reward']);
                     $dataResult = $this->_utilFrgTools->getEditResult();
                     $this->_view->assign('chageCond', $dataResult['chageCond']);
                     $this->_view->assign('chageEffect', $dataResult['chageEffect']);
                     $this->_view->assign('chageTool', $dataResult['chageTool']);
                     $this->_view->assign('num', $this->_utilFrgTools->getEditNum());
                     $this->_view->assign('systemTime', $data['data']['SYSTEM_TIME']);
                     $this->_view->assign('timesDetail', $data['data']['Reward']['TimesDetail']);
                 }
                 $this->_utilMsg->createPackageNavBar();
                 $this->_view->set_tpl(array('body' => 'HaiDao/HaiDaoMaster/PayLibaoEdit.html'));
                 $this->_view->assign('systemTime', $data['data']['SYSTEM_TIME']);
                 $this->_view->display();
             }
             break;
         case 'del':
             $this->_utilFRGInterface = $this->_getGlobalData('Util_FRGInterface', 'object');
             $sendParams = Tools::getFilterRequestParam();
             $this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
             $this->_utilFRGInterface->setGet(array('c' => 'Card', 'a' => 'PackageList', 'doaction' => 'delete'));
             $this->_utilFRGInterface->setPost($sendParams);
             $data = $this->_utilFRGInterface->callInterface();
             if ($data) {
                 if ($data['msgno'] == 1) {
                     $this->_utilMsg->showMsg($data['message'], 1, Tools::url(CONTROL, ACTION, array('zp' => self::PACKAGE, 'server_id' => $_POST['server_id'])));
                 } else {
                     $this->_utilMsg->showMsg($data['message'], -2, 1);
                 }
             } else {
                 $this->_utilMsg->showMsg(Tools::getLang('CONNECT_SERVER_ERROR', 'Common'), -2);
             }
             break;
         case 'proportion':
             //比例设置
             if ($this->_isPost()) {
                 Tools::import('Util_FRGInterface');
                 if ($_POST['subaction'] == 'set_count') {
                     $this->_utilFRGInterface = new Util_FRGInterface();
                     $this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
                     $sendParams = Tools::getFilterRequestParam();
                     $this->_utilFRGInterface->setGet(array('c' => 'Conf', 'a' => 'vartype', 'doaction' => 'saveadd'));
                     $this->_utilFRGInterface->setPost($sendParams);
                     $data = $this->_utilFRGInterface->callInterface();
                     if ($data) {
                         if ($data['msgno'] == 1) {
                             $this->_utilMsg->showMsg($data['message'], 1);
                         } else {
                             $this->_utilMsg->showMsg($data['message'], -2, 2);
                         }
                     } else {
                         $this->_utilMsg->showMsg(Tools::getLang('CONNECT_SERVER_ERROR', 'Common'), -2);
                     }
                 } else {
                     $this->_utilFRGInterface = new Util_FRGInterface();
                     $this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
                     $sendParams = Tools::getFilterRequestParam();
                     $this->_utilFRGInterface->setGet(array('c' => 'Conf', 'a' => 'vartype', 'doaction' => 'saveedit', 'CatId' => 1));
                     $this->_utilFRGInterface->setPost($sendParams);
                     $data = $this->_utilFRGInterface->callInterface();
                     if ($data) {
                         if ($data['msgno'] == 1) {
                             $this->_utilMsg->showMsg($data['message'], 1);
                         } else {
                             $this->_utilMsg->showMsg($data['message'], -2, 2);
                         }
                     } else {
                         $this->_utilMsg->showMsg(Tools::getLang('CONNECT_SERVER_ERROR', 'Common'), -2);
                     }
                 }
             } else {
                 $this->_createServerList();
                 Tools::import('Util_FRGInterface');
                 $this->_utilFRGInterface = new Util_FRGInterface();
                 $this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
                 $this->_utilFRGInterface->setGet(array('c' => 'Conf', 'a' => 'vartype', 'showaction' => 'edit', 'CatId' => 1));
                 $data = $this->_utilFRGInterface->callInterface();
                 $arrarCount = $data['data']['SystemVars']['247']['ArrayCount'];
                 $var = $data['data']['SystemVars']['247']['VarValue'];
                 $payProportion = array();
                 for ($i = 0; $i < $arrarCount; $i++) {
                     $key = $var[$i][0] ? $var[$i][0] : $i;
                     $payProportion[$key] = $var[$i][1] ? $var[$i][1] : $i;
                 }
                 $this->_view->assign('payProportion', $payProportion);
                 $this->_utilFRGInterface->clearGet();
                 $this->_utilFRGInterface->setGet(array('c' => 'Conf', 'a' => 'vartype', 'showaction' => 'addvar', 'VarName' => 'DepositRatio'));
                 $num = $this->_utilFRGInterface->callInterface();
                 $this->_view->assign('num', $num['data']['ConfVar']);
                 $this->_utilMsg->createPackageNavBar();
                 $this->_view->set_tpl(array('body' => 'HaiDao/HaiDaoMaster/PayLibaoProportion.html'));
                 $this->_view->display();
                 break;
             }
         case 'serverSyn':
             $this->_payLibaoServerSyn();
             return;
         default:
             $this->_createServerList();
             if ($_REQUEST['server_id']) {
                 $this->_utilFRGInterface = $this->_getGlobalData('Util_FRGInterface', 'object');
                 $this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
                 $this->_utilFRGInterface->setGet(array('c' => 'Card', 'a' => 'PackageList'));
                 $data = $this->_utilFRGInterface->callInterface();
                 if ($data) {
                     if ($data['data']['Data']) {
                         foreach ($data['data']['Data'] as &$list) {
                             $list['url_edit'] = Tools::url(CONTROL, ACTION, array('zp' => self::PACKAGE, 'doaction' => 'edit', 'Id' => $list['Id'], 'server_id' => $_REQUEST['server_id']));
                         }
                         $this->_view->assign('dataList', $data['data']['Data']);
                     }
                 } else {
                     $this->_view->assign('errorConn', Tools::getLang('CONNECT_SERVER_ERROR', 'Common'));
                 }
             }
             $this->_utilMsg->createPackageNavBar();
             $this->_view->display();
     }
 }