stanley-king 3 лет назад
Родитель
Сommit
2e3074470f
2 измененных файлов с 10 добавлено и 5 удалено
  1. 4 1
      core/framework/libraries/log.php
  2. 6 4
      helper/refill/RefillBase.php

+ 4 - 1
core/framework/libraries/log.php

@@ -8,16 +8,19 @@ defined('InShopNC') or exit('Access Invalid!');
 class scope_trace
 {
     private $mTag;
+    private $mStart;
 
     public function __construct($tag)
     {
         $this->mTag = $tag;
+        $this->mStart = microtime(true);
         Log::record("{$this->mTag} begin----------------------------", Log::DEBUG);
     }
 
     public function __destruct()
     {
-        Log::record("{$this->mTag} end  ----------------------------", Log::DEBUG);
+        $period = microtime(true) - $this->mStart;
+        Log::record(sprintf("{$this->mTag} end time=%.6f----------------------",$period), Log::DEBUG);
     }
 }
 

+ 6 - 4
helper/refill/RefillBase.php

@@ -14,6 +14,7 @@ require_once(BASE_HELPER_PATH . '/refill/util.php');
 require_once(BASE_HELPER_PATH . '/refill/errcode.php');
 
 use Log;
+use scope_trace;
 use mtopcard;
 use QueueClient;
 use member_info;
@@ -172,6 +173,7 @@ class RefillBase
 
     private function retry(array $refill_info, array $order_info)
     {
+        $trace = new scope_trace(__METHOD__);
         $order = order::from_db($refill_info,$order_info);
         if($order->is_third()) {
             return [false,null];
@@ -567,10 +569,10 @@ class RefillBase
         $refill_info = $mod_refill->getOrderInfo(['order_id' => $order_id,'inner_status' => 0]);
         $chname = $refill_info['channel_name'];
 
-//        if($refill_info['notify_state'] == 1) {
-//            QueueClient::push("NotifyMerchantComplete", ['order_id' => $order_id,'manual' => false]);
-//            return true;
-//        }
+        if ($refill_info['notify_state'] == 1 && in_array($order_info['order_state'], [ORDER_STATE_SUCCESS, ORDER_STATE_CANCEL])) {
+            QueueClient::push("NotifyMerchantComplete", ['order_id' => $order_id,'manual' => false]);
+            return true;
+        }
 
         if($order_info['order_state'] == ORDER_STATE_SEND) {
             $query_able = true;