Sfoglia il codice sorgente

modify monitor time() to order commit_time

stanley-king 2 anni fa
parent
commit
dbffcc1e6f
2 ha cambiato i file con 10 aggiunte e 9 eliminazioni
  1. 6 5
      helper/refill/RefillBase.php
  2. 4 4
      helper/refill/util.php

+ 6 - 5
helper/refill/RefillBase.php

@@ -174,9 +174,9 @@ class RefillBase
                 QueueClient::async_push("OnRiskSN", $params, 1);
                 return false;
             }
-
-            $period = time() - intval($refill_info['commit_time']);
-            util::monitor_notify($chname,$spec,$card_type,$refill_info['channel_amount'],$period,$success);
+            $commit_time = intval($refill_info['commit_time']);
+            $period = time() - $commit_time;
+            util::monitor_notify($chname,$spec,$card_type,$refill_info['channel_amount'],$period,$success,$commit_time);
 
             if ($success) {
                 $logic_vr_order->changeOrderStateSuccess($order_id,true);
@@ -457,9 +457,10 @@ class RefillBase
 
             if ($state)
             {
+                $commit_time = time();
                 $chfilters->add_channel($channel_name,true);
                 util::incr_commit($channel_name,$card_type,$spec,$quality,true);
-                util::monitor_commit($channel_name, $spec, $card_type, $channel_amount);
+                util::monitor_commit($channel_name, $spec, $card_type, $channel_amount,$commit_time);
                 $trade_no = $errmsg;
 
                 $refill_type = $provider->refill_type();
@@ -481,7 +482,7 @@ class RefillBase
                     Log::record("Err refill_type = {$refill_type}",Log::ERR);
                 }
 
-                $data = ['commit_time' => time(), 'ch_trade_no' => $trade_no];
+                $data = ['commit_time' => $commit_time, 'ch_trade_no' => $trade_no];
                 $mod_refill->edit($order_id, $data);
                 $refill_state = true;
 

+ 4 - 4
helper/refill/util.php

@@ -532,14 +532,14 @@ class util
         queue\MonitorClient::instance()->onNetCheck($chname, time(),$succ);
     }
 
-    public static function monitor_commit($chname, $spec, $card_type, $channel_amount)
+    public static function monitor_commit($chname, $spec, $card_type, $channel_amount,$commit_time)
     {
-        queue\MonitorClient::instance()->onCommit($chname, time(), $spec, $card_type, $channel_amount);
+        queue\MonitorClient::instance()->onCommit($chname, $commit_time, $spec, $card_type, $channel_amount);
     }
 
-    public static function monitor_notify($chname, $spec, $card_type, $channel_amount, $period, $succ)
+    public static function monitor_notify($chname, $spec, $card_type, $channel_amount, $period, $succ,$commit_time)
     {
-        queue\MonitorClient::instance()->onNotify($chname, time(), $spec, $card_type, floatval($channel_amount), $period, $succ);
+        queue\MonitorClient::instance()->onNotify($chname, $commit_time, $spec, $card_type, floatval($channel_amount), $period, $succ);
     }
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     public static function set_order_channels($mchid,$mchorder,$datas)