瀏覽代碼

gdsinopec update amount

haru haru 2 年之前
父節點
當前提交
d6a256ce92
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      helper/refill/api/xyz/gdsinopec/RefillPhone.php

+ 8 - 1
helper/refill/api/xyz/gdsinopec/RefillPhone.php

@@ -87,6 +87,12 @@ class RefillPhone extends refill\IRefillThird
         }
     }
 
+    private function getProduct($product_code)
+    {
+        $thrid_refill = Model('thrid_refill');
+        return $thrid_refill->getProduct(['system_code' => $product_code,'opened' => 1]);
+    }
+
     private function req_params(int $phone, $supplier_origin, $product_id, string $order_sn, $sku)
     {
         $params['supplier_origin'] = $supplier_origin;
@@ -131,7 +137,8 @@ class RefillPhone extends refill\IRefillThird
         if(empty($supplier_origin)) {
             return [false, '该省份不支持', false];
         }
-        [$state, $product] = $this->match_product($supplier_origin, $amount);
+        $third_product = $this->getProduct($params['product_code']);
+        [$state, $product] = $this->match_product($supplier_origin, $third_product['refill_amount']);
         if($state === false) {
             return [false, $product, false];
         }