stanley-king 2 éve
szülő
commit
59007b25b8
3 módosított fájl, 20 hozzáadás és 16 törlés
  1. 3 3
      helper/refill/RefillBase.php
  2. 2 2
      helper/refill/util.php
  3. 15 11
      rdispatcher/proxy.php

+ 3 - 3
helper/refill/RefillBase.php

@@ -207,7 +207,7 @@ class RefillBase
             }
 
             $mod_refill->partition(util::part_refill($order_time))->edit($order_id, ['notify_time' => time(), 'is_retrying' => 0,'notify_state' => 1]);
-            util::pop_queue_order($mchid,$mch_order);
+            util::pop_queue_order($mchid,$mch_order,$order_time);
             QueueClient::push("NotifyMerchantComplete", ['order_id' => $order_id,'manual' => false]);
 
             return true;
@@ -846,7 +846,7 @@ class RefillBase
                 mtopcard\cards_helper::assign($order_id);
 
 
-                util::pop_queue_order($refill_info['mchid'],$refill_info['mch_order']);
+                util::pop_queue_order($refill_info['mchid'], $refill_info['mch_order'], $order_time);
             }
             else {
                 $tran->commit();
@@ -884,7 +884,7 @@ class RefillBase
                 $mod_refill->partition(util::part_refill($order_time))->edit($order_id, ['notify_time' => time(), 'notify_state' => 1,'is_retrying' => 0]);
 
                 mtopcard\cards_helper::reuse($order_id);
-                util::pop_queue_order($refill_info['mchid'],$refill_info['mch_order']);
+                util::pop_queue_order($refill_info['mchid'], $refill_info['mch_order'], $order_time);
             }
             else {
                 $tran->commit();

+ 2 - 2
helper/refill/util.php

@@ -544,10 +544,10 @@ class util
         $ret = $ins->hdel($name, '', $key);
     }
 
-    public static function pop_queue_order($mchid,$mch_order)
+    public static function pop_queue_order($mchid,$mch_order,$order_time = 0)
     {
         util::del_order_channels($mchid,$mch_order);
-        Model('refill_order')->edit_detail($mchid,$mch_order,['order_state' => ORDER_STATE_HANDLED]);
+        Model('refill_order')->partition(util::part_refill($order_time))->edit_detail($mchid,$mch_order,['order_state' => ORDER_STATE_HANDLED]);
         $ins = Cache::getInstance('cacheredis');
 
         $name = 'merchant_order_query';

+ 15 - 11
rdispatcher/proxy.php

@@ -10,19 +10,20 @@ class proxy
 {
     private function onEerror(refill\order $order,$need_callback,$errmsg)
     {
-        $refill_order = Model('refill_order');
+        $mod_refill = Model('refill_order');
         $mchid = $order->mchid();
         $mch_order = $order->mch_order();
         $last_order_id = $order->last_order_id();
+        $order_time = $order->order_time();
 
         if ($last_order_id === 0) {
             $order_id = refill\RefillFactory::instance()->zero_order($order, $errmsg);
             $last_order_id = $order_id;
         } else {
-            $refill_order->edit($last_order_id, ['notify_time' => time(), 'notify_state' => 1, 'is_retrying' => 0]);
+            $mod_refill->partition(util::part_refill($order_time))->edit($last_order_id, ['notify_time' => time(), 'notify_state' => 1, 'is_retrying' => 0]);
         }
 
-        refill\util::pop_queue_order($mchid, $mch_order);
+        refill\util::pop_queue_order($mchid, $mch_order,$order_time);
         QueueClient::push("NotifyMerchantComplete", ['order_id' => $last_order_id, 'manual' => false]);
 
         if($need_callback)
@@ -100,7 +101,7 @@ class proxy
             return false;
         }
 
-        refill\util::pop_queue_order($mchid, $mch_order);
+        refill\util::pop_queue_order($mchid, $mch_order, $order->order_time());
         QueueClient::push("NotifyMerchantComplete", ['order_id' => $order_id, 'manual' => false]);
 
         return true;
@@ -117,11 +118,12 @@ class proxy
 
         $mchid = $order->mchid();
         $mch_order = $order->mch_order();
+        $order_time = $order->order_time();
 
-        $refill_order = Model('refill_order');
+        $mod_refill = Model('refill_order');
         if($order->first_commit()) {
             refill\util::push_queue_order($mchid,$mch_order,ORDER_STATE_SEND);
-            $refill_order->edit_detail($mchid,$mch_order,['order_state' => ORDER_STATE_SEND]);
+            $mod_refill->partition(util::part_refill($order_time))->edit_detail($mchid,$mch_order,['order_state' => ORDER_STATE_SEND]);
         }
         Log::record("proxy::add times={$order->commit_times()} mch_order={$mch_order} card_no = {$order->card_no()} regin_no={$order->region_no()} org_quality={$order->org_quality()} quality={$order->cur_quality()}",Log::DEBUG);
 
@@ -194,7 +196,7 @@ class proxy
                 {
                     $params['order_id'] = $order_id;
                     if($order_id > 0) {
-                        $refill_order->edit($order_id, ['is_retrying' => 1]);
+                        $mod_refill->partition(util::part_refill($order_time))->edit($order_id, ['is_retrying' => 1]);
                     }
 
                     $params = $order->queue_params();
@@ -266,15 +268,16 @@ class proxy
         $order = refill\order::from_parameters($params);
         $mchid = $order->mchid();
         $mch_order = $order->mch_order();
+        $order_time = $order->order_time();
 
         refill\util::push_queue_order($mchid,$mch_order,ORDER_STATE_SEND);
-        Model('refill_order')->edit_detail($mchid,$mch_order,['order_state' => ORDER_STATE_SEND]);
+        Model('refill_order')->partition(util::part_refill($order_time))->edit_detail($mchid,$mch_order,['order_state' => ORDER_STATE_SEND]);
 
         [$org_quality,$quality] = refill\RefillFactory::instance()->find_quality($order);
         Log::record("proxy::add mch_order={$mch_order} card_no = {$order->card_no()} regin_no={$order->region_no()} org_quality={$org_quality} quality={$quality}",Log::DEBUG);
         $order_id = refill\RefillFactory::instance()->zero_order($order,"手动0元订单");
 
-        refill\util::pop_queue_order($mchid, $mch_order);
+        refill\util::pop_queue_order($mchid, $mch_order, $order_time);
         QueueClient::push("NotifyMerchantComplete", ['order_id' => $order_id, 'manual' => false]);
     }
 
@@ -321,10 +324,11 @@ class proxy
 
         $mchid = $order->mchid();
         $mch_order = $order->mch_order();
+        $order_time = $order->order_time();
 
-        $refill_order = Model('refill_order');
+        $mod_refill = Model('refill_order');
         refill\util::push_queue_order($mchid,$mch_order,ORDER_STATE_SEND);
-        $refill_order->edit_detail($mchid,$mch_order,['order_state' => ORDER_STATE_SEND]);
+        $mod_refill->partition(util::part_refill($order_time))->edit_detail($mchid,$mch_order,['order_state' => ORDER_STATE_SEND]);
 
         $mch_amount = refill\RefillFactory::instance()->mch_amount($order);
         if ($mch_amount === false) {