コード例 #1
0
 public function sendStatusAction()
 {
     $oPermission = new Config_Permission();
     $oApp = new Config_App();
     $oServer = new Config_Server();
     $oPartnerApp = new Config_Partner_App();
     $oPartner = new Config_Partner();
     $oArea = new Config_Area();
     //获取用户可以查看的游戏列表
     $permitted_app = $oPermission->getApp($this->manager->data_groups, 'AppId,name');
     //预处理地区信息
     $AreaList = $oArea->getAll();
     //检查当前页面权限
     $sign = '?ctl=config/socket.queue&ac=send.status';
     $this->manager->checkMenuPermission($sign, Widget_Manager::MENU_PURVIEW_SELECT);
     $SocketType = $this->oSocketType->getAll();
     //页面输入变量
     $AppId = intval($this->request->AppId);
     $PartnerId = intval($this->request->PartnerId);
     $ServerId = intval($this->request->ServerId);
     $AreaId = intval($this->request->AreaId) ? intval($this->request->AreaId) : 0;
     $app_type = intval($this->request->app_type);
     $partner_type = intval($this->request->partner_type);
     $is_abroad = intval($this->request->is_abroad) ? intval($this->request->is_abroad) : 0;
     $uType = intval($this->request->uType) ? intval($this->request->uType) : 0;
     //时间范围初始化
     $Date = $this->request->Date ? $this->request->Date : date("Y-m-d", time());
     //初始化图表配置
     $divideV = 23;
     $Step = 60;
     //初始化合作商列表
     $permitted_partner = array();
     //初始化服务器列表
     $permitted_server = array();
     //获取当前地区列表
     $AreaList = $oArea->getAbroad($is_abroad, $AreaList);
     //生成允许的地区id数组
     if ($app_type > 0) {
         //筛选是否平台产品
         $permitted_app = $oApp->getApp($app_type, $permitted_app);
     }
     if ($AppId > 0) {
         //获取可查看的权限总表
         $permitted_partner = $oPermission->getPartner($this->manager->data_groups, $AppId, 'PartnerId,name,AreaId');
         //根据合作方式筛选
         $permitted_partner = $oPartnerApp->getPermittedPartnerByPartnerType($partner_type, $permitted_partner);
         //根据所在地区筛选
         $permitted_partner = $oPartnerApp->getPermittedPartnerByPartnerArea($AreaList, $permitted_partner);
         if ($PartnerId > 0) {
             //获取服务器列表
             $permitted_server = $oPermission->getServer($this->manager->data_groups, $AppId, $PartnerId, 'ServerId,name');
         }
     }
     //获取用于查询的权限sql语句
     $SendStatusArr = $this->oSocketQueue->getSendStatus($Date, $ServerId, $uType);
     for ($i = 0; $i < 24 * 60; $i++) {
         $H = intval($i / 60);
         $m = $i - $H * 60;
         if (!isset($SendStatusArr[$i])) {
             $SendStatusArr[$i] = array('Time' => sprintf("%02d", $H) . ":" . sprintf("%02d", $m), 'SendCount' => 0);
         } else {
             $SendStatusArr[$i]['Time'] = sprintf('%02d', $H) . ":" . sprintf('%02d', $m);
         }
     }
     ksort($SendStatusArr);
     # Include FusionCharts PHP Class
     include 'Third/fusion/Includes/FusionCharts_Gen.php';
     # Create Multiseries ColumnD chart object using FusionCharts PHP Class
     $FC = new FusionCharts("MsLine", '100%', '500');
     # Set the relative path of the swf file
     $FC->setSWFPath("../Charts/");
     # Store chart attributes in a variable
     $strParam = "caption='Socket队列发送情况';animation=0;xAxisName='时间';baseFontSize=12;numberPrefix=;decimalPrecision=0;showValues=0;formatNumberScale=0;labelStep={$Step};numvdivlines={$divideV};rotateNames=1;yAxisMinValue=0;yAxisMaxValue=10;numDivLines=9;showAlternateHGridColor=1;alternateHGridAlpha=5;alternateHGridColor='CC3300'";
     # Set chart attributes
     $FC->setChartParams($strParam);
     foreach ($SendStatusArr as $key => $data) {
         $FC->addCategory($data['Time']);
     }
     $FC->addDataset("发送数量");
     foreach ($SendStatusArr as $key => $data) {
         $FC->addChartData($data['SendCount']);
     }
     $page_title = "Socket队列发送情况";
     $page_form_action = $sign;
     //调取模板
     include $this->tpl('Config_SocketQueue_SendStatus');
 }
コード例 #2
0
ファイル: ProductController.php プロジェクト: eappl/prototype
 public function productQueueSendDetailAction()
 {
     $oArea = new Config_Area();
     $oPartnerApp = new Config_Partner_App();
     $oServer = new Config_Server();
     $oPermission = new Config_Permission();
     $oUser = new Lm_User();
     $ProductSendTypeArr = $this->config->ProductSendTypeArr;
     $ProductTypeArr = $this->config->ProductTypeArr;
     //获取用户可以查看的游戏列表
     $permitted_app = $oPermission->getApp($this->manager->data_groups, 'AppId,name');
     $AreaList = $oArea->getAll();
     set_time_limit(0);
     $page = intval(max($this->request->page, 1));
     //检查当前页面权限
     $sign = '?ctl=config/product/product&ac=product.queue.send.detail';
     $this->manager->checkMenuPermission($sign, Widget_Manager::MENU_PURVIEW_SELECT);
     //页面输入变量
     $AppId = intval($this->request->AppId);
     $PartnerId = intval($this->request->PartnerId);
     $PassageId = intval($this->request->PassageId);
     $AreaId = intval($this->request->AreaId) ? intval($this->request->AreaId) : 0;
     $UserName = $this->request->UserName;
     $app_type = intval($this->request->app_type);
     $partner_type = intval($this->request->partner_type);
     $is_abroad = intval($this->request->is_abroad) ? intval($this->request->is_abroad) : 0;
     //页面输入变量
     $ProductSendType = $this->request->ProductSendType;
     $ProductType = $this->request->ProductType;
     //是否导出当前页面表格
     $export = $this->request->export ? intval($this->request->export) : 0;
     $pagesize = $export ? 0 : 20;
     //初始化图表配置
     $Input = array('UserName' => urlencode($UserName), 'AppId' => $AppId, 'PartnerId' => $PartnerId, 'ServerId' => $ServerId, 'ProductSendType' => $ProductSendType, 'export' => 1);
     $export_var = "<a href =" . Base_Common::getUrl('', 'config/product/product', 'product.queue.send.detail', $Input) . "><导出表格></a>";
     //初始化合作商列表
     $permitted_partner = array();
     //获取当前地区列表
     $AreaList = $oArea->getAbroad($is_abroad, $AreaList);
     //生成允许的地区id数组
     if ($app_type > 0) {
         //筛选是否平台产品
         $permitted_app = $this->oApp->getApp($app_type, $permitted_app);
     }
     if ($AppId > 0) {
         //获取可查看的权限总表
         $permitted_partner = $oPermission->getPartner($this->manager->data_groups, $AppId, 'PartnerId,name,AreaId');
         //根据合作方式筛选
         $permitted_partner = $oPartnerApp->getPermittedPartnerByPartnerType($partner_type, $permitted_partner);
         //根据所在地区筛选
         $permitted_partner = $oPartnerApp->getPermittedPartnerByPartnerArea($AreaList, $permitted_partner);
         if ($PartnerId > 0) {
             //获取服务器列表
             $permitted_server = $oPermission->getServer($this->manager->data_groups, $AppId, $PartnerId, 'ServerId,name');
         }
     }
     if ($UserName) {
         $UserInfo = $oUser->getUserByName($UserName);
         if ($UserInfo['UserId']) {
             $UserId = $UserInfo['UserId'];
         } else {
             $UserId = -1;
         }
     } else {
         $UserId = 0;
     }
     $ProductSendQueueDetailArr = $this->oProduct->getProductSendQueueDetail($UserId, $ProductSendType, $ProductType, $ServerId, ($page - 1) * $pagesize, $pagesize);
     $UserInfoList = array();
     if (is_array($ProductSendQueueDetailArr['ProductSendQueueDetail'])) {
         foreach ($ProductSendQueueDetailArr['ProductSendQueueDetail'] as $key => $value) {
             if ($value['UserId']) {
                 if (!isset($UserInfoList[$value['UserId']])) {
                     $UserInfo = $oUser->getUserById($value['UserId']);
                     $UserInfoList[$value['UserId']] = $UserInfo;
                 }
             }
             if (!isset($ServerInfo[$value['ServerId']])) {
                 $ServerInfo[$value['ServerId']] = $oServer->getRow($value['ServerId']);
             }
             $Comment = json_decode($value['Comment'], true);
             $ProductSendQueueDetailArr['ProductSendQueueDetail'][$key]['UserName'] = $value['UserId'] ? $UserInfoList[$value['UserId']]['UserName'] : "******";
             $ProductSendQueueDetailArr['ProductSendQueueDetail'][$key]['ProductSendTypeName'] = $ProductSendTypeArr[$value['SendType']];
             $ProductSendQueueDetailArr['ProductSendQueueDetail'][$key]['ProductTypeName'] = $ProductTypeArr[$value['ProductType']];
             $ProductSendQueueDetailArr['ProductSendQueueDetail'][$key]['ServerName'] = $ServerInfo[$value['ServerId']]['name'];
         }
     }
     $page_title = "道具发送队列详情";
     $page_form_action = $sign;
     //调取模板
     include $this->tpl('Config_Product_ProductSendQueueDetail');
 }