فهرست منبع

Merge branch 'raccount' into rbalance

stanley-king 2 سال پیش
والد
کامیت
478d185657
51فایلهای تغییر یافته به همراه1747 افزوده شده و 77 حذف شده
  1. 7 1
      admin/control/merchant.php
  2. 1 1
      admin/control/refill_detail.php
  3. 12 8
      admin/control/refill_order_manual.php
  4. 19 1
      admin/templates/default/merchant.ctl.php
  5. 37 5
      admin/templates/default/transfer.order.recharge.php
  6. 154 13
      data/config/xyz/refill.ini.php
  7. 105 12
      data/config/yl/refill.ini.php
  8. 50 0
      helper/refill/api/xyz/bodian/RefillCallBack.php
  9. 140 0
      helper/refill/api/xyz/bodian/RefillPhone.php
  10. 15 0
      helper/refill/api/xyz/bodian/api.txt
  11. 27 0
      helper/refill/api/xyz/bodian/config.php
  12. BIN
      helper/refill/api/xyz/guochuang/20220522青海移动调价函.jpg
  13. 1 1
      helper/refill/api/xyz/guochuang/config.php
  14. 1 0
      helper/refill/api/xyz/huoshenguoman/config.php
  15. 4 1
      helper/refill/api/xyz/huoshenguoman/开户信息.txt
  16. 39 0
      helper/refill/api/xyz/liantongzx/RefillCallBack.php
  17. 145 0
      helper/refill/api/xyz/liantongzx/RefillPhone.php
  18. 6 0
      helper/refill/api/xyz/liantongzx/account.txt
  19. 43 0
      helper/refill/api/xyz/liantongzx/config.php
  20. 50 0
      helper/refill/api/xyz/tongmai/RefillCallBack.php
  21. 144 0
      helper/refill/api/xyz/tongmai/RefillPhone.php
  22. 39 0
      helper/refill/api/xyz/tongmai/api.txt
  23. 54 0
      helper/refill/api/xyz/tongmai/config.php
  24. 15 4
      helper/refill/api/xyz/yunlingdf/RefillPhone.php
  25. 2 1
      helper/refill/api/xyz/yunlingdf/config.php
  26. 1 1
      helper/refill/api/xyz/zhenghe/api.txt
  27. 1 1
      helper/refill/api/xyz/zhenghe/config.php
  28. 2 2
      helper/refill/api/xyz/zhongst/config.php
  29. 5 1
      helper/refill/api/xyz/zhongst/开户信息.txt
  30. 50 0
      helper/refill/api/yl/bodian/RefillCallBack.php
  31. 140 0
      helper/refill/api/yl/bodian/RefillPhone.php
  32. 15 0
      helper/refill/api/yl/bodian/api.txt
  33. 27 0
      helper/refill/api/yl/bodian/config.php
  34. 1 1
      helper/refill/api/yl/guochuang/config.php
  35. 1 0
      helper/refill/api/yl/huoshenguoman/config.php
  36. 50 0
      helper/refill/api/yl/tongmai/RefillCallBack.php
  37. 144 0
      helper/refill/api/yl/tongmai/RefillPhone.php
  38. 39 0
      helper/refill/api/yl/tongmai/api.txt
  39. 54 0
      helper/refill/api/yl/tongmai/config.php
  40. 1 1
      helper/refill/api/yl/zhenghe/api.txt
  41. 1 1
      helper/refill/api/yl/zhenghe/config.php
  42. 2 2
      helper/refill/api/yl/zhongst/config.php
  43. 8 6
      helper/refill/policy/transfer.php
  44. 2 3
      helper/refill/policy/xyz/policy.php
  45. 7 1
      helper/refill/util.php
  46. 4 0
      mobile/callback/refill_bodian.php
  47. 9 0
      mobile/callback/refill_liantongzx.php
  48. 4 0
      mobile/callback/refill_tongmai.php
  49. 2 1
      rdispatcher/proxy.php
  50. 55 8
      test/TestRefill.php
  51. 12 0
      test/TestRefillYl.php

+ 7 - 1
admin/control/merchant.php

@@ -1149,6 +1149,12 @@ class merchantControl extends SystemControl
                 $transfer_cfg['transfer_mchid'] = intval($_POST['transfer_mchid']) ?? 0;
                 $transfer_cfg['transfer_lowertime']  = intval($_POST['transfer_lowertime']) ?? 0;
                 $transfer_cfg['transfer_uppertime']  = intval($_POST['transfer_uppertime']) ?? 0;
+                if (!empty($_POST['transfer_card_types'])) {
+                    foreach ($_POST['transfer_card_types'] as $card_type) {
+                        $card_types[] = intval($card_type);
+                    }
+                    $transfer_cfg['card_types'] = $card_types;
+                }
 
                 return serialize($transfer_cfg);
             };
@@ -1283,7 +1289,7 @@ class merchantControl extends SystemControl
     {
         $transfer_cfg = $merchant['transfer_cfg'];
         if (empty($transfer_cfg)) {
-            $transfer_cfg = ['transfer_opened' => 0, 'transfer_mchid' => 0, 'transfer_lowertime' => 0, 'transfer_uppertime' => 0];
+            $transfer_cfg = ['transfer_opened' => 0, 'transfer_mchid' => 0, 'transfer_lowertime' => 0, 'transfer_uppertime' => 0, 'card_types' => []];
         } else {
             $transfer_cfg = unserialize($transfer_cfg);
         }

+ 1 - 1
admin/control/refill_detail.php

@@ -198,7 +198,7 @@ class refill_detailControl extends SystemControl
         {
             $mchid = $detail['mchid'];
             $mch_order = $detail['mch_order'];
-            util::del_queue_order($mchid,$mch_order);
+            util::pop_queue_order($mchid,$mch_order);
         }
         showMessage('操作成功','index.php?act=refill_detail&op=index');
     }

+ 12 - 8
admin/control/refill_order_manual.php

@@ -469,12 +469,12 @@ class refill_order_manualControl extends SystemControl
             return [];
         }
 
-        $condition['vr_order.add_time&vr_order.add_time'] = ['_multi' => true,
-            ['egt', $start_day],
-            ['lt', $cur_time]];
-        $condition['refill_order.order_time&refill_order.order_time'] = ['_multi' => true,
-            ['egt', $start_day],
-            ['lt', $cur_time]];
+//        $condition['vr_order.add_time&vr_order.add_time'] = ['_multi' => true,
+//            ['egt', $start_day],
+//            ['lt', $cur_time]];
+//        $condition['refill_order.order_time&refill_order.order_time'] = ['_multi' => true,
+//            ['egt', $start_day],
+//            ['lt', $cur_time]];
 
         $merchant_list = $this->merchants(['mchid' => ['in', $mchids]]);
         $order_list = $mod->getMerchantOrderList($condition, 200, 0,'refill_order.*,vr_order.order_state', 'refill_order.order_time desc');
@@ -510,8 +510,12 @@ class refill_order_manualControl extends SystemControl
                 refill\util::set_next_order($mchid, $mch_order);
                 $this->log("预回调订单转快充,订单号:{$order['order_sn']},商家单号:{$mch_order},机构编码:{$mchid}");
             }
-            elseif ($type === 'cancel_order_retry') {
-                [$succ,$err] = refill\util::retry_canceled_order($order_id);
+            elseif ($type === 'canceled_order_retry') {
+                [$succ,$err] = refill\util::retry_canceled_order($order_id,false);
+                $this->log("预回调订单失败补充,订单号:{$order['order_sn']},商家单号:{$mch_order},机构编码:{$mchid} err:{$err}");
+            }
+            elseif ($type === 'canceled_order_retry_next') {
+                [$succ,$err] = refill\util::retry_canceled_order($order_id,true);
                 $this->log("预回调订单失败补快充,订单号:{$order['order_sn']},商家单号:{$mch_order},机构编码:{$mchid} err:{$err}");
             } else {
                 continue;

+ 19 - 1
admin/templates/default/merchant.ctl.php

@@ -222,7 +222,25 @@
                     </td>
                 </tr>
 
-
+                <tr class="noborder">
+                    <td colspan="2" class="required"><label class="mleft" style="margin-right: 12px;" for="name">运营商拦截:</label>
+                        <label>
+                            <input type="checkbox" name="transfer_card_types[]" value="<?php echo mtopcard\ChinaMobileCard; ?>" <?php if (!empty($output['transfer_cfg']['card_types']) && in_array(mtopcard\ChinaMobileCard, $output['transfer_cfg']['card_types'])) {
+                                echo 'checked';
+                            } ?>>
+                        </label>移动
+                        <label>
+                            <input type="checkbox" name="transfer_card_types[]" value="<?php echo mtopcard\ChinaUnicomCard; ?>" <?php if (!empty($output['transfer_cfg']['card_types']) && in_array(mtopcard\ChinaUnicomCard, $output['transfer_cfg']['card_types'])) {
+                                echo 'checked';
+                            } ?>>
+                        </label>联通
+                        <label>
+                            <input type="checkbox" name="transfer_card_types[]" value="<?php echo mtopcard\ChinaTelecomCard; ?>" <?php if (!empty($output['transfer_cfg']['card_types']) && in_array(mtopcard\ChinaTelecomCard, $output['transfer_cfg']['card_types'])) {
+                                echo 'checked';
+                            } ?>>
+                        </label>电信
+                    </td>
+                </tr>
 
                 <tr class="noborder">
                     <td>

+ 37 - 5
admin/templates/default/transfer.order.recharge.php

@@ -129,7 +129,12 @@
         <table class="tb-type1 noborder search">
             <tr>
                 <td>
-                    <a href="#" class="btns" id="hFail">
+                    <a href="#" class="btns" id="canceled_order_retry">
+                        <span><i class="icon-edit"></i>批量补充</span>
+                    </a>
+                </td>
+                <td>
+                    <a href="#" class="btns" id="canceled_order_retry_next">
                         <span><i class="icon-edit"></i>批量补快充</span>
                     </a>
                 </td>
@@ -200,8 +205,11 @@
                     <td class="align-center"><?php echo orderState($order); ?></td>
                     <td class="align-center">
                         <input type="hidden" value="<?php echo $order['can_cancel']; ?>">
-                        <a href="index.php?act=refill_order_manual&op=transfer_order_dispose&type=cancel_order_retry&order_ids=<?php echo $order['order_id']; ?>" id="hdFail">
+                        <a href="index.php?act=refill_order_manual&op=transfer_order_dispose&type=canceled_order_retry&order_ids=<?php echo $order['order_id']; ?>" id="hdFail">
                             补充</a>
+                        |
+                        <a href="index.php?act=refill_order_manual&op=transfer_order_dispose&type=canceled_order_retry_next&order_ids=<?php echo $order['order_id']; ?>" id="hdFail">
+                            补快充</a>
                     </td>
                 </tr>
             <?php } ?>
@@ -293,7 +301,7 @@
         })
 
         //批量
-        $('#hFail').click(function() {
+        $('#canceled_order_retry').click(function() {
             layer.confirm('您确定要批量补充吗', {
                 btn: ['确定', '取消'],
                 title: '批量补充'
@@ -307,9 +315,33 @@
                 let number = Number(strr);
                 if (isNaN(number)) {
                     let strrr = str.substring(1, str.length);
-                    window.location.href = `index.php?act=refill_order_manual&op=transfer_order_dispose&type=cancel_order_retry&order_ids= ${strrr ? strrr : ''}`
+                    window.location.href = `index.php?act=refill_order_manual&op=transfer_order_dispose&type=canceled_order_retry&order_ids= ${strrr ? strrr : ''}`
+                } else if (!isNaN(number) && str !== '') {
+                    window.location.href = `index.php?act=refill_order_manual&op=transfer_order_dispose&type=canceled_order_retry&order_ids= ${str ? str : ''}`
+                } else {
+                    layer.msg('请还没有任何操作,请先选择');
+                }
+            }, function() {});
+        })
+
+        //批量
+        $('#canceled_order_retry_next').click(function() {
+            layer.confirm('您确定要批量补快充吗', {
+                btn: ['确定', '取消'],
+                title: '批量补快充'
+            }, function() {
+                let arr = [];
+                $("input:checkbox:checked").each(function(i) {
+                    arr[i] = $(this).val();
+                })
+                let str = arr.join(",");
+                let strr = str.substring(0, 1);
+                let number = Number(strr);
+                if (isNaN(number)) {
+                    let strrr = str.substring(1, str.length);
+                    window.location.href = `index.php?act=refill_order_manual&op=transfer_order_dispose&type=canceled_order_retry_next&order_ids= ${strrr ? strrr : ''}`
                 } else if (!isNaN(number) && str !== '') {
-                    window.location.href = `index.php?act=refill_order_manual&op=transfer_order_dispose&type=cancel_order_retry&order_ids= ${str ? str : ''}`
+                    window.location.href = `index.php?act=refill_order_manual&op=transfer_order_dispose&type=canceled_order_retry_next&order_ids= ${str ? str : ''}`
                 } else {
                     layer.msg('请还没有任何操作,请先选择');
                 }

+ 154 - 13
data/config/xyz/refill.ini.php

@@ -607,45 +607,45 @@ $zhongst_phone = ['name' => 'zhongst', 'store_id' => 39, 'qualitys' => '2',
         ],
 
         10 => [
-            ['goods_id' => 6464, 'price' => 10.05, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6464, 'price' => 10.1, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6464, 'price' => 10.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6464, 'price' => 10.2, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         20 => [
-            ['goods_id' => 6465, 'price' => 20.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6465, 'price' => 20.2, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6465, 'price' => 20.14, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6465, 'price' => 20.4, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         30 => [
             ['goods_id' => 6466, 'price' => 30.18, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6466, 'price' => 30.12, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6466, 'price' => 30.21, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6466, 'price' => 30.09, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         50 => [
             ['goods_id' => 6467, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 6467, 'price' => 50.05, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6467, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6467, 'price' => 50.15, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         100 => [
-            ['goods_id' => 6468, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6468, 'price' => 100.15, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 6468, 'price' => 100.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6468, 'price' => 100.1, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 6469, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6469, 'price' => 200.3, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 6469, 'price' => 200.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6469, 'price' => 200.2, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         300 => [
-            ['goods_id' => 6470, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6470, 'price' => 300.45, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 6470, 'price' => 300.3, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6470, 'price' => 300.3, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         500 => [
-            ['goods_id' => 6471, 'price' => 501, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6471, 'price' => 500.5, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6471, 'price' => 500.75, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6471, 'price' => 501, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6471, 'price' => 500.5, 'quality' => 2, 'card_type' => 'chinatelecom']
         ]
     ],
@@ -5350,6 +5350,7 @@ $huoshenguoman_phone = ['name' => 'huoshenguoman', 'store_id' => 209, 'qualitys'
 //            ['goods_id' => 7756, 'price' => 27.6, 'quality' => 5, 'card_type' => 'chinatelecom']
 //        ],
         50 => [
+            ['goods_id' => 7757, 'price' => 47.25, 'quality' => 5, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 7757, 'price' => 45.75, 'quality' => 5, 'card_type' => 'chinaunicom'],
             ['goods_id' => 7757, 'price' => 45.75, 'quality' => 5, 'card_type' => 'chinatelecom']
         ],
@@ -5736,7 +5737,7 @@ $donghong_high_phone = ['name' => 'donghong_high', 'store_id' => 222, 'qualitys'
 //        20 => [
 //            ['goods_id' => 7847, 'price' => 19.3, 'quality' => 1, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 7847, 'price' => 19.04, 'quality' => 1, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7847, 'price' => 19.04 'quality' => 1, 'card_type' => 'chinatelecom']
+//            ['goods_id' => 7847, 'price' => 19.04, 'quality' => 1, 'card_type' => 'chinatelecom']
 //        ],
         30 => [
             ['goods_id' => 7848, 'price' => 28.95, 'quality' => 1, 'card_type' => 'chinamobile'],
@@ -5781,7 +5782,7 @@ $donghong_normal_phone = ['name' => 'donghong_normal', 'store_id' => 223, 'quali
 //        20 => [
 //            ['goods_id' => 7855, 'price' => 19.24, 'quality' => 1, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 7855, 'price' => 18.9, 'quality' => 1, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7855, 'price' => 19 'quality' => 1, 'card_type' => 'chinatelecom']
+//            ['goods_id' => 7855, 'price' => 19, 'quality' => 1, 'card_type' => 'chinatelecom']
 //        ],
         30 => [
             ['goods_id' => 7856, 'price' => 28.86, 'quality' => 1, 'card_type' => 'chinamobile'],
@@ -5815,6 +5816,142 @@ $donghong_normal_phone = ['name' => 'donghong_normal', 'store_id' => 223, 'quali
 //        ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
+
+$tongmai_phone = ['name' => 'tongmai', 'store_id' => 224, 'qualitys' => '2',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 7862, 'price' => 9.95, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7862, 'price' => 9.98, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7862, 'price' => 9.97, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        20 => [
+//            ['goods_id' => 7863, 'price' => 19.9, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7863, 'price' => 19.96, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7863, 'price' => 19.94, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+        30 => [
+            ['goods_id' => 7864, 'price' => 29.85, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7864, 'price' => 29.94, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7864, 'price' => 29.91, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 7865, 'price' => 49.75, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7865, 'price' => 49.9, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7865, 'price' => 49.85, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 7866, 'price' => 99.5, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7866, 'price' => 99.8, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7866, 'price' => 99.7, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 7867, 'price' => 199, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7867, 'price' => 199.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7867, 'price' => 199.4, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 7868, 'price' => 298.5, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7868, 'price' => 299.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7868, 'price' => 299.1, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 7869, 'price' => 497.5, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7869, 'price' => 499, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7869, 'price' => 498.5, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$liantongzx_phone = ['name' => 'liantongzx', 'store_id' => 225, 'qualitys' => '2',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 7870, 'price' => 9.98, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7870, 'price' => 9.98, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7870, 'price' => 9.98, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        20 => [
+//            ['goods_id' => 7871, 'price' => 19.96, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7871, 'price' => 19.96, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7871, 'price' => 19.96, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        30 => [
+//            ['goods_id' => 7872, 'price' => 29.94, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7872, 'price' => 29.94, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7872, 'price' => 29.94, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+        50 => [
+//            ['goods_id' => 7873, 'price' => 49.9, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7873, 'price' => 49.9, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7873, 'price' => 49.9, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+//            ['goods_id' => 7874, 'price' => 99.8, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7874, 'price' => 99.8, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7874, 'price' => 99.8, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+//            ['goods_id' => 7875, 'price' => 199.6, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7875, 'price' => 199.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7875, 'price' => 199.6, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+//            ['goods_id' => 7876, 'price' => 299.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7876, 'price' => 299.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7876, 'price' => 299.4, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+//            ['goods_id' => 7877, 'price' => 499, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7877, 'price' => 499, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7877, 'price' => 499, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$bodian_phone = ['name' => 'bodian', 'store_id' => 226, 'qualitys' => '2',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 7878, 'price' => 9.98, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7878, 'price' => 9.98, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7878, 'price' => 9.98, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        20 => [
+//            ['goods_id' => 7879, 'price' => 19.96, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7879, 'price' => 19.96, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7879, 'price' => 19.96, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        30 => [
+//            ['goods_id' => 7880, 'price' => 29.94, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7880, 'price' => 29.94, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7880, 'price' => 29.94, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+        50 => [
+//            ['goods_id' => 7881, 'price' => 49.9, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7881, 'price' => 49.9, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7881, 'price' => 49.9, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+//            ['goods_id' => 7882, 'price' => 99.8, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7882, 'price' => 99.8, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7882, 'price' => 99.8, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+//            ['goods_id' => 7883, 'price' => 199.6, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7883, 'price' => 199.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7883, 'price' => 199.6, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+//            ['goods_id' => 7884, 'price' => 299.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7884, 'price' => 299.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7884, 'price' => 299.4, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+//        500 => [
+//            ['goods_id' => 7885, 'price' => 499, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7885, 'price' => 499, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7885, 'price' => 499, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -5996,6 +6133,10 @@ $phone_providers = [
     ['name' => 'chending_tax', 'cfg' => $chending_tax_phone],
     ['name' => 'donghong_high', 'cfg' => $donghong_high_phone],
     ['name' => 'donghong_normal', 'cfg' => $donghong_normal_phone],
+    ['name' => 'tongmai', 'cfg' => $tongmai_phone],
+    ['name' => 'liantongzx', 'cfg' => $liantongzx_phone],
+    ['name' => 'bodian', 'cfg' => $bodian_phone],
+
 ];
 $config['phone_providers'] = $phone_providers;
 

+ 105 - 12
data/config/yl/refill.ini.php

@@ -607,45 +607,45 @@ $zhongst_phone = ['name' => 'zhongst', 'store_id' => 39, 'qualitys' => '2',
         ],
 
         10 => [
-            ['goods_id' => 6464, 'price' => 10.05, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6464, 'price' => 10.1, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6464, 'price' => 10.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6464, 'price' => 10.2, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         20 => [
-            ['goods_id' => 6465, 'price' => 20.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6465, 'price' => 20.2, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6465, 'price' => 20.14, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6465, 'price' => 20.4, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         30 => [
             ['goods_id' => 6466, 'price' => 30.18, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6466, 'price' => 30.12, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6466, 'price' => 30.21, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6466, 'price' => 30.09, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         50 => [
             ['goods_id' => 6467, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 6467, 'price' => 50.05, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6467, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6467, 'price' => 50.15, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         100 => [
-            ['goods_id' => 6468, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6468, 'price' => 100.15, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 6468, 'price' => 100.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6468, 'price' => 100.1, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 6469, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6469, 'price' => 200.3, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 6469, 'price' => 200.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6469, 'price' => 200.2, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         300 => [
-            ['goods_id' => 6470, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6470, 'price' => 300.45, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 6470, 'price' => 300.3, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6470, 'price' => 300.3, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         500 => [
-            ['goods_id' => 6471, 'price' => 501, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6471, 'price' => 500.5, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6471, 'price' => 500.75, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6471, 'price' => 501, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6471, 'price' => 500.5, 'quality' => 2, 'card_type' => 'chinatelecom']
         ]
     ],
@@ -5352,6 +5352,7 @@ $huoshenguoman_phone = ['name' => 'huoshenguoman', 'store_id' => 209, 'qualitys'
 //            ['goods_id' => 7756, 'price' => 27.6, 'quality' => 5, 'card_type' => 'chinatelecom']
 //        ],
         50 => [
+            ['goods_id' => 7757, 'price' => 47.25, 'quality' => 5, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 7757, 'price' => 45.75, 'quality' => 5, 'card_type' => 'chinaunicom'],
             ['goods_id' => 7757, 'price' => 45.75, 'quality' => 5, 'card_type' => 'chinatelecom']
         ],
@@ -5691,6 +5692,97 @@ $donghong_normal_phone = ['name' => 'donghong_normal', 'store_id' => 217, 'quali
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$tongmai_phone = ['name' => 'tongmai', 'store_id' => 218, 'qualitys' => '2',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 7826, 'price' => 9.95, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7826, 'price' => 9.98, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7826, 'price' => 9.97, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        20 => [
+//            ['goods_id' => 7827, 'price' => 19.9, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7827, 'price' => 19.96, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7827, 'price' => 19.94, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+        30 => [
+            ['goods_id' => 7828, 'price' => 29.85, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7828, 'price' => 29.94, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7828, 'price' => 29.91, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 7829, 'price' => 49.75, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7829, 'price' => 49.9, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7829, 'price' => 49.85, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 7830, 'price' => 99.5, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7830, 'price' => 99.8, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7830, 'price' => 99.7, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 7831, 'price' => 199, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7831, 'price' => 199.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7831, 'price' => 199.4, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 7832, 'price' => 298.5, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7832, 'price' => 299.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7832, 'price' => 299.1, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 7833, 'price' => 497.5, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7833, 'price' => 499, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7833, 'price' => 498.5, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$bodian_phone = ['name' => 'bodian', 'store_id' => 219, 'qualitys' => '2',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 7834, 'price' => 9.98, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7834, 'price' => 9.98, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7834, 'price' => 9.98, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        20 => [
+//            ['goods_id' => 7835, 'price' => 19.96, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7835, 'price' => 19.96, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7835, 'price' => 19.96, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        30 => [
+//            ['goods_id' => 7836, 'price' => 29.94, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7836, 'price' => 29.94, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7836, 'price' => 29.94, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+        50 => [
+//            ['goods_id' => 7837, 'price' => 49.9, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7837, 'price' => 49.9, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7837, 'price' => 49.9, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+//            ['goods_id' => 7838, 'price' => 99.8, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7838, 'price' => 99.8, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7838, 'price' => 99.8, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+//            ['goods_id' => 7839, 'price' => 199.6, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7839, 'price' => 199.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7839, 'price' => 199.6, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+//            ['goods_id' => 7840, 'price' => 299.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7840, 'price' => 299.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7840, 'price' => 299.4, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+//        500 => [
+//            ['goods_id' => 7841, 'price' => 499, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7841, 'price' => 499, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7841, 'price' => 499, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -5869,7 +5961,8 @@ $phone_providers = [
     ['name' => 'ainika_high', 'cfg' => $ainika_high_phone],
     ['name' => 'donghong_high', 'cfg' => $donghong_high_phone],
     ['name' => 'donghong_normal', 'cfg' => $donghong_normal_phone],
-
+    ['name' => 'tongmai', 'cfg' => $tongmai_phone],
+    ['name' => 'bodian', 'cfg' => $bodian_phone],
 ];
 $config['phone_providers'] = $phone_providers;
 

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

@@ -0,0 +1,50 @@
+<?php
+namespace refill\bodian;
+
+require_once(BASE_HELPER_RAPI_PATH . '/bodian/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')->getOrderInfo(['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];
+        }
+    }
+}

+ 140 - 0
helper/refill/api/xyz/bodian/RefillPhone.php

@@ -0,0 +1,140 @@
+<?php
+
+namespace refill\bodian;
+
+require_once(BASE_HELPER_RAPI_PATH . '/bodian/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['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/bodian/api.txt

@@ -0,0 +1,15 @@
+后台参数
+客户地址:http://36.139.45.33:10186/plat/index
+账号:YZ100206
+密码:123456
+
+对接参数
+ID:200022
+key:eccbb10eeba844e2bd5b8bc53314083e
+
+正式环境:
+下单地址:http://36.139.45.33:10186/plat/api/old/submitorder
+查询地址:http://36.139.45.33:10186/plat/api/old/queryorder
+查询余额地址:http://36.139.45.33:10186/plat/api/old/queryBalance
+
+对接文档地址:https://docs.qq.com/doc/DWkV1VkxQVk13eEtQ

+ 27 - 0
helper/refill/api/xyz/bodian/config.php

@@ -0,0 +1,27 @@
+<?php
+
+
+namespace refill\bodian;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://36.139.45.33:10186/plat/api/old/submitorder';
+    const QUERY_URL= 'http://36.139.45.33:10186/plat/api/old/queryorder';
+    const BALANCE_URL = 'http://36.139.45.33:10186/plat/api/old/queryBalance';
+
+    const USER_ID= '200022';
+    const KEY = 'eccbb10eeba844e2bd5b8bc53314083e';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_bodian.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
+    ];
+}

BIN
helper/refill/api/xyz/guochuang/20220522青海移动调价函.jpg


+ 1 - 1
helper/refill/api/xyz/guochuang/config.php

@@ -67,7 +67,7 @@ class config
         "4-10-6" => 9.76, "4-20-6" => 19.52, "4-30-6" => 29.28, "4-50-6" => 48.8, "4-100-6" => 97.6, "4-200-6" => 195.2, "4-300-6" => 292.8, "4-500-6" => 488,//辽宁 6
         "4-10-9" => 9.94, "4-20-9" => 19.88, "4-30-9" => 29.82, "4-50-9" => 49.7, "4-100-9" => 99.4,//上海 9
         "4-10-8" => 10.01, "4-20-8" => 20.02, "4-30-8" => 30.03, "4-50-8" => 50.05, "4-100-8" => 100.1, "4-200-8" => 200.2, "4-300-8" => 300.3, "4-500-8" => 500.5,//黑龙江 8
-        "4-10-29" => 9.75, "4-20-29" => 19.5, "4-30-29" => 29.25, "4-50-29" => 48.75, "4-100-29" => 97.5, "4-200-29" => 195, "4-300-29" => 292.5, "4-500-29" => 487.5,//青海 29
+        "4-10-29" => 9.78, "4-20-29" => 19.56, "4-30-29" => 29.34, "4-50-29" => 48.9, "4-100-29" => 97.8, "4-200-29" => 195.6, "4-300-29" => 293.4, "4-500-29" => 489,//青海 29
         "4-10-28" => 9.985, "4-20-28" => 19.97, "4-30-28" => 29.955, "4-50-28" => 49.925, "4-100-28" => 99.85, "4-200-28" => 199.7, "4-300-28" => 299.55, "4-500-28" => 499.25,//甘肃 28
         "4-10-13" => 10.22, "4-20-13" => 19.94, "4-30-13" => 29.91, "4-50-13" => 49.85, "4-100-13" => 99.7, "4-200-13" => 199.4, "4-300-13" => 300.9, "4-500-13" => 501.5,//福建 13
         "4-10-5" => 10, "4-20-5" => 20, "4-30-5" => 30, "4-50-5" => 50, "4-100-5" => 100, "4-200-5" => 200.4, "4-300-5" => 300.6, "4-500-5" => 501,//内蒙古 5

+ 1 - 0
helper/refill/api/xyz/huoshenguoman/config.php

@@ -15,6 +15,7 @@ class config
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_huoshenguoman.php";
     const PRODUCT = [
         mtopcard\ChinaMobileCard => [
+            50  => 100027,
             100 => 100028,
             200 => 100029,
         ],

+ 4 - 1
helper/refill/api/xyz/huoshenguoman/开户信息.txt

@@ -25,4 +25,7 @@ appSecret:vfrkNedzDCXXdIdT
 
 2022.4.20
 100028 慢充移动100
-100029 慢充移动200
+100029 慢充移动200
+
+2022.5.19
+100027 慢充移动50

+ 39 - 0
helper/refill/api/xyz/liantongzx/RefillCallBack.php

@@ -0,0 +1,39 @@
+<?php
+namespace refill\liantongzx;
+
+require_once(BASE_HELPER_RAPI_PATH . '/liantongzx/config.php');
+
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $input = $params;
+        unset($input['signature']);
+        $sign = config::sign($input);
+        if ($params['signature'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    public function notify($params)
+    {
+        $status = intval($params['status']);
+        $order_sn = $params['buisId'];
+        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+
+        $order_id = $order_info['order_id'];
+        if ($status === 2) {
+            return [$order_id, true, false, true];
+        } elseif ($status === 3) {
+            return [$order_id, false, true, true];
+        } else {
+            return [$order_id, false, false, false];
+        }
+    }
+}

+ 145 - 0
helper/refill/api/xyz/liantongzx/RefillPhone.php

@@ -0,0 +1,145 @@
+<?php
+
+namespace refill\liantongzx;
+
+require_once(BASE_HELPER_RAPI_PATH . '/liantongzx/config.php');
+
+use refill;
+use Log;
+use QueueClient;
+
+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['appKey'] = config::APP_KEY;
+        $params['phone'] = $phone;
+        $params['busiId'] = $order_sn;
+        $params['money'] = $amount * 100;
+
+        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 = config::sign($params);
+        $params['signature'] = $sign;
+        $params = json_encode($params);
+
+        $resp = http_post_data(config::ORDER_URL, $params , config::ExtHeaders, $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['code'] === '00000')
+            {
+                $status = $resp['data']['status'];
+                if ($status === 1) {
+                    return [true, $resp['data']['id'], false];
+                } elseif ($status === 2) {
+                    QueueClient::async_push("QueryRefillState", ['order_id' => $params['order_id']], 30);
+                    return [true, $resp['data']['id'], false];
+                } elseif ($status === 3) {
+                    return [false, $resp['msg'], false];
+                } else {
+                    $net_errno = "HTTP-{$status}";
+                    return [true, $resp['msg'], true];
+                }
+            }
+            elseif ($resp['code'] === '20008' || $resp['code'] === '99999')
+            {
+                $net_errno = "HTTP-{$resp['code']}";
+                return [true, $resp['msg'], true];
+            }
+            else {
+                return [false, $resp['msg'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['appKey'] = config::APP_KEY;
+        $params['busiId'] = $refill_info['order_sn'];
+        $sign = config::sign($params);
+        $params['signature'] = $sign;
+        $params = json_encode($params);
+
+        $resp = http_post_data(config::QUERY_URL, $params , config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            }
+
+            if($resp['code'] === '00000')
+            {
+                $status = $resp['data']['status'];
+                if ($status === 2) {
+                    $order_state = ORDER_STATE_SUCCESS;
+                } elseif ($status === 3) {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif (in_array($status, [0, 1, 4], true)) {
+                    $order_state = ORDER_STATE_SEND;
+                } else {
+                    return [false, $status];
+                }
+                return [true, $order_state];
+            }
+            elseif($resp['code'] === '40000' && (time() - $refill_info['commit_time'] > 600))
+            {
+                return [true, ORDER_STATE_NOEXIST];
+            }
+            else
+            {
+                return [false, $resp['msg']];
+            }
+        }
+    }
+
+    public function balance()
+    {
+        $params['appKey'] = config::APP_KEY;
+        $sign = config::sign($params);
+        $params['signature'] = $sign;
+        $params = json_encode($params);
+
+        $resp = http_post_data(config::BALANCE_URL, $params , 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['code'] === '00000') {
+                $left_cent = intval($resp['data']['balance']);
+                return [true, ncPriceFormat($left_cent / 100)];
+            } else {
+                return [false, $resp['msg']];
+            }
+        }
+    }
+}

+ 6 - 0
helper/refill/api/xyz/liantongzx/account.txt

@@ -0,0 +1,6 @@
+https://yx.mail.wo.cn:12443/rechargeplat/login
+账号:Dbjyz      初始密码:Beijyz0516
+appKey:Dbjyz
+secret:C1A0845BEBB9F2BC62A53CC920EF440D
+
+接口文档地址为:https://yx.mail.wo.cn:12443/rechargeplat/login/go-api-page

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

@@ -0,0 +1,43 @@
+<?php
+
+
+namespace refill\liantongzx;
+
+class config
+{
+    //回调地址上游后台配置
+    const ORDER_URL = 'https://yx.mail.wo.cn:11443/rechargeplat-rest/rechargeIntf/singleRecharge';
+    const QUERY_URL= 'https://yx.mail.wo.cn:11443/rechargeplat-rest/rechargeIntf/queryRechargeRecord';
+    const BALANCE_URL= 'https://yx.mail.wo.cn:11443/rechargeplat-rest/getUserBalance';
+
+    const APP_KEY = 'Dbjyz';
+    const APP_SECRET = 'C1A0845BEBB9F2BC62A53CC920EF440D';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_liantongzx.php";
+    const ExtHeaders = ['Content-Type: application/json' , 'Accept: application/json;charset=UTF-8'];
+
+    public static function sign($params)
+    {
+        $content = '';
+        ksort($params);
+        foreach ($params as $key => $val){
+            if(false === self::check_empty($val)) {
+                $content .= "{$key}{$val}";
+            }
+        }
+        $content .= "key=".config::APP_SECRET;
+
+        return strtoupper(md5($content));
+    }
+
+    public static function check_empty($value)
+    {
+        if (!isset($value))
+            return true;
+        if ($value === null)
+            return true;
+        if (trim($value) === "")
+            return true;
+
+        return false;
+    }
+}

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

@@ -0,0 +1,50 @@
+<?php
+namespace refill\tongmai;
+
+require_once(BASE_HELPER_RAPI_PATH . '/tongmai/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')->getOrderInfo(['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];
+        }
+    }
+}

+ 144 - 0
helper/refill/api/xyz/tongmai/RefillPhone.php

@@ -0,0 +1,144 @@
+<?php
+
+namespace refill\tongmai;
+
+require_once(BASE_HELPER_RAPI_PATH . '/tongmai/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['nProductClass'] = 1;
+        $params['nProductType'] = 1;
+        $params['szProductId'] = config::PRODUCT[$card_type][$amount];
+        $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);
+        if(empty($params['szProductId'])) {
+            return [false, '商品编号错误', false];
+        }
+        $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);
+    }
+}

+ 39 - 0
helper/refill/api/xyz/tongmai/api.txt

@@ -0,0 +1,39 @@
+尊敬的用户:北京椰子
+
+正式环境:
+话费下单地址:http://47.111.15.203:10186/plat/api/old/submitorder
+查询地址:http://47.111.15.203:10186/plat/api/old/queryorder
+查询余额地址:http://47.111.15.203:10186/plat/api/old/queryBalance
+
+正式ID:200010
+秘钥:53f5570a38f54004b3b75886456968cb
+
+对接文档地址:https://docs.qq.com/doc/DWkV1VkxQVk13eEtQ
+前端查单地址:http://47.111.15.203:10186/plat/index
+账号:18500608333   密码(初始密码)123456
+
+移动:
+1000030 话费 全国移动30元
+1000050 话费 全国移动50元
+1000100 话费 全国移动100元
+1000200 话费 全国移动200元
+1000300 话费 全国移动300元
+1000500 话费 全国移动500元
+
+
+联通:
+2000030 话费 全国联通30元
+2000050 话费 全国联通50元
+2000100 话费 全国联通100元
+2000200 话费 全国联通200元
+2000300 话费 全国联通300元
+2000500 话费 全国联通500元
+
+电信:
+3000030 话费 全国电信30元
+3000050 话费 全国电信50元
+3000100 话费 全国电信100元
+3000200 话费 全国电信200元
+3000300 话费 全国电信300元
+3000500 话费 全国电信500元
+

+ 54 - 0
helper/refill/api/xyz/tongmai/config.php

@@ -0,0 +1,54 @@
+<?php
+
+
+namespace refill\tongmai;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://47.111.15.203:10186/plat/api/old/submitorder';
+    const QUERY_URL= 'http://47.111.15.203:10186/plat/api/old/queryorder';
+    const BALANCE_URL = 'http://47.111.15.203:10186/plat/api/old/queryBalance';
+
+    const USER_ID= '200010';
+    const KEY = '53f5570a38f54004b3b75886456968cb';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_tongmai.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  => [
+            30   => 1000030,
+            50   => 1000050,
+            100  => 1000100,
+            200  => 1000200,
+            300  => 1000300,
+            500  => 1000500,
+        ],
+        mtopcard\ChinaUnicomCard  => [
+            30   => 2000030,
+            50   => 2000050,
+            100  => 2000100,
+            200  => 2000200,
+            300  => 2000300,
+            500  => 2000500,
+        ],
+        mtopcard\ChinaTelecomCard => [
+            30   => 3000030,
+            50   => 3000050,
+            100  => 3000100,
+            200  => 3000200,
+            300  => 3000300,
+            500  => 3000500,
+        ]
+    ];
+}

+ 15 - 4
helper/refill/api/xyz/yunlingdf/RefillPhone.php

@@ -15,7 +15,7 @@ class RefillPhone extends refill\IRefillThird
         parent::__construct($cfgs);
     }
 
-    private function req_params(int $phone, int $amount, $company_type, string $order_sn, $province, $card_id, $use_type)
+    private function req_params(int $phone, int $amount, $company_type, string $order_sn, $province, $card_id, $use_type, $city)
     {
         $params['userid'] = config::USER_ID;
         $params['productid'] = config::product_id[$province][$amount];
@@ -27,11 +27,12 @@ class RefillPhone extends refill\IRefillThird
         $params['sporderid'] = $order_sn;
         $params['back_url'] = config::NOTIFY_URL;
 
+        $area = mtopcard\ProvinceList[$province];
         $data = [
             'product_type' => 3, 'userid' => $phone, 'username' => $card_id,
-            'type' => config::USE_TYPE[$use_type], 'area' => mtopcard\ProvinceList[$province]
+            'type' => config::USE_TYPE[$use_type], 'area' => $area, 'city' => $city
         ];
-        $params['account'] = json_encode($data, JSON_UNESCAPED_UNICODE);
+        $params['account'] = mb_convert_encoding(json_encode($data,JSON_UNESCAPED_UNICODE),"gb2312","UTF-8");
         return $params;
     }
 
@@ -48,11 +49,15 @@ class RefillPhone extends refill\IRefillThird
         $card_id = $params['card_id'] ?? '';
         $use_type = $params['use_type'];
         $province = $params['province'] ?? -1;
+        $city = $params['city'] ?? '';
+        if(!empty($city)) {
+            $city = $this->city_filter($city);
+        }
         if($province <= 0) {
             return [false, '省份获取错误', false];
         }
         $product = $this->getProduct($params['product_code']);
-        $params = $this->req_params($card_no, $product['refill_amount'], $company_type, $order_sn, $province, $card_id, $use_type);
+        $params = $this->req_params($card_no, $product['refill_amount'], $company_type, $order_sn, $province, $card_id, $use_type, $city);
 
         if(empty($params['productid'])) {
             return [false, '商品编号获取失败', false];
@@ -162,4 +167,10 @@ class RefillPhone extends refill\IRefillThird
         $content .= "&sporderid={$params['sporderid']}&key={$key}";
         return strtoupper(md5($content));
     }
+
+    private function city_filter($city)
+    {
+        $endtxt = '市';
+        return mb_strcut($city, 0, strrpos($city, $endtxt));
+    }
 }

+ 2 - 1
helper/refill/api/xyz/yunlingdf/config.php

@@ -12,13 +12,14 @@ class config
     const KEY = 'M4GZNKZCW6kasAMbpGxDn3AcPJiYDFS5';
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_yunlingdf.php";
 
+
     const USE_TYPE = [
         'home'  => 1,
         'commerce'  => 3,
         'pedlar' => 2,
     ];
 
-    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
+    const ExtHeaders = ['Content-type : application/x-www-form-urlencoded; charset=gb2312'];
     const ERR_NOS = [
         '5001','5002','5003','5004','5005','5008','5009','5010','5011','5012'
     ];

+ 1 - 1
helper/refill/api/xyz/zhenghe/api.txt

@@ -5,7 +5,7 @@
 
 对接参数
 ID:200032
-秘钥:6beadbdac55845e580dd4e363c839b14
+秘钥:70fc4782de6e4686b7d1d125d3cd28ff
 
 正式环境:
 话费下单地址:http://47.98.208.128:10186/plat/api/old/submitorder

+ 1 - 1
helper/refill/api/xyz/zhenghe/config.php

@@ -11,7 +11,7 @@ class config
     const BALANCE_URL = 'http://47.98.208.128:10186/plat/api/old/queryBalance';
 
     const USER_ID= '200032';
-    const KEY = '6beadbdac55845e580dd4e363c839b14';
+    const KEY = '70fc4782de6e4686b7d1d125d3cd28ff';
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_zhenghe.php";
     const operator = [
         mtopcard\ChinaMobileCard  => 1,

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

@@ -42,8 +42,8 @@ class config
             7  	=> 100037,
             8  	=> 100038,
             9  	=> 100039,
-            10   => 100040,
-            20   => 100041,
+            10   => 100179,
+            20   => 100180,
             30   => 100181,
             50   => 100043,
             100  => 100183,

+ 5 - 1
helper/refill/api/xyz/zhongst/开户信息.txt

@@ -46,4 +46,8 @@ appSecret:eIpGtPfBdSfqAYSv
 100183   电信电渠100
 100184   电信电渠200
 100185   电信电渠300
-100186   电信电渠500
+100186   电信电渠500
+
+2022.5.19
+100179     电信电渠10
+100180      电信电渠20

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

@@ -0,0 +1,50 @@
+<?php
+namespace refill\bodian;
+
+require_once(BASE_HELPER_RAPI_PATH . '/bodian/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')->getOrderInfo(['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];
+        }
+    }
+}

+ 140 - 0
helper/refill/api/yl/bodian/RefillPhone.php

@@ -0,0 +1,140 @@
+<?php
+
+namespace refill\bodian;
+
+require_once(BASE_HELPER_RAPI_PATH . '/bodian/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['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/yl/bodian/api.txt

@@ -0,0 +1,15 @@
+后台参数
+客户地址:http://36.139.45.33:10186/plat/index
+账号:YL100205
+密码:123456
+
+对接参数
+ID:200021
+key:fd73d42260a84a6396b99334b0cffe92
+
+正式环境:
+下单地址:http://36.139.45.33:10186/plat/api/old/submitorder
+查询地址:http://36.139.45.33:10186/plat/api/old/queryorder
+查询余额地址:http://36.139.45.33:10186/plat/api/old/queryBalance
+
+对接文档地址:https://docs.qq.com/doc/DWkV1VkxQVk13eEtQ

+ 27 - 0
helper/refill/api/yl/bodian/config.php

@@ -0,0 +1,27 @@
+<?php
+
+
+namespace refill\bodian;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://36.139.45.33:10186/plat/api/old/submitorder';
+    const QUERY_URL= 'http://36.139.45.33:10186/plat/api/old/queryorder';
+    const BALANCE_URL = 'http://36.139.45.33:10186/plat/api/old/queryBalance';
+
+    const USER_ID= '200021';
+    const KEY = 'fd73d42260a84a6396b99334b0cffe92';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_bodian.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
+    ];
+}

+ 1 - 1
helper/refill/api/yl/guochuang/config.php

@@ -67,7 +67,7 @@ class config
         "4-10-6" => 9.76, "4-20-6" => 19.52, "4-30-6" => 29.28, "4-50-6" => 48.8, "4-100-6" => 97.6, "4-200-6" => 195.2, "4-300-6" => 292.8, "4-500-6" => 488,//辽宁 6
         "4-10-9" => 9.94, "4-20-9" => 19.88, "4-30-9" => 29.82, "4-50-9" => 49.7, "4-100-9" => 99.4,//上海 9
         "4-10-8" => 10.01, "4-20-8" => 20.02, "4-30-8" => 30.03, "4-50-8" => 50.05, "4-100-8" => 100.1, "4-200-8" => 200.2, "4-300-8" => 300.3, "4-500-8" => 500.5,//黑龙江 8
-        "4-10-29" => 9.75, "4-20-29" => 19.5, "4-30-29" => 29.25, "4-50-29" => 48.75, "4-100-29" => 97.5, "4-200-29" => 195, "4-300-29" => 292.5, "4-500-29" => 487.5,//青海 29
+        "4-10-29" => 9.78, "4-20-29" => 19.56, "4-30-29" => 29.34, "4-50-29" => 48.9, "4-100-29" => 97.8, "4-200-29" => 195.6, "4-300-29" => 293.4, "4-500-29" => 489,//青海 29
         "4-10-28" => 9.985, "4-20-28" => 19.97, "4-30-28" => 29.955, "4-50-28" => 49.925, "4-100-28" => 99.85, "4-200-28" => 199.7, "4-300-28" => 299.55, "4-500-28" => 499.25,//甘肃 28
         "4-10-13" => 10.22, "4-20-13" => 19.94, "4-30-13" => 29.91, "4-50-13" => 49.85, "4-100-13" => 99.7, "4-200-13" => 199.4, "4-300-13" => 300.9, "4-500-13" => 501.5,//福建 13
         "4-10-5" => 10, "4-20-5" => 20, "4-30-5" => 30, "4-50-5" => 50, "4-100-5" => 100, "4-200-5" => 200.4, "4-300-5" => 300.6, "4-500-5" => 501,//内蒙古 5

+ 1 - 0
helper/refill/api/yl/huoshenguoman/config.php

@@ -15,6 +15,7 @@ class config
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_huoshenguoman.php";
     const PRODUCT = [
         mtopcard\ChinaMobileCard => [
+            50  => 100027,
             100 => 100028,
             200 => 100029,
         ],

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

@@ -0,0 +1,50 @@
+<?php
+namespace refill\tongmai;
+
+require_once(BASE_HELPER_RAPI_PATH . '/tongmai/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')->getOrderInfo(['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];
+        }
+    }
+}

+ 144 - 0
helper/refill/api/yl/tongmai/RefillPhone.php

@@ -0,0 +1,144 @@
+<?php
+
+namespace refill\tongmai;
+
+require_once(BASE_HELPER_RAPI_PATH . '/tongmai/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['nProductClass'] = 1;
+        $params['nProductType'] = 1;
+        $params['szProductId'] = config::PRODUCT[$card_type][$amount];
+        $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);
+        if(empty($params['szProductId'])) {
+            return [false, '商品编号错误', false];
+        }
+        $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);
+    }
+}

+ 39 - 0
helper/refill/api/yl/tongmai/api.txt

@@ -0,0 +1,39 @@
+尊敬的用户:北京椰林
+
+正式环境:
+话费下单地址:http://47.111.15.203:10186/plat/api/old/submitorder
+查询地址:http://47.111.15.203:10186/plat/api/old/queryorder
+查询余额地址:http://47.111.15.203:10186/plat/api/old/queryBalance
+
+正式ID:200012
+秘钥:c09fca7fbc0f40109a2aa0ec86cd2569
+
+对接文档地址:https://docs.qq.com/doc/DWkV1VkxQVk13eEtQ
+前端查单地址:http://47.111.15.203:10186/plat/index
+账号:18513846008   密码(初始密码)123456
+
+移动:
+1000030 话费 全国移动30元
+1000050 话费 全国移动50元
+1000100 话费 全国移动100元
+1000200 话费 全国移动200元
+1000300 话费 全国移动300元
+1000500 话费 全国移动500元
+
+
+联通:
+2000030 话费 全国联通30元
+2000050 话费 全国联通50元
+2000100 话费 全国联通100元
+2000200 话费 全国联通200元
+2000300 话费 全国联通300元
+2000500 话费 全国联通500元
+
+电信:
+3000030 话费 全国电信30元
+3000050 话费 全国电信50元
+3000100 话费 全国电信100元
+3000200 话费 全国电信200元
+3000300 话费 全国电信300元
+3000500 话费 全国电信500元
+

+ 54 - 0
helper/refill/api/yl/tongmai/config.php

@@ -0,0 +1,54 @@
+<?php
+
+
+namespace refill\tongmai;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://47.111.15.203:10186/plat/api/old/submitorder';
+    const QUERY_URL= 'http://47.111.15.203:10186/plat/api/old/queryorder';
+    const BALANCE_URL = 'http://47.111.15.203:10186/plat/api/old/queryBalance';
+
+    const USER_ID= '200012';
+    const KEY = 'c09fca7fbc0f40109a2aa0ec86cd2569';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_tongmai.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  => [
+            30   => 1000030,
+            50   => 1000050,
+            100  => 1000100,
+            200  => 1000200,
+            300  => 1000300,
+            500  => 1000500,
+        ],
+        mtopcard\ChinaUnicomCard  => [
+            30   => 2000030,
+            50   => 2000050,
+            100  => 2000100,
+            200  => 2000200,
+            300  => 2000300,
+            500  => 2000500,
+        ],
+        mtopcard\ChinaTelecomCard => [
+            30   => 3000030,
+            50   => 3000050,
+            100  => 3000100,
+            200  => 3000200,
+            300  => 3000300,
+            500  => 3000500,
+        ]
+    ];
+}

+ 1 - 1
helper/refill/api/yl/zhenghe/api.txt

@@ -5,7 +5,7 @@
 
 对接参数
 ID:200042
-秘钥:b68c7cef72bc4a6582715196b18e499f
+秘钥:6ca2ccacff9e44c6a91ef1157a8dc322
 
 正式环境:
 话费下单地址:http://47.98.208.128:10186/plat/api/old/submitorder

+ 1 - 1
helper/refill/api/yl/zhenghe/config.php

@@ -11,7 +11,7 @@ class config
     const BALANCE_URL = 'http://47.98.208.128:10186/plat/api/old/queryBalance';
 
     const USER_ID= '200042';
-    const KEY = 'b68c7cef72bc4a6582715196b18e499f';
+    const KEY = '6ca2ccacff9e44c6a91ef1157a8dc322';
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_zhenghe.php";
     const operator = [
         mtopcard\ChinaMobileCard  => 1,

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

@@ -42,8 +42,8 @@ class config
             7  	=> 100037,
             8  	=> 100038,
             9  	=> 100039,
-            10   => 100040,
-            20   => 100041,
+            10   => 100179,
+            20   => 100180,
             30   => 100181,
             50   => 100043,
             100  => 100183,

+ 8 - 6
helper/refill/policy/transfer.php

@@ -56,21 +56,21 @@ class transfer
                 $tmchid = intval($transfer_cfg['transfer_mchid']);
                 $lower_time = intval($transfer_cfg['transfer_lowertime']);
                 $upper_time = intval($transfer_cfg['transfer_uppertime']);
+                $card_types = $transfer_cfg['card_types'] ?? [];
 
                 if ($opened == 1 && $tmchid > 0 && $tmchid != $mchid && $lower_time > 0 && $upper_time > $lower_time)
                 {
                     $admin_id = $mch_checker($tmchid);
                     if($admin_id > 0) {
                         $this->mMchid2Infos[$mchid] = ['transfer_mchid' => $tmchid, 'admin_id' => $admin_id,
-                            'lower_time' => $lower_time, 'upper_time' => $upper_time];
+                            'lower_time' => $lower_time, 'upper_time' => $upper_time,'card_types' => $card_types];
                     }
-
                 }
             }
         }
     }
 
-    public function need_transfer($mchid,$order_time)
+    public function need_transfer($mchid,$order_time,$card_type)
     {
         if(array_key_exists($mchid,$this->mMchid2Infos))
         {
@@ -78,12 +78,14 @@ class transfer
 
             $lower_time = $transfer_cfg['lower_time'];
             $upper_time = $transfer_cfg['upper_time'];
+            $card_types = $transfer_cfg['card_types'];
 
             $elpse_secs = time() - $order_time;
-            if($lower_time <= $elpse_secs && $upper_time > $elpse_secs) {
+            if ($elpse_secs >= $lower_time && $elpse_secs < $upper_time) {
                 return true;
-            }
-            else {
+            } elseif (in_array($card_type, $card_types)) {
+                return false;
+            } else {
                 return false;
             }
         }

+ 2 - 3
helper/refill/policy/xyz/policy.php

@@ -277,9 +277,8 @@ class policy extends ProviderManager implements IPolicy
             {
                 $ret = array_intersect($names, $channels);
                 if (empty($ret)) {
-                    return [[],false];
-                }
-                else {
+                    return [[], false];
+                } else {
                     $names = $ret;
                 }
             }

+ 7 - 1
helper/refill/util.php

@@ -739,7 +739,7 @@ class util
         });
     }
 
-    public static function retry_canceled_order($order_id)
+    public static function retry_canceled_order($order_id, $skip)
     {
         $mod_order = Model('vr_order');
         $mod_refill = Model('refill_order');
@@ -771,6 +771,12 @@ class util
             $params = $order->queue_params();
             $params['order_time'] = time();
 
+            if ($skip) {
+                $mchid = $refill_info['mchid'];
+                $mch_order = $refill_info['mch_order'];
+                refill\util::set_next_order($mchid, $mch_order);
+            }
+
             if(util::push_add($params)) {
                 return [true,''];
             } else {

+ 4 - 0
mobile/callback/refill_bodian.php

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

+ 9 - 0
mobile/callback/refill_liantongzx.php

@@ -0,0 +1,9 @@
+<?php
+
+$content = $_SERVER['post_content'] ?? [];
+$input = json_decode($content,true);
+refill\util::push_notify('liantongzx',$input['data']);
+
+$response = ["code" => "200", "msg" => "成功"];
+$body = json_encode($response);
+echo($body);

+ 4 - 0
mobile/callback/refill_tongmai.php

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

+ 2 - 1
rdispatcher/proxy.php

@@ -31,7 +31,8 @@ class proxy
     {
         $order_time = $order->order_time();
         $mchid = $order->mchid();
-        $ret = refill\transfer::instance()->need_transfer($mchid,$order_time);
+        $card_type = $order->card_type();
+        $ret = refill\transfer::instance()->need_transfer($mchid,$order_time,$card_type);
 
         return $ret;
     }

+ 55 - 8
test/TestRefill.php

@@ -1598,15 +1598,19 @@ class TestRefill extends TestCase
 
     public function testYunlingdf()
     {
-//        $provider = $this->getProvider('yunlingdf');
-//        $resp = $provider->add(1004638637, 4, 50, ['order_sn' => $this->make_sn(), 'province' => 1]);
-//        $resp = $provider->query(['order_sn' => '52311640682774916978']);
+        $provider = $this->getProvider('yunlingdf');
+//        $resp = $provider->balance();
+        $resp = $provider->add(2079727198, 7, 100, [
+            'order_sn' => $this->make_sn(), 'company_type' => 'nation', 'use_type' => 'home',
+            'province' => 18, 'city' => '永州市', 'product_code' => 'DF_nation_home_100'
+        ]);
+//        $resp = $provider->query(['order_sn' => '45331652932902024418']);
 
-        $body = '{"orderid":"RCE21122817138556500","sporderid":"52311640682774916978","userid":"10002623","merchantsubmittime":"20211228182932","resultno":"1","parvalue":"50","remark1":"50.00","payno":"50.00","fundbalance":"-46.5","sign":"B40807706460BAF9CBE150166633F20A"}';
-        $params = json_decode($body, true);
-        $provider = $this->getProvider('yunlingdf', 'RefillCallBack');
-        $ret = $provider->verify($params);
-        $resp = $provider->notify($params);
+//        $body = ' {"orderid":"JDE22051911549026252","sporderid":"26641652932472092667","userid":"10002623","merchantsubmittime":"20220519115448","resultno":"9","parvalue":"100","remark1":"","payno":"","fundbalance":"-140.5","sign":"1EC1F9730A66ED23B68B89DD7CA4EB15"}';
+//        $params = json_decode($body, true);
+//        $provider = $this->getProvider('yunlingdf', 'RefillCallBack');
+//        $ret = $provider->verify($params);
+//        $resp = $provider->notify($params);
     }
 
     public function testYamiao_high()
@@ -2258,6 +2262,49 @@ class TestRefill extends TestCase
         $resp = $provider->notify($params);
     }
 
+    public function testTongmai()
+    {
+//        $provider = $this->getProvider('tongmai');
+//        $resp = $provider->balance();
+//        $resp = $provider->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
+//        $resp = $provider->query(['order_sn' => '14471652858448773887']);
+
+        $body = '{"szOrderId":"14471652858448773887","fSalePrice":"49.75","szAgentId":"200010","nFlag":"2","szVerifyString":"228ad25509b080bb728276d6176d9fea","szPhoneNum":"13699279618","szRtnMsg":"220518-443138774640458","nDemo":"50"}';
+        $params = json_decode($body, true);
+        $provider = $this->getProvider('tongmai','RefillCallBack');
+        $ret = $provider->verify($params);
+        $resp = $provider->notify($params);
+    }
+
+    public function testLiantongzx()
+    {
+//        $provider = $this->getProvider('liantongzx');
+//        $resp = $provider->balance();
+//        $resp = $provider->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
+//        $resp = $provider->query(['order_sn' => '31091653029001738304']);
+
+        $body = '{"msg":"成功","code":"00000","data":{"buisId":"31091653029001738304","signature":"59E5589E87B24B2DCBEC7AE09B0310B8","rechargePhone":"18500608333","appKey":"Dbjyz","id":"202205201443247E4AEC9FF804F14AC2","operator":"CU","status":2,"rechargeMoney":5000}}';
+        $params = json_decode($body, true);
+        $provider = $this->getProvider('liantongzx','RefillCallBack');
+        $ret = $provider->verify($params['data']);
+        $resp = $provider->notify($params['data']);
+    }
+
+    public function testBodian()
+    {
+//        $provider = $this->getProvider('bodian');
+//        $resp = $provider->balance();
+//        $resp = $provider->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
+//        $resp = $provider->query(['order_sn' => '57771653272628058996']);
+
+        $body = '{"szOrderId":"57771653272628058996","fSalePrice":"49.9","szAgentId":"200022","nFlag":"2","szVerifyString":"3d0cad0e5b5b5e21822aeb30541d689c","szPhoneNum":"18500608333","szRtnMsg":"100101101062205231024014167462","nDemo":"50"}';
+        $params = json_decode($body, true);
+        $provider = $this->getProvider('bodian','RefillCallBack');
+        $ret = $provider->verify($params);
+        $resp = $provider->notify($params);
+
+    }
+
     public function testAmingjd()
     {
 //        $provider = new refill\amingjd\RefillPhone([]);

+ 12 - 0
test/TestRefillYl.php

@@ -700,4 +700,16 @@ class TestRefillYl extends TestCase
         $provider = $this->getProvider('donghong_normal');
         $resp = $provider->balance();
     }
+
+    public function testTongmai()
+    {
+        $provider = $this->getProvider('tongmai');
+        $resp = $provider->balance();
+    }
+
+    public function testBodian()
+    {
+        $provider = $this->getProvider('bodian');
+        $resp = $provider->balance();
+    }
 }