stanley-king 4 rokov pred
rodič
commit
61b20e2b31

+ 9 - 7
helper/refill/RefillBase.php

@@ -106,9 +106,15 @@ class RefillBase
                 if(!empty($refill_info))
                 {
                     $logic_vr_order->changeOrderStateCancel($order_info, '', "{$chname}接口回调通知失败,正在重试");
-                    if ($this->retry($refill_info, $order_info)) {
+                    $params = $this->retry($refill_info, $order_info);
+                    if ($params !== false) {
                         $mod_refill->edit($order_id, ['is_retrying' => 1]);
                         $tran->commit();
+                        if(defined('USE_COROUTINE') && USE_COROUTINE) {
+                            \Swoole\Coroutine::sleep(2);
+                        }
+
+                        util::push_add($params);
                         return true;
                     }
                 }
@@ -156,7 +162,7 @@ class RefillBase
             'order_id' => $refill_info['order_id']
         ];
 
-        return util::push_add($params);
+        return $params;
     }
 
     public function zero_order($mchid, $buyer_id, $amount, $card_no,
@@ -223,8 +229,6 @@ class RefillBase
             $card_type = mtopcard\card_type($card_no);
         }
         [$providers,$overload] = $this->mPolicy->find_providers($amount,$card_type,$quality);
-        Log::record("RefillBase::add 1",Log::DEBUG);
-
 
         if (empty($providers))
         {
@@ -236,7 +240,7 @@ class RefillBase
                 return [errcode::CANNOT_MATCH_PROVIDER, "匹配不到合适的充值通道",$last_orderid,false];
             }
         }
-        Log::record("RefillBase::add 2",Log::DEBUG);
+
         if (empty($notify_url)) {
             $notify_url = "";
         }
@@ -244,14 +248,12 @@ class RefillBase
         $minfo = new member_info($buyer_id);
         $calc = new CalcMerchantPrice($mchid, $amount, $card_type,$quality);
         $mch_amount = $calc->calc_vgoods_price([]);
-        Log::record("RefillBase::add 3",Log::DEBUG);
 
         $available = $minfo->available_predeposit();
         if ($mch_amount > $available) {
             Log::record("下单时机构余额不足,可用余额为:{$available}", Log::DEBUG);
             return [errcode::MERCHANT_SHORT_MONEY, "余额不足支付订单",$last_orderid,false];
         }
-        Log::record("RefillBase::add 4",Log::DEBUG);
 
         $refill_state = false;
         $order_success = false;

+ 6 - 3
helper/refill/api/lingzh/amingjd/RefillPhone.php

@@ -22,7 +22,7 @@ class RefillPhone extends refill\IRefillPhone
         $params['orderid'] = $order_sn;
         $params['price'] = $amount;
         $params['teltype'] = $this->phone_type($phone);
-        $params['timeout'] = 86400;
+        $params['timeout'] = 600;
         $params['notify'] = config::NOTIFY_URL;
         $params['time'] = time();
         $params['rand'] = rand(100000,999999);
@@ -60,10 +60,13 @@ class RefillPhone extends refill\IRefillPhone
         $resp = http_request(config::QUERY_URL, $params , 'POST' , false);
         if ($resp === false) {
             return [false, '系统错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['code'] == 100) {
+            if ($resp['code'] == 100)
+            {
                 $order_state = -1;
                 if ($resp['status'] == 3) {
                     $order_state = ORDER_STATE_SUCCESS;

+ 1 - 1
helper/refill/policy/chctl.php

@@ -46,7 +46,7 @@ class chctl
                     $amount = $item['amount'];
                     $card_type = $item['type'];
 
-                    $opened = $item['opened'] == 1 ? true : false;
+                    $opened = $item['opened'] == 1;
                     $sort = $item['sort'];
                     $speed = $item['speed'];
 

+ 1 - 1
helper/refill/policy/lingzh/quality_ploy.php

@@ -9,7 +9,7 @@ class quality_ploy extends Quality
         parent::__construct();
 
         $this->mSpeeds = [
-            self::Normal => ['retry_times' => 2,'retry_timeout' => 180,'per_secs' => 120],
+            self::Normal => ['retry_times' => 2,'retry_timeout' => 180,'per_secs' => 60],
             self::Quick => ['retry_times' => 2,'retry_timeout' => 60,'per_secs' => 30],
             self::CardKey => ['retry_times' => 2,'retry_timeout' => 120,'per_secs' => 60],
             self::ThirdShop => ['retry_times' => 2,'retry_timeout' => 600,'per_secs' => 600],

+ 1 - 3
helper/refill/policy/quaility.php

@@ -56,6 +56,7 @@ class Quality
         elseif(array_key_exists($quality,$this->mQualities)) {
             $org = $quality;
             $qualities = $this->mQualities[$quality];
+            $time_out = $this->mSpeeds[$org]['retry_timeout'];
         }
         else {
             Log::record("find_quality: cannot find any quality",Log::DEBUG);
@@ -67,10 +68,8 @@ class Quality
         }
 
         $max_times = $this->mSpeeds[$org]['retry_times'];
-        Log::record("find_quality: 1 find org={$org} qualitys=" . implode(',',$qualities),Log::DEBUG);
         $qualities = $this->calc_quality($qualities,$times,$used_time,$time_out,$max_times);
 
-        Log::record("find_quality: find org={$org} qualitys=" . implode(',',$qualities),Log::DEBUG);
         return [$org,$qualities];
     }
 
@@ -79,7 +78,6 @@ class Quality
     {
         $left_time = $time_out - $used_time;
         if($left_time <= 0 || $max_times <= $times) return [];
-
         $qualities = array_reverse($qualities);
 
         $result = [];

+ 4 - 9
rdispatcher/proxy.php

@@ -31,8 +31,6 @@ class proxy
         $org_quality = intval($params['org_quality']) ?? 0;
         $card_type   = intval($params['card_type']) ?? 0;
 
-        Log::record("proxy::add 1" ,Log::DEBUG);
-
         $need_check = false;
         if($card_type == 0)
         {
@@ -41,11 +39,8 @@ class proxy
                 $need_check = true;
             }
         }
-        Log::record("proxy::add 2" ,Log::DEBUG);
 
         [$org_quality,$quality] = refill\RefillFactory::instance()->find_quality($mchid,$amount,$card_type,$org_quality,$commit_times,time() - $order_time);
-        Log::record("org_quality = {$org_quality} quality = {$quality}",Log::DEBUG);
-
         if ($need_check)
         {
             $valided = mtopcard\valid_phone($card_no);
@@ -58,15 +53,12 @@ class proxy
             }
         }
 
-        Log::record("proxy::add 3" ,Log::DEBUG);
         [$errcode, $errmsg, $order_id, $neterr] = refill\RefillFactory::instance()->add($mchid, $buyer_id, $amount, $card_no,
             $mch_order, $idcard, $card_name, $notify_url, $quality,$org_quality,
             $order_time, $commit_times, $last_order_id,$card_type);
         $params['commit_times'] += 1;
         $commit_times += 1;
 
-        Log::record("proxy::add 4" ,Log::DEBUG);
-
         if($errcode !== true)
         {
             $fNotify = true;
@@ -79,7 +71,10 @@ class proxy
                     if($order_id > 0) {
                         $refill_order->edit($order_id, ['is_retrying' => 1]);
                     }
-                    \Swoole\Coroutine::sleep(2);
+
+                    if(defined('USE_COROUTINE') && USE_COROUTINE) {
+                        \Swoole\Coroutine::sleep(2);
+                    }
                     refill\util::push_add($params);
                 }
             }