Przeglądaj źródła

xinruiheng_fs sync price

xiaoyu 2 lat temu
rodzic
commit
1df43ddf7b

+ 14 - 0
helper/refill/api/xyz/xinruiheng_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, int $amount, $card_type, string $order_sn)
     {
         $params['userid'] = config::USER_ID;

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

@@ -24,4 +24,19 @@ class config
         '5001','5002','5003','5004','5005','5008','5009','5010','5011','5012','7001'
     ];
     const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;'];
+
+    //key格式 卡类型-面值-regin_no
+    const Price = [
+        //移动
+        "4-50-25" => 47.3, "4-100-25" => 94.6, "4-200-25" => 189.2,//云南 25
+        "4-50-15" => 47.3, "4-100-15" => 94.6, "4-200-15" => 189.2,//山东 15
+        "4-30-10" => 28.38, "4-50-10" => 47.3, "4-100-10" => 94.6, "4-200-10" => 189.2,//江苏 10
+        "4-30-24" => 28.38, "4-50-24" => 47.3, "4-100-24" => 94.6, "4-200-24" => 189.2,//贵州 24
+        "4-50-19" => 47.5, "4-100-19" => 95, "4-200-19" => 190,//广东 19
+
+        //电信
+        "6-30-2" => 28.05,"6-50-2" => 46.75, "6-100-2" => 93.5, "6-200-2" => 187,//天津 2
+        "6-30-9" => 28.5, "6-50-9" => 47.5, "6-100-9" => 95, "6-200-9" => 190,//上海 9
+        "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/xinruiheng_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, int $amount, $card_type, string $order_sn)
     {
         $params['userid'] = config::USER_ID;

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

@@ -24,4 +24,19 @@ class config
         '5001','5002','5003','5004','5005','5008','5009','5010','5011','5012','7001'
     ];
     const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;'];
+
+    //key格式 卡类型-面值-regin_no
+    const Price = [
+        //移动
+        "4-50-25" => 47.3, "4-100-25" => 94.6, "4-200-25" => 189.2,//云南 25
+        "4-50-15" => 47.3, "4-100-15" => 94.6, "4-200-15" => 189.2,//山东 15
+        "4-30-10" => 28.38, "4-50-10" => 47.3, "4-100-10" => 94.6, "4-200-10" => 189.2,//江苏 10
+        "4-30-24" => 28.38, "4-50-24" => 47.3, "4-100-24" => 94.6, "4-200-24" => 189.2,//贵州 24
+        "4-50-19" => 47.5, "4-100-19" => 95, "4-200-19" => 190,//广东 19
+
+        //电信
+        "6-30-2" => 28.05,"6-50-2" => 46.75, "6-100-2" => 93.5, "6-200-2" => 187,//天津 2
+        "6-30-9" => 28.5, "6-50-9" => 47.5, "6-100-9" => 95, "6-200-9" => 190,//上海 9
+        "6-30-19" => 28.5,"6-50-19" => 47.5, "6-100-19" => 95, "6-200-19" => 190,//广东 19
+    ];
 }