Ejemplo n.º 1
0
 /**
  * 导入/导出 卡号列表
  */
 public function actionImportCard()
 {
     switch ($_GET['doaction']) {
         case 'card_reset':
             //重置为可用卡号
             $this->_utilFRGInterface = $this->_getGlobalData('Util_FRGInterface', 'object');
             $sendParams = Tools::getFilterRequestParam();
             $this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
             $this->_utilFRGInterface->setGet(array('c' => 'Card', 'a' => 'CardList', 'doaction' => 'CardReset'));
             $this->_utilFRGInterface->setPost($sendParams);
             $data = $this->_utilFRGInterface->callInterface();
             if ($data['msgno'] == 1) {
                 $this->_utilMsg->showMsg(Tools::getLang('REST_SUCCESS', __CLASS__), 1);
             } else {
                 $this->_utilMsg->showMsg($data['message'], -2);
             }
             break;
         case 'invalid_delete':
             //删除无效卡号
             $this->_utilFRGInterface = $this->_getGlobalData('Util_FRGInterface', 'object');
             $this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
             $this->_utilFRGInterface->setGet(array('c' => 'Card', 'a' => 'CardList', 'doaction' => 'delete'));
             $data = $this->_utilFRGInterface->callInterface();
             if ($data['msgno'] == 1) {
                 $this->_utilMsg->showMsg(Tools::getLang('CLEAR_SUCCESS', __CLASS__), 1);
             } else {
                 $this->_utilMsg->showMsg($data['message'], -2);
             }
             break;
         case 'export':
             //导出卡号列表
             set_time_limit(200);
             if (!$_REQUEST['server_id']) {
                 $this->_utilMsg->showMsg(Tools::getLang('PLEASE_SELECTSERVER', 'Common'));
             }
             $this->_utilFRGInterface = $this->_getGlobalData('Util_FRGInterface', 'object');
             $startTime = intval(strtotime($_POST['start']));
             $endTime = intval(strtotime($_POST['end']));
             $this->_utilFRGInterface->setServerUrl($_GET['server_id']);
             $this->_utilFRGInterface->setGet(array('c' => 'Card', 'a' => 'ImportCard', 'doaction' => 'export'));
             $this->_utilFRGInterface->setPost(array('type_id' => $_GET['type_id'], 'start' => $startTime, 'end' => $endTime));
             $data = $this->_utilFRGInterface->callInterface();
             if ($data) {
                 if ($data['msgno'] == 1) {
                     //输出excel
                     Tools::import('Util_ExportExcel');
                     $utilExportExcel = new Util_ExportExcel('card', 'Excel/LibaoCard', $data['params']);
                     $utilExportExcel->outPutExcel();
                 } else {
                     $this->_utilMsg->showMsg($data['message'], -2, 1);
                 }
             } else {
                 $this->_utilMsg->showMsg(Tools::getLang('CONNECT_SERVER_ERROR', 'Common'), -1);
             }
             break;
         default:
             //导入卡号动作
             if ($this->_isPost()) {
                 $this->_utilFRGInterface = $this->_getGlobalData('Util_FRGInterface', 'object');
                 $this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
                 $sendParams = Tools::getFilterRequestParam();
                 $this->_utilFRGInterface->setGet(array('c' => 'Card', 'a' => 'ImportCard'));
                 $this->_utilFRGInterface->setPost($sendParams);
                 $data = $this->_utilFRGInterface->callInterface();
                 if ($data) {
                     if ($data['msgno'] == 1) {
                         if ($data['backparams']) {
                             $msg = Tools::getLang('NOT_IMPORT_CARD', __CLASS__);
                             foreach ($data['backparams'] as $list) {
                                 $msg .= "<li>{$list}</li>";
                             }
                             $msg .= '</ul>';
                         }
                         $this->_utilMsg->showMsg($msg, 1, Tools::url(CONTROL, 'CardList', array('server_id' => $_REQUEST['server_id'])), null);
                     } else {
                         $this->_utilMsg->showMsg($data['message'], -2, Tools::url(CONTROL, ACTION, array('server_id' => $_REQUEST['server_id'])), null);
                     }
                 } else {
                     $this->_utilMsg->showMsg(Tools::getLang('CONNECT_SERVER_ERROR', 'Common'), -1);
                 }
             } else {
                 //导入卡号显示页面
                 $this->_createServerList();
                 $this->_utilFRGInterface = $this->_getGlobalData('Util_FRGInterface', 'object');
                 $this->_utilFRGInterface->setServerUrl($_REQUEST['server_id']);
                 $sendParams = Tools::getFilterRequestParam();
                 $this->_utilFRGInterface->setGet(array('c' => 'Card', 'a' => 'Create'));
                 $this->_utilFRGInterface->setPost($sendParams);
                 $data = $this->_utilFRGInterface->callInterface();
                 if ($data['data']['TypeData']) {
                     $this->_view->assign('cardList', json_encode($data['data']['TypeData']));
                 }
                 //卡类型
                 $this->_view->assign('systemTime', $data['data']['SYSTEM_TIME']);
                 if ($_GET['Id'] && $_GET['card_name']) {
                     $this->_view->assign('selectedLibao', array('Id' => $_GET['Id'], 'card_name' => $_GET['card_name']));
                 }
                 $this->_utilMsg->createNavBar();
                 $this->_view->display();
             }
     }
 }
Ejemplo n.º 2
0
 /**
  * 导出卡号
  */
 public function actionExport()
 {
     $this->_modelGoldCard = $this->_getGlobalData('Model_GoldCard', 'object');
     $dataList = $this->_modelGoldCard->getBatchNumData($_GET['batch_num']);
     Tools::import('Util_ExportExcel');
     $utilExportExcel = new Util_ExportExcel($_GET['batch_num'], 'Excel/GoldCard', $dataList);
     $utilExportExcel->outPutExcel();
 }