stanley-king 3 years ago
parent
commit
be1f48d21e
2 changed files with 35 additions and 1 deletions
  1. 34 0
      helper/refill/IRefillThird.php
  2. 1 1
      helper/refill/api/test/youhedf/RefillPhone.php

+ 34 - 0
helper/refill/IRefillThird.php

@@ -0,0 +1,34 @@
+<?php
+
+
+namespace refill;
+
+abstract class IRefillThird extends IRefill
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    public function balance()
+    {
+        return [false, 'RefillPhone 暂无余额接口'];
+    }
+
+    public function goods($quality,int $amount,int $card_type,$regin_no,$other)
+    {
+        [$goods_id, $price] = parent::goods($quality,$amount,$card_type,$regin_no,$other);
+        if($goods_id <= 0) return [0,0];
+
+        $store_id = $this->mStoreID;
+        $pcode = $other['product_code'];
+        $thrid_refill = Model('thrid_refill');
+        $product = $thrid_refill->getProviderProduct($store_id,$goods_id,$pcode);
+        if(empty($product)) {
+            Log::record("cannot find provider's produce where name={$this->mName}, goods_id = {$goods_id} pcode={$pcode}",Log::ERR);
+            return [0,0];
+        } else {
+            return [$goods_id,ncPriceFormat($product['channel_amount'])];
+        }
+    }
+}

+ 1 - 1
helper/refill/api/test/youhedf/RefillPhone.php

@@ -8,7 +8,7 @@ use refill;
 use Log;
 use mtopcard;
 
-class RefillPhone extends refill\IRefillPhone
+class RefillPhone extends refill\IRefillThird
 {
     public function __construct($cfgs)
     {