Kaynağa Gözat

增加统计任务

stanley-king 8 yıl önce
ebeveyn
işleme
deeb1477cc

+ 1 - 1
helper/search/server.php

@@ -16,7 +16,7 @@ interface IProcessor
 class CentraHelper
 {
     const body_header_len = 10;
-    const time_out = 3600;
+    const time_out = 3600*24*30;
 
     private $socket;
     private $ev_base;

+ 1 - 1
helper/search/tcp_client.php

@@ -14,7 +14,7 @@ class tcp_client
 {
     const GetRelatedWord = 1;
     const SearchReasult  = 2;
-    const time_out = 3600;
+    const time_out = 3600*24*30;
     const body_header_len = 10;
 
     private static $stInstance;

+ 9 - 3
helper/statistics_helper.php

@@ -39,15 +39,21 @@ class statistics_helper
         $day = new DateTime();
         $day->setTimestamp($this->mRecordTime);
         $day->setTime(0,0,0);
-        $time_stamp = $day->getTimestamp() + 24 * 60 * 60;
+        $morning = $day->getTimestamp();
+
+        $time_stamp = $morning + 12 * 60 * 60;
+        if($this->mRecordTime > $time_stamp) {
+            $time_stamp = $day->getTimestamp() + 24 * 60 * 60;
+        }
+
         return ($this->mRecordTime >= $time_stamp);
     }
 
     private function save()
     {
         $pid = posix_getpid();
-        $date = gmdate('Y-M-d',$this->mRecordTime);
-        $file = BASE_DATA_PATH_PATH . '/log/' . "{$date}-{$pid}.txt";
+        $date = date('Ymd-H',time());
+        $file = BASE_DATA_PATH . '/log/' . "{$date}-{$pid}.txt";
         $data = array('star_time'=> $this->mRecordTime,'end_time' => time(),'function' => $this->mItems,'other' => $this->mOther);
         $data = json_encode($data);
         file_put_contents($file,$data);