reportModel = $reportModel; } /** * 首页数量数据 * @param Request $request */ public function homePageCountData(Request $request) { // 基站数据 // $station_data = $this->reportModel->getStationCountData() ?: []; $station_data =[]; // 部门数据 // $department_data = $this->reportModel->getDepartmentCountData() ?: []; // 用户数据 $user_data = $this->reportModel->getDeviceUserCountData() ?: []; $data = array_merge($station_data, $user_data); return CatchResponse::success($data); } /** * 基站增长趋势数据 * @param Request $request */ public function stationGrowthTrendData(Request $request) { $data = $this->reportModel->getStationGrowthTrendData() ?: []; return CatchResponse::success($data); } /** * 用户设备增长趋势数据 * @param Request $request */ public function deviceGrowthTrendData(Request $request) { $data = $this->reportModel->getDeviceGrowthTrendData() ?: []; return CatchResponse::success($data); } /** * 过车总量统计 * @param Request $request */ public function vehiclePassingCount(Request $request){ $params=$request->param(); $start_time=strtotime($params['timeRange'][0]); $end_time=strtotime($params['timeRange'][1]); $xAxisData=[]; $yAxisData=[]; for($i=$start_time;$i<$end_time+24*3600;$i+=24*3600){ $time1=date('Y-m-d 00:00:00',$i); $time2=date('Y-m-d 23:59:59',$i); $xAxisData[]=date('Y-m-d',$i); $cond['RF_DATE']=['timeRange',$time1,$time2]; // $count=queryOracleCount('DSSC2.W_DW_RF_RECORD',$cond); $count=mt_rand(0,99999); $yAxisData[]=$count; } // var_dump($end_time); return CatchResponse::success(['xAxisData'=>$xAxisData,'yAxisData'=>$yAxisData]); } /** * 区域过车统计 * @param Request $request */ public function areaDeviceCollect(Request $request){ $params=$request->param(); $start_time=date('Y-m-d 00:00:00',strtotime($params['timeRange'][0])); $end_time=date('Y-m-d 00:00:00',strtotime($params['timeRange'][1])); $host= Env::get('oracle.hostname', '127.0.0.1'); $port= Env::get('oracle.hostport', '1521'); $instance_name= Env::get('oracle.instance', 'ORCL'); $username= Env::get('oracle.username', 'root'); $password= Env::get('oracle.password', 'root'); // $conn = oci_connect('dssc3', 'dssc3', '61.175.203.188:6521/DSSC','AL32UTF8'); // if (!$conn) { // $e = oci_error(); // trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); // } // $sql='SELECT a.RF_ID,count(a.RF_FLAGID) num,b.DEVICE_NAME FROM DSSC2.W_DW_RF_RECORD a join DSSC2.ADM_DEV b ON a.RF_ID=b.LOGIN_NAME WHERE RF_DATE >= to_date(\''.$start_time.'\', \'yyyy-mm-dd hh24:mi:ss\') AND RF_DATE <= to_date(\''.$end_time.'\', \'yyyy-mm-dd hh24:mi:ss\') GROUP BY a.RF_ID,b.DEVICE_NAME ORDER BY num desc'; // // var_dump($sql); // // 查询并渲染 // $stid = oci_parse($conn, $sql); // $r = oci_execute($stid); // $rows=[]; // while($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) { // $rows[]=$row; // } // oci_free_statement($stid); $xAxisData=[]; $yAxisData=[]; // foreach($rows as $val){ // $xAxisData[]=$val['DEVICE_NAME']; // $yAxisData[]=$val['NUM']; // } for($i=0;$i<800;$i++){ $xAxisData[]='测试基站'.$i; $yAxisData[]=mt_rand(0,99999); } // return $rows; return CatchResponse::success(['xAxisData'=>$xAxisData,'yAxisData'=>$yAxisData]); } }