stanley-king před 3 měsíci
rodič
revize
e60c1f3ee9
1 změnil soubory, kde provedl 4 přidání a 7 odebrání
  1. 4 7
      helper/refill/api/xyz/masheng/RefillPhone.php

+ 4 - 7
helper/refill/api/xyz/masheng/RefillPhone.php

@@ -16,13 +16,13 @@ class RefillPhone extends refill\IRefillPhone
 
     private function req_params(int $phone, int $amount, $card_type, string $order_sn): array
     {
-        $params['batch_no'] = $order_sn;
-        $params['agent_id'] = config::USER_ID;
         $productid = config::ProductIdS[$card_type][$amount] ?? false;
         if ($productid === false){
             return [];
         }
 
+        $params['batch_no'] = $order_sn;
+        $params['agent_id'] = config::USER_ID;
         $params['productNo'] = $productid;
         $params['account'] = $phone;
         $params['notify_url'] = config::NOTIFY_URL;
@@ -41,7 +41,6 @@ class RefillPhone extends refill\IRefillPhone
 
         $sign = $this->sign($params);
         $params['sign'] = $sign;
-
         $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
 
         if (empty($resp)) {
@@ -78,8 +77,7 @@ class RefillPhone extends refill\IRefillPhone
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if (empty($resp))
-            {
+            if (empty($resp)) {
                 return [false, '系统错误'];
             }
             elseif ($resp['code'] === 200 && !empty($resp['result']))
@@ -99,8 +97,7 @@ class RefillPhone extends refill\IRefillPhone
 
                 return [true, $order_state];
             }
-            else
-            {
+            else {
                 return [false, $resp['message']];
             }
         }