Browse Source

Merge branch 'raccount' of 39.97.239.116:gyfl/xyzshop into raccount

xiaoyu 2 years ago
parent
commit
da1d9a611c
42 changed files with 2637 additions and 8 deletions
  1. 71 0
      data/config/xyz/refill.ini.php
  2. 58 0
      data/config/yl/refill.ini.php
  3. 46 0
      helper/refill/api/xyz/bier_fs/RefillCallBack.php
  4. 174 0
      helper/refill/api/xyz/bier_fs/RefillPhone.php
  5. 101 0
      helper/refill/api/xyz/bier_fs/config.php
  6. 85 0
      helper/refill/api/xyz/bier_fs/椰子.txt
  7. BIN
      helper/refill/api/xyz/bier_fs/话费API接口文档.docx
  8. 50 0
      helper/refill/api/xyz/lechongquan/RefillCallBack.php
  9. 142 0
      helper/refill/api/xyz/lechongquan/RefillPhone.php
  10. 15 0
      helper/refill/api/xyz/lechongquan/api.txt
  11. 28 0
      helper/refill/api/xyz/lechongquan/config.php
  12. 43 0
      helper/refill/api/xyz/qianqian_fs/api.txt
  13. 26 2
      helper/refill/api/xyz/qianqian_fs/config.php
  14. BIN
      helper/refill/api/xyz/ruixunda_fs/20221118江苏福建调价函.jpg
  15. 2 2
      helper/refill/api/xyz/ruixunda_fs/config.php
  16. 50 0
      helper/refill/api/xyz/yangchi/RefillCallBack.php
  17. 142 0
      helper/refill/api/xyz/yangchi/RefillPhone.php
  18. 27 0
      helper/refill/api/xyz/yangchi/api.txt
  19. 43 0
      helper/refill/api/xyz/yangchi/config.php
  20. 50 0
      helper/refill/api/xyz/yangchi_fs/RefillCallBack.php
  21. 161 0
      helper/refill/api/xyz/yangchi_fs/RefillPhone.php
  22. 62 0
      helper/refill/api/xyz/yangchi_fs/api.txt
  23. 121 0
      helper/refill/api/xyz/yangchi_fs/config.php
  24. 46 0
      helper/refill/api/yl/bier_fs/RefillCallBack.php
  25. 174 0
      helper/refill/api/yl/bier_fs/RefillPhone.php
  26. 101 0
      helper/refill/api/yl/bier_fs/config.php
  27. 80 0
      helper/refill/api/yl/bier_fs/椰子.txt
  28. BIN
      helper/refill/api/yl/bier_fs/话费API接口文档.docx
  29. 26 2
      helper/refill/api/yl/qianqian_fs/config.php
  30. 2 2
      helper/refill/api/yl/ruixunda_fs/config.php
  31. 50 0
      helper/refill/api/yl/yangchi/RefillCallBack.php
  32. 142 0
      helper/refill/api/yl/yangchi/RefillPhone.php
  33. 27 0
      helper/refill/api/yl/yangchi/api.txt
  34. 43 0
      helper/refill/api/yl/yangchi/config.php
  35. 50 0
      helper/refill/api/yl/yangchi_fs/RefillCallBack.php
  36. 161 0
      helper/refill/api/yl/yangchi_fs/RefillPhone.php
  37. 63 0
      helper/refill/api/yl/yangchi_fs/api.txt
  38. 121 0
      helper/refill/api/yl/yangchi_fs/config.php
  39. 4 0
      mobile/callback/refill_bier_fs.php
  40. 4 0
      mobile/callback/refill_yangchi.php
  41. 4 0
      mobile/callback/refill_yangchi_fs.php
  42. 42 0
      test/TestRefill.php

+ 71 - 0
data/config/xyz/refill.ini.php

@@ -7285,6 +7285,74 @@ $huishi_phone = ['name' => 'huishi', 'store_id' => 269, 'qualitys' => '1',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$yangchi_phone = ['name' => 'yangchi', 'store_id' => 270, 'qualitys' => '1',
+    'amount' => [
+//        10 => [['goods_id' => 8247, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        20 => [['goods_id' => 8248, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinamobile']],
+        30 => [
+//            ['goods_id' => 8249, 'price' => 28.98, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8249, 'price' => 26.7, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        50 => [
+            ['goods_id' => 8250, 'price' => 48.3, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8250, 'price' => 44.5, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        100 => [
+            ['goods_id' => 8251, 'price' => 96.6, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8251, 'price' => 89, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        200 => [
+            ['goods_id' => 8252, 'price' => 193.2, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8252, 'price' => 178, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        300 => [
+            ['goods_id' => 8253, 'price' => 267, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        500 => [
+            ['goods_id' => 8254, 'price' => 445, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$yangchi_fs_phone = ['name' => 'yangchi_fs', 'store_id' => 271, 'qualitys' => '1',
+    'amount' => [
+//        10 => [['goods_id' => 8255, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        20 => [['goods_id' => 8256, 'price' => 19, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        30 => [['goods_id' => 8257, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        50 => [['goods_id' => 8258, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        100 => [['goods_id' => 8259, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        200 => [['goods_id' => 8260, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        300 => [['goods_id' => 8261, 'price' => 285, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        500 => [['goods_id' => 8262, 'price' => 475, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$bier_fs_phone = ['name' => 'bier_fs', 'store_id' => 272, 'qualitys' => '1',
+    'amount' => [
+//        10 => [['goods_id' => 8263, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        20 => [['goods_id' => 8264, 'price' => 19, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        30 => [['goods_id' => 8265, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        50 => [['goods_id' => 8266, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        100 => [['goods_id' => 8267, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        200 => [['goods_id' => 8268, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        300 => [['goods_id' => 8269, 'price' => 285, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        500 => [['goods_id' => 8270, 'price' => 475, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$lechongquan_phone = ['name' => 'lechongquan', 'store_id' => 273, 'qualitys' => '2',
+    'amount' => [
+//        10 => [['goods_id' => 8271, 'price' => 9.985, 'quality' => 2, 'card_type' => 'chinaunicom']],
+//        20 => [['goods_id' => 8272, 'price' => 19.97, 'quality' => 2, 'card_type' => 'chinaunicom']],
+//        30 => [['goods_id' => 8273, 'price' => 29.955, 'quality' => 2, 'card_type' => 'chinaunicom']],
+        50 => [['goods_id' => 8274, 'price' => 49.925, 'quality' => 2, 'card_type' => 'chinaunicom']],
+        100 => [['goods_id' => 8275, 'price' => 99.85, 'quality' => 2, 'card_type' => 'chinaunicom']],
+        200 => [['goods_id' => 8276, 'price' => 199.7, 'quality' => 2, 'card_type' => 'chinaunicom']],
+        300 => [['goods_id' => 8277, 'price' => 299.55, 'quality' => 2, 'card_type' => 'chinaunicom']],
+//        500 => [['goods_id' => 8278, 'price' => 499.25, 'quality' => 2, 'card_type' => 'chinaunicom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -7511,6 +7579,9 @@ $phone_providers = [
     ['name' => 'bier', 'cfg' => $bier_phone],
     ['name' => 'youhe_fs', 'cfg' => $youhe_fs_phone],
     ['name' => 'huishi', 'cfg' => $huishi_phone],
+    ['name' => 'yangchi', 'cfg' => $yangchi_phone],
+    ['name' => 'yangchi_fs', 'cfg' => $yangchi_fs_phone],
+    ['name' => 'bier_fs', 'cfg' => $bier_fs_phone],
 
 ];
 $config['phone_providers'] = $phone_providers;

+ 58 - 0
data/config/yl/refill.ini.php

@@ -6805,6 +6805,61 @@ $youhe_fs_phone = ['name' => 'youhe_fs', 'store_id' => 252, 'qualitys' => '1',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$yangchi_phone = ['name' => 'yangchi', 'store_id' => 253, 'qualitys' => '1',
+    'amount' => [
+//        10 => [['goods_id' => 8107, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        20 => [['goods_id' => 8108, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinamobile']],
+        30 => [
+//            ['goods_id' => 8109, 'price' => 28.98, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8109, 'price' => 26.7, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        50 => [
+            ['goods_id' => 8110, 'price' => 48.3, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8110, 'price' => 44.5, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        100 => [
+            ['goods_id' => 8111, 'price' => 96.6, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8111, 'price' => 89, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        200 => [
+            ['goods_id' => 8112, 'price' => 193.2, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8112, 'price' => 178, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        300 => [
+            ['goods_id' => 8113, 'price' => 267, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        500 => [
+            ['goods_id' => 8114, 'price' => 445, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$yangchi_fs_phone = ['name' => 'yangchi_fs', 'store_id' => 254, 'qualitys' => '1',
+    'amount' => [
+//        10 => [['goods_id' => 8115, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        20 => [['goods_id' => 8116, 'price' => 19, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        30 => [['goods_id' => 8117, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        50 => [['goods_id' => 8118, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        100 => [['goods_id' => 8119, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        200 => [['goods_id' => 8120, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        300 => [['goods_id' => 8121, 'price' => 285, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        500 => [['goods_id' => 8122, 'price' => 475, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$bier_fs_phone = ['name' => 'bier_fs', 'store_id' => 255, 'qualitys' => '1',
+    'amount' => [
+//        10 => [['goods_id' => 8123, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        20 => [['goods_id' => 8124, 'price' => 19, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        30 => [['goods_id' => 8125, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        50 => [['goods_id' => 8126, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        100 => [['goods_id' => 8127, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        200 => [['goods_id' => 8128, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        300 => [['goods_id' => 8129, 'price' => 285, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        500 => [['goods_id' => 8130, 'price' => 475, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -7018,6 +7073,9 @@ $phone_providers = [
     ['name' => 'qianqian_fs_gd', 'cfg' => $qianqian_fs_gd_phone],
     ['name' => 'bier', 'cfg' => $bier_phone],
     ['name' => 'youhe_fs', 'cfg' => $youhe_fs_phone],
+    ['name' => 'yangchi', 'cfg' => $yangchi_phone],
+    ['name' => 'yangchi_fs', 'cfg' => $yangchi_fs_phone],
+    ['name' => 'bier_fs', 'cfg' => $bier_fs_phone],
 
 ];
 $config['phone_providers'] = $phone_providers;

+ 46 - 0
helper/refill/api/xyz/bier_fs/RefillCallBack.php

@@ -0,0 +1,46 @@
+<?php
+namespace refill\bier_fs;
+require_once(BASE_HELPER_RAPI_PATH . '/bier_fs/config.php');
+
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = $this->sign($params);
+        if ($params['sign'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params)
+    {
+        $signature = [config::KEY, $params['timestamp'], config::ACCOUNT];
+        sort($signature, SORT_STRING);
+        $signature = implode($signature);
+        return sha1($signature);
+    }
+
+    public function notify($params)
+    {
+        $status = $params['status'];
+        $order_sn = $params['consumerNo'];
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+
+        $order_id = $order_info['order_id'];
+        if ($status === '001') {
+            $data['official_sn'] = strtolower($params['voucherNo']) == 'null' ? '' : $params['voucherNo'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false, true];
+        } elseif (in_array($status,config::NotifyErrCodes, true)) {
+            return [$order_id, false, true, true];
+        } else {
+            return [$order_id, false, false, false];
+        }
+    }
+}

+ 174 - 0
helper/refill/api/xyz/bier_fs/RefillPhone.php

@@ -0,0 +1,174 @@
+<?php
+
+namespace refill\bier_fs;
+
+require_once(BASE_HELPER_RAPI_PATH . '/bier_fs/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        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 $card_type, string $order_sn)
+    {
+        $params['account'] = config::ACCOUNT;
+        $params['consumerNo'] = $order_sn;
+        $params['mobile'] = $phone;
+        $params['ispCode'] = config::operator[$card_type];
+        $params['cbkUrl'] = config::NOTIFY_URL;
+        $params['timestamp'] = $this->get_millisecond();
+
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
+    {
+        $regin_no = $params['regin_no'] ?? -1;
+        if($regin_no <= 0) {
+            return [false, '省份获取错误', false];
+        }
+        $params = $this->req_params($card_no, $card_type, $params['order_sn']);
+        $params['flowCode'] = config::ProductIDS[$card_type][$regin_no][$amount];
+        if (empty($params['flowCode'])) {
+            return [false, '产品编号错误', false];
+        }
+
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params, 'GET', false, [], $net_errno);
+
+        if (empty($resp)) {
+            return [false, '系统错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp ,true);
+
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['status'] === '001') {
+                return [true, $resp['orderNo'], false];
+            } else {
+                return [false, $resp['status'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['account'] = config::ACCOUNT;
+        $params['consumerNo'] = $refill_info['order_sn'];
+        $params['timestamp'] = $this->get_millisecond();
+        $params['sign'] = $this->sign($params);
+
+        $resp = http_request(config::QUERY_URL, $params);
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+
+            $status = $resp['status'];
+            if ($status === '001')
+            {
+                $order_state = ORDER_STATE_SUCCESS;
+                $save['official_sn'] = strtolower($resp['voucherNo']) == 'null' ? '' : $resp['voucherNo'];
+                Model('refill_order')->edit($refill_info['order_id'], $save);
+            }
+            elseif (in_array($status,config::QueryErrCodes, true))
+            {
+                if ($status === '026')
+                {
+                    //订单不存在状态,三小时内查询可失败,超过则返回充值中.不可以在下单后的同时立马发起查询,否则返回该状态处理为充值中,至少隔30秒以上再发起查询
+                    $commit_secs = time() - $refill_info['commit_time'];
+                    if ($commit_secs > 0 && $commit_secs <= 180) {
+                        return [false, '时长不足'];
+                    } elseif ($commit_secs > 180 && $commit_secs <= 10800) {
+                        $order_state = ORDER_STATE_NOEXIST;
+                    } else {
+                        $order_state = ORDER_STATE_SEND;
+                    }
+                }
+                else {
+                    $order_state = ORDER_STATE_CANCEL;
+                }
+            }
+            elseif ($status === '002') {
+                $order_state = ORDER_STATE_SEND;
+            }
+            else {
+                return [false, $status];
+            }
+
+            return [true, $order_state];
+        }
+    }
+
+    public function balance()
+    {
+        $params['account'] = config::ACCOUNT;
+        $params['timestamp'] = $this->get_millisecond();
+        $params['sign'] = $this->sign($params);
+
+        $resp = http_request(config::BALANCE_URL, $params);
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            } elseif ($resp['status'] === 'success') {
+                return [true, $resp['balance']];
+            } else {
+                return [false, $resp['descriptor']];
+            }
+        }
+    }
+
+    private function sign($params)
+    {
+        $signature = [config::KEY, $params['timestamp'], config::ACCOUNT];
+        sort($signature, SORT_STRING);
+        $signature = implode($signature);
+        return sha1($signature);
+    }
+
+    /**
+     * 获取毫秒级别的时间戳
+     */
+    private function get_millisecond()
+    {
+        $cur = microtime (true);
+        return intval($cur * 1000);
+    }
+}

+ 101 - 0
helper/refill/api/xyz/bier_fs/config.php

@@ -0,0 +1,101 @@
+<?php
+
+
+namespace refill\bier_fs;
+use mtopcard;
+
+class config
+{
+    const ORDER_URL = 'http://47.108.202.150/flow-receiver/api/recharge/feecbk';
+    const QUERY_URL = 'http://47.108.202.150/flow-receiver/api/query/feecbk';
+    const BALANCE_URL = 'http://47.108.202.150/flow-receiver/api/balance/feecbk';
+    const NOTIFY_URL = BASE_SITE_URL . '/mobile/callback/refill_bier_fs.php';
+
+    const ACCOUNT = 'yzfs1688';
+    const KEY = '257d28723a814bbcbc8b8f21edf669fe';
+    const operator = [
+        mtopcard\ChinaMobileCard  => 'CMCC',
+        mtopcard\ChinaUnicomCard  => 'CUCC',
+        mtopcard\ChinaTelecomCard => 'CTCC'
+    ];
+    const ProductIDS = [
+        mtopcard\ChinaMobileCard => [
+            //福建
+            13 => [
+                30 => 'CMCCFJr30r', 50 => 'CMCCFJr50r',
+                100 => 'CMCCFJr100r', 200 => 'CMCCFJr200r'
+            ],
+            //贵州
+            24 => [
+                30 => 'CMCCGZr30r', 50 => 'CMCCGZr50r',
+                100 => 'CMCCGZr100r', 200 => 'CMCCGZr200r'
+            ],
+            //广东
+            19 => [
+                30 => 'CMCCGDr30r', 50 => 'CMCCGDr50r',
+                100 => 'CMCCGDr100r', 200 => 'CMCCGDr200r'
+            ],
+            //山东
+            15 => [
+                50 => 'CMCCSDr50r',
+                100 => 'CMCCSDr100r', 200 => 'CMCCSDr200r'
+            ],
+            //江苏
+            10 => [
+                30 => 'CMCCJSr30r', 50 => 'CMCCJSr50r',
+                100 => 'CMCCJSr100r', 200 => 'CMCCJSr200r'
+            ],
+        ],
+        mtopcard\ChinaTelecomCard => [
+            //山东
+            15 => [
+                30 => 'CTCCSDr30r', 50 => 'CTCCSDr50r',
+                100 => 'CTCCSDr100r', 200 => 'CTCCSDr200r'
+            ],
+            //天津
+            2 => [
+                30 => 'CTCCTJr30r', 50 => 'CTCCTJr50r',
+                100 => 'CTCCTJr100r', 200 => 'CTCCTJr200r'
+            ],
+            //云南
+            25 => [
+                30 => 'CTCCYNr30r', 50 => 'CTCCYNr50r',
+                100 => 'CTCCYNr100r', 200 => 'CTCCYNr200r'
+            ],
+            //广东
+            19 => [
+                30 => 'CTCCGDr30r', 50 => 'CTCCGDr50r',
+                100 => 'CTCCGDr100r', 200 => 'CTCCGDr200r'
+            ],
+            //上海
+            9 => [
+                50 => 'CTCCSHr50r',
+                100 => 'CTCCSHr100r', 200 => 'CTCCSHr200r'
+            ],
+        ]
+    ];
+
+    const NotifyErrCodes = [
+        '003','004','005','006','007','008','015','016','017','018','019','020','021','022','023','025','027','028','098','099'
+    ];
+
+    const QueryErrCodes = [
+        '003','004','005','006','007','008','015','016','017','018','019','020','021','022','023','024','025','026','027','028','098','099'
+    ];
+
+    const Price = [
+        // 移动
+        "4-30-13" => 28.8, "4-50-13" => 48, "4-100-13" => 96, "4-200-13" => 192,//福建 13
+        "4-30-24" => 28.65, "4-50-24" => 47.75, "4-100-24" => 95.5, "4-200-24" => 191,//贵州 24
+        "4-30-19" => 28.8, "4-50-19" => 48, "4-100-19" => 96, "4-200-19" => 192,//广东 19
+        "4-50-15" => 48, "4-100-15" => 96, "4-200-15" => 192,//山东 15
+        "4-30-10" => 28.65, "4-50-10" => 47.75, "4-100-10" => 95.5, "4-200-10" => 191,//江苏 10
+
+        "6-30-23" => 28.65, "6-50-23" => 47.75, "6-100-23" => 95.5, "6-200-23" => 191,//四川 23
+        "6-30-15" => 28.65, "6-50-15" => 47.75, "6-100-15" => 95.5, "6-200-15" => 191,//山东 15
+        "6-30-2" => 28.65, "6-50-2" => 47.75, "6-100-2" => 95.5, "6-200-2" => 191,//天津 2
+        "6-30-25" => 28.65, "6-50-25" => 47.75, "6-100-25" => 95.5, "6-200-25" => 191,//云南 25
+        "6-30-19" => 28.8, "6-50-19" => 48, "6-100-19" => 96, "6-200-19" => 192,//广东 19
+        "6-50-9" => 47.75, "6-100-9" => 95.5, "6-200-9" => 191,//上海 9
+    ];
+}

+ 85 - 0
helper/refill/api/xyz/bier_fs/椰子.txt

@@ -0,0 +1,85 @@
+账号:yzfs1688
+密码:yz123456
+密钥:257d28723a814bbcbc8b8f21edf669fe
+
+客户后台地址:http://47.108.202.150/flow-consumer/login.html
+
+下单地址
+http://47.108.202.150/flow-receiver/api/recharge/feecbk
+查询地址
+http://47.108.202.150/flow-receiver/api/query/feecbk
+余额查询地址
+http://47.108.202.150/flow-receiver/api/balance/feecbk
+
+
+请务必绑定我们回调IP:47.108.202.150
+
+产品编码可登录客户后台查看:个人信息>产品编码
+
+福建移动分省
+CMCCFJr30r	折扣96
+CMCCFJr50r	折扣96
+CMCCFJr100r	折扣96
+CMCCFJr200r	折扣96
+
+贵州分省
+CMCCGZr30r	折扣95.5
+CMCCGZr50r	折扣95.5
+CMCCGZr100r	折扣95.5
+CMCCGZr200r	折扣95.5
+
+广东移动
+CMCCGDr30r	折扣96
+CMCCGDr50r	折扣96
+CMCCGDr100r	折扣96
+CMCCGDr200r	折扣96
+
+山东移动
+没有30面值
+CMCCSDr50r	折扣96
+CMCCSDr100r	折扣96
+CMCCSDr200r	折扣96
+
+江苏移动
+CMCCJSr30r	折扣95.5
+CMCCJSr50r	折扣95.5
+CMCCJSr100r	折扣95.5
+CMCCJSr200r	折扣95.5
+
+
+四川电信分省
+CTCCSCr30r 	折扣95.5
+CTCCSCr50r 	折扣95.5
+CTCCSCr100r 	折扣95.5
+CTCCSCr200r   	折扣95.5
+
+
+
+山东电信分省	折扣95.5
+CTCCSDr30r	折扣95.5
+CTCCSDr50r	折扣95.5
+CTCCSDr100r	折扣95.5
+CTCCSDr200r
+
+天津电信分省
+CTCCTJr30r	折扣95.5
+CTCCTJr50r	折扣95.5
+CTCCTJr100r	折扣95.5
+CTCCTJr200r	折扣95.5
+
+云南电信分省
+CTCCYNr30r	折扣95.5
+CTCCYNr50r	折扣95.5
+CTCCYNr100r	折扣95.5
+CTCCYNr200r	折扣95.5
+
+广东电信分省
+CTCCGDr30r	折扣96
+CTCCGDr50r	折扣96
+CTCCGDr100r	折扣96
+CTCCGDr200r	折扣96
+
+上海电信
+CTCCSHr50r
+CTCCSHr100r
+CTCCSHr200r

BIN
helper/refill/api/xyz/bier_fs/话费API接口文档.docx


+ 50 - 0
helper/refill/api/xyz/lechongquan/RefillCallBack.php

@@ -0,0 +1,50 @@
+<?php
+namespace refill\lechongquan;
+
+require_once(BASE_HELPER_RAPI_PATH . '/lechongquan/config.php');
+
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = $this->sign($params);
+        if ($params['szVerifyString'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$userid}&szOrderId={$params['szOrderId']}&szPhoneNum={$params['szPhoneNum']}&nDemo={$params['nDemo']}&fSalePrice={$params['fSalePrice']}";
+        $content .= "&nFlag={$params['nFlag']}&szKey={$key}";
+        return md5($content);
+    }
+
+    public function notify($params)
+    {
+        $status = intval($params['nFlag']);
+        $order_sn = $params['szOrderId'];
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+        $order_id = $order_info['order_id'];
+
+        if ($status === 2) {
+            $data['official_sn'] = strtolower($params['szRtnMsg']) == 'null' ? '' : $params['szRtnMsg'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif ($status === 3) {
+            return [$order_id, false, true,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
+}

+ 142 - 0
helper/refill/api/xyz/lechongquan/RefillPhone.php

@@ -0,0 +1,142 @@
+<?php
+
+namespace refill\lechongquan;
+
+require_once(BASE_HELPER_RAPI_PATH . '/lechongquan/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    private function req_params(int $phone, int $amount, int $card_type, string $order_sn)
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $params['szOrderId'] = $order_sn;
+        $params['szPhoneNum'] = $phone;
+        $params['nMoney'] = $amount;
+        $params['nSortType'] = config::operator[$card_type];
+        $params['szProductId'] = '';
+        $params['nProductClass'] = 1;
+        $params['nProductType'] = 1;
+        $params['szTimeStamp'] = date("Y-m-d H:i:s");
+        $params['szNotifyUrl'] = config::NOTIFY_URL;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
+    {
+        $order_sn = $params['order_sn'];
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
+
+        $sign = $this->sign($params);
+        $params['szVerifyString'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
+
+        if (empty($resp)) {
+            return [false, '网络错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+
+            $nRtn = $resp['nRtn'];
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            } elseif ($nRtn === 0) {
+                return [true, '', false];
+            } elseif (in_array($nRtn, config::ERR_NOS, true)) {
+                return [false, $resp['szRtnCode'], false];
+            } elseif (in_array($nRtn, [2050, 999], true)) {
+                $net_errno = "HTTP-{$nRtn}";
+                return [false, $resp['szRtnCode'], true];
+            } else {
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resp['szRtnCode'], true];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $params['szOrderId'] = $refill_info['order_sn'];
+        $key = config::KEY;
+        $content = "szAgentId={$params['szAgentId']}&szOrderId={$params['szOrderId']}&szKey={$key}";
+        $params['szVerifyString'] = md5($content);
+
+        $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            }
+
+            $status = $resp['nRtn'];
+            if ($status === 5012) {
+                $updata['official_sn'] = $resp['szRtnMsg'];
+                Model('refill_order')->edit($refill_info['order_id'], $updata);
+                $order_state = ORDER_STATE_SUCCESS;
+            } elseif ($status === 5013) {
+                $order_state = ORDER_STATE_CANCEL;
+            } elseif (in_array($status, [5011,5019],true)) {
+                $order_state = ORDER_STATE_SEND;
+            } elseif ($status === 5005 && (time() - $refill_info['commit_time'] >= 300)) {
+                $order_state = ORDER_STATE_NOEXIST;
+            } else {
+                return [false, $resp['szRtnMsg']];
+            }
+
+            return [true, $order_state];
+        }
+    }
+
+    public function balance()
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$params['szAgentId']}&szKey={$key}";
+        $params['szVerifyString'] = md5($content);
+
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            } elseif ($resp['nRtn'] === 0) {
+                return [true, $resp['fBalance']];
+            } else {
+                return [false, $resp['szRtnCode']];
+            }
+        }
+    }
+
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$userid}&szOrderId={$params['szOrderId']}&szPhoneNum={$params['szPhoneNum']}&nMoney={$params['nMoney']}&nSortType={$params['nSortType']}";
+        $content .= "&nProductClass={$params['nProductClass']}&nProductType={$params['nProductType']}&szTimeStamp={$params['szTimeStamp']}&szKey={$key}";
+        return md5($content);
+    }
+}

+ 15 - 0
helper/refill/api/xyz/lechongquan/api.txt

@@ -0,0 +1,15 @@
+对接文档:https://docs.qq.com/doc/DWkV1VkxQVk13eEtQ
+
+话费下单地址:http://123.56.142.204:10186/plat/api/old/submitorder
+查询地址:http://123.56.142.204:10186/plat/api/old/queryorder
+查询余额地址:http://123.56.142.204:10186/plat/api/old/queryBalance
+
+ID:200036
+
+秘钥:acab25bf463841948b3d7cd2c1c8f330
+
+后台地址:http://123.56.142.204:10186/plat/index
+
+账户:guoyanwuxianzhi
+
+密码:123456

+ 28 - 0
helper/refill/api/xyz/lechongquan/config.php

@@ -0,0 +1,28 @@
+<?php
+
+
+namespace refill\lechongquan;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://123.56.142.204:10186/plat/api/old/submitorder';
+    const QUERY_URL= 'http://123.56.142.204:10186/plat/api/old/queryorder';
+    const BALANCE_URL = 'http://123.56.142.204:10186/plat/api/old/queryBalance';
+
+    const USER_ID= '200036';
+    const KEY = 'acab25bf463841948b3d7cd2c1c8f330';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_lechongquan.php";
+
+
+    const operator = [
+        mtopcard\ChinaMobileCard  => 1,
+        mtopcard\ChinaUnicomCard  => 2,
+        mtopcard\ChinaTelecomCard => 3
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
+
+    const ERR_NOS = [
+        1000,1001,1003,1004,2001,2002,2003,2020,2021,1006,2030,3003
+    ];
+}

+ 43 - 0
helper/refill/api/xyz/qianqian_fs/api.txt

@@ -42,3 +42,46 @@ CMCCGZr200r				200
 CMCCGDr50r
 CMCCGDr100r
 CMCCGDr200r
+
+2022.11.18
+福建移动分省
+
+CMCCFJr30r
+CMCCFJr50r
+CMCCFJr100r
+CMCCFJr200r
+
+四川电信分省
+CTCCSCr30r
+CTCCSCr50r
+CTCCSCr100r
+CTCCSCr200r
+
+山东电信分省
+CTCCSDr30r
+CTCCSDr50r
+CTCCSDr100r
+CTCCSDr200r
+
+天津电信分省
+CTCCTJr30r
+CTCCTJr50r
+CTCCTJr100r
+CTCCTJr200r
+
+云南电信分省
+CTCCYNr30r
+CTCCYNr50r
+CTCCYNr100r
+CTCCYNr200r
+
+广东电信分省
+CTCCGDr30r
+CTCCGDr50r
+CTCCGDr100r
+CTCCGDr200r
+
+上海电信
+CTCCSHr50r
+CTCCSHr100r
+CTCCSHr200r

+ 26 - 2
helper/refill/api/xyz/qianqian_fs/config.php

@@ -25,6 +25,9 @@ class config
             24 => [
                 50 => 'CMCCGZr50r', 100 => 'CMCCGZr100r', 200 => 'CMCCGZr200r'
             ], //贵州
+            13 => [
+                30 => 'CMCCFJr30r', 50 => 'CMCCFJr50r', 100 => 'CMCCFJr100r', 200 => 'CMCCFJr200r'
+            ], //福建
         ],
         mtopcard\ChinaUnicomCard => [
 
@@ -32,7 +35,22 @@ class config
         mtopcard\ChinaTelecomCard => [
             19 => [
                 30 => 'CTCCGDr30r', 50 => 'CTCCGDr50r', 100 => 'CTCCGDr100r', 200 => 'CTCCGDr200r'
-            ] //广东
+            ], //广东
+            23 => [
+                30 => 'CTCCSCr30r', 50 => 'CTCCSCr50r', 100 => 'CTCCSCr100r', 200 => 'CTCCSCr200r'
+            ], //四川
+            15 => [
+                30 => 'CTCCSDr30r', 50 => 'CTCCSDr50r', 100 => 'CTCCSDr100r', 200 => 'CTCCSDr200r'
+            ], //山东
+            2 => [
+                30 => 'CTCCTJr30r', 50 => 'CTCCTJr50r', 100 => 'CTCCTJr100r', 200 => 'CTCCTJr200r'
+            ], //天津
+            25 => [
+                30 => 'CTCCYNr30r', 50 => 'CTCCYNr50r', 100 => 'CTCCYNr100r', 200 => 'CTCCYNr200r'
+            ], //云南
+            9 => [
+                50 => 'CTCCSHr50r', 100 => 'CTCCSHr100r', 200 => 'CTCCSHr200r'
+            ], //上海
         ]
     ];
 
@@ -50,8 +68,14 @@ class config
         "4-50-10" => 47.75, "4-100-10" => 95.5, "4-200-10" => 191,//江苏 10
         "4-50-15" => 48, "4-100-15" => 96, "4-200-15" => 192,//山东 15
         "4-50-24" => 47.75, "4-100-24" => 95.5, "4-200-24" => 191,//贵州 24
+        "4-30-13" => 28.65, "4-50-13" => 47.75, "4-100-13" => 95.5, "4-200-13" => 191,//福建 13
 
         //电信
-        "6-30-19" => 28.5, "6-50-19" => 47.5, "6-100-19" => 95, "6-200-19" => 190,//广东 19
+        "6-30-19" => 28.8, "6-50-19" => 48, "6-100-19" => 96, "6-200-19" => 192,//广东 19
+        "6-30-23" => 28.65, "6-50-23" => 47.75, "6-100-23" => 95.5, "6-200-23" => 191,//四川 23
+        "6-30-15" => 28.65, "6-50-15" => 47.75, "6-100-15" => 95.5, "6-200-15" => 191,//山东 15
+        "6-30-2" => 28.65, "6-50-2" => 47.75, "6-100-2" => 95.5, "6-200-2" => 191,//天津 2
+        "6-30-25" => 28.65, "6-50-25" => 47.75, "6-100-25" => 95.5, "6-200-25" => 191,//云南 25
+        "6-50-9" => 47.75, "6-100-9" => 95.5, "6-200-9" => 191,//上海 9
     ];
 }

BIN
helper/refill/api/xyz/ruixunda_fs/20221118江苏福建调价函.jpg


+ 2 - 2
helper/refill/api/xyz/ruixunda_fs/config.php

@@ -91,9 +91,9 @@ class config
     const Price = [
         //移动
         "4-30-24" => 27.6, "4-50-24" => 46, "4-100-24" => 92, "4-200-24" => 184,//贵州 24
-        "4-30-10" => 28.5, "4-50-10" => 47.5, "4-100-10" => 95, "4-200-10" => 190,//江苏 10
+        "4-30-10" => 28.5, "4-50-10" => 46.5, "4-100-10" => 93, "4-200-10" => 186,//江苏 10
         "4-30-15" => 28.5, "4-50-15" => 47.5, "4-100-15" => 95, "4-200-15" => 190,//山东 15
-        "4-30-13" => 28.2, "4-50-13" => 47, "4-100-13" => 94, "4-200-13" => 188,//福建 13
+        "4-30-13" => 28.2, "4-50-13" => 46.75, "4-100-13" => 93.5, "4-200-13" => 187,//福建 13
 
         //电信
         "6-30-18" => 28.05, "6-50-18" => 46.75, "6-100-18" => 93.5, "6-200-18" => 187,//湖南 18

+ 50 - 0
helper/refill/api/xyz/yangchi/RefillCallBack.php

@@ -0,0 +1,50 @@
+<?php
+namespace refill\yangchi;
+
+require_once(BASE_HELPER_RAPI_PATH . '/yangchi/config.php');
+
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = $this->sign($params);
+        if ($params['szVerifyString'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$userid}&szOrderId={$params['szOrderId']}&szPhoneNum={$params['szPhoneNum']}&nDemo={$params['nDemo']}&fSalePrice={$params['fSalePrice']}";
+        $content .= "&nFlag={$params['nFlag']}&szKey={$key}";
+        return md5($content);
+    }
+
+    public function notify($params)
+    {
+        $status = intval($params['nFlag']);
+        $order_sn = $params['szOrderId'];
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+        $order_id = $order_info['order_id'];
+
+        if ($status === 2) {
+            $data['official_sn'] = strtolower($params['szRtnMsg']) == 'null' ? '' : $params['szRtnMsg'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif ($status === 3) {
+            return [$order_id, false, true,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
+}

+ 142 - 0
helper/refill/api/xyz/yangchi/RefillPhone.php

@@ -0,0 +1,142 @@
+<?php
+
+namespace refill\yangchi;
+
+require_once(BASE_HELPER_RAPI_PATH . '/yangchi/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    private function req_params(int $phone, int $amount, int $card_type, string $order_sn)
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $params['szOrderId'] = $order_sn;
+        $params['szPhoneNum'] = $phone;
+        $params['nMoney'] = $amount;
+        $params['nSortType'] = config::operator[$card_type];
+        $params['szProductId'] = config::Product[$card_type][$amount];
+        $params['nProductClass'] = 1;
+        $params['nProductType'] = 1;
+        $params['szTimeStamp'] = date("Y-m-d H:i:s");
+        $params['szNotifyUrl'] = config::NOTIFY_URL;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
+    {
+        $order_sn = $params['order_sn'];
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
+
+        $sign = $this->sign($params);
+        $params['szVerifyString'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
+
+        if (empty($resp)) {
+            return [false, '网络错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+
+            $nRtn = $resp['nRtn'];
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            } elseif ($nRtn === 0) {
+                return [true, '', false];
+            } elseif (in_array($nRtn, config::ERR_NOS, true)) {
+                return [false, $resp['szRtnCode'], false];
+            } elseif (in_array($nRtn, [2050, 999], true)) {
+                $net_errno = "HTTP-{$nRtn}";
+                return [false, $resp['szRtnCode'], true];
+            } else {
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resp['szRtnCode'], true];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $params['szOrderId'] = $refill_info['order_sn'];
+        $key = config::KEY;
+        $content = "szAgentId={$params['szAgentId']}&szOrderId={$params['szOrderId']}&szKey={$key}";
+        $params['szVerifyString'] = md5($content);
+
+        $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            }
+
+            $status = $resp['nRtn'];
+            if ($status === 5012) {
+                $updata['official_sn'] = $resp['szRtnMsg'];
+                Model('refill_order')->edit($refill_info['order_id'], $updata);
+                $order_state = ORDER_STATE_SUCCESS;
+            } elseif ($status === 5013) {
+                $order_state = ORDER_STATE_CANCEL;
+            } elseif (in_array($status, [5011,5019],true)) {
+                $order_state = ORDER_STATE_SEND;
+            } elseif ($status === 5005 && (time() - $refill_info['commit_time'] >= 300)) {
+                $order_state = ORDER_STATE_NOEXIST;
+            } else {
+                return [false, $resp['szRtnMsg']];
+            }
+
+            return [true, $order_state];
+        }
+    }
+
+    public function balance()
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$params['szAgentId']}&szKey={$key}";
+        $params['szVerifyString'] = md5($content);
+
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            } elseif ($resp['nRtn'] === 0) {
+                return [true, $resp['fBalance']];
+            } else {
+                return [false, $resp['szRtnCode']];
+            }
+        }
+    }
+
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$userid}&szOrderId={$params['szOrderId']}&szPhoneNum={$params['szPhoneNum']}&nMoney={$params['nMoney']}&nSortType={$params['nSortType']}";
+        $content .= "&nProductClass={$params['nProductClass']}&nProductType={$params['nProductType']}&szTimeStamp={$params['szTimeStamp']}&szKey={$key}";
+        return md5($content);
+    }
+}

+ 27 - 0
helper/refill/api/xyz/yangchi/api.txt

@@ -0,0 +1,27 @@
+正式环境:
+话费下单地址:http://47.118.37.113:10186/plat/api/old/submitorder
+
+查询地址:http://47.118.37.113:10186/plat/api/old/queryorder
+
+查询余额地址:http://47.118.37.113:10186/plat/api/old/queryBalance
+
+商户登录地址:http://47.118.37.113:10186/plat
+
+ID:200035
+
+秘钥:8660abb89a354cabbaa51e5eefe3bb45
+
+账户:dyy 密码:123456
+
+对接文档地址:https://docs.qq.com/doc/DWkV1VkxQVk13eEtQ
+
+全国移动50元	1000050	966
+全国移动100元	1000100	966
+全国移动200元	1000200	966
+
+全国联通30元	2000030	890
+全国联通50元	2000050	890
+全国联通100元	2000100	890
+全国联通200元	2000200	890
+全国联通300元	2000300	890
+全国联通500元	2000500	890

+ 43 - 0
helper/refill/api/xyz/yangchi/config.php

@@ -0,0 +1,43 @@
+<?php
+
+
+namespace refill\yangchi;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://47.118.37.113:10186/plat/api/old/submitorder';
+    const QUERY_URL= 'http://47.118.37.113:10186/plat/api/old/queryorder';
+    const BALANCE_URL = 'http://47.118.37.113:10186/plat/api/old/queryBalance';
+
+    const USER_ID= '200035';
+    const KEY = '8660abb89a354cabbaa51e5eefe3bb45';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_yangchi.php";
+
+    const operator = [
+        mtopcard\ChinaMobileCard  => 1,
+        mtopcard\ChinaUnicomCard  => 2,
+        mtopcard\ChinaTelecomCard => 3
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
+
+    const ERR_NOS = [
+        1000,1001,1003,1004,2001,2002,2003,2020,2021,1006,2030,3003
+    ];
+
+    const Product = [
+        mtopcard\ChinaMobileCard => [
+            50  => 1000050,
+            100 => 1000100,
+            200 => 1000200,
+        ],
+        mtopcard\ChinaUnicomCard => [
+            30  => 2000030,
+            50  => 2000050,
+            100 => 2000100,
+            200 => 2000200,
+            300 => 2000300,
+            500 => 2000500,
+        ],
+    ];
+}

+ 50 - 0
helper/refill/api/xyz/yangchi_fs/RefillCallBack.php

@@ -0,0 +1,50 @@
+<?php
+namespace refill\yangchi_fs;
+
+require_once(BASE_HELPER_RAPI_PATH . '/yangchi_fs/config.php');
+
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = $this->sign($params);
+        if ($params['szVerifyString'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$userid}&szOrderId={$params['szOrderId']}&szPhoneNum={$params['szPhoneNum']}&nDemo={$params['nDemo']}&fSalePrice={$params['fSalePrice']}";
+        $content .= "&nFlag={$params['nFlag']}&szKey={$key}";
+        return md5($content);
+    }
+
+    public function notify($params)
+    {
+        $status = intval($params['nFlag']);
+        $order_sn = $params['szOrderId'];
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+        $order_id = $order_info['order_id'];
+
+        if ($status === 2) {
+            $data['official_sn'] = strtolower($params['szRtnMsg']) == 'null' ? '' : $params['szRtnMsg'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif ($status === 3) {
+            return [$order_id, false, true,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
+}

+ 161 - 0
helper/refill/api/xyz/yangchi_fs/RefillPhone.php

@@ -0,0 +1,161 @@
+<?php
+
+namespace refill\yangchi_fs;
+
+require_once(BASE_HELPER_RAPI_PATH . '/yangchi_fs/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        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, int $card_type, string $order_sn, $regin_no)
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $params['szOrderId'] = $order_sn;
+        $params['szPhoneNum'] = $phone;
+        $params['nMoney'] = $amount;
+        $params['nSortType'] = config::operator[$card_type];
+        $params['szProductId'] = config::Product[$card_type][$regin_no][$amount];
+        $params['nProductClass'] = 1;
+        $params['nProductType'] = 1;
+        $params['szTimeStamp'] = date("Y-m-d H:i:s");
+        $params['szNotifyUrl'] = config::NOTIFY_URL;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
+    {
+        $order_sn = $params['order_sn'];
+        $regin_no = $params['regin_no'] ?? -1;
+
+        if($regin_no <= 0) {
+            return [false, '省份获取错误', false];
+        }
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn, $regin_no);
+
+        $sign = $this->sign($params);
+        $params['szVerifyString'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
+
+        if (empty($resp)) {
+            return [false, '网络错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+
+            $nRtn = $resp['nRtn'];
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            } elseif ($nRtn === 0) {
+                return [true, '', false];
+            } elseif (in_array($nRtn, config::ERR_NOS, true)) {
+                return [false, $resp['szRtnCode'], false];
+            } elseif (in_array($nRtn, [2050, 999], true)) {
+                $net_errno = "HTTP-{$nRtn}";
+                return [false, $resp['szRtnCode'], true];
+            } else {
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resp['szRtnCode'], true];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $params['szOrderId'] = $refill_info['order_sn'];
+        $key = config::KEY;
+        $content = "szAgentId={$params['szAgentId']}&szOrderId={$params['szOrderId']}&szKey={$key}";
+        $params['szVerifyString'] = md5($content);
+
+        $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            }
+
+            $status = $resp['nRtn'];
+            if ($status === 5012) {
+                $updata['official_sn'] = $resp['szRtnMsg'];
+                Model('refill_order')->edit($refill_info['order_id'], $updata);
+                $order_state = ORDER_STATE_SUCCESS;
+            } elseif ($status === 5013) {
+                $order_state = ORDER_STATE_CANCEL;
+            } elseif (in_array($status, [5011,5019],true)) {
+                $order_state = ORDER_STATE_SEND;
+            } elseif ($status === 5005 && (time() - $refill_info['commit_time'] >= 300)) {
+                $order_state = ORDER_STATE_NOEXIST;
+            } else {
+                return [false, $resp['szRtnMsg']];
+            }
+
+            return [true, $order_state];
+        }
+    }
+
+    public function balance()
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$params['szAgentId']}&szKey={$key}";
+        $params['szVerifyString'] = md5($content);
+
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            } elseif ($resp['nRtn'] === 0) {
+                return [true, $resp['fBalance']];
+            } else {
+                return [false, $resp['szRtnCode']];
+            }
+        }
+    }
+
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$userid}&szOrderId={$params['szOrderId']}&szPhoneNum={$params['szPhoneNum']}&nMoney={$params['nMoney']}&nSortType={$params['nSortType']}";
+        $content .= "&nProductClass={$params['nProductClass']}&nProductType={$params['nProductType']}&szTimeStamp={$params['szTimeStamp']}&szKey={$key}";
+        return md5($content);
+    }
+}

+ 62 - 0
helper/refill/api/xyz/yangchi_fs/api.txt

@@ -0,0 +1,62 @@
+正式环境:
+话费下单地址:http://47.118.37.113:10186/plat/api/old/submitorder
+查询地址:http://47.118.37.113:10186/plat/api/old/queryorder
+查询余额地址:http://47.118.37.113:10186/plat/api/old/queryBalance
+
+商户登录地址:http://47.118.37.113:10186/plat
+ID:200036
+秘钥:d2270210995f4462b01ffe897fcad274
+账户:dyyfs 密码:123456
+
+对接文档地址:https://docs.qq.com/doc/DWkV1VkxQVk13eEtQ
+
+贵州移动30元	1520030
+贵州移动50元	1520050
+贵州移动100元	1520100
+贵州移动200元	1520200
+
+福建移动30元	1350030
+福建移动50元	1350050
+福建移动100元	1350100
+福建移动200元	1350200
+
+山东移动30元	1370030
+山东移动50元	1370050
+山东移动100元	1370100
+山东移动200元	1370200
+
+江苏移动30元	1320030
+江苏移动50元	1320050
+江苏移动100元	1320100
+江苏移动200元	1320200
+
+广东移动50元	1440050
+广东移动100元	1440100
+广东移动200元	1440200
+
+
+
+天津电信30元	3120030
+天津电信50元	3120050
+天津电信100元	3120100
+天津电信200元	3120200
+
+四川电信30元	3510030
+四川电信50元	3510050
+四川电信100元	3510100
+四川电信200元	3510200
+
+上海电信30元	3310030
+上海电信50元	3310050
+上海电信100元	3310100
+上海电信200元	3310200
+
+山东电信30元	3370030
+山东电信50元	3370050
+山东电信100元	3370100
+山东电信200元	3370200
+
+广东电信30元	3440030
+广东电信50元	3440050
+广东电信100元	3440100
+广东电信200元	3440200

+ 121 - 0
helper/refill/api/xyz/yangchi_fs/config.php

@@ -0,0 +1,121 @@
+<?php
+
+
+namespace refill\yangchi_fs;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://47.118.37.113:10186/plat/api/old/submitorder';
+    const QUERY_URL= 'http://47.118.37.113:10186/plat/api/old/queryorder';
+    const BALANCE_URL = 'http://47.118.37.113:10186/plat/api/old/queryBalance';
+
+    const USER_ID= '200036';
+    const KEY = 'd2270210995f4462b01ffe897fcad274';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_yangchi_fs.php";
+
+    const operator = [
+        mtopcard\ChinaMobileCard  => 1,
+        mtopcard\ChinaUnicomCard  => 2,
+        mtopcard\ChinaTelecomCard => 3
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
+
+    const ERR_NOS = [
+        1000,1001,1003,1004,2001,2002,2003,2020,2021,1006,2030,3003
+    ];
+
+    const Product = [
+        mtopcard\ChinaMobileCard => [
+            //贵州
+            24 => [
+                30  => 1520030,
+                50  => 1520050,
+                100 => 1520100,
+                200 => 1520200,
+            ],
+            //福建
+            13 => [
+                30  => 1350030,
+                50  => 1350050,
+                100 => 1350100,
+                200 => 1350200,
+            ],
+            //山东
+            15 => [
+                30  => 1370030,
+                50  => 1370050,
+                100 => 1370100,
+                200 => 1370200,
+            ],
+            //江苏
+            10 => [
+                30  => 1320030,
+                50  => 1320050,
+                100 => 1320100,
+                200 => 1320200,
+            ],
+            //广东
+            19 => [
+                50  => 1440050,
+                100 => 1440100,
+                200 => 1440200,
+            ],
+        ],
+        mtopcard\ChinaTelecomCard => [
+            //天津
+            2 => [
+                30  => 3120030,
+                50  => 3120050,
+                100 => 3120100,
+                200 => 3120200,
+            ],
+            //四川
+            23 => [
+                30  => 3510030,
+                50  => 3510050,
+                100 => 3510100,
+                200 => 3510200,
+            ],
+            //上海
+            9 => [
+                30  => 3310030,
+                50  => 3310050,
+                100 => 3310100,
+                200 => 3310200,
+            ],
+            //山东
+            15 => [
+                30  => 3370030,
+                50  => 3370050,
+                100 => 3370100,
+                200 => 3370200,
+            ],
+            //广东
+            19 => [
+                30  => 3440030,
+                50  => 3440050,
+                100 => 3440100,
+                200 => 3440200,
+            ],
+        ],
+    ];
+
+    //key格式 卡类型-面值-regin_no
+    const Price = [
+        //移动
+        "4-30-24" => 27.78, "4-50-24" => 46.3, "4-100-24" => 92.6, "4-200-24" => 185.2,//贵州 24
+        "4-30-13" => 28.5, "4-50-13" => 47.5, "4-100-13" => 95, "4-200-13" => 190,//福建 13
+        "4-30-15" => 28.65, "4-50-15" => 47.75, "4-100-15" => 95.5, "4-200-15" => 191,//山东 15
+        "4-30-10" => 28.2, "4-50-10" => 47, "4-100-10" => 94, "4-200-10" => 188,//江苏 10
+        "4-50-19" => 47.35, "4-100-19" => 94.7, "4-200-19" => 189.4,//广东 19
+
+        //电信
+        "6-30-2" => 28.05, "6-50-2" => 46.75, "6-100-2" => 93.5, "6-200-2" => 187,//天津 2
+        "6-30-23" => 28.05, "6-50-23" => 46.75, "6-100-23" => 93.5, "6-200-23" => 187,//四川 23
+        "6-30-9" => 28.35, "6-50-9" => 47.25, "6-100-9" => 94.5, "6-200-9" => 189,//上海 9
+        "6-30-15" => 28.35, "6-50-15" => 47.25, "6-100-15" => 94.5, "6-200-15" => 189,//山东 15
+        "6-30-19" => 28.5, "6-50-19" => 47.5, "6-100-19" => 95, "6-200-19" => 190,//广东 19
+    ];
+
+}

+ 46 - 0
helper/refill/api/yl/bier_fs/RefillCallBack.php

@@ -0,0 +1,46 @@
+<?php
+namespace refill\bier_fs;
+require_once(BASE_HELPER_RAPI_PATH . '/bier_fs/config.php');
+
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = $this->sign($params);
+        if ($params['sign'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params)
+    {
+        $signature = [config::KEY, $params['timestamp'], config::ACCOUNT];
+        sort($signature, SORT_STRING);
+        $signature = implode($signature);
+        return sha1($signature);
+    }
+
+    public function notify($params)
+    {
+        $status = $params['status'];
+        $order_sn = $params['consumerNo'];
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+
+        $order_id = $order_info['order_id'];
+        if ($status === '001') {
+            $data['official_sn'] = strtolower($params['voucherNo']) == 'null' ? '' : $params['voucherNo'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false, true];
+        } elseif (in_array($status,config::NotifyErrCodes, true)) {
+            return [$order_id, false, true, true];
+        } else {
+            return [$order_id, false, false, false];
+        }
+    }
+}

+ 174 - 0
helper/refill/api/yl/bier_fs/RefillPhone.php

@@ -0,0 +1,174 @@
+<?php
+
+namespace refill\bier_fs;
+
+require_once(BASE_HELPER_RAPI_PATH . '/bier_fs/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        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 $card_type, string $order_sn)
+    {
+        $params['account'] = config::ACCOUNT;
+        $params['consumerNo'] = $order_sn;
+        $params['mobile'] = $phone;
+        $params['ispCode'] = config::operator[$card_type];
+        $params['cbkUrl'] = config::NOTIFY_URL;
+        $params['timestamp'] = $this->get_millisecond();
+
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
+    {
+        $regin_no = $params['regin_no'] ?? -1;
+        if($regin_no <= 0) {
+            return [false, '省份获取错误', false];
+        }
+        $params = $this->req_params($card_no, $card_type, $params['order_sn']);
+        $params['flowCode'] = config::ProductIDS[$card_type][$regin_no][$amount];
+        if (empty($params['flowCode'])) {
+            return [false, '产品编号错误', false];
+        }
+
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params, 'GET', false, [], $net_errno);
+
+        if (empty($resp)) {
+            return [false, '系统错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp ,true);
+
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['status'] === '001') {
+                return [true, $resp['orderNo'], false];
+            } else {
+                return [false, $resp['status'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['account'] = config::ACCOUNT;
+        $params['consumerNo'] = $refill_info['order_sn'];
+        $params['timestamp'] = $this->get_millisecond();
+        $params['sign'] = $this->sign($params);
+
+        $resp = http_request(config::QUERY_URL, $params);
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+
+            $status = $resp['status'];
+            if ($status === '001')
+            {
+                $order_state = ORDER_STATE_SUCCESS;
+                $save['official_sn'] = strtolower($resp['voucherNo']) == 'null' ? '' : $resp['voucherNo'];
+                Model('refill_order')->edit($refill_info['order_id'], $save);
+            }
+            elseif (in_array($status,config::QueryErrCodes, true))
+            {
+                if ($status === '026')
+                {
+                    //订单不存在状态,三小时内查询可失败,超过则返回充值中.不可以在下单后的同时立马发起查询,否则返回该状态处理为充值中,至少隔30秒以上再发起查询
+                    $commit_secs = time() - $refill_info['commit_time'];
+                    if ($commit_secs > 0 && $commit_secs <= 180) {
+                        return [false, '时长不足'];
+                    } elseif ($commit_secs > 180 && $commit_secs <= 10800) {
+                        $order_state = ORDER_STATE_NOEXIST;
+                    } else {
+                        $order_state = ORDER_STATE_SEND;
+                    }
+                }
+                else {
+                    $order_state = ORDER_STATE_CANCEL;
+                }
+            }
+            elseif ($status === '002') {
+                $order_state = ORDER_STATE_SEND;
+            }
+            else {
+                return [false, $status];
+            }
+
+            return [true, $order_state];
+        }
+    }
+
+    public function balance()
+    {
+        $params['account'] = config::ACCOUNT;
+        $params['timestamp'] = $this->get_millisecond();
+        $params['sign'] = $this->sign($params);
+
+        $resp = http_request(config::BALANCE_URL, $params);
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            } elseif ($resp['status'] === 'success') {
+                return [true, $resp['balance']];
+            } else {
+                return [false, $resp['descriptor']];
+            }
+        }
+    }
+
+    private function sign($params)
+    {
+        $signature = [config::KEY, $params['timestamp'], config::ACCOUNT];
+        sort($signature, SORT_STRING);
+        $signature = implode($signature);
+        return sha1($signature);
+    }
+
+    /**
+     * 获取毫秒级别的时间戳
+     */
+    private function get_millisecond()
+    {
+        $cur = microtime (true);
+        return intval($cur * 1000);
+    }
+}

+ 101 - 0
helper/refill/api/yl/bier_fs/config.php

@@ -0,0 +1,101 @@
+<?php
+
+
+namespace refill\bier_fs;
+use mtopcard;
+
+class config
+{
+    const ORDER_URL = 'http://47.108.202.150/flow-receiver/api/recharge/feecbk';
+    const QUERY_URL = 'http://47.108.202.150/flow-receiver/api/query/feecbk';
+    const BALANCE_URL = 'http://47.108.202.150/flow-receiver/api/balance/feecbk';
+    const NOTIFY_URL = BASE_SITE_URL . '/mobile/callback/refill_bier_fs.php';
+
+    const ACCOUNT = 'ylfs1588';
+    const KEY = '4592a79540984a8f8b9610db42cf6561';
+    const operator = [
+        mtopcard\ChinaMobileCard  => 'CMCC',
+        mtopcard\ChinaUnicomCard  => 'CUCC',
+        mtopcard\ChinaTelecomCard => 'CTCC'
+    ];
+    const ProductIDS = [
+        mtopcard\ChinaMobileCard => [
+            //福建
+            13 => [
+                30 => 'CMCCFJr30r', 50 => 'CMCCFJr50r',
+                100 => 'CMCCFJr100r', 200 => 'CMCCFJr200r'
+            ],
+            //贵州
+            24 => [
+                30 => 'CMCCGZr30r', 50 => 'CMCCGZr50r',
+                100 => 'CMCCGZr100r', 200 => 'CMCCGZr200r'
+            ],
+            //广东
+            19 => [
+                30 => 'CMCCGDr30r', 50 => 'CMCCGDr50r',
+                100 => 'CMCCGDr100r', 200 => 'CMCCGDr200r'
+            ],
+            //山东
+            15 => [
+                50 => 'CMCCSDr50r',
+                100 => 'CMCCSDr100r', 200 => 'CMCCSDr200r'
+            ],
+            //江苏
+            10 => [
+                30 => 'CMCCJSr30r', 50 => 'CMCCJSr50r',
+                100 => 'CMCCJSr100r', 200 => 'CMCCJSr200r'
+            ],
+        ],
+        mtopcard\ChinaTelecomCard => [
+            //山东
+            15 => [
+                30 => 'CTCCSDr30r', 50 => 'CTCCSDr50r',
+                100 => 'CTCCSDr100r', 200 => 'CTCCSDr200r'
+            ],
+            //天津
+            2 => [
+                30 => 'CTCCTJr30r', 50 => 'CTCCTJr50r',
+                100 => 'CTCCTJr100r', 200 => 'CTCCTJr200r'
+            ],
+            //云南
+            25 => [
+                30 => 'CTCCYNr30r', 50 => 'CTCCYNr50r',
+                100 => 'CTCCYNr100r', 200 => 'CTCCYNr200r'
+            ],
+            //广东
+            19 => [
+                30 => 'CTCCGDr30r', 50 => 'CTCCGDr50r',
+                100 => 'CTCCGDr100r', 200 => 'CTCCGDr200r'
+            ],
+            //上海
+            9 => [
+                50 => 'CTCCSHr50r',
+                100 => 'CTCCSHr100r', 200 => 'CTCCSHr200r'
+            ],
+        ]
+    ];
+
+    const NotifyErrCodes = [
+        '003','004','005','006','007','008','015','016','017','018','019','020','021','022','023','025','027','028','098','099'
+    ];
+
+    const QueryErrCodes = [
+        '003','004','005','006','007','008','015','016','017','018','019','020','021','022','023','024','025','026','027','028','098','099'
+    ];
+
+    const Price = [
+        // 移动
+        "4-30-13" => 28.8, "4-50-13" => 48, "4-100-13" => 96, "4-200-13" => 192,//福建 13
+        "4-30-24" => 28.65, "4-50-24" => 47.75, "4-100-24" => 95.5, "4-200-24" => 191,//贵州 24
+        "4-30-19" => 28.8, "4-50-19" => 48, "4-100-19" => 96, "4-200-19" => 192,//广东 19
+        "4-50-15" => 48, "4-100-15" => 96, "4-200-15" => 192,//山东 15
+        "4-30-10" => 28.65, "4-50-10" => 47.75, "4-100-10" => 95.5, "4-200-10" => 191,//江苏 10
+
+        "6-30-23" => 28.65, "6-50-23" => 47.75, "6-100-23" => 95.5, "6-200-23" => 191,//四川 23
+        "6-30-15" => 28.65, "6-50-15" => 47.75, "6-100-15" => 95.5, "6-200-15" => 191,//山东 15
+        "6-30-2" => 28.65, "6-50-2" => 47.75, "6-100-2" => 95.5, "6-200-2" => 191,//天津 2
+        "6-30-25" => 28.65, "6-50-25" => 47.75, "6-100-25" => 95.5, "6-200-25" => 191,//云南 25
+        "6-30-19" => 28.8, "6-50-19" => 48, "6-100-19" => 96, "6-200-19" => 192,//广东 19
+        "6-50-9" => 47.75, "6-100-9" => 95.5, "6-200-9" => 191,//上海 9
+    ];
+}

+ 80 - 0
helper/refill/api/yl/bier_fs/椰子.txt

@@ -0,0 +1,80 @@
+账号:ylfs1588
+密码:yl123456
+密钥:4592a79540984a8f8b9610db42cf6561
+
+客户后台地址:http://47.108.202.150/flow-consumer/login.html
+
+下单地址
+http://47.108.202.150/flow-receiver/api/recharge/feecbk
+查询地址
+http://47.108.202.150/flow-receiver/api/query/feecbk
+余额查询地址
+http://47.108.202.150/flow-receiver/api/balance/feecbk
+
+
+请务必绑定我们回调IP:47.108.202.150
+
+产品编码可登录客户后台查看:个人信息>产品编码
+
+福建移动分省
+CMCCFJr30r	折扣96
+CMCCFJr50r	折扣96
+CMCCFJr100r	折扣96
+CMCCFJr200r	折扣96
+
+贵州分省
+CMCCGZr30r	折扣95.5
+CMCCGZr50r	折扣95.5
+CMCCGZr100r	折扣95.5
+CMCCGZr200r	折扣95.5
+
+广东移动
+CMCCGDr30r	折扣96
+CMCCGDr50r	折扣96
+CMCCGDr100r	折扣96
+CMCCGDr200r	折扣96
+
+山东移动
+没有30面值
+CMCCSDr50r	折扣96
+CMCCSDr100r	折扣96
+CMCCSDr200r	折扣96
+
+江苏移动
+CMCCJSr30r	折扣95.5
+CMCCJSr50r	折扣95.5
+CMCCJSr100r	折扣95.5
+CMCCJSr200r	折扣95.5
+
+
+四川电信分省
+CTCCSCr30r 	折扣95.5
+CTCCSCr50r 	折扣95.5
+CTCCSCr100r 	折扣95.5
+CTCCSCr200r   	折扣95.5
+
+
+
+山东电信分省	折扣95.5
+CTCCSDr30r	折扣95.5
+CTCCSDr50r	折扣95.5
+CTCCSDr100r	折扣95.5
+CTCCSDr200r
+
+天津电信分省
+CTCCTJr30r	折扣95.5
+CTCCTJr50r	折扣95.5
+CTCCTJr100r	折扣95.5
+CTCCTJr200r	折扣95.5
+
+云南电信分省
+CTCCYNr30r	折扣95.5
+CTCCYNr50r	折扣95.5
+CTCCYNr100r	折扣95.5
+CTCCYNr200r	折扣95.5
+
+广东电信分省
+CTCCGDr30r	折扣96
+CTCCGDr50r	折扣96
+CTCCGDr100r	折扣96
+CTCCGDr200r	折扣96

BIN
helper/refill/api/yl/bier_fs/话费API接口文档.docx


+ 26 - 2
helper/refill/api/yl/qianqian_fs/config.php

@@ -25,6 +25,9 @@ class config
             24 => [
                 50 => 'CMCCGZr50r', 100 => 'CMCCGZr100r', 200 => 'CMCCGZr200r'
             ], //贵州
+            13 => [
+                30 => 'CMCCFJr30r', 50 => 'CMCCFJr50r', 100 => 'CMCCFJr100r', 200 => 'CMCCFJr200r'
+            ], //福建
         ],
         mtopcard\ChinaUnicomCard => [
 
@@ -32,7 +35,22 @@ class config
         mtopcard\ChinaTelecomCard => [
             19 => [
                 30 => 'CTCCGDr30r', 50 => 'CTCCGDr50r', 100 => 'CTCCGDr100r', 200 => 'CTCCGDr200r'
-            ] //广东
+            ], //广东
+            23 => [
+                30 => 'CTCCSCr30r', 50 => 'CTCCSCr50r', 100 => 'CTCCSCr100r', 200 => 'CTCCSCr200r'
+            ], //四川
+            15 => [
+                30 => 'CTCCSDr30r', 50 => 'CTCCSDr50r', 100 => 'CTCCSDr100r', 200 => 'CTCCSDr200r'
+            ], //山东
+            2 => [
+                30 => 'CTCCTJr30r', 50 => 'CTCCTJr50r', 100 => 'CTCCTJr100r', 200 => 'CTCCTJr200r'
+            ], //天津
+            25 => [
+                30 => 'CTCCYNr30r', 50 => 'CTCCYNr50r', 100 => 'CTCCYNr100r', 200 => 'CTCCYNr200r'
+            ], //云南
+            9 => [
+                50 => 'CTCCSHr50r', 100 => 'CTCCSHr100r', 200 => 'CTCCSHr200r'
+            ], //上海
         ]
     ];
 
@@ -50,8 +68,14 @@ class config
         "4-50-10" => 47.75, "4-100-10" => 95.5, "4-200-10" => 191,//江苏 10
         "4-50-15" => 48, "4-100-15" => 96, "4-200-15" => 192,//山东 15
         "4-50-24" => 47.75, "4-100-24" => 95.5, "4-200-24" => 191,//贵州 24
+        "4-30-13" => 28.65, "4-50-13" => 47.75, "4-100-13" => 95.5, "4-200-13" => 191,//福建 13
 
         //电信
-        "6-30-19" => 28.5, "6-50-19" => 47.5, "6-100-19" => 95, "6-200-19" => 190,//广东 19
+        "6-30-19" => 28.8, "6-50-19" => 48, "6-100-19" => 96, "6-200-19" => 192,//广东 19
+        "6-30-23" => 28.65, "6-50-23" => 47.75, "6-100-23" => 95.5, "6-200-23" => 191,//四川 23
+        "6-30-15" => 28.65, "6-50-15" => 47.75, "6-100-15" => 95.5, "6-200-15" => 191,//山东 15
+        "6-30-2" => 28.65, "6-50-2" => 47.75, "6-100-2" => 95.5, "6-200-2" => 191,//天津 2
+        "6-30-25" => 28.65, "6-50-25" => 47.75, "6-100-25" => 95.5, "6-200-25" => 191,//云南 25
+        "6-50-9" => 47.75, "6-100-9" => 95.5, "6-200-9" => 191,//上海 9
     ];
 }

+ 2 - 2
helper/refill/api/yl/ruixunda_fs/config.php

@@ -91,9 +91,9 @@ class config
     const Price = [
         //移动
         "4-30-24" => 27.6, "4-50-24" => 46, "4-100-24" => 92, "4-200-24" => 184,//贵州 24
-        "4-30-10" => 28.5, "4-50-10" => 47.5, "4-100-10" => 95, "4-200-10" => 190,//江苏 10
+        "4-30-10" => 28.5, "4-50-10" => 46.5, "4-100-10" => 93, "4-200-10" => 186,//江苏 10
         "4-30-15" => 28.5, "4-50-15" => 47.5, "4-100-15" => 95, "4-200-15" => 190,//山东 15
-        "4-30-13" => 28.2, "4-50-13" => 47, "4-100-13" => 94, "4-200-13" => 188,//福建 13
+        "4-30-13" => 28.2, "4-50-13" => 46.75, "4-100-13" => 93.5, "4-200-13" => 187,//福建 13
 
         //电信
         "6-30-18" => 28.05, "6-50-18" => 46.75, "6-100-18" => 93.5, "6-200-18" => 187,//湖南 18

+ 50 - 0
helper/refill/api/yl/yangchi/RefillCallBack.php

@@ -0,0 +1,50 @@
+<?php
+namespace refill\yangchi;
+
+require_once(BASE_HELPER_RAPI_PATH . '/yangchi/config.php');
+
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = $this->sign($params);
+        if ($params['szVerifyString'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$userid}&szOrderId={$params['szOrderId']}&szPhoneNum={$params['szPhoneNum']}&nDemo={$params['nDemo']}&fSalePrice={$params['fSalePrice']}";
+        $content .= "&nFlag={$params['nFlag']}&szKey={$key}";
+        return md5($content);
+    }
+
+    public function notify($params)
+    {
+        $status = intval($params['nFlag']);
+        $order_sn = $params['szOrderId'];
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+        $order_id = $order_info['order_id'];
+
+        if ($status === 2) {
+            $data['official_sn'] = strtolower($params['szRtnMsg']) == 'null' ? '' : $params['szRtnMsg'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif ($status === 3) {
+            return [$order_id, false, true,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
+}

+ 142 - 0
helper/refill/api/yl/yangchi/RefillPhone.php

@@ -0,0 +1,142 @@
+<?php
+
+namespace refill\yangchi;
+
+require_once(BASE_HELPER_RAPI_PATH . '/yangchi/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    private function req_params(int $phone, int $amount, int $card_type, string $order_sn)
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $params['szOrderId'] = $order_sn;
+        $params['szPhoneNum'] = $phone;
+        $params['nMoney'] = $amount;
+        $params['nSortType'] = config::operator[$card_type];
+        $params['szProductId'] = config::Product[$card_type][$amount];
+        $params['nProductClass'] = 1;
+        $params['nProductType'] = 1;
+        $params['szTimeStamp'] = date("Y-m-d H:i:s");
+        $params['szNotifyUrl'] = config::NOTIFY_URL;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
+    {
+        $order_sn = $params['order_sn'];
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
+
+        $sign = $this->sign($params);
+        $params['szVerifyString'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
+
+        if (empty($resp)) {
+            return [false, '网络错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+
+            $nRtn = $resp['nRtn'];
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            } elseif ($nRtn === 0) {
+                return [true, '', false];
+            } elseif (in_array($nRtn, config::ERR_NOS, true)) {
+                return [false, $resp['szRtnCode'], false];
+            } elseif (in_array($nRtn, [2050, 999], true)) {
+                $net_errno = "HTTP-{$nRtn}";
+                return [false, $resp['szRtnCode'], true];
+            } else {
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resp['szRtnCode'], true];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $params['szOrderId'] = $refill_info['order_sn'];
+        $key = config::KEY;
+        $content = "szAgentId={$params['szAgentId']}&szOrderId={$params['szOrderId']}&szKey={$key}";
+        $params['szVerifyString'] = md5($content);
+
+        $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            }
+
+            $status = $resp['nRtn'];
+            if ($status === 5012) {
+                $updata['official_sn'] = $resp['szRtnMsg'];
+                Model('refill_order')->edit($refill_info['order_id'], $updata);
+                $order_state = ORDER_STATE_SUCCESS;
+            } elseif ($status === 5013) {
+                $order_state = ORDER_STATE_CANCEL;
+            } elseif (in_array($status, [5011,5019],true)) {
+                $order_state = ORDER_STATE_SEND;
+            } elseif ($status === 5005 && (time() - $refill_info['commit_time'] >= 300)) {
+                $order_state = ORDER_STATE_NOEXIST;
+            } else {
+                return [false, $resp['szRtnMsg']];
+            }
+
+            return [true, $order_state];
+        }
+    }
+
+    public function balance()
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$params['szAgentId']}&szKey={$key}";
+        $params['szVerifyString'] = md5($content);
+
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            } elseif ($resp['nRtn'] === 0) {
+                return [true, $resp['fBalance']];
+            } else {
+                return [false, $resp['szRtnCode']];
+            }
+        }
+    }
+
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$userid}&szOrderId={$params['szOrderId']}&szPhoneNum={$params['szPhoneNum']}&nMoney={$params['nMoney']}&nSortType={$params['nSortType']}";
+        $content .= "&nProductClass={$params['nProductClass']}&nProductType={$params['nProductType']}&szTimeStamp={$params['szTimeStamp']}&szKey={$key}";
+        return md5($content);
+    }
+}

+ 27 - 0
helper/refill/api/yl/yangchi/api.txt

@@ -0,0 +1,27 @@
+正式环境:
+话费下单地址:http://47.118.37.113:10186/plat/api/old/submitorder
+
+查询地址:http://47.118.37.113:10186/plat/api/old/queryorder
+
+查询余额地址:http://47.118.37.113:10186/plat/api/old/queryBalance
+
+商户登录地址:http://47.118.37.113:10186/plat
+
+ID:200037
+秘钥:2002b857154c4cc0b509d3c94d83a5cb
+账户:dyy2 密码:123456
+对接文档地址:https://docs.qq.com/doc/DWkV1VkxQVk13eEtQ
+
+
+
+
+全国移动50元	1000050	966
+全国移动100元	1000100	966
+全国移动200元	1000200	966
+
+全国联通30元	2000030	890
+全国联通50元	2000050	890
+全国联通100元	2000100	890
+全国联通200元	2000200	890
+全国联通300元	2000300	890
+全国联通500元	2000500	890

+ 43 - 0
helper/refill/api/yl/yangchi/config.php

@@ -0,0 +1,43 @@
+<?php
+
+
+namespace refill\yangchi;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://47.118.37.113:10186/plat/api/old/submitorder';
+    const QUERY_URL= 'http://47.118.37.113:10186/plat/api/old/queryorder';
+    const BALANCE_URL = 'http://47.118.37.113:10186/plat/api/old/queryBalance';
+
+    const USER_ID= '200037';
+    const KEY = '2002b857154c4cc0b509d3c94d83a5cb';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_yangchi.php";
+
+    const operator = [
+        mtopcard\ChinaMobileCard  => 1,
+        mtopcard\ChinaUnicomCard  => 2,
+        mtopcard\ChinaTelecomCard => 3
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
+
+    const ERR_NOS = [
+        1000,1001,1003,1004,2001,2002,2003,2020,2021,1006,2030,3003
+    ];
+
+    const Product = [
+        mtopcard\ChinaMobileCard => [
+            50  => 1000050,
+            100 => 1000100,
+            200 => 1000200,
+        ],
+        mtopcard\ChinaUnicomCard => [
+            30  => 2000030,
+            50  => 2000050,
+            100 => 2000100,
+            200 => 2000200,
+            300 => 2000300,
+            500 => 2000500,
+        ],
+    ];
+}

+ 50 - 0
helper/refill/api/yl/yangchi_fs/RefillCallBack.php

@@ -0,0 +1,50 @@
+<?php
+namespace refill\yangchi_fs;
+
+require_once(BASE_HELPER_RAPI_PATH . '/yangchi_fs/config.php');
+
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = $this->sign($params);
+        if ($params['szVerifyString'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$userid}&szOrderId={$params['szOrderId']}&szPhoneNum={$params['szPhoneNum']}&nDemo={$params['nDemo']}&fSalePrice={$params['fSalePrice']}";
+        $content .= "&nFlag={$params['nFlag']}&szKey={$key}";
+        return md5($content);
+    }
+
+    public function notify($params)
+    {
+        $status = intval($params['nFlag']);
+        $order_sn = $params['szOrderId'];
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+        $order_id = $order_info['order_id'];
+
+        if ($status === 2) {
+            $data['official_sn'] = strtolower($params['szRtnMsg']) == 'null' ? '' : $params['szRtnMsg'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif ($status === 3) {
+            return [$order_id, false, true,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
+}

+ 161 - 0
helper/refill/api/yl/yangchi_fs/RefillPhone.php

@@ -0,0 +1,161 @@
+<?php
+
+namespace refill\yangchi_fs;
+
+require_once(BASE_HELPER_RAPI_PATH . '/yangchi_fs/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        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, int $card_type, string $order_sn, $regin_no)
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $params['szOrderId'] = $order_sn;
+        $params['szPhoneNum'] = $phone;
+        $params['nMoney'] = $amount;
+        $params['nSortType'] = config::operator[$card_type];
+        $params['szProductId'] = config::Product[$card_type][$regin_no][$amount];
+        $params['nProductClass'] = 1;
+        $params['nProductType'] = 1;
+        $params['szTimeStamp'] = date("Y-m-d H:i:s");
+        $params['szNotifyUrl'] = config::NOTIFY_URL;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
+    {
+        $order_sn = $params['order_sn'];
+        $regin_no = $params['regin_no'] ?? -1;
+
+        if($regin_no <= 0) {
+            return [false, '省份获取错误', false];
+        }
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn, $regin_no);
+
+        $sign = $this->sign($params);
+        $params['szVerifyString'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
+
+        if (empty($resp)) {
+            return [false, '网络错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+
+            $nRtn = $resp['nRtn'];
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            } elseif ($nRtn === 0) {
+                return [true, '', false];
+            } elseif (in_array($nRtn, config::ERR_NOS, true)) {
+                return [false, $resp['szRtnCode'], false];
+            } elseif (in_array($nRtn, [2050, 999], true)) {
+                $net_errno = "HTTP-{$nRtn}";
+                return [false, $resp['szRtnCode'], true];
+            } else {
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resp['szRtnCode'], true];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $params['szOrderId'] = $refill_info['order_sn'];
+        $key = config::KEY;
+        $content = "szAgentId={$params['szAgentId']}&szOrderId={$params['szOrderId']}&szKey={$key}";
+        $params['szVerifyString'] = md5($content);
+
+        $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            }
+
+            $status = $resp['nRtn'];
+            if ($status === 5012) {
+                $updata['official_sn'] = $resp['szRtnMsg'];
+                Model('refill_order')->edit($refill_info['order_id'], $updata);
+                $order_state = ORDER_STATE_SUCCESS;
+            } elseif ($status === 5013) {
+                $order_state = ORDER_STATE_CANCEL;
+            } elseif (in_array($status, [5011,5019],true)) {
+                $order_state = ORDER_STATE_SEND;
+            } elseif ($status === 5005 && (time() - $refill_info['commit_time'] >= 300)) {
+                $order_state = ORDER_STATE_NOEXIST;
+            } else {
+                return [false, $resp['szRtnMsg']];
+            }
+
+            return [true, $order_state];
+        }
+    }
+
+    public function balance()
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$params['szAgentId']}&szKey={$key}";
+        $params['szVerifyString'] = md5($content);
+
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            } elseif ($resp['nRtn'] === 0) {
+                return [true, $resp['fBalance']];
+            } else {
+                return [false, $resp['szRtnCode']];
+            }
+        }
+    }
+
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$userid}&szOrderId={$params['szOrderId']}&szPhoneNum={$params['szPhoneNum']}&nMoney={$params['nMoney']}&nSortType={$params['nSortType']}";
+        $content .= "&nProductClass={$params['nProductClass']}&nProductType={$params['nProductType']}&szTimeStamp={$params['szTimeStamp']}&szKey={$key}";
+        return md5($content);
+    }
+}

+ 63 - 0
helper/refill/api/yl/yangchi_fs/api.txt

@@ -0,0 +1,63 @@
+正式环境:
+话费下单地址:http://47.118.37.113:10186/plat/api/old/submitorder
+查询地址:http://47.118.37.113:10186/plat/api/old/queryorder
+查询余额地址:http://47.118.37.113:10186/plat/api/old/queryBalance
+
+商户登录地址:http://47.118.37.113:10186/plat
+ID:200038
+秘钥:583fb02cff1f487b879cdedd2365ac54
+账户:dyyfs2 密码:123456
+
+对接文档地址:https://docs.qq.com/doc/DWkV1VkxQVk13eEtQ
+
+
+贵州移动30元	1520030
+贵州移动50元	1520050
+贵州移动100元	1520100
+贵州移动200元	1520200
+
+福建移动30元	1350030
+福建移动50元	1350050
+福建移动100元	1350100
+福建移动200元	1350200
+
+山东移动30元	1370030
+山东移动50元	1370050
+山东移动100元	1370100
+山东移动200元	1370200
+
+江苏移动30元	1320030
+江苏移动50元	1320050
+江苏移动100元	1320100
+江苏移动200元	1320200
+
+广东移动50元	1440050
+广东移动100元	1440100
+广东移动200元	1440200
+
+
+
+天津电信30元	3120030
+天津电信50元	3120050
+天津电信100元	3120100
+天津电信200元	3120200
+
+四川电信30元	3510030
+四川电信50元	3510050
+四川电信100元	3510100
+四川电信200元	3510200
+
+上海电信30元	3310030
+上海电信50元	3310050
+上海电信100元	3310100
+上海电信200元	3310200
+
+山东电信30元	3370030
+山东电信50元	3370050
+山东电信100元	3370100
+山东电信200元	3370200
+
+广东电信30元	3440030
+广东电信50元	3440050
+广东电信100元	3440100
+广东电信200元	3440200

+ 121 - 0
helper/refill/api/yl/yangchi_fs/config.php

@@ -0,0 +1,121 @@
+<?php
+
+
+namespace refill\yangchi_fs;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://47.118.37.113:10186/plat/api/old/submitorder';
+    const QUERY_URL= 'http://47.118.37.113:10186/plat/api/old/queryorder';
+    const BALANCE_URL = 'http://47.118.37.113:10186/plat/api/old/queryBalance';
+
+    const USER_ID= '200038';
+    const KEY = '583fb02cff1f487b879cdedd2365ac54';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_yangchi_fs.php";
+
+    const operator = [
+        mtopcard\ChinaMobileCard  => 1,
+        mtopcard\ChinaUnicomCard  => 2,
+        mtopcard\ChinaTelecomCard => 3
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
+
+    const ERR_NOS = [
+        1000,1001,1003,1004,2001,2002,2003,2020,2021,1006,2030,3003
+    ];
+
+    const Product = [
+        mtopcard\ChinaMobileCard => [
+            //贵州
+            24 => [
+                30  => 1520030,
+                50  => 1520050,
+                100 => 1520100,
+                200 => 1520200,
+            ],
+            //福建
+            13 => [
+                30  => 1350030,
+                50  => 1350050,
+                100 => 1350100,
+                200 => 1350200,
+            ],
+            //山东
+            15 => [
+                30  => 1370030,
+                50  => 1370050,
+                100 => 1370100,
+                200 => 1370200,
+            ],
+            //江苏
+            10 => [
+                30  => 1320030,
+                50  => 1320050,
+                100 => 1320100,
+                200 => 1320200,
+            ],
+            //广东
+            19 => [
+                50  => 1440050,
+                100 => 1440100,
+                200 => 1440200,
+            ],
+        ],
+        mtopcard\ChinaTelecomCard => [
+            //天津
+            2 => [
+                30  => 3120030,
+                50  => 3120050,
+                100 => 3120100,
+                200 => 3120200,
+            ],
+            //四川
+            23 => [
+                30  => 3510030,
+                50  => 3510050,
+                100 => 3510100,
+                200 => 3510200,
+            ],
+            //上海
+            9 => [
+                30  => 3310030,
+                50  => 3310050,
+                100 => 3310100,
+                200 => 3310200,
+            ],
+            //山东
+            15 => [
+                30  => 3370030,
+                50  => 3370050,
+                100 => 3370100,
+                200 => 3370200,
+            ],
+            //广东
+            19 => [
+                30  => 3440030,
+                50  => 3440050,
+                100 => 3440100,
+                200 => 3440200,
+            ],
+        ],
+    ];
+
+    //key格式 卡类型-面值-regin_no
+    const Price = [
+        //移动
+        "4-30-24" => 27.78, "4-50-24" => 46.3, "4-100-24" => 92.6, "4-200-24" => 185.2,//贵州 24
+        "4-30-13" => 28.5, "4-50-13" => 47.5, "4-100-13" => 95, "4-200-13" => 190,//福建 13
+        "4-30-15" => 28.65, "4-50-15" => 47.75, "4-100-15" => 95.5, "4-200-15" => 191,//山东 15
+        "4-30-10" => 28.2, "4-50-10" => 47, "4-100-10" => 94, "4-200-10" => 188,//江苏 10
+        "4-50-19" => 47.35, "4-100-19" => 94.7, "4-200-19" => 189.4,//广东 19
+
+        //电信
+        "6-30-2" => 28.05, "6-50-2" => 46.75, "6-100-2" => 93.5, "6-200-2" => 187,//天津 2
+        "6-30-23" => 28.05, "6-50-23" => 46.75, "6-100-23" => 93.5, "6-200-23" => 187,//四川 23
+        "6-30-9" => 28.35, "6-50-9" => 47.25, "6-100-9" => 94.5, "6-200-9" => 189,//上海 9
+        "6-30-15" => 28.35, "6-50-15" => 47.25, "6-100-15" => 94.5, "6-200-15" => 189,//山东 15
+        "6-30-19" => 28.5, "6-50-19" => 47.5, "6-100-19" => 95, "6-200-19" => 190,//广东 19
+    ];
+
+}

+ 4 - 0
mobile/callback/refill_bier_fs.php

@@ -0,0 +1,4 @@
+<?php
+
+refill\util::push_notify('bier_fs',$_POST);
+echo ('SUCCESS');

+ 4 - 0
mobile/callback/refill_yangchi.php

@@ -0,0 +1,4 @@
+<?php
+
+refill\util::push_notify('yangchi',$_POST);
+echo ('ok');

+ 4 - 0
mobile/callback/refill_yangchi_fs.php

@@ -0,0 +1,4 @@
+<?php
+
+refill\util::push_notify('yangchi_fs',$_POST);
+echo ('ok');

+ 42 - 0
test/TestRefill.php

@@ -2839,6 +2839,48 @@ class TestRefill extends TestCase
         $resp = $provider->notify($params);
     }
 
+    public function testYangchi()
+    {
+//        $provider = $this->getProvider('yangchi');
+//        $resp = $provider->balance();
+//        $resp = $provider->add(15811535608, 4, 50, ['order_sn' => $this->make_sn(), 'regin_no' => 16]);
+//        $resp = $provider->query(['order_sn' => '93291668743605489040']);
+
+        $body = '{"szOrderId":"93291668743605489040","fSalePrice":"48.3","szAgentId":"200035","nFlag":"3","szVerifyString":"bd51c3df1132ed84de92b46ee7f5743e","szPhoneNum":"15811535608","szRtnMsg":"","nDemo":"50"}';
+        $params = json_decode($body, true);
+        $provider = $this->getProvider('yangchi', 'RefillCallBack');
+        $ret = $provider->verify($params);
+        $resp = $provider->notify($params);
+    }
+
+    public function testYangchi_fs()
+    {
+//        $provider = $this->getProvider('yangchi_fs');
+//        $resp = $provider->balance();
+//        $resp = $provider->add(15811535608, 4, 30, ['order_sn' => $this->make_sn(), 'regin_no' => 24]);
+//        $resp = $provider->query(['order_sn' => '43071668750406110934']);
+
+        $body = '{"szOrderId":"43071668750406110934","fSalePrice":"27.78","szAgentId":"200036","nFlag":"3","szVerifyString":"6b6f42600c07146d08c51b737487eafc","szPhoneNum":"15811535608","szRtnMsg":"","nDemo":"30"}';
+        $params = json_decode($body, true);
+        $provider = $this->getProvider('yangchi_fs', 'RefillCallBack');
+        $ret = $provider->verify($params);
+        $resp = $provider->notify($params);
+    }
+
+    public function testBier_fs()
+    {
+//        $provider = $this->getProvider('bier_fs');
+//        $resp = $provider->balance();
+//        $resp = $provider->add(15811535608, 4, 30, ['order_sn' => $this->make_sn(), 'regin_no' => 13]);
+//        $resp = $provider->query(['order_sn' => '18361668755806837322']);
+
+        $body = '{"status":"027","orderNo":"F2211181516549189078","consumerNo":"18361668755806837322","mobile":"15811535608","voucherNo":"null","account":"yzfs1688","timestamp":"1668755817002","sign":"e44cadf815d0e2359f0872bce78a7628d0edbc98"}';
+        $params = json_decode($body, true);
+        $provider = $this->getProvider('bier_fs', 'RefillCallBack');
+        $ret = $provider->verify($params);
+        $resp = $provider->notify($params);
+    }
+
     public function testAmingjd()
     {
 //        $provider = new refill\amingjd\RefillPhone([]);