tongshanglei 2 年之前
父節點
當前提交
68ad5ea930
共有 1 個文件被更改,包括 24 次插入21 次删除
  1. 24 21
      catch/report/controller/Report.php

+ 24 - 21
catch/report/controller/Report.php

@@ -24,32 +24,35 @@ class Report extends CatchController
      */
     public function homePageCountData(Request $request)
     {
-        $start_time = date('Y-m-d 00:00:00',time());
-        $end_time = date('Y-m-d 23:59:59',time());
+       
 
-        
-        $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($username, $password, $host.':'.$port.'/'.$instance_name,'AL32UTF8');
+        $time1=date('Y-m-d',time());
+        $time2=date('Y-m-d',time());
+        $passCount=Db::table('station_passing')->where('date','between',[$time1,$time2])->sum('num');
+        // $start_time = date('Y-m-d 00:00:00',time());
+        // $end_time = date('Y-m-d 23:59:59',time());
+        // $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($username, $password, $host.':'.$port.'/'.$instance_name,'AL32UTF8');
 
-        if (!$conn) {
-            $e = oci_error();
-            trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
-        }
+        // if (!$conn) {
+        //     $e = oci_error();
+        //     trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
+        // }
 
-        $sql='SELECT count(*) as TOTAL FROM DSSC2.W_DW_RF_RECORD   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\')   ORDER BY RF_DATE DESC';
-        // 查询并渲染
+        // $sql='SELECT count(*) as TOTAL FROM DSSC2.W_DW_RF_RECORD   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\')   ORDER BY RF_DATE DESC';
+        // // 查询并渲染
     
-        $stid = oci_parse($conn, $sql);
-        oci_define_by_name($stid, 'TOTAL', $passCount);
-        oci_execute($stid);
-        oci_fetch($stid);
+        // $stid = oci_parse($conn, $sql);
+        // oci_define_by_name($stid, 'TOTAL', $passCount);
+        // oci_execute($stid);
+        // oci_fetch($stid);
 
-        oci_free_statement($stid);
-        oci_close($conn);
+        // oci_free_statement($stid);
+        // oci_close($conn);
         $alarmCount=Db::table('control_alarm')->whereBetweenTime('created_at', $start_time,$end_time)->count();
         $data = array(
             'passCount'=>(string)$passCount,