Ejemplo n.º 1
0
 /**
  * 数据统计 
  */
 public function actionData()
 {
     // 		ini_set("display_errors", "On");
     // 		error_reporting(E_ALL | E_STRICT);
     $this->_modelUser = $this->_getGlobalData('Model_User', 'object');
     $orgList = $this->_getGlobalData('org');
     $allOrgUser = $this->_modelUser->findSetOrgByUser();
     $gameTypes = $this->_getGlobalData('game_type');
     $gameTypes = Model::getTtwoArrConvertOneArr($gameTypes, 'Id', 'name');
     $this->_view->assign('game_type', $gameTypes);
     $utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $operators = $utilRbac->getOperatorActList();
     //个人授权可操作的运营商
     $this->_view->assign('operators', $operators);
     foreach ($orgList as &$value) {
         $curOrgUser = $this->_modelUser->findByOrgId($value['Id']);
         if ($curOrgUser) {
             $curOrgUser = Model::getTtwoArrConvertOneArr($curOrgUser, 'Id', 'nick_name');
             $value['user'] = $curOrgUser;
         }
     }
     $this->_view->assign('orgList', $orgList);
     if ($this->_isPost()) {
         @ini_set('memory_limit', '512M');
         if (count($_POST['check_users']) && $_POST['start_date'] && $_POST['end_date'] && count($_POST['operator_id'])) {
             //必须保证有搜索项而且还选择了用户才会开开始搜索
             $date = array();
             $this->_view->assign('selectedTime', array('start' => $_POST['start_date'], 'end' => $_POST['end_date']));
             $this->_view->assign('selectedUsers', $_POST['check_users']);
             $date['start'] = strtotime($_POST['start_date']);
             //开始时间
             $date['end'] = strtotime($_POST['end_date']);
             //结束时间
             if ($date['start'] > $date['end']) {
                 $this->_utilMsg->showMsg('开始时间不能大于结束时间', -2);
             }
             $this->_modelWorkOrder = $this->_getGlobalData('Model_WorkOrder', 'object');
             $statusList = $this->_modelWorkOrder->statsDetail(array('start' => strtotime($_POST['start_date']), 'end' => strtotime($_POST['end_date'])), $_POST['check_users'], $_POST['game_type'], $_POST['operator_id']);
             $this->_view->assign('dataList', $statusList);
             $this->_view->assign('users', $this->_getGlobalData('user_index_id'));
         } else {
             $this->_utilMsg->showMsg('请选择时间,用户,运营商', -2);
         }
     }
     $this->_utilMsg->createPackageNavBar();
     if ($_POST['xls']) {
         Tools::import('Util_ExportExcel');
         $this->_utilExportExcel = new Util_ExportExcel('用户详细统计', 'Excel/StatsUser', $statusList);
         $this->_utilExportExcel->outPutExcel();
     } else {
         $this->_view->display();
     }
 }