stanley-king 3 лет назад
Родитель
Сommit
7fcc0f5f13
4 измененных файлов с 15 добавлено и 3 удалено
  1. 4 2
      helper/refill/RefillBase.php
  2. 4 0
      helper/refill/util.php
  3. 1 1
      rdispatcher/proxy.php
  4. 6 0
      test/TestRedis.php

+ 4 - 2
helper/refill/RefillBase.php

@@ -295,7 +295,8 @@ class RefillBase
 
         $refill_state = false;
         $order_success = false;
-        $net_errno = 0;
+        $net_errno = '';
+        $neterr = false;
 
         foreach ($providers as $provider)
         {
@@ -396,7 +397,8 @@ class RefillBase
         } elseif ($order_success) {
             return [errcode::MERCHANT_REFILL_ERROR, "充值失败", $last_orderid, $neterr, $net_errno];
         } else {
-            return [errcode::MERCHANT_REFILL_ERROR, "充值失败", $last_orderid, false, 0];
+            //订单创建失败,不需要再重试了,可能已经是数据库等系统错误
+            return [errcode::MERCHANT_REFILL_ERROR, "充值失败", $last_orderid, false, 'ORDER_CREATE_FAIL'];
         }
     }
 

+ 4 - 0
helper/refill/util.php

@@ -609,6 +609,10 @@ class util
         }
     }
 
+    public static function order_errflag($net_errno) {
+        return ($net_errno === 'ORDER_CREATE_FAIL');
+    }
+
     public static function onOrderSuccess($refill_info,$order_info)
     {
         $data = store_member::instance()->get_member($order_info['store_id']);

+ 1 - 1
rdispatcher/proxy.php

@@ -75,7 +75,7 @@ class proxy
                 QueueClient::async_push("QueryOrderNeterr",['order_id' => $order_id],15);
                 $fError = false;
             }
-            elseif(($errcode === refill\errcode::MERCHANT_REFILL_ERROR && $neterr))
+            elseif(($errcode === refill\errcode::MERCHANT_REFILL_ERROR) && refill\util::order_errflag($net_errno) === false)
             {
                 [$org_quality,$quality] = refill\RefillFactory::instance()->find_quality($order,true);
                 $order->set_quality($org_quality,$quality);

+ 6 - 0
test/TestRedis.php

@@ -353,6 +353,12 @@ class TestRedis extends TestCase
 
     }
 
+    public function testErrorFlag()
+    {
+        $flag1 = refill\util::order_errflag(0);
+        $flag2 = refill\util::order_errflag('ORDER_CREATE_FAIL');
+    }
+
     ////docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRedis::testCancel)( .*)?$/" --test-suffix TestRedis.php /var/www/html/test
     ////docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRedis::testCancelPayed)( .*)?$/" --test-suffix TestRedis.php /var/www/html/test
     public static function tearDownAfterClass() : void