Kaynağa Gözat

jinfeng_fs add 广东移动 price sync

xiaoyu 2 yıl önce
ebeveyn
işleme
427e0ed142

+ 14 - 0
helper/refill/api/xyz/jinfeng_fs/RefillPhone.php

@@ -14,6 +14,20 @@ class RefillPhone extends refill\IRefillPhone
         parent::__construct($cfgs);
     }
 
+    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];
+        $key = "{$card_type}-{$amount}-{$regin_no}";
+        $price = config::Price[$key];
+        if(empty($price)) {
+            Log::record("channel cannot find price where name={$this->mName}, goods_id = {$goods_id} card_type={$card_type} amount={$amount} regin_no={$regin_no}",Log::ERR);
+            return [0,0];
+        } else {
+            return [$goods_id,ncPriceFormat($price)];
+        }
+    }
+
     private function req_params(int $phone, string $order_sn)
     {
         $params['account'] = config::ACCOUNT;

+ 6 - 0
helper/refill/api/xyz/jinfeng_fs/api.txt

@@ -43,3 +43,9 @@ CTCCALLr200r  电信200
 50				CMCCGZr50r
 100				CMCCGZr100r
 200				CMCCGZr200r
+
+2022.11.7
+广东移动分省
+CMCCGDr50r
+CMCCGDr100r
+CMCCGDr200r

+ 15 - 0
helper/refill/api/xyz/jinfeng_fs/config.php

@@ -25,6 +25,9 @@ class config
             24 => [
                 50 => 'CMCCGZr50r', 100 => 'CMCCGZr100r', 200 => 'CMCCGZr200r'
             ], //贵州
+            19 => [
+                50 => 'CMCCGDr50r', 100 => 'CMCCGDr100r', 200 => 'CMCCGDr200r'
+            ], //广东
         ],
         mtopcard\ChinaUnicomCard => [
 
@@ -43,4 +46,16 @@ class config
     const QueryErrCodes = [
         '003','004','005','006','007','008','015','016','017','018','019','020','021','022','023','024','025','026','027','028','098','099'
     ];
+
+    //key格式 卡类型-面值-regin_no
+    const Price = [
+        //移动
+        "4-50-10" => 48, "4-100-10" => 96, "4-200-10" => 192,//江苏 10
+        "4-50-15" => 48, "4-100-15" => 96, "4-200-15" => 192,//山东 15
+        "4-50-24" => 48, "4-100-24" => 96, "4-200-24" => 192,//贵州 24
+        "4-50-19" => 48.15, "4-100-19" => 96.3, "4-200-19" => 192.6,//广东 19
+
+        //电信
+        "6-30-19" => 28.5, "6-50-19" => 47.5, "6-100-19" => 95, "6-200-19" => 190,//广东 19
+    ];
 }

+ 14 - 0
helper/refill/api/yl/jinfeng_fs/RefillPhone.php

@@ -14,6 +14,20 @@ class RefillPhone extends refill\IRefillPhone
         parent::__construct($cfgs);
     }
 
+    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];
+        $key = "{$card_type}-{$amount}-{$regin_no}";
+        $price = config::Price[$key];
+        if(empty($price)) {
+            Log::record("channel cannot find price where name={$this->mName}, goods_id = {$goods_id} card_type={$card_type} amount={$amount} regin_no={$regin_no}",Log::ERR);
+            return [0,0];
+        } else {
+            return [$goods_id,ncPriceFormat($price)];
+        }
+    }
+
     private function req_params(int $phone, string $order_sn)
     {
         $params['account'] = config::ACCOUNT;

+ 15 - 0
helper/refill/api/yl/jinfeng_fs/config.php

@@ -25,6 +25,9 @@ class config
             24 => [
                 50 => 'CMCCGZr50r', 100 => 'CMCCGZr100r', 200 => 'CMCCGZr200r'
             ], //贵州
+            19 => [
+                50 => 'CMCCGDr50r', 100 => 'CMCCGDr100r', 200 => 'CMCCGDr200r'
+            ], //广东
         ],
         mtopcard\ChinaUnicomCard => [
 
@@ -43,4 +46,16 @@ class config
     const QueryErrCodes = [
         '003','004','005','006','007','008','015','016','017','018','019','020','021','022','023','024','025','026','027','028','098','099'
     ];
+
+    //key格式 卡类型-面值-regin_no
+    const Price = [
+        //移动
+        "4-50-10" => 48, "4-100-10" => 96, "4-200-10" => 192,//江苏 10
+        "4-50-15" => 48, "4-100-15" => 96, "4-200-15" => 192,//山东 15
+        "4-50-24" => 48, "4-100-24" => 96, "4-200-24" => 192,//贵州 24
+        "4-50-19" => 48.15, "4-100-19" => 96.3, "4-200-19" => 192.6,//广东 19
+
+        //电信
+        "6-30-19" => 28.5, "6-50-19" => 47.5, "6-100-19" => 95, "6-200-19" => 190,//广东 19
+    ];
 }