ayHaru 4 年 前
コミット
5ade794674
40 ファイル変更1225 行追加465 行削除
  1. 5 3
      admin/templates/default/merchant.edit.php
  2. 1 3
      admin/templates/default/merchant.index.php
  3. 15 1
      admin/templates/default/merchant.price.php
  4. 4 0
      admin/templates/default/provider.amount.control.php
  5. 4 0
      admin/templates/default/provider.index.php
  6. 10 6
      admin/templates/default/refill.order.index.php
  7. 331 13
      data/config/dev/refill.ini.php
  8. 168 115
      data/config/lingzh/refill.ini.php
  9. 78 30
      data/config/win/refill.ini.php
  10. 100 52
      data/config/xyz/refill.ini.php
  11. 1 1
      docker/conf/php-fpm/php-local-debug.ini
  12. 34 1
      helper/mtopcard/mtopcard.php
  13. 2 0
      helper/refill/LZRefillFactory.php
  14. 4 1
      helper/refill/ProviderManager.php
  15. 24 17
      helper/refill/RefillBase.php
  16. 2 0
      helper/refill/XYZRefillFactory.php
  17. 7 3
      helper/refill/api/lingzh/amingjd/RefillPhone.php
  18. 4 2
      helper/refill/api/xyz/lingzh/RefillPhone.php
  19. 1 1
      helper/refill/api/xyz/tonglu/RefillPhone.php
  20. 16 11
      helper/refill/api/xyz/xc/RefillCallBack.php
  21. 9 6
      helper/refill/api/xyz/xc/RefillPhone.php
  22. 5 5
      helper/refill/api/xyz/xc/config.php
  23. 2 4
      helper/refill/policy/IPolicy.php
  24. 13 9
      helper/refill/policy/chctl.php
  25. 0 1
      helper/refill/policy/ctl_item.php
  26. 29 22
      helper/refill/policy/lingzh/policy.php
  27. 35 0
      helper/refill/policy/lingzh/quality_ploy.php
  28. 8 2
      helper/refill/policy/mchctl.php
  29. 102 0
      helper/refill/policy/quaility.php
  30. 21 89
      helper/refill/policy/xyz/policy.php
  31. 33 0
      helper/refill/policy/xyz/quality_ploy.php
  32. 19 16
      mobile/control/refill.php
  33. 4 1
      racc/control/lzrefill.php
  34. 9 8
      racc/control/refill.php
  35. 0 1
      rdispatcher/codispatcher.php
  36. 0 17
      rdispatcher/coprocessor.php
  37. 35 13
      rdispatcher/proxy.php
  38. 4 4
      test/TestDispatcher.php
  39. 1 0
      test/TestMemberCard.php
  40. 85 7
      test/TestRefill.php

+ 5 - 3
admin/templates/default/merchant.edit.php

@@ -63,11 +63,13 @@
                 <td colspan="2" class="required"><label class="validation" for="quality">通道质量:</label></td>
             </tr>
             <tr class="noborder">
-                <td class="">
+                <td class="vatop">
                     <input id="activity_state1" name="quality" <?php if($output['merchant']['quality'] == 1){ echo 'checked';}?> value="1" type="radio">普通
                     <input id="activity_state0" name="quality" <?php if($output['merchant']['quality'] == 2){ echo 'checked';}?> value="2" type="radio">快速
-                    <input id="activity_state1" name="quality" <?php if($output['merchant']['quality'] == 3){ echo 'checked';}?> value="3" type="radio">普通+快速通道(优先走普通通道,如果在最长回调时间内不成功切换快速通道,确保成功率)
-
+                    <input id="activity_state1" name="quality" <?php if($output['merchant']['quality'] == 3){ echo 'checked';}?> value="3" type="radio">卡密
+                    <input id="activity_state1" name="quality" <?php if($output['merchant']['quality'] == 4){ echo 'checked';}?> value="4" type="radio">三方
+                    <input id="activity_state1" name="quality" <?php if($output['merchant']['quality'] == 5){ echo 'checked';}?> value="5" type="radio">慢充
+                    <input id="activity_state1" name="quality" <?php if($output['merchant']['quality'] == 11){ echo 'checked';}?> value="11" type="radio">系统默认
                 </td>
             </tr>
             </tbody>

+ 1 - 3
admin/templates/default/merchant.index.php

@@ -114,9 +114,7 @@ defined('InShopNC') or exit('Access Invalid!'); ?>
                                 <a href="index.php?act=merchant&op=recharge_manual&mchid=<?php echo $v['mchid'] ?>">加款</a>
                             <?php } ?>
                             <span style="display: block">
-                                <a href="index.php?act=merchant&op=price&quality=1&mchid=<?php echo $v['mchid'] ?>">普通通道设置</a>
-                                |
-                                <a href="index.php?act=merchant&op=price&quality=2&mchid=<?php echo $v['mchid'] ?>">快速通道设置</a>
+                                <a href="index.php?act=merchant&op=price&quality=1&mchid=<?php echo $v['mchid'] ?>">通道费率设置</a>
                             </span>
                         </td>
                     </tr>

+ 15 - 1
admin/templates/default/merchant.price.php

@@ -83,7 +83,12 @@
                 <li><a href="index.php?act=merchant&op=merchant"><span><?php echo $lang['nc_manage'] ?></span></a></li>
                 <li><a href="index.php?act=merchant&op=merchant_add"><span><?php echo $lang['nc_new'] ?></span></a></li>
                 <li><a href="index.php?act=merchant&op=orderStorge"><span>机构库存锁定</span></a></li>
-                <li><a href="JavaScript:void(0);" class="current"><span>费率设置</span></a></li>
+
+                <li><a href="index.php?act=merchant&op=price&quality=1&mchid=<?php echo $_GET['mchid'] ?>" class="classA" data-quality="1"><span>普通通道费率设置</span></a></li>
+                <li><a href="index.php?act=merchant&op=price&quality=2&mchid=<?php echo $_GET['mchid'] ?>" class="classA" data-quality="2"><span>快速通道费率设置</span></a></li>
+                <li><a href="index.php?act=merchant&op=price&quality=3&mchid=<?php echo $_GET['mchid'] ?>" class="classA" data-quality="3"><span>卡密通道费率设置</span></a></li>
+                <li><a href="index.php?act=merchant&op=price&quality=4&mchid=<?php echo $_GET['mchid'] ?>" class="classA" data-quality="4"><span>三方通道费率设置</span></a></li>
+                <li><a href="index.php?act=merchant&op=price&quality=5&mchid=<?php echo $_GET['mchid'] ?>" class="classA" data-quality="5"><span>慢充通道费率设置</span></a></li>
             </ul>
         </div>
     </div>
@@ -404,5 +409,14 @@
             $(this).parent().hide();
             $(this).prev().val('');
         });
+
+        let quality = '<?php echo $_GET['quality'];?>';
+        $(".classA").each(function () {
+            if (quality == $(this).attr("data-quality")) {
+                $(this).addClass('current')
+                $(this).attr('href','JavaScript:void(0);')
+            }
+        })
+
     });
 </script>

+ 4 - 0
admin/templates/default/provider.amount.control.php

@@ -125,6 +125,10 @@
                 <li><a href="index.php?act=merchant&op=provider"><span><?php echo $lang['nc_manage'] ?></span></a></li>
                 <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=common" class="classA" data-type="2-common"><span>普通话费单量控制</span></a></li>
                 <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=fast" class="classA" data-type="2-fast"><span>快充话费单量控制</span></a></li>
+                <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=card" class="classA" data-type="1-common"><span>卡密话费单量控制</span></a></li>
+                <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=third" class="classA" data-type="1-fast"><span>三方话费单量控制</span></a></li>
+                <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=slow" class="classA" data-type="1-fast"><span>慢充话费单量控制</span></a></li>
+
                 <li><a href="index.php?act=merchant&op=provider_amount_control&type=1&form=common" class="classA" data-type="1-common"><span>普通油卡单量控制</span></a></li>
                 <li><a href="index.php?act=merchant&op=provider_amount_control&type=1&form=fast" class="classA" data-type="1-fast"><span>普通油卡单量控制</span></a></li>
             </ul>

+ 4 - 0
admin/templates/default/provider.index.php

@@ -8,6 +8,10 @@
                 <li><a href="JavaScript:void(0);" class="current"><span><?php echo $lang['nc_manage'] ?></span></a></li>
                 <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=common"><span>普通话费单量控制</span></a></li>
                 <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=fast"><span>快充话费单量控制</span></a></li>
+                <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=card"><span>卡密话费单量控制</span></a></li>
+                <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=third"><span>三方话费单量控制</span></a></li>
+                <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=slow"><span>慢充话费单量控制</span></a></li>
+
                 <li><a href="index.php?act=merchant&op=provider_amount_control&type=1&form=common"><span>普通油卡单量控制</span></a></li>
                 <li><a href="index.php?act=merchant&op=provider_amount_control&type=1&form=fast"><span>普通油卡单量控制</span></a></li>
             </ul>

+ 10 - 6
admin/templates/default/refill.order.index.php

@@ -146,7 +146,7 @@
                 <td></td>
                 <td>
                     <a href="#" class="btns" onclick="hCopyChannel(event)">
-                        <span><i class="icon-edit"></i>拷贝供方单号</span>
+                        <span><i class="icon-edit"></i>拷贝渠道单号</span>
                     </a>
                     <a href="#" class="btns" onclick="hCopyCardNo(event)">
                         <span><i class="icon-edit"></i>拷贝充值卡号</span>
@@ -220,9 +220,11 @@
             <th class="align-center">运营商流水号</th>
             <th class="align-center">失败原因</th>
             <th class="align-center">商家单号</th>
-            <th class="align-center">扣款金额</th>
             <th class="align-center">渠道单号</th>
             <th class="align-center">渠道名称</th>
+            <th class="align-center">queue</th>
+            <th class="align-center">org_que</th>
+            <th class="align-center">扣款金额</th>
             <th class="align-center"><?php echo $lang['nc_handle']; ?></th>
         </tr>
         </thead>
@@ -257,9 +259,11 @@
                     <td class="align-left"><?php echo $order['official_sn']; ?></td>
                     <td class="align-left"><?php echo $order['err_msg']; ?></td>
                     <td class="align-left"><?php echo $order['mch_order']; ?></td>
-                    <td class="align-center"><?php echo $order['mch_amount']; ?></td>
                     <td class="align-left" class="ch_trade_no"><?php echo $order['ch_trade_no']; ?></td>
                     <td class="align-center"><?php echo $order['channel_name']; ?></td>
+                    <td class="align-center"><?php echo $order['quality']; ?></td>
+                    <td class="align-center"><?php echo $order['org_quality']; ?></td>
+                    <td class="align-center"><?php echo $order['mch_amount']; ?></td>
                     <td class="w144 align-center">
                         <a href="index.php?act=merchant&op=notify_merchant&order_id=<?php echo $order['order_id']; ?>">
                                 回调</a>
@@ -275,13 +279,13 @@
             <?php } ?>
         <?php } else { ?>
             <tr class="no_data">
-                <td colspan="17"><?php echo $lang['nc_no_record']; ?></td>
+                <td colspan="19"><?php echo $lang['nc_no_record']; ?></td>
             </tr>
         <?php } ?>
         </tbody>
         <tfoot>
         <tr class="tfoot">
-            <td colspan="15" id="dataFuncs">
+            <td colspan="19" id="dataFuncs">
                 <div class="pagination"> <?php echo $output['show_page']; ?> </div>
             </td>
         </tr>
@@ -315,7 +319,7 @@
     function hCopyChannel(e) {
         let str = ''
         $('#tbody tr').each(function () {
-            let res = $(this).find('td').eq(14).text()
+            let res = $(this).find('td').eq(13).text()
             str += res + '\n'
         })
         let oInput = document.createElement("textarea");

+ 331 - 13
data/config/dev/refill.ini.php

@@ -7,30 +7,348 @@ $config['refill_phone_specs'] = [10, 20, 30, 50, 100, 200, 300, 500];
 
 //充值额度基本表
 $config['refill_specs'] = [
-    'petrochina' => $config['refill_oil_specs'],
-    'sinopec' => $config['refill_oil_specs'],
+    'petrochina'  => $config['refill_oil_specs'],
+    'sinopec'     => $config['refill_oil_specs'],
     'chinamobile' => $config['refill_phone_specs'],
     'chinaunicom' => $config['refill_phone_specs'],
     'chinatelecom' => $config['refill_phone_specs']
 ];
 
-
 //充值渠道配置表
-$oil_providers = [];
+//速汇充京东加油通道
+$tianjt_oil = ['name' => 'tianjt', 'store_id' => 7,'qualitys' => '1',
+    'amount' => [
+        100 => [['goods_id' => 6290, 'price' => 97.0, 'quality' => 1, 'card_type' => 'sinopec']],
+        200 => [['goods_id' => 6291, 'price' => 194, 'quality' => 1, 'card_type' => 'sinopec']],
+        500 => [['goods_id' => 6292, 'price' => 485, 'quality' => 1, 'card_type' => 'sinopec']],
+        1000 => [['goods_id' => 6293, 'price' => 970, 'quality' => 1, 'card_type' => 'sinopec']]
+    ],
+    'period' => ['start' => '8:30', 'end' => '22:20'], 'refill_type' => 'api'];
+
+//速汇充天猫加油通道
+$suhctm_oil = ['name' => 'suhctm', 'store_id' => 7,'qualitys' => '1',
+    'amount' => [
+        100 => [['goods_id' => 6290, 'price' => 96.8, 'quality' => 1, 'card_type' => 'sinopec']],
+        200 => [['goods_id' => 6291, 'price' => 193.6, 'quality' => 1, 'card_type' => 'sinopec']],
+        500 => [['goods_id' => 6292, 'price' => 484, 'quality' => 1, 'card_type' => 'sinopec']],
+        1000 => [['goods_id' => 6293, 'price' => 968, 'quality' => 1, 'card_type' => 'sinopec']]
+    ],
+    'period' => ['start' => '8:30', 'end' => '22:20'], 'refill_type' => 'api'];
+
+$suhcpdd_oil = ['name' => 'suhcpdd', 'store_id' => 7,'qualitys' => '1',
+    'amount' => [
+        100 => [['goods_id' => 6290, 'price' => 96.8, 'quality' => 1, 'card_type' => 'sinopec']],
+        200 => [['goods_id' => 6291, 'price' => 193.6, 'quality' => 1, 'card_type' => 'sinopec']],
+        500 => [['goods_id' => 6292, 'price' => 484, 'quality' => 1, 'card_type' => 'sinopec']],
+        1000 => [['goods_id' => 6293, 'price' => 968, 'quality' => 1, 'card_type' => 'sinopec']]
+    ],
+    'period' => ['start' => '8:30', 'end' => '22:20'], 'refill_type' => 'api'];
+
+//赵梓暄提供的加油通道
+$zzx_oil = ['name' => 'zzx', 'store_id' => 13,'qualitys' => '1',
+    'amount' => [
+        100 => [['goods_id' => 6307, 'price' => 97.8, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
+        200 => [['goods_id' => 6308, 'price' => 195.6, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
+        500 => [['goods_id' => 6309, 'price' => 489, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
+        1000 => [['goods_id' => 6310, 'price' => 978, 'quality' => 1, 'card_type' => 'petrochina,sinopec']]
+    ],
+    'refill_type' => 'api'];
+
+//赵梓暄提供的加油通道
+$lx_oil = ['name' => 'lx', 'store_id' => 14,'qualitys' => '1',
+    'amount' => [
+        500 => [['goods_id' => 6322, 'price' => 479, 'quality' => 1, 'card_type' => 'sinopec']],
+        1000 => [['goods_id' => 6311, 'price' => 958, 'quality' => 1, 'card_type' => 'sinopec']] //,
+//        2000 => ['goods_id' => 6322, 'price' => 1916]
+    ],
+    'period' => ['start' => '14:00', 'end' => '19:00'], 'official_sn' => true, 'refill_type' => 'inner_store'];
+
+//赛虎
+$saihu_oil = ['name' => 'saihu', 'store_id' => 15,'qualitys' => '1',
+    'amount' => [
+        100 => [['goods_id' => 6313, 'price' => 97, 'quality' => 1, 'card_type' => 'sinopec']],
+        200 => [['goods_id' => 6314, 'price' => 194, 'quality' => 1, 'card_type' => 'sinopec']],
+        500 => [['goods_id' => 6315, 'price' => 485, 'quality' => 1, 'card_type' => 'sinopec']],
+        1000 => [['goods_id' => 6316, 'price' => 970, 'quality' => 1, 'card_type' => 'sinopec']],
+        2000 => [['goods_id' => 6317, 'price' => 1940, 'quality' => 1, 'card_type' => 'sinopec']]
+    ],
+    'refill_type' => 'api'];
+
+#官方中石油通道
+$gftd_oil = ['name' => 'gftd', 'store_id' => 19,'qualitys' => '1',
+    'amount' => [
+        100 => [['goods_id' => 6339, 'price' => 95, 'quality' => 1, 'card_type' => 'petrochina']],
+        200 => [['goods_id' => 6340, 'price' => 190, 'quality' => 1, 'card_type' => 'petrochina']],
+        500 => [['goods_id' => 6341, 'price' => 475, 'quality' => 1, 'card_type' => 'petrochina']],
+        1000 => [['goods_id' => 6342, 'price' => 950, 'quality' => 1, 'card_type' => 'petrochina']]
+    ],
+    'period' => [], 'refill_type' => 'api'];
+
+#官方中石化通道
+$gftdsinop_oil = ['name' => 'gftdsinop', 'store_id' => 20,'qualitys' => '1',
+    'amount' => [
+        100 => [['goods_id' => 6343, 'price' => 95, 'quality' => 1, 'card_type' => 'sinopec']],
+        200 => [['goods_id' => 6344, 'price' => 190, 'quality' => 1, 'card_type' => 'sinopec']],
+        500 => [['goods_id' => 6345, 'price' => 475, 'quality' => 1, 'card_type' => 'sinopec']],
+        1000 => [['goods_id' => 6346, 'price' => 950, 'quality' => 1, 'card_type' => 'sinopec']]
+    ],
+    'period' => [], 'refill_type' => 'api'];
+
+$oil_providers = [
+    ['name' => 'tianjt', 'cfg' => $tianjt_oil],
+    ['name' => 'suhctm', 'cfg' => $suhctm_oil],
+    ['name' => 'suhcpdd', 'cfg' => $suhcpdd_oil],
+    ['name' => 'zzx', 'cfg' => $zzx_oil],
+    ['name' => 'lx', 'cfg' => $lx_oil],
+    ['name' => 'saihu', 'cfg' => $saihu_oil],
+    ['name' => 'gftd', 'cfg' => $gftd_oil],
+    ['name' => 'gftdsinop', 'cfg' => $gftdsinop_oil]
+];
 $config['oil_providers'] = $oil_providers;
 
-$baidu_phone = ['name' => 'baidu', 'store_id' => 8,
+$beixt_phone = ['name' => 'beixt', 'store_id' => 8,'qualitys' => '1',
+    'amount' => [
+        50 => [['goods_id' => 6295, 'price' => 48.75, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6296, 'price' => 97.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6297, 'price' => 195,  'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'refill_type' => 'api'];
+
+$bxtwt_phone = ['name' => 'bxtwt', 'store_id' => 10,'qualitys' => '1',
+    'amount' => [
+        50 => [['goods_id' => 6298, 'price' => 48,   'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6299, 'price' => 96,  'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6300, 'price' => 192, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'refill_type' => 'api'];
+
+$bjb_phone = ['name' => 'bjb', 'store_id' => 12,'qualitys' => '1',
+    'amount' => [
+        10 => [['goods_id' => 6305, 'price' => 9.51,  'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6306, 'price' => 19.02, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6301, 'price' => 28.53, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6302, 'price' => 47.55, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6303, 'price' => 95.1, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6304, 'price' => 190.20, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6327, 'price' => 285.30, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6328, 'price' => 475.50, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']]
+        ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$lingzh_phone = ['name' => 'lingzh', 'store_id' => 28,'qualitys' => '1,4',
+    'amount' => [
+        10 => [
+            ['goods_id' => 6389, 'price' => 9.53, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6389, 'price' => 9.51, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
+            ['goods_id' => 6389, 'price' => 9.20, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 6390, 'price' => 19.06, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6390, 'price' => 19.02, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
+            ['goods_id' => 6390, 'price' => 18.40, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 6391, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6391, 'price' => 28.53, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
+            ['goods_id' => 6391, 'price' => 27.60, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 6392, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6392, 'price' => 47.55, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
+            ['goods_id' => 6392, 'price' => 46.00, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+        ],
+        100 => [
+            ['goods_id' => 6393, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6393, 'price' => 95.1, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
+            ['goods_id' => 6393, 'price' => 92.0, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 6394, 'price' => 190.60, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6394, 'price' => 190.20, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
+            ['goods_id' => 6394, 'price' => 184.00, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 6395, 'price' => 285.90, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6395, 'price' => 285.30, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
+            ['goods_id' => 6395, 'price' => 276.00, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 6396, 'price' => 476.50, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6396, 'price' => 475.50, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
+            ['goods_id' => 6396, 'price' => 460.00, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+//$lingzhdl_phone = ['name' => 'lingzhdl', 'store_id' => 29, 'qualitys' => '1',
+//    'amount' => [
+//        10 => [['goods_id' => 6397, 'price' => 9.51, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+//        20 => [['goods_id' => 6398, 'price' => 19.02, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+//        30 => [['goods_id' => 6399, 'price' => 28.53, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+//        50 => [['goods_id' => 6400, 'price' => 47.55, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+//
+//        100 => [['goods_id' => 6401, 'price' => 95.1, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+//        200 => [['goods_id' => 6402, 'price' => 190.20, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+//        300 => [['goods_id' => 6403, 'price' => 285.30, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+//        500 => [['goods_id' => 6404, 'price' => 475.50, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']]
+//    ],
+//    'official_sn' => true, 'refill_type' => 'api'];
+
+$bjbyd_phone = ['name' => 'bjbyd', 'store_id' => 24,'qualitys' => '1',
+    'amount' => [
+        30 => [['goods_id' => 6367, 'price' => 28.53, 'quality' => 1, 'card_type' => 'chinamobile']],
+        50 => [['goods_id' => 6368, 'price' => 47.55, 'quality' => 1, 'card_type' => 'chinamobile']],
+        100 => [['goods_id' => 6369, 'price' => 95.1, 'quality' => 1, 'card_type' => 'chinamobile']],
+        200 => [['goods_id' => 6370, 'price' => 190.2, 'quality' => 1, 'card_type' => 'chinamobile']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$afandnew_phone = ['name' => 'afandnew', 'store_id' => 25,'qualitys' => '1',
+    'amount' => [
+        30 => [['goods_id' => 6386, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile']],
+        50 => [['goods_id' => 6371, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile']],
+        100 => [['goods_id' => 6372, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile']],
+        200 => [['goods_id' => 6373, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile']],
+        300 => [['goods_id' => 6387, 'price' => 285, 'quality' => 1, 'card_type' => 'chinamobile']],
+        500 => [['goods_id' => 6388, 'price' => 475, 'quality' => 1, 'card_type' => 'chinamobile']]
+    ],
+    'refill_type' => 'api'];
+
+$tianx_phone = ['name' => 'tianx', 'store_id' => 25,'qualitys' => '1',
+    'amount' => [
+        50 => [['goods_id' => 6371, 'price' => 46.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6372, 'price' => 93,  'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6373, 'price' => 186, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'refill_type' => 'api'];
+
+$yifa_phone = ['name' => 'yifa', 'store_id' => 16,'qualitys' => '1',
+    'amount' => [
+        30 => [['goods_id' => 6318, 'price' => 28.65, 'quality' => 1, 'card_type' => 'chinamobile']],
+        50 => [['goods_id' => 6319, 'price' => 47.75, 'quality' => 1, 'card_type' => 'chinamobile']],
+        100 => [['goods_id' => 6320, 'price' => 95.5, 'quality' => 1, 'card_type' => 'chinamobile']],
+        200 => [['goods_id' => 6321, 'price' => 191,  'quality' => 1, 'card_type' => 'chinamobile']]
+    ],
+    'refill_type' => 'api'];
+
+$jiec_phone = ['name' => 'jiec', 'store_id' => 17,'qualitys' => '1',
+    'amount' => [
+        30 => [['goods_id' => 6323, 'price' => 28.65, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6324, 'price' => 47.75, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6325, 'price' => 95.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6326, 'price' => 191, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6329, 'price' => 286.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6330, 'price' => 477.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$weit_phone = ['name' => 'weit', 'store_id' => 18,'qualitys' => '1',
+    'amount' => [
+        10 => [['goods_id' => 6337, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6338, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6331, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6332, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6333, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6334, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6335, 'price' => 285, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6336, 'price' => 475, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$afand_phone = ['name' => 'afand', 'store_id' => 26,'qualitys' => '1',
+    'amount' => [
+        30 => [['goods_id' => 6374, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6375, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6376, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6377, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6378, 'price' => 285, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6379, 'price' => 475, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$afandeng_phone = ['name' => 'afandeng', 'store_id' => 27,'qualitys' => '1',
+    'amount' => [
+        10 => [['goods_id' => 6406, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6407, 'price' => 19, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6380, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6381, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6382, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6383, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6384, 'price' => 285, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6385, 'price' => 475, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$tongy_phone = ['name' => 'tongy', 'store_id' => 31,'qualitys' => '2',
     'amount' => [
-        10 => [['goods_id' => 6245, 'price' => 9.51, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-               ['goods_id' => 6245, 'price' => 9.61, 'quality' => 1, 'card_type' => 'chinamobile'],
-               ['goods_id' => 6245, 'price' => 9.81, 'quality' => 2, 'card_type' => 'chinamobile']],
+        30 => [['goods_id' => 6408, 'price' => 29.76, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6408, 'price' => 29.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6408, 'price' => 29.64, 'quality' => 2, 'card_type' => 'chinatelecom']],
 
-        20 => [['goods_id' => 6247, 'price' => 19.02, 'card_type' => 'chinaunicom,chinatelecom']],
-        30 => [['goods_id' => 6249, 'price' => 28.53, 'card_type' => 'chinamobile,chinatelecom']],
-        50 => [['goods_id' => 6250, 'price' => 47.55, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        100 => [['goods_id' => 6251, 'price' => 95.1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+        50 => [['goods_id' => 6409, 'price' => 49.6, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6409, 'price' => 48.75, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6409, 'price' => 49.4, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        100 => [['goods_id' => 6410, 'price' => 99.2, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6410, 'price' => 97.5, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6410, 'price' => 98.8, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        200 => [['goods_id' => 6411, 'price' => 198.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6411, 'price' => 194.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6411, 'price' => 197.6, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        300 => [['goods_id' => 6412, 'price' => 297.6, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6412, 'price' => 291.9, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6412, 'price' => 296.4, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        500 => [['goods_id' => 6413, 'price' => 496, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6413, 'price' => 486.5, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6413, 'price' => 494, 'quality' => 2, 'card_type' => 'chinatelecom']]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
+
+$weiyi_phone = ['name' => 'weiyi', 'store_id' => 32,'qualitys' => '1',
+    'amount' => [
+        10 => [['goods_id' => 6414, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6415, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6416, 'price' => 28.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6417, 'price' => 48, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6418, 'price' => 96, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6419, 'price' => 192, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6420, 'price' => 288, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6421, 'price' => 480, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$tonglu_phone = ['name' => 'tonglu', 'store_id' => 33,'qualitys' => '4',
+    'amount' => [
+        10 => [['goods_id' => 6422, 'price' => 9.4, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6423, 'price' => 18.8, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6424, 'price' => 28.2, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6425, 'price' => 47, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6426, 'price' => 94, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6427, 'price' => 188, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6428, 'price' => 282, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6429, 'price' => 470, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
-    ['name' => 'baidu', 'cfg' => $baidu_phone, 'opened' => true, 'sort' => 1]];
+//    ['name' => 'beixt', 'cfg' => $beixt_phone],
+//    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
+//    ['name' => 'bjb', 'cfg' => $bjb_phone],
+//    ['name' => 'bjbyd', 'cfg' => $bjbyd_phone],
+//    ['name' => 'yifa', 'cfg' => $yifa_phone],
+//    ['name' => 'jiec', 'cfg' => $jiec_phone],
+//    ['name' => 'weit', 'cfg' => $weit_phone],
+
+    ['name' => 'afand', 'cfg' => $afand_phone],
+    ['name' => 'afandeng', 'cfg' => $afandeng_phone],
+    ['name' => 'afandnew', 'cfg' => $afandnew_phone],
+    ['name' => 'lingzh', 'cfg' => $lingzh_phone],
+//    ['name' => 'lingzhdl', 'cfg' => $lingzhdl_phone],
+    ['name' => 'tongy', 'cfg' => $tongy_phone],
+    ['name' => 'weiyi', 'cfg' => $weiyi_phone],
+    ['name' => 'tonglu', 'cfg' => $tonglu_phone],
+];
 $config['phone_providers'] = $phone_providers;

+ 168 - 115
data/config/lingzh/refill.ini.php

@@ -19,155 +19,208 @@ $oil_providers = [];
 $config['oil_providers'] = $oil_providers;
 
 
-$baizeyd = ['name' => 'baizeyd', 'store_id' => 32,
+$baizeyd = ['name' => 'baizeyd', 'store_id' => 32,'qualitys' => '1',
     'amount' => [
-        10 => [['goods_id' => 1, 'price' => 9.51, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 1, 'price' => 9.81, 'quality' => 2, 'card_type' => 'chinamobile']],
-        30 => [['goods_id' => 3, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 3, 'price' => 28.8, 'quality' => 2, 'card_type' => 'chinamobile']],
-        50 => [['goods_id' => 4, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 4, 'price' => 48, 'quality' => 2, 'card_type' => 'chinamobile']],
-        100 => [['goods_id' => 5, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 5, 'price' => 96, 'quality' => 2, 'card_type' => 'chinamobile']],
-        200 => [['goods_id' => 6, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6, 'price' => 192, 'quality' => 2, 'card_type' => 'chinamobile']],
+        10 => [
+            ['goods_id' => 1, 'price' => 9.51, 'quality' => 1, 'card_type' => 'chinamobile']
+        ],
+        30 => [
+            ['goods_id' => 3, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile']
+        ],
+        50 => [
+            ['goods_id' => 4, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile']
+        ],
+        100 => [
+            ['goods_id' => 5, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile']
+        ],
+        200 => [
+            ['goods_id' => 6, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile']
+        ],
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
 
-$aming_phone = ['name' => 'aming', 'store_id' => 34,
+$aming_phone = ['name' => 'aming', 'store_id' => 34,'qualitys' => '1',
     'amount' => [
-        10 => [['goods_id'  => 9, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-                ['goods_id' => 9, 'price' => 9.6, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        20 => [['goods_id' => 10, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 10, 'price' => 19.2, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        30 => [['goods_id' => 11, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 11, 'price' => 28.8, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        50 => [['goods_id' => 12, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 12, 'price' => 48, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        100 => [['goods_id' => 13, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 13, 'price' => 96, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        200 => [['goods_id' => 14, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 14, 'price' => 192, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        300 => [['goods_id' => 15, 'price' => 285, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 15, 'price' => 288, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        500 => [['goods_id' => 16, 'price' => 475, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 16, 'price' => 480, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
+        10 => [
+            ['goods_id'  => 9, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 10, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 11, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 12, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 13, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 14, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 15, 'price' => 285, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 16, 'price' => 475, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$binghc_phone = ['name' => 'binghc', 'store_id' => 35,
+$binghc_phone = ['name' => 'binghc', 'store_id' => 35,'qualitys' => '1',
     'amount' => [
-        10 => [['goods_id' => 17, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 17, 'price' => 9.6, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        20 => [['goods_id' => 18, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 18, 'price' => 19.2, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        30 => [['goods_id' => 19, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 19, 'price' => 28.8, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        50 => [['goods_id' => 20, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 20, 'price' => 48, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        100 => [['goods_id' => 21, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 21, 'price' => 96, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        200 => [['goods_id' => 22, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 22, 'price' => 192, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        300 => [['goods_id' => 23, 'price' => 285, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 23, 'price' => 288, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        500 => [['goods_id' => 24, 'price' => 475, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 24, 'price' => 480, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
+        10 => [
+            ['goods_id' => 17, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 18, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 19, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 20, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 21, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 22, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 23, 'price' => 285, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 24, 'price' => 475, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$ruishun_phone = ['name' => 'ruishun', 'store_id' => 36,
+$ruishun_phone = ['name' => 'ruishun', 'store_id' => 36,'qualitys' => '1',
     'amount' => [
-        10 => [['goods_id' => 25, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 25, 'price' => 9.6, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        20 => [['goods_id' => 26, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 26, 'price' => 19.2, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        30 => [['goods_id' => 27, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 27, 'price' => 28.8, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        50 => [['goods_id' => 28, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 28, 'price' => 48, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        100 => [['goods_id' => 29, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 29, 'price' => 96, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        200 => [['goods_id' => 30, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 30, 'price' => 192, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        300 => [['goods_id' => 31, 'price' => 285, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 31, 'price' => 288, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
-        500 => [['goods_id' => 32, 'price' => 475, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
-            ['goods_id' => 32, 'price' => 480, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']],
+        10 => [
+            ['goods_id' => 25, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 26, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 27, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 28, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 29, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 30, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 31, 'price' => 285, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 32, 'price' => 475, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$wuchen_phone = ['name' => 'wuchen', 'store_id' => 37,
+$wuchen_phone = ['name' => 'wuchen', 'store_id' => 37,'qualitys' => '1',
     'amount' => [
-        10 => [['goods_id' => 33, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 33, 'price' => 9.6, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        20 => [['goods_id' => 34, 'price' => 19, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 34, 'price' => 19.2, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        30 => [['goods_id' => 35, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 35, 'price' => 28.8, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        50 => [['goods_id' => 36, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 36, 'price' => 48, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        100 => [['goods_id' => 37, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 37, 'price' => 96, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        200 => [['goods_id' => 38, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 38, 'price' => 192, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        300 => [['goods_id' => 39, 'price' => 285, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 39, 'price' => 288, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        500 => [['goods_id' => 40, 'price' => 475, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 40, 'price' => 480, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        10 => [
+            ['goods_id' => 33, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 34, 'price' => 19, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 35, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 36, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 37, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 38, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 39, 'price' => 285, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 40, 'price' => 475, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$yibao_phone = ['name' => 'yibao', 'store_id' => 38,
+$yibao_phone = ['name' => 'yibao', 'store_id' => 38,'qualitys' => '1',
     'amount' => [
-        30 => [['goods_id' => 41, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 41, 'price' => 28.8, 'quality' => 2, 'card_type' => 'chinamobile']],
-        50 => [['goods_id' => 42, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 42, 'price' => 48, 'quality' => 2, 'card_type' => 'chinamobile']],
-        100 => [['goods_id' => 43, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 43, 'price' => 96, 'quality' => 2, 'card_type' => 'chinamobile']],
-        200 => [['goods_id' => 44, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 44, 'price' => 192, 'quality' => 2, 'card_type' => 'chinamobile']],
+        30 => [
+            ['goods_id' => 41, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 42, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 43, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 44, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$amingyd_phone = ['name' => 'amingyd', 'store_id' => 39,
+$amingyd_phone = ['name' => 'amingyd', 'store_id' => 39,'qualitys' => '1',
     'amount' => [
-        30 => [['goods_id' => 45, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 45, 'price' => 28.8, 'quality' => 2, 'card_type' => 'chinamobile']],
-        50 => [['goods_id' => 46, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 46, 'price' => 48, 'quality' => 2, 'card_type' => 'chinamobile']],
-        100 => [['goods_id' => 47, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 47, 'price' => 96, 'quality' => 2, 'card_type' => 'chinamobile']],
-        200 => [['goods_id' => 48, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 48, 'price' => 192, 'quality' => 2, 'card_type' => 'chinamobile']],
+        30 => [
+            ['goods_id' => 45, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile']
+        ],
+        50 => [
+            ['goods_id' => 46, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile']
+        ],
+        100 => [
+            ['goods_id' => 47, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile']
+        ],
+        200 => [
+            ['goods_id' => 48, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile']
+        ],
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$chuka_phone = ['name' => 'chuka', 'store_id' => 40,
+$chuka_phone = ['name' => 'chuka', 'store_id' => 40,'qualitys' => '1',
     'amount' => [
-        20 => [['goods_id' => 49, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 49, 'price' => 192, 'quality' => 2, 'card_type' => 'chinaunicom']],
-        30 => [['goods_id' => 50, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 50, 'price' => 28.8, 'quality' => 2, 'card_type' => 'chinaunicom']],
-        50 => [['goods_id' => 51, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 51, 'price' => 48, 'quality' => 2, 'card_type' => 'chinaunicom']],
-        100 => [['goods_id' => 52, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 52, 'price' => 96, 'quality' => 2, 'card_type' => 'chinaunicom']],
+        20 => [
+            ['goods_id' => 49, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        30 => [
+            ['goods_id' => 50, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        50 => [
+            ['goods_id' => 51, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        100 => [
+            ['goods_id' => 52, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$amingjd_phone = ['name' => 'amingjd', 'store_id' => 41,
+$amingjd_phone = ['name' => 'amingjd', 'store_id' => 41,'qualitys' => '5',
     'amount' => [
-        30 => [['goods_id' => 55, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 55, 'price' => 28.8, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        50 => [['goods_id' => 56, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 56, 'price' => 48, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        100 => [['goods_id' => 53, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 53, 'price' => 96, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        200 => [['goods_id' => 54, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 54, 'price' => 192, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+        30 => [
+            ['goods_id' => 55, 'price' => 27, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 56, 'price' => 45, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 53, 'price' => 90, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 54, 'price' => 180, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 

+ 78 - 30
data/config/win/refill.ini.php

@@ -16,7 +16,7 @@ $config['refill_specs'] = [
 
 //充值渠道配置表
 //速汇充京东加油通道
-$tianjt_oil = ['name' => 'tianjt', 'store_id' => 7,
+$tianjt_oil = ['name' => 'tianjt', 'store_id' => 7, 'qualitys' => '1',
     'amount' => [
         100 => [['goods_id' => 6290, 'price' => 97.0, 'quality' => 1, 'card_type' => 'sinopec']],
         200 => [['goods_id' => 6291, 'price' => 194, 'quality' => 1, 'card_type' => 'sinopec']],
@@ -26,7 +26,7 @@ $tianjt_oil = ['name' => 'tianjt', 'store_id' => 7,
     'period' => ['start' => '8:30', 'end' => '22:20'], 'refill_type' => 'api'];
 
 //速汇充天猫加油通道
-$suhctm_oil = ['name' => 'suhctm', 'store_id' => 7,
+$suhctm_oil = ['name' => 'suhctm', 'store_id' => 7, 'qualitys' => '1',
     'amount' => [
         100 => [['goods_id' => 6290, 'price' => 96.8, 'quality' => 1, 'card_type' => 'sinopec']],
         200 => [['goods_id' => 6291, 'price' => 193.6, 'quality' => 1, 'card_type' => 'sinopec']],
@@ -35,7 +35,7 @@ $suhctm_oil = ['name' => 'suhctm', 'store_id' => 7,
     ],
     'period' => ['start' => '8:30', 'end' => '22:20'], 'refill_type' => 'api'];
 
-$suhcpdd_oil = ['name' => 'suhcpdd', 'store_id' => 7,
+$suhcpdd_oil = ['name' => 'suhcpdd', 'store_id' => 7, 'qualitys' => '1',
     'amount' => [
         100 => [['goods_id' => 6290, 'price' => 96.8, 'quality' => 1, 'card_type' => 'sinopec']],
         200 => [['goods_id' => 6291, 'price' => 193.6, 'quality' => 1, 'card_type' => 'sinopec']],
@@ -45,7 +45,7 @@ $suhcpdd_oil = ['name' => 'suhcpdd', 'store_id' => 7,
     'period' => ['start' => '8:30', 'end' => '22:20'], 'refill_type' => 'api'];
 
 //赵梓暄提供的加油通道
-$zzx_oil = ['name' => 'zzx', 'store_id' => 13,
+$zzx_oil = ['name' => 'zzx', 'store_id' => 13, 'qualitys' => '1',
     'amount' => [
         100 => [['goods_id' => 6307, 'price' => 97.8, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
         200 => [['goods_id' => 6308, 'price' => 195.6, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
@@ -55,7 +55,7 @@ $zzx_oil = ['name' => 'zzx', 'store_id' => 13,
     'refill_type' => 'api'];
 
 //赵梓暄提供的加油通道
-$lx_oil = ['name' => 'lx', 'store_id' => 14,
+$lx_oil = ['name' => 'lx', 'store_id' => 14, 'qualitys' => '1',
     'amount' => [
         500 => [['goods_id' => 6322, 'price' => 479, 'quality' => 1, 'card_type' => 'sinopec']],
         1000 => [['goods_id' => 6311, 'price' => 958, 'quality' => 1, 'card_type' => 'sinopec']] //,
@@ -64,7 +64,7 @@ $lx_oil = ['name' => 'lx', 'store_id' => 14,
     'period' => ['start' => '14:00', 'end' => '19:00'], 'official_sn' => true, 'refill_type' => 'inner_store'];
 
 //赛虎
-$saihu_oil = ['name' => 'saihu', 'store_id' => 15,
+$saihu_oil = ['name' => 'saihu', 'store_id' => 15, 'qualitys' => '1',
     'amount' => [
         100 => [['goods_id' => 6313, 'price' => 97, 'quality' => 1, 'card_type' => 'sinopec']],
         200 => [['goods_id' => 6314, 'price' => 194, 'quality' => 1, 'card_type' => 'sinopec']],
@@ -75,7 +75,7 @@ $saihu_oil = ['name' => 'saihu', 'store_id' => 15,
     'refill_type' => 'api'];
 
 #官方中石油通道
-$gftd_oil = ['name' => 'gftd', 'store_id' => 19,
+$gftd_oil = ['name' => 'gftd', 'store_id' => 19, 'qualitys' => '1',
     'amount' => [
         100 => [['goods_id' => 6339, 'price' => 95, 'quality' => 1, 'card_type' => 'petrochina']],
         200 => [['goods_id' => 6340, 'price' => 190, 'quality' => 1, 'card_type' => 'petrochina']],
@@ -85,7 +85,7 @@ $gftd_oil = ['name' => 'gftd', 'store_id' => 19,
     'period' => [], 'refill_type' => 'api'];
 
 #官方中石化通道
-$gftdsinop_oil = ['name' => 'gftdsinop', 'store_id' => 20,
+$gftdsinop_oil = ['name' => 'gftdsinop', 'store_id' => 20, 'qualitys' => '1',
     'amount' => [
         100 => [['goods_id' => 6343, 'price' => 95, 'quality' => 1, 'card_type' => 'sinopec']],
         200 => [['goods_id' => 6344, 'price' => 190, 'quality' => 1, 'card_type' => 'sinopec']],
@@ -106,7 +106,7 @@ $oil_providers = [
 ];
 $config['oil_providers'] = $oil_providers;
 
-$beixt_phone = ['name' => 'beixt', 'store_id' => 8,
+$beixt_phone = ['name' => 'beixt', 'store_id' => 8, 'qualitys' => '1',
     'amount' => [
         50 => [['goods_id' => 6295, 'price' => 48.75, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
         100 => [['goods_id' => 6296, 'price' => 97.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
@@ -114,7 +114,7 @@ $beixt_phone = ['name' => 'beixt', 'store_id' => 8,
     ],
     'refill_type' => 'api'];
 
-$bxtwt_phone = ['name' => 'bxtwt', 'store_id' => 10,
+$bxtwt_phone = ['name' => 'bxtwt', 'store_id' => 10, 'qualitys' => '1',
     'amount' => [
         50 => [['goods_id' => 6298, 'price' => 48,   'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
         100 => [['goods_id' => 6299, 'price' => 96,  'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
@@ -122,7 +122,7 @@ $bxtwt_phone = ['name' => 'bxtwt', 'store_id' => 10,
     ],
     'refill_type' => 'api'];
 
-$bjb_phone = ['name' => 'bjb', 'store_id' => 12,
+$bjb_phone = ['name' => 'bjb', 'store_id' => 12, 'qualitys' => '1',
     'amount' => [
         10 => [['goods_id' => 6305, 'price' => 9.51,  'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
         20 => [['goods_id' => 6306, 'price' => 19.02, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
@@ -134,7 +134,7 @@ $bjb_phone = ['name' => 'bjb', 'store_id' => 12,
         500 => [['goods_id' => 6328, 'price' => 475.50, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
-$lingzh_phone = ['name' => 'lingzh', 'store_id' => 28,
+$lingzh_phone = ['name' => 'lingzh', 'store_id' => 28, 'qualitys' => '1',
     'amount' => [
         10 => [['goods_id' => 6389, 'price' => 9.53, 'quality' => 1, 'card_type' => 'chinamobile']],
         20 => [['goods_id' => 6390, 'price' => 19.06, 'quality' => 1, 'card_type' => 'chinamobile']],
@@ -147,7 +147,7 @@ $lingzh_phone = ['name' => 'lingzh', 'store_id' => 28,
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$lingzhdl_phone = ['name' => 'lingzhdl', 'store_id' => 29, 'card_type' => ['chinaunicom', 'chinatelecom'],
+$lingzhdl_phone = ['name' => 'lingzhdl', 'store_id' => 29, 'card_type' => ['chinaunicom', 'chinatelecom'], 'qualitys' => '1',
     'amount' => [
         10 => [['goods_id' => 6397, 'price' => 9.51, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
         20 => [['goods_id' => 6398, 'price' => 19.02, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
@@ -160,7 +160,7 @@ $lingzhdl_phone = ['name' => 'lingzhdl', 'store_id' => 29, 'card_type' => ['chin
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$bjbyd_phone = ['name' => 'bjbyd', 'store_id' => 24,
+$bjbyd_phone = ['name' => 'bjbyd', 'store_id' => 24, 'qualitys' => '1',
     'amount' => [
         30 => [['goods_id' => 6367, 'price' => 28.53, 'quality' => 1, 'card_type' => 'chinamobile']],
         50 => [['goods_id' => 6368, 'price' => 47.55, 'quality' => 1, 'card_type' => 'chinamobile']],
@@ -169,7 +169,7 @@ $bjbyd_phone = ['name' => 'bjbyd', 'store_id' => 24,
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$afandnew_phone = ['name' => 'afandnew', 'store_id' => 25,
+$afandnew_phone = ['name' => 'afandnew', 'store_id' => 25, 'qualitys' => '1',
     'amount' => [
         30 => [['goods_id' => 6386, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile']],
         50 => [['goods_id' => 6371, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile']],
@@ -180,7 +180,7 @@ $afandnew_phone = ['name' => 'afandnew', 'store_id' => 25,
     ],
     'refill_type' => 'api'];
 
-$tianx_phone = ['name' => 'tianx', 'store_id' => 25,
+$tianx_phone = ['name' => 'tianx', 'store_id' => 25, 'qualitys' => '1',
     'amount' => [
         50 => [['goods_id' => 6371, 'price' => 46.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
         100 => [['goods_id' => 6372, 'price' => 93,  'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
@@ -188,7 +188,7 @@ $tianx_phone = ['name' => 'tianx', 'store_id' => 25,
     ],
     'refill_type' => 'api'];
 
-$yifa_phone = ['name' => 'yifa', 'store_id' => 16,
+$yifa_phone = ['name' => 'yifa', 'store_id' => 16, 'qualitys' => '1',
     'amount' => [
         30 => [['goods_id' => 6318, 'price' => 28.65, 'quality' => 1, 'card_type' => 'chinamobile']],
         50 => [['goods_id' => 6319, 'price' => 47.75, 'quality' => 1, 'card_type' => 'chinamobile']],
@@ -197,7 +197,7 @@ $yifa_phone = ['name' => 'yifa', 'store_id' => 16,
     ],
     'refill_type' => 'api'];
 
-$jiec_phone = ['name' => 'jiec', 'store_id' => 17,
+$jiec_phone = ['name' => 'jiec', 'store_id' => 17, 'qualitys' => '1',
     'amount' => [
         30 => [['goods_id' => 6323, 'price' => 28.65, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
         50 => [['goods_id' => 6324, 'price' => 47.75, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
@@ -208,7 +208,7 @@ $jiec_phone = ['name' => 'jiec', 'store_id' => 17,
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$weit_phone = ['name' => 'weit', 'store_id' => 18,
+$weit_phone = ['name' => 'weit', 'store_id' => 18, 'qualitys' => '1',
     'amount' => [
         10 => [['goods_id' => 6337, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
         20 => [['goods_id' => 6338, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
@@ -221,7 +221,7 @@ $weit_phone = ['name' => 'weit', 'store_id' => 18,
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$afand_phone = ['name' => 'afand', 'store_id' => 26,
+$afand_phone = ['name' => 'afand', 'store_id' => 26, 'qualitys' => '1',
     'amount' => [
         30 => [['goods_id' => 6374, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
         50 => [['goods_id' => 6375, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
@@ -232,7 +232,7 @@ $afand_phone = ['name' => 'afand', 'store_id' => 26,
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$afandeng_phone = ['name' => 'afandeng', 'store_id' => 27,
+$afandeng_phone = ['name' => 'afandeng', 'store_id' => 27, 'qualitys' => '1',
     'amount' => [
         10 => [['goods_id' => 6406, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
         20 => [['goods_id' => 6407, 'price' => 19, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
@@ -245,20 +245,68 @@ $afandeng_phone = ['name' => 'afandeng', 'store_id' => 27,
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$phone_providers = [
-//    ['name' => 'beixt', 'cfg' => $beixt_phone],
-//    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
-    ['name' => 'bjb', 'cfg' => $bjb_phone],
-    ['name' => 'bjbyd', 'cfg' => $bjbyd_phone],
+$tongy_phone = ['name' => 'tongy', 'store_id' => 31, 'qualitys' => '2',
+    'amount' => [
+        30 => [['goods_id' => 6408, 'price' => 29.76, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6408, 'price' => 29.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6408, 'price' => 29.64, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        50 => [['goods_id' => 6409, 'price' => 49.6, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6409, 'price' => 48.75, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6409, 'price' => 49.4, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        100 => [['goods_id' => 6410, 'price' => 99.2, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6410, 'price' => 97.5, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6410, 'price' => 98.8, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        200 => [['goods_id' => 6411, 'price' => 198.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6411, 'price' => 194.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6411, 'price' => 197.6, 'quality' => 2, 'card_type' => 'chinatelecom']],
 
-//    ['name' => 'yifa', 'cfg' => $yifa_phone],
-//    ['name' => 'jiec', 'cfg' => $jiec_phone],
-//    ['name' => 'weit', 'cfg' => $weit_phone],
+        300 => [['goods_id' => 6412, 'price' => 297.6, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6412, 'price' => 291.9, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6412, 'price' => 296.4, 'quality' => 2, 'card_type' => 'chinatelecom']],
 
+        500 => [['goods_id' => 6413, 'price' => 496, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6413, 'price' => 486.5, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6413, 'price' => 494, 'quality' => 2, 'card_type' => 'chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$weiyi_phone = ['name' => 'weiyi', 'store_id' => 32, 'qualitys' => '1',
+    'amount' => [
+        10 => [['goods_id' => 6414, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6415, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6416, 'price' => 28.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6417, 'price' => 48, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6418, 'price' => 96, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6419, 'price' => 192, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6420, 'price' => 288, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6421, 'price' => 480, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$tonglu_phone = ['name' => 'tonglu', 'store_id' => 33, 'qualitys' => '1',
+    'amount' => [
+        10 => [['goods_id' => 6422, 'price' => 9.4, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6423, 'price' => 18.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6424, 'price' => 28.2, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6425, 'price' => 47, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6426, 'price' => 94, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6427, 'price' => 188, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6428, 'price' => 282, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6429, 'price' => 470, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$phone_providers = [
     ['name' => 'afand', 'cfg' => $afand_phone],
     ['name' => 'afandeng', 'cfg' => $afandeng_phone],
     ['name' => 'afandnew', 'cfg' => $afandnew_phone],
     ['name' => 'lingzh', 'cfg' => $lingzh_phone],
-    ['name' => 'lingzhdl', 'cfg' => $lingzhdl_phone]
+    ['name' => 'lingzhdl', 'cfg' => $lingzhdl_phone],
+    ['name' => 'tongy', 'cfg' => $tongy_phone],
+    ['name' => 'weiyi', 'cfg' => $weiyi_phone],
+    ['name' => 'tonglu', 'cfg' => $tonglu_phone],
 ];
 $config['phone_providers'] = $phone_providers;

+ 100 - 52
data/config/xyz/refill.ini.php

@@ -16,7 +16,7 @@ $config['refill_specs'] = [
 
 //充值渠道配置表
 //速汇充京东加油通道
-$tianjt_oil = ['name' => 'tianjt', 'store_id' => 7,
+$tianjt_oil = ['name' => 'tianjt', 'store_id' => 7,'qualitys' => '1',
     'amount' => [
         100 => [['goods_id' => 6290, 'price' => 97.0, 'quality' => 1, 'card_type' => 'sinopec']],
         200 => [['goods_id' => 6291, 'price' => 194, 'quality' => 1, 'card_type' => 'sinopec']],
@@ -26,7 +26,7 @@ $tianjt_oil = ['name' => 'tianjt', 'store_id' => 7,
     'period' => ['start' => '8:30', 'end' => '22:20'], 'refill_type' => 'api'];
 
 //速汇充天猫加油通道
-$suhctm_oil = ['name' => 'suhctm', 'store_id' => 7,
+$suhctm_oil = ['name' => 'suhctm', 'store_id' => 7,'qualitys' => '1',
     'amount' => [
         100 => [['goods_id' => 6290, 'price' => 96.8, 'quality' => 1, 'card_type' => 'sinopec']],
         200 => [['goods_id' => 6291, 'price' => 193.6, 'quality' => 1, 'card_type' => 'sinopec']],
@@ -35,7 +35,7 @@ $suhctm_oil = ['name' => 'suhctm', 'store_id' => 7,
     ],
     'period' => ['start' => '8:30', 'end' => '22:20'], 'refill_type' => 'api'];
 
-$suhcpdd_oil = ['name' => 'suhcpdd', 'store_id' => 7,
+$suhcpdd_oil = ['name' => 'suhcpdd', 'store_id' => 7,'qualitys' => '1',
     'amount' => [
         100 => [['goods_id' => 6290, 'price' => 96.8, 'quality' => 1, 'card_type' => 'sinopec']],
         200 => [['goods_id' => 6291, 'price' => 193.6, 'quality' => 1, 'card_type' => 'sinopec']],
@@ -45,7 +45,7 @@ $suhcpdd_oil = ['name' => 'suhcpdd', 'store_id' => 7,
     'period' => ['start' => '8:30', 'end' => '22:20'], 'refill_type' => 'api'];
 
 //赵梓暄提供的加油通道
-$zzx_oil = ['name' => 'zzx', 'store_id' => 13,
+$zzx_oil = ['name' => 'zzx', 'store_id' => 13,'qualitys' => '1',
     'amount' => [
         100 => [['goods_id' => 6307, 'price' => 97.8, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
         200 => [['goods_id' => 6308, 'price' => 195.6, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
@@ -55,7 +55,7 @@ $zzx_oil = ['name' => 'zzx', 'store_id' => 13,
     'refill_type' => 'api'];
 
 //赵梓暄提供的加油通道
-$lx_oil = ['name' => 'lx', 'store_id' => 14,
+$lx_oil = ['name' => 'lx', 'store_id' => 14,'qualitys' => '1',
     'amount' => [
         500 => [['goods_id' => 6322, 'price' => 479, 'quality' => 1, 'card_type' => 'sinopec']],
         1000 => [['goods_id' => 6311, 'price' => 958, 'quality' => 1, 'card_type' => 'sinopec']] //,
@@ -64,7 +64,7 @@ $lx_oil = ['name' => 'lx', 'store_id' => 14,
     'period' => ['start' => '14:00', 'end' => '19:00'], 'official_sn' => true, 'refill_type' => 'inner_store'];
 
 //赛虎
-$saihu_oil = ['name' => 'saihu', 'store_id' => 15,
+$saihu_oil = ['name' => 'saihu', 'store_id' => 15,'qualitys' => '1',
     'amount' => [
         100 => [['goods_id' => 6313, 'price' => 97, 'quality' => 1, 'card_type' => 'sinopec']],
         200 => [['goods_id' => 6314, 'price' => 194, 'quality' => 1, 'card_type' => 'sinopec']],
@@ -75,7 +75,7 @@ $saihu_oil = ['name' => 'saihu', 'store_id' => 15,
     'refill_type' => 'api'];
 
 #官方中石油通道
-$gftd_oil = ['name' => 'gftd', 'store_id' => 19,
+$gftd_oil = ['name' => 'gftd', 'store_id' => 19,'qualitys' => '1',
     'amount' => [
         100 => [['goods_id' => 6339, 'price' => 95, 'quality' => 1, 'card_type' => 'petrochina']],
         200 => [['goods_id' => 6340, 'price' => 190, 'quality' => 1, 'card_type' => 'petrochina']],
@@ -85,7 +85,7 @@ $gftd_oil = ['name' => 'gftd', 'store_id' => 19,
     'period' => [], 'refill_type' => 'api'];
 
 #官方中石化通道
-$gftdsinop_oil = ['name' => 'gftdsinop', 'store_id' => 20,
+$gftdsinop_oil = ['name' => 'gftdsinop', 'store_id' => 20,'qualitys' => '1',
     'amount' => [
         100 => [['goods_id' => 6343, 'price' => 95, 'quality' => 1, 'card_type' => 'sinopec']],
         200 => [['goods_id' => 6344, 'price' => 190, 'quality' => 1, 'card_type' => 'sinopec']],
@@ -106,7 +106,7 @@ $oil_providers = [
 ];
 $config['oil_providers'] = $oil_providers;
 
-$beixt_phone = ['name' => 'beixt', 'store_id' => 8,
+$beixt_phone = ['name' => 'beixt', 'store_id' => 8,'qualitys' => '1',
     'amount' => [
         50 => [['goods_id' => 6295, 'price' => 48.75, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
         100 => [['goods_id' => 6296, 'price' => 97.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
@@ -114,7 +114,7 @@ $beixt_phone = ['name' => 'beixt', 'store_id' => 8,
     ],
     'refill_type' => 'api'];
 
-$bxtwt_phone = ['name' => 'bxtwt', 'store_id' => 10,
+$bxtwt_phone = ['name' => 'bxtwt', 'store_id' => 10,'qualitys' => '1',
     'amount' => [
         50 => [['goods_id' => 6298, 'price' => 48,   'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
         100 => [['goods_id' => 6299, 'price' => 96,  'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
@@ -122,7 +122,7 @@ $bxtwt_phone = ['name' => 'bxtwt', 'store_id' => 10,
     ],
     'refill_type' => 'api'];
 
-$bjb_phone = ['name' => 'bjb', 'store_id' => 12,
+$bjb_phone = ['name' => 'bjb', 'store_id' => 12,'qualitys' => '1',
     'amount' => [
         10 => [['goods_id' => 6305, 'price' => 9.51,  'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
         20 => [['goods_id' => 6306, 'price' => 19.02, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
@@ -134,33 +134,67 @@ $bjb_phone = ['name' => 'bjb', 'store_id' => 12,
         500 => [['goods_id' => 6328, 'price' => 475.50, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']]
         ],
     'official_sn' => true, 'refill_type' => 'api'];
-$lingzh_phone = ['name' => 'lingzh', 'store_id' => 28,
-    'amount' => [
-        10 => [['goods_id' => 6389, 'price' => 9.53, 'quality' => 1, 'card_type' => 'chinamobile']],
-        20 => [['goods_id' => 6390, 'price' => 19.06, 'quality' => 1, 'card_type' => 'chinamobile']],
-        30 => [['goods_id' => 6391, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinamobile']],
-        50 => [['goods_id' => 6392, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinamobile']],
-        100 => [['goods_id' => 6393, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinamobile']],
-        200 => [['goods_id' => 6394, 'price' => 190.60, 'quality' => 1, 'card_type' => 'chinamobile']],
-        300 => [['goods_id' => 6395, 'price' => 285.90, 'quality' => 1, 'card_type' => 'chinamobile']],
-        500 => [['goods_id' => 6396, 'price' => 476.50, 'quality' => 1, 'card_type' => 'chinamobile']]
-    ],
-    'official_sn' => true, 'refill_type' => 'api'];
 
-$lingzhdl_phone = ['name' => 'lingzhdl', 'store_id' => 29, 'card_type' => ['chinaunicom', 'chinatelecom'],
+$lingzh_phone = ['name' => 'lingzh', 'store_id' => 28,'qualitys' => '1,5',
     'amount' => [
-        10 => [['goods_id' => 6397, 'price' => 9.51, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
-        20 => [['goods_id' => 6398, 'price' => 19.02, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
-        30 => [['goods_id' => 6399, 'price' => 28.53, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
-        50 => [['goods_id' => 6400, 'price' => 47.55, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
-        100 => [['goods_id' => 6401, 'price' => 95.1, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
-        200 => [['goods_id' => 6402, 'price' => 190.20, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
-        300 => [['goods_id' => 6403, 'price' => 285.30, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
-        500 => [['goods_id' => 6404, 'price' => 475.50, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']]
+        10 => [
+            ['goods_id' => 6389, 'price' => 9.53, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6389, 'price' => 9.51, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
+            ['goods_id' => 6389, 'price' => 9.20, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 6390, 'price' => 19.06, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6390, 'price' => 19.02, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
+            ['goods_id' => 6390, 'price' => 18.40, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 6391, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6391, 'price' => 28.53, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
+            ['goods_id' => 6391, 'price' => 27.60, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 6392, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6392, 'price' => 47.55, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
+            ['goods_id' => 6392, 'price' => 46.00, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+        ],
+        100 => [
+            ['goods_id' => 6393, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6393, 'price' => 95.1, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
+            ['goods_id' => 6393, 'price' => 92.0, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 6394, 'price' => 190.60, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6394, 'price' => 190.20, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
+            ['goods_id' => 6394, 'price' => 184.00, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 6395, 'price' => 285.90, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6395, 'price' => 285.30, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
+            ['goods_id' => 6395, 'price' => 276.00, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 6396, 'price' => 476.50, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6396, 'price' => 475.50, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
+            ['goods_id' => 6396, 'price' => 460.00, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$bjbyd_phone = ['name' => 'bjbyd', 'store_id' => 24,
+//$lingzhdl_phone = ['name' => 'lingzhdl', 'store_id' => 29, 'qualitys' => '1',
+//    'amount' => [
+//        10 => [['goods_id' => 6397, 'price' => 9.51, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+//        20 => [['goods_id' => 6398, 'price' => 19.02, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+//        30 => [['goods_id' => 6399, 'price' => 28.53, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+//        50 => [['goods_id' => 6400, 'price' => 47.55, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+//
+//        100 => [['goods_id' => 6401, 'price' => 95.1, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+//        200 => [['goods_id' => 6402, 'price' => 190.20, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+//        300 => [['goods_id' => 6403, 'price' => 285.30, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
+//        500 => [['goods_id' => 6404, 'price' => 475.50, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']]
+//    ],
+//    'official_sn' => true, 'refill_type' => 'api'];
+
+$bjbyd_phone = ['name' => 'bjbyd', 'store_id' => 24,'qualitys' => '1',
     'amount' => [
         30 => [['goods_id' => 6367, 'price' => 28.53, 'quality' => 1, 'card_type' => 'chinamobile']],
         50 => [['goods_id' => 6368, 'price' => 47.55, 'quality' => 1, 'card_type' => 'chinamobile']],
@@ -169,7 +203,7 @@ $bjbyd_phone = ['name' => 'bjbyd', 'store_id' => 24,
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$afandnew_phone = ['name' => 'afandnew', 'store_id' => 25,
+$afandnew_phone = ['name' => 'afandnew', 'store_id' => 25,'qualitys' => '1',
     'amount' => [
         30 => [['goods_id' => 6386, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile']],
         50 => [['goods_id' => 6371, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile']],
@@ -180,7 +214,7 @@ $afandnew_phone = ['name' => 'afandnew', 'store_id' => 25,
     ],
     'refill_type' => 'api'];
 
-$tianx_phone = ['name' => 'tianx', 'store_id' => 25,
+$tianx_phone = ['name' => 'tianx', 'store_id' => 25,'qualitys' => '1',
     'amount' => [
         50 => [['goods_id' => 6371, 'price' => 46.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
         100 => [['goods_id' => 6372, 'price' => 93,  'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
@@ -188,7 +222,7 @@ $tianx_phone = ['name' => 'tianx', 'store_id' => 25,
     ],
     'refill_type' => 'api'];
 
-$yifa_phone = ['name' => 'yifa', 'store_id' => 16,
+$yifa_phone = ['name' => 'yifa', 'store_id' => 16,'qualitys' => '1',
     'amount' => [
         30 => [['goods_id' => 6318, 'price' => 28.65, 'quality' => 1, 'card_type' => 'chinamobile']],
         50 => [['goods_id' => 6319, 'price' => 47.75, 'quality' => 1, 'card_type' => 'chinamobile']],
@@ -197,7 +231,7 @@ $yifa_phone = ['name' => 'yifa', 'store_id' => 16,
     ],
     'refill_type' => 'api'];
 
-$jiec_phone = ['name' => 'jiec', 'store_id' => 17,
+$jiec_phone = ['name' => 'jiec', 'store_id' => 17,'qualitys' => '1',
     'amount' => [
         30 => [['goods_id' => 6323, 'price' => 28.65, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
         50 => [['goods_id' => 6324, 'price' => 47.75, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
@@ -208,7 +242,7 @@ $jiec_phone = ['name' => 'jiec', 'store_id' => 17,
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$weit_phone = ['name' => 'weit', 'store_id' => 18,
+$weit_phone = ['name' => 'weit', 'store_id' => 18,'qualitys' => '1',
     'amount' => [
         10 => [['goods_id' => 6337, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
         20 => [['goods_id' => 6338, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
@@ -221,7 +255,7 @@ $weit_phone = ['name' => 'weit', 'store_id' => 18,
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$afand_phone = ['name' => 'afand', 'store_id' => 26,
+$afand_phone = ['name' => 'afand', 'store_id' => 26,'qualitys' => '1',
     'amount' => [
         30 => [['goods_id' => 6374, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
         50 => [['goods_id' => 6375, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
@@ -232,7 +266,7 @@ $afand_phone = ['name' => 'afand', 'store_id' => 26,
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$afandeng_phone = ['name' => 'afandeng', 'store_id' => 27,
+$afandeng_phone = ['name' => 'afandeng', 'store_id' => 27,'qualitys' => '1',
     'amount' => [
         10 => [['goods_id' => 6406, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
         20 => [['goods_id' => 6407, 'price' => 19, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
@@ -245,7 +279,7 @@ $afandeng_phone = ['name' => 'afandeng', 'store_id' => 27,
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$tongy_phone = ['name' => 'tongy', 'store_id' => 31,
+$tongy_phone = ['name' => 'tongy', 'store_id' => 31,'qualitys' => '2',
     'amount' => [
         30 => [['goods_id' => 6408, 'price' => 29.76, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 6408, 'price' => 29.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
@@ -273,7 +307,7 @@ $tongy_phone = ['name' => 'tongy', 'store_id' => 31,
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$weiyi_phone = ['name' => 'weiyi', 'store_id' => 32,
+$weiyi_phone = ['name' => 'weiyi', 'store_id' => 32,'qualitys' => '1',
     'amount' => [
         10 => [['goods_id' => 6414, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
         20 => [['goods_id' => 6415, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
@@ -286,16 +320,29 @@ $weiyi_phone = ['name' => 'weiyi', 'store_id' => 32,
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$tonglu_phone = ['name' => 'tonglu', 'store_id' => 33,
+$tonglu_phone = ['name' => 'tonglu', 'store_id' => 33,'qualitys' => '4',
+    'amount' => [
+        10 => [['goods_id' => 6422, 'price' => 9.4, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6423, 'price' => 18.8, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6424, 'price' => 28.2, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6425, 'price' => 47, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6426, 'price' => 94, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6427, 'price' => 188, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6428, 'price' => 282, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6429, 'price' => 470, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$xc_phone = ['name' => 'xc', 'store_id' => 34,'qualitys' => '1',
     'amount' => [
-        10 => [['goods_id' => 6422, 'price' => 9.4, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        20 => [['goods_id' => 6423, 'price' => 18.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        30 => [['goods_id' => 6424, 'price' => 28.2, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        50 => [['goods_id' => 6425, 'price' => 47, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        100 => [['goods_id' => 6426, 'price' => 94, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        200 => [['goods_id' => 6427, 'price' => 188, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        300 => [['goods_id' => 6428, 'price' => 282, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        500 => [['goods_id' => 6429, 'price' => 470, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+        10 => [['goods_id' => 6430, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6431, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6432, 'price' => 28.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6433, 'price' => 48, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6434, 'price' => 96, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6435, 'price' => 192, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6436, 'price' => 288, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6437, 'price' => 480, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
@@ -312,9 +359,10 @@ $phone_providers = [
     ['name' => 'afandeng', 'cfg' => $afandeng_phone],
     ['name' => 'afandnew', 'cfg' => $afandnew_phone],
     ['name' => 'lingzh', 'cfg' => $lingzh_phone],
-    ['name' => 'lingzhdl', 'cfg' => $lingzhdl_phone],
+//    ['name' => 'lingzhdl', 'cfg' => $lingzhdl_phone],
     ['name' => 'tongy', 'cfg' => $tongy_phone],
     ['name' => 'weiyi', 'cfg' => $weiyi_phone],
     ['name' => 'tonglu', 'cfg' => $tonglu_phone],
+//    ['name' => 'xc', 'cfg' => $xc_phone],
 ];
 $config['phone_providers'] = $phone_providers;

+ 1 - 1
docker/conf/php-fpm/php-local-debug.ini

@@ -397,7 +397,7 @@ max_input_time = 60
 ;max_input_nesting_level = 64
 
 ; How many GET/POST/COOKIE input variables may be accepted
-; max_input_vars = 1000
+max_input_vars = 10000
 
 ; Maximum amount of memory a script may consume (128MB)
 ; http://php.net/memory-limit

+ 34 - 1
helper/mtopcard/mtopcard.php

@@ -140,7 +140,13 @@ function simple_card_type($cardno)
     elseif(preg_match('/^1\d{10}$/',$cardno,$matches)) {
         return PhoneCard;
 
-    } else {
+    }elseif(preg_match( '/^1[0-9]{18}$/',$cardno,$matches)) {
+        return SinopecCard;
+    }
+    elseif(preg_match( '/^9[0-9]{15}$/',$cardno,$matches)) {
+        return PetroChinaCard;
+    }
+    else {
         return UnknownCard;
     }
 }
@@ -220,3 +226,30 @@ function oil_type($cardno)
     }
 }
 
+function valid_phone($phone) : bool
+{
+    $url = 'https://mobileempty.shumaidata.com/mobileempty';
+    $params['mobile'] = $phone;
+    $headers = ["Authorization:APPCODE " . '8f92d951293f4d2ea48ff86d5a70c537'];
+
+    $resp = http_request($url, $params, 'GET', false, $headers);
+    if ($resp == false) return true;
+
+    $resp = json_decode($resp, true);
+    if ($resp == false) return true;
+
+    if ($resp['success'] == true && $resp['code'] == 200)
+    {
+        // "status": 1 //状态 0:空号;1:实号;2:停机;3:库无;4:沉默号;5:风险号
+        $status = intval($resp['data']['status']);
+        if (in_array($status, [0, 3, 4, 5])) {
+            Log::record("valid_phone phone:{$phone}, status : {$status}", Log::DEBUG);
+            return false;
+        } else {
+            return true;
+        }
+    } else {
+        Log::record("valid_phone phone:{$phone} return msg:{$resp['msg']}", Log::DEBUG);
+        return true;
+    }
+}

+ 2 - 0
helper/refill/LZRefillFactory.php

@@ -10,6 +10,8 @@ require_once(BASE_HELPER_PATH . '/refill/policy/lingzh/policy.php');
 require_once(BASE_HELPER_PATH . '/refill/policy/chctl.php');
 require_once(BASE_HELPER_PATH . '/refill/policy/ctl_item.php');
 require_once(BASE_HELPER_PATH . '/refill/policy/mchctl.php');
+require_once(BASE_HELPER_PATH . '/refill/policy/quaility.php');
+require_once(BASE_HELPER_PATH . '/refill/policy/lingzh/quality_ploy.php');
 
 
 use Log;

+ 4 - 1
helper/refill/ProviderManager.php

@@ -17,6 +17,9 @@ use Exception;
 
 class ProviderManager
 {
+    const LowestQuality  = 1;
+    const HighestQuality = 5;
+
     protected $mProviderNames;
     protected $mAllQMapPTS;
     protected $mProviders;
@@ -148,7 +151,7 @@ class ProviderManager
     private function read_channel()
     {
         $refill_provider = Model('refill_provider');
-        $items = $refill_provider->getProviderList([]);
+        $items = $refill_provider->getProviderList(['provider_id' => ['gt' , 0]]);
 
         $result = [];
         foreach ($items as $item) {

+ 24 - 17
helper/refill/RefillBase.php

@@ -44,8 +44,8 @@ class RefillBase
         $this->mPolicy->load();
     }
 
-    public function first_quality($mchid) {
-        return $this->mPolicy->first_quality($mchid);
+    public function find_quality($mchid,$spec,$card_type,$org_quality,$times,$period): array {
+        return $this->mPolicy->find_quality($mchid,$spec,$card_type,$org_quality,$times,$period);
     }
 
     public function notify($chname, $input)
@@ -131,14 +131,22 @@ class RefillBase
 
     private function retry(array $refill_info, array $order_info)
     {
-        [$cantry,$quality] = $this->mPolicy->can_retry($refill_info,$order_info);
-        if(!$cantry) return false;
+        $mchid = intval($refill_info['mchid']);
+        $spec  = intval($refill_info['refill_amount']);
+        $card_type = intval($refill_info['card_type']);
+        $org_quality = intval($refill_info['org_quality']);
+        $used_time = time() - intval($refill_info['order_time']);
+        $commit_times = intval($refill_info['commit_times']);
+
+        [$org_quality,$quality] = $this->find_quality($mchid,$spec,$card_type,$org_quality,$commit_times,$used_time);
+        if($quality <= 0) return false;
 
         $params = [ 'mchid' => $refill_info['mchid'],
             'buyer_id' => $order_info['buyer_id'],
             'amount' => $refill_info['refill_amount'],
             'card_no' => $refill_info['card_no'],
-            'quality' => $quality,
+            'card_type' => $refill_info['card_type'],
+            'org_quality' => $org_quality,
             'mch_order' =>  $refill_info['mch_order'],
             'notify_url' => $refill_info['notify_url'],
             'idcard' => $refill_info['idcard'] ?? '',
@@ -152,7 +160,7 @@ class RefillBase
     }
 
     public function zero_order($mchid, $buyer_id, $amount, $card_no,
-                        $mch_order, $idcard, $card_name, $notify_url,$quality,
+                        $mch_order, $idcard, $card_name, $notify_url,$quality,$org_quality,
                         $order_time = 0, $commit_times = 0,$errmsg='')
     {
         $card_type = mtopcard\card_type($card_no);
@@ -193,7 +201,8 @@ class RefillBase
                 'mch_amount' => $mch_amount, 'channel_amount' => 0,
                 'order_time' => $order_time, 'commit_times' => $commit_times,
                 'commit_time' => time(),'notify_state' => 1,'notify_time' => time(),
-                'card_type' => $card_type, 'card_no' => $card_no,'quality' => $quality,'err_msg' => $errmsg];
+                'card_type' => $card_type, 'card_no' => $card_no, 'quality' => $quality, 'org_quality' => $org_quality,
+                'err_msg' => $errmsg];
             $mod_refill->add_refill($orderext);
             return $order_id;
         }
@@ -202,24 +211,22 @@ class RefillBase
         }
     }
 
-    public function can_nettry($mchid,$quality,$order_time,$commit_times) : bool
-    {
-        return $this->mPolicy->can_nettry($mchid,$quality,$order_time,$commit_times);
-    }
-
     //$quality,质量
     //返回值:[ 错误码,错误信息,订单ID,是否是网络错误]
     //说明:错误码为true 表示成功
     //     其它情况,则需要判断订单ID
     public function add($mchid, $buyer_id, $amount, $card_no,
-                        $mch_order, $idcard, $card_name, $notify_url,$quality,
-                        $order_time, $commit_times,$last_orderid = 0)
+                        $mch_order, $idcard, $card_name, $notify_url,$quality,$org_quality,
+                        $order_time, $commit_times,$last_orderid = 0,$card_type = 0)
     {
-        $card_type = mtopcard\card_type($card_no);
+        if($card_type == 0) {
+            $card_type = mtopcard\card_type($card_no);
+        }
         [$providers,$overload] = $this->mPolicy->find_providers($amount,$card_type,$quality);
 
         if (empty($providers))
         {
+            Log::record("canot find any providers",Log::DEBUG);
             if($overload) {
                 return [errcode::PROVIDER_OVERLOAD, "匹配不到合适的充值通道",$last_orderid,false];
             }
@@ -295,7 +302,7 @@ class RefillBase
                     'notify_url' => $notify_url, 'channel_name' => $channel_name,
                     'mch_amount' => $mch_amount, 'channel_amount' => $price,
                     'order_time' => $order_time, 'commit_times' => $commit_times,
-                    'card_type' => $card_type, 'card_no' => $card_no,'quality' => $quality];
+                    'card_type' => $card_type, 'card_no' => $card_no,'quality' => $quality,'org_quality'=> $org_quality];
                 $mod_refill->add_refill($orderext);
             } else {
                 Log::record("{$result['msg']}",Log::ERR);
@@ -304,7 +311,7 @@ class RefillBase
 
             $order_success = true;
             util::incr_order($channel_name,$card_type,$amount,$quality);
-            $params = ['order_sn' => $order_sn, 'idcard' => $idcard, 'card_name' => $card_name];
+            $params = ['order_sn' => $order_sn, 'idcard' => $idcard, 'card_name' => $card_name,'quality' => $quality];
             [$state, $errmsg,$neterr] = $provider->add($card_no, $card_type, $amount, $params);
 
             if ($state)

+ 2 - 0
helper/refill/XYZRefillFactory.php

@@ -12,6 +12,8 @@ require_once(BASE_HELPER_PATH . '/refill/policy/xyz/policy.php');
 require_once(BASE_HELPER_PATH . '/refill/policy/chctl.php');
 require_once(BASE_HELPER_PATH . '/refill/policy/ctl_item.php');
 require_once(BASE_HELPER_PATH . '/refill/policy/mchctl.php');
+require_once(BASE_HELPER_PATH . '/refill/policy/quaility.php');
+require_once(BASE_HELPER_PATH . '/refill/policy/xyz/quality_ploy.php');
 
 use Log;
 use StatesHelper;

+ 7 - 3
helper/refill/api/lingzh/amingjd/RefillPhone.php

@@ -22,7 +22,7 @@ class RefillPhone extends refill\IRefillPhone
         $params['orderid'] = $order_sn;
         $params['price'] = $amount;
         $params['teltype'] = $this->phone_type($phone);
-        $params['timeout'] = 86400;
+        $params['timeout'] = 600;
         $params['notify'] = config::NOTIFY_URL;
         $params['time'] = time();
         $params['rand'] = rand(100000,999999);
@@ -60,10 +60,13 @@ class RefillPhone extends refill\IRefillPhone
         $resp = http_request(config::QUERY_URL, $params , 'POST' , false);
         if ($resp === false) {
             return [false, '系统错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['code'] == 100) {
+            if ($resp['code'] == 100)
+            {
                 $order_state = -1;
                 if ($resp['status'] == 3) {
                     $order_state = ORDER_STATE_SUCCESS;
@@ -74,6 +77,7 @@ class RefillPhone extends refill\IRefillPhone
                 } elseif (in_array($resp['status'] , [1 , 2])) {
                     $order_state = ORDER_STATE_SEND;
                 }
+
                 if ($order_state == -1) {
                     return [false, $resp['msg']];
                 }

+ 4 - 2
helper/refill/api/xyz/lingzh/RefillPhone.php

@@ -13,7 +13,7 @@ class RefillPhone extends refill\IRefillPhone
         parent::__construct($cfgs);
     }
 
-    private function req_params(int $phone, int $amount ,string $order_sn)
+    private function req_params(int $phone, int $amount ,string $order_sn,int $quality)
     {
         $params['act'] = 'lzrefill';
         $params['op'] = 'add_mob';
@@ -25,13 +25,15 @@ class RefillPhone extends refill\IRefillPhone
         $params['tim'] = date("YmdHis");
         $params['yysid'] = 0;
         $params['hmlx'] = 0;
+        $params['quality'] = $quality;
         return $params;
     }
 
     public function add($card_no, $card_type,$amount,$params)
     {
         $order_sn = $params['order_sn'];
-        $params = $this->req_params($card_no,$amount,$order_sn);
+        $quality = $params['quality'];
+        $params = $this->req_params($card_no,$amount,$order_sn,$quality);
         $sign = $this->sign($params);
         $params['sgn'] = $sign;
         $resp = http_request(config::PAY_PHONE_URL,$params,'GET');

+ 1 - 1
helper/refill/api/xyz/tonglu/RefillPhone.php

@@ -79,7 +79,7 @@ class RefillPhone extends refill\IRefillPhone
                     $order_state = ORDER_STATE_SEND;
                 }
                 if ($order_state == -1) {
-                    return [false, $resp['desc']];
+                    return [false, $resp['msg']];
                 }
                 return [true, $order_state];
             }else{

+ 16 - 11
helper/refill/api/xyz/xc/RefillCallBack.php

@@ -21,10 +21,10 @@ class RefillCallBack implements refill\IRefillCallBack
 
     private function sign($params)
     {
-        $body[] = $params['wt_orderid'];
-        $body[] = $params['Pay_iphone'];
-        $body[] = $params['Pay_orderid'];
-        $body[] = $params['Pay_money'];
+        $body['wt_orderid'] = $params['wt_orderid'];
+        $body['pay_iphone'] = $params['pay_iphone'];
+        $body['pay_orderid'] = $params['pay_orderid'];
+        $body['pay_money'] = $params['pay_money'];
 
         ksort($body);
         $str = '';
@@ -39,18 +39,23 @@ class RefillCallBack implements refill\IRefillCallBack
     public function notify($params)
     {
         $status = intval($params['status']);
-        $order_sn = $params['Pay_orderid'];
+        $order_sn = $params['pay_orderid'];
         $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
         if(empty($order_info)) {
-            return [false,false];
+            return [false, false, false,false];
         }
         $order_id = $order_info['order_id'];
         $data['official_sn'] = $params['wt_orderid'];
-        Model('refill_order')->edit($order_id, $data);
-        if($status === 1) {
-            return [$order_id,true];
-        } else {
-            return [$order_id,false];
+
+        if ($status === 1) {
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif ($status === 0) {
+            return [$order_id, false, true,true];
+        }
+        else {
+            return [$order_id, false, false,false];
         }
     }
 }

+ 9 - 6
helper/refill/api/xyz/xc/RefillPhone.php

@@ -37,11 +37,11 @@ class RefillPhone extends refill\IRefillPhone
         {
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
-            if($resp['code'] == 200 && $resp['result'] == 'SUCCESS') {
+            if($resp['code'] == 200 && $resp['result'] == 'success') {
                 return [true,$resp['result'], false];
             }
             else {
-                return [false,$resp['result'], false];
+                return [false,$resp['info'], false];
             }
         }
     }
@@ -61,15 +61,18 @@ class RefillPhone extends refill\IRefillPhone
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
             $order_state = -1;
-            if ($resp['status'] == 1) {
+            $status = $resp['data']['status'];
+            if ($status == 1) {
                 $order_state = ORDER_STATE_SUCCESS;
-            } elseif ($resp['status'] == 2) {
+                $save['official_sn'] = $resp['data']['wt_orderid'];
+                Model('refill_order')->edit($refill_info['order_id'], $save);
+            } elseif ($status == 0) {
                 $order_state = ORDER_STATE_CANCEL;
-            } elseif ($resp['status'] == 6){
+            } elseif ($status == 2){
                 $order_state = ORDER_STATE_SEND;
             }
             if ($order_state == -1) {
-                return [false, $resp['data']];
+                return [false, $resp['info']];
             }
             return [true, $order_state];
         }

+ 5 - 5
helper/refill/api/xyz/xc/config.php

@@ -6,9 +6,9 @@ namespace refill\xc;
 
 class config
 {
-    const ORDER_URL = 'http://180.215.207.83/pay/order/upload';
-    const QUERY_ORDER_URL = 'http://180.215.207.83/chaxun/order/queryStatus';
-    const NUMBER_ID= '10019';
-    const KEY = '346ab585a7cbeccd4f11e54ffaf5fe1c';
-    const NOTIFY_URL =  BASE_SITE_URL."/mobile/signature.php";
+    const ORDER_URL = 'http://202.79.172.201/pay/order/upload';
+    const QUERY_ORDER_URL = 'http://202.79.172.201/chaxun/order/queryStatus';
+    const NUMBER_ID= '10010';
+    const KEY = '11a5e71e0da0e3ae0942cbd6b7c62f2a';
+    const NOTIFY_URL =  BASE_SITE_URL."/mobile/refill_xc.php";
 }

+ 2 - 4
helper/refill/policy/IPolicy.php

@@ -6,10 +6,8 @@ namespace refill;
 
 interface IPolicy
 {
-    //[can_try,quality]
-    public function can_retry(array $refill_info, array $order_info) : array;
-    public function first_quality($mchid): int;
+    //[orgian_quality,current_quality]
+    public function find_quality($mchid,$spec,$card_type,$quality,$times,$used_time): array;
     public function allow($mchid,$card_type,$amount,$quality) : bool;
-    public function can_nettry($mchid,$quality,$order_time,$commit_times) : bool;
     public function notify($order_info, $refill_info) : bool;
 }

+ 13 - 9
helper/refill/policy/chctl.php

@@ -13,8 +13,12 @@ class chctl
     static $cache_names = [
         ['quality'=> 1,'name' => 'channel-ctl-oil-common-limit'],
         ['quality'=> 2,'name' => 'channel-ctl-oil-fast-limit'],
+
         ['quality'=> 1,'name' => 'channel-ctl-phone-common-limit'],
-        ['quality'=> 2,'name' => 'channel-ctl-phone-fast-limit']
+        ['quality'=> 2,'name' => 'channel-ctl-phone-fast-limit'],
+        ['quality'=> 3,'name' => 'channel-ctl-phone-card-limit'],
+        ['quality'=> 4,'name' => 'channel-ctl-phone-third-limit'],
+        ['quality'=> 5,'name' => 'channel-ctl-phone-slow-limit'],
     ];
 
     public function __construct()
@@ -42,7 +46,7 @@ class chctl
                     $amount = $item['amount'];
                     $card_type = $item['type'];
 
-                    $opened = $item['opened'] == 1 ? true : false;
+                    $opened = $item['opened'] == 1;
                     $sort = $item['sort'];
                     $speed = $item['speed'];
 
@@ -56,21 +60,16 @@ class chctl
 
     public function match($names,int $spec, int $card_type,int $quality)
     {
-        $overload = false;
-
         $ctl_items = [];
         foreach ($names as $name)
         {
             $key = $this->prefix($name,$spec,$card_type,$quality);
+            Log::record("chctl::match key={$key}",Log::DEBUG);
             if(array_key_exists($key,$this->mSpeedtable)) {
                 $ctl_items[] = $this->mSpeedtable[$key];
             }
         }
 
-        if(empty($ctl_items)) {
-            return [$names,$overload];
-        }
-
         $usable_items = [];
         foreach ($ctl_items as $item) {
             if($item->opened()) {
@@ -101,14 +100,19 @@ class chctl
         usort($usable_items, $ascending);
 
         $result = [];
+        $overload = false;
         foreach ($usable_items as $item)
         {
             if(!$item->speed_overload()) {
                 $result[] = $item->name();
+                $overload = true;
             }
         }
 
-        $overload = count($result) == 0;
+        if(count($result) > 0) {
+            $overload = false;
+        }
+
         return [$result,$overload];
     }
 

+ 0 - 1
helper/refill/policy/ctl_item.php

@@ -13,7 +13,6 @@ class ctl_item
     private $mCardType;
     private $mAmount;
 
-
     private $mMaxSpeed;
     private $mPrefix;
     private $mLastReadTime;

+ 29 - 22
helper/refill/policy/lingzh/policy.php

@@ -7,31 +7,31 @@ use Log;
 
 class policy extends ProviderManager implements IPolicy
 {
-    const normal_times = 15;
-    const normle_time_out = 90;
-
-    const high_times = 5;
-    const high_time_out = 30;
-
     protected $mChannelControl;
     protected $mMchctl;
+    protected $mQuality;
+
     public function __construct()
     {
         parent::__construct();
         $this->mChannelControl = new chctl();
         $this->mMchctl = new mchctl();
+        $this->mQuality = new quality_ploy();
     }
 
     public function load()
     {
         parent::load();
+
         $this->mChannelControl->load();
         $this->mMchctl->load();
+        $this->mQuality->load();
     }
 
     public function find_providers(int $spec, int $card_type,int $quality): array
     {
         $providers = parent::find_providers($spec,$card_type,$quality);
+
         if(empty($providers)) {
             return [$providers,false];
         }
@@ -42,6 +42,7 @@ class policy extends ProviderManager implements IPolicy
         }
 
         [$names,$overload] = $this->mChannelControl->match($names,$spec,$card_type,$quality);
+        Log::record("policy::find_providers match result=" . implode($names),Log::DEBUG);
 
         $result = [];
         foreach ($names as $name)
@@ -57,14 +58,30 @@ class policy extends ProviderManager implements IPolicy
         return [$result,$overload];
     }
 
-    public function first_quality($mchid): int
+    public function find_quality($mchid,$spec,$card_type,$org_quality,$times,$used_time): array
     {
-        return 1;
-    }
+        [$org_quality,$qualities] = $this->mQuality->find_quality($mchid,$org_quality,$times,$used_time);
+        if(empty($qualities)) {
+            return [$org_quality,0];
+        }
 
-    public function can_retry(array $refill_info, array $order_info): array
-    {
-        return [false,0];
+        foreach ($qualities as $quality)
+        {
+            [$names,$overload] = $this->find_providers($spec,$card_type,$quality);
+            if($overload) {
+                Log::record("Policy::find_quality:{$quality}-{$spec}-{$card_type} is ok",Log::DEBUG);
+                return [$org_quality,$quality];
+            }
+            if(!empty($names)) {
+                Log::record("Policy::find_quality:{$quality}-{$spec}-{$card_type} is ok",Log::DEBUG);
+                return [$org_quality,$quality];
+            }
+            else {
+                Log::record("Policy::find_quality:{$quality}-{$spec}-{$card_type} is fail",Log::DEBUG);
+            }
+        }
+
+        return [$org_quality,0];
     }
 
     public function allow($mchid, $card_type, $amount, $quality): bool
@@ -72,16 +89,6 @@ class policy extends ProviderManager implements IPolicy
         return true;
     }
 
-    public function can_nettry($mchid,$quality,$order_time,$commit_times) : bool
-    {
-        if($quality == 1) {
-            return $commit_times < policy::normal_times && time() - $order_time < policy::normle_time_out;
-        }
-        else {
-            return $commit_times < policy::high_times && time() - $order_time < policy::high_time_out;
-        }
-    }
-
     public function notify($order_info, $refill_info) : bool
     {
         $order_state = $order_info['order_state'];

+ 35 - 0
helper/refill/policy/lingzh/quality_ploy.php

@@ -0,0 +1,35 @@
+<?php
+
+namespace refill;
+
+class quality_ploy extends Quality
+{
+    public function __construct()
+    {
+        parent::__construct();
+
+        $this->mSpeeds = [
+            self::Normal => ['retry_times' => 2,'retry_timeout' => 180,'per_secs' => 60],
+            self::Quick => ['retry_times' => 2,'retry_timeout' => 60,'per_secs' => 30],
+            self::CardKey => ['retry_times' => 2,'retry_timeout' => 120,'per_secs' => 60],
+            self::ThirdShop => ['retry_times' => 2,'retry_timeout' => 600,'per_secs' => 600],
+            self::Slow => ['retry_times' => 2,'retry_timeout' => 3600,'per_secs' => 3600],
+
+            self::DefNormal => ['retry_times' => 2,'retry_timeout' => 180,'per_secs' => 120],
+            self::DefSuccess => ['retry_times' => 2,'retry_timeout' => 60,'per_secs' => 30],
+        ];
+
+        $this->mQualities = [
+            self::Normal => [self::Normal],
+            self::Quick => [self::Quick],
+            self::CardKey => [self::CardKey],
+            self::ThirdShop => [self::ThirdShop],
+            self::Slow => [self::Slow],
+
+            self::DefNormal  => [self::Normal],
+            self::DefSuccess => [self::Quick],
+        ];
+    }
+}
+
+

+ 8 - 2
helper/refill/policy/mchctl.php

@@ -33,8 +33,14 @@ class mchctl
             $quality = intval($item['quality']);
             $time_out = $item['time_out'];
 
-            if ($quality < 1 || $quality > 3) {
-                $quality = 1;
+            if($quality == Quality::DefNormal || $quality == Quality::DefSuccess) {
+
+            }
+            elseif ($quality >= Quality::LowestQuality && $quality <= Quality::HighestQuality) {
+
+            }
+            else {
+                $quality = Quality::DefNormal;
             }
 
             $this->mMchidMapCtls[$mchid] = ['quality' => $quality,'time_out' => $time_out];

+ 102 - 0
helper/refill/policy/quaility.php

@@ -0,0 +1,102 @@
+<?php
+
+namespace refill;
+
+use Log;
+
+class Quality
+{
+    const LowestQuality  = 1;
+    const HighestQuality = 5;
+
+    const Normal = 1;
+    const Quick = 2;
+    const CardKey = 3;
+    const ThirdShop = 4;
+    const Slow = 5;
+
+    const DefNormal  = 11; // 4 -> 1
+    const DefSuccess = 12; // 4 -> 3 -> 1 -> 2
+
+    protected $mMchctl;
+    protected $mSpeeds;
+    protected $mQualities;
+
+    public function __construct()
+    {
+        $this->mMchctl = new mchctl();
+    }
+
+    public function load()
+    {
+        $this->mMchctl->load();
+    }
+
+    public function find_quality($mchid,$quality,$times,$used_time): array
+    {
+        if($quality == 0)
+        {
+            [$sucdess,$setting_quality,$time_out] = $this->mMchctl->getCtls($mchid);
+            if($sucdess)
+            {
+                if(array_key_exists($setting_quality,$this->mQualities)) {
+                    $org = $setting_quality;
+                    $qualities = $this->mQualities[$setting_quality];
+                }
+                else {
+                    $org = $setting_quality;
+                    $qualities = [$setting_quality];
+                }
+            }
+            else {
+                $org = self::DefNormal;
+                $qualities = [self::ThirdShop,self::Normal];
+            }
+        }
+        elseif(array_key_exists($quality,$this->mQualities)) {
+            $org = $quality;
+            $qualities = $this->mQualities[$quality];
+            $time_out = $this->mSpeeds[$org]['retry_timeout'];
+        }
+        else {
+            Log::record("find_quality: cannot find any quality",Log::DEBUG);
+            return [0,[]];
+        }
+
+        if(empty($time_out)) {
+            $time_out = $this->mSpeeds[$org]['retry_timeout'];
+        }
+
+        $max_times = $this->mSpeeds[$org]['retry_times'];
+        $qualities = $this->calc_quality($qualities,$times,$used_time,$time_out,$max_times);
+
+        return [$org,$qualities];
+    }
+
+    //通过每种类型通道耗时,倒推当前可用通道,并优先走推荐通道.
+    private function calc_quality($qualities, $times, $used_time, $time_out, $max_times)
+    {
+        $left_time = $time_out - $used_time;
+        if($left_time <= 0 || $max_times <= $times) return [];
+        $qualities = array_reverse($qualities);
+
+        $result = [];
+        foreach ($qualities as $quality)
+        {
+            $per_secs = $this->mSpeeds[$quality]['per_secs'];
+            $left_time -= $per_secs;
+            if($left_time > 0) {
+                $result[] = $quality;
+            } else {
+                break;
+            }
+        }
+
+        if(empty($result)) {
+            $result[] = $quality;
+        }
+
+        $result = array_reverse($result);
+        return $result;
+    }
+}

+ 21 - 89
helper/refill/policy/xyz/policy.php

@@ -9,27 +9,25 @@ use StatesHelper;
 
 class policy extends ProviderManager implements IPolicy
 {
-    const normal_times = 3;
-    const normal_time_out = 600;
-    const normal_req_secs = 60;
-
-    const high_times = 3;
-    const high_time_out = 60;
-
     protected $mChannelControl;
     protected $mMchctl;
+    protected $mQuality;
+
     public function __construct()
     {
         parent::__construct();
         $this->mChannelControl = new chctl();
         $this->mMchctl = new mchctl();
+        $this->mQuality = new quality_ploy();
     }
 
     public function load()
     {
         parent::load();
+
         $this->mChannelControl->load();
         $this->mMchctl->load();
+        $this->mQuality->load();
     }
 
     public function find_providers(int $spec, int $card_type,int $quality): array
@@ -46,6 +44,7 @@ class policy extends ProviderManager implements IPolicy
         }
 
         [$names,$overload] = $this->mChannelControl->match($names,$spec,$card_type,$quality);
+        Log::record("policy::find_providers match result=" . implode($names),Log::DEBUG);
 
         $result = [];
         foreach ($names as $name)
@@ -61,97 +60,30 @@ class policy extends ProviderManager implements IPolicy
         return [$result,$overload];
     }
 
-    //按价格从低到高排序
-    private function sort_price($providers,int $spec, int $card_type,int $quality)
-    {
-        $ascending = function ($l, $r) use ($quality,$spec,$card_type) {
-            [$glid, $lprice] = $l->goods($quality,$spec,$card_type);
-            [$rgid, $rprice] = $r->goods($quality,$spec,$card_type);
-
-            $lsort = $l->sort();
-            $rsort = $r->sort();
-
-            if($lprice == $rprice) {
-                return $lsort < $rsort ? -1 : 1;
-            }
-            else {
-                return $lprice < $rprice ? -1 : 1;
-            }
-        };
-        usort($providers, $ascending);
-
-        return $providers;
-    }
-
-    public function can_retry(array $refill_info, array $order_info) : array
+    public function find_quality($mchid,$spec,$card_type,$org_quality,$times,$used_time): array
     {
-        $checker = function ($refill, $order,$time_out,$quality)
-        {
-            $state = intval($order['order_state']);
-            if ($state !== ORDER_STATE_SEND) {
-                Log::record("retry false:order_state != send", Log::DEBUG);
-                return [false,0];
-            }
-
-            $times = intval($refill['commit_times']);
-            if ($times > policy::normal_times) {
-                return [false,0];
-            }
-
-            $period = time() - $refill['order_time'];
-            if ($period >= $time_out) {
-                Log::record("retry false:time > 15m", Log::DEBUG);
-                return [false,0];
-            }
-            elseif($period + 60 > $time_out && $quality == 3) {
-                return [true,2];
-            }
-            else {
-                return [true,$quality];
-            }
-        };
-
-        $mchid = $refill_info['mchid'];
-        [$sucdess,$quality,$time_out] = $this->mMchctl->getCtls($mchid);
-
-        if($sucdess) {
-            Log::record("mchid = {$mchid} timeout={$time_out}",Log::DEBUG);
-            return $checker($refill_info, $order_info,$time_out,$quality);
+        [$org_quality,$qualities] = $this->mQuality->find_quality($mchid,$org_quality,$times,$used_time);
+        if(empty($qualities)) {
+            return [$org_quality,0];
         }
-        else {
-            return $checker($refill_info, $order_info,policy::normal_time_out,1);
-        }
-    }
 
-    public function can_nettry($mchid,$quality,$order_time,$commit_times) : bool
-    {
-        [$sucdess,$quality,$time_out] = $this->mMchctl->getCtls($mchid);
-
-        if($sucdess)
+        foreach ($qualities as $quality)
         {
-            if($quality == 1) {
-                return $commit_times < policy::normal_times && time() - $order_time < $time_out;
+            [$names,$overload] = $this->find_providers($spec,$card_type,$quality);
+            if($overload) {
+                Log::record("Policy::find_quality:{$quality}-{$spec}-{$card_type} is ok",Log::DEBUG);
+                return [$org_quality,$quality];
+            }
+            if(!empty($names)) {
+                Log::record("Policy::find_quality:{$quality}-{$spec}-{$card_type} is ok",Log::DEBUG);
+                return [$org_quality,$quality];
             }
             else {
-                return $commit_times < policy::high_times && time() - $order_time < $time_out;
+                Log::record("Policy::find_quality:{$quality}-{$spec}-{$card_type} is fail",Log::DEBUG);
             }
         }
-        elseif($quality == 1) {
-            return $commit_times < policy::normal_times && time() - $order_time < policy::normal_time_out;
-        }
-        else {
-            return $commit_times < policy::high_times && time() - $order_time < policy::high_time_out;
-        }
-    }
 
-    public function first_quality($mchid): int
-    {
-        [$sucdess,$quality,$time_out] = $this->mMchctl->getCtls($mchid);
-        if($sucdess) {
-            return $quality;
-        } else {
-            return 1;
-        }
+        return [$org_quality,0];
     }
 
     public function allow($mchid,$card_type,$amount,$quality) : bool

+ 33 - 0
helper/refill/policy/xyz/quality_ploy.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace refill;
+
+class quality_ploy extends Quality
+{
+    public function __construct()
+    {
+        parent::__construct();
+
+        $this->mSpeeds = [
+            self::Normal => ['retry_times' => 60,'retry_timeout' => 900,'per_secs' => 120],
+            self::Quick => ['retry_times' => 10,'retry_timeout' => 60,'per_secs' => 30],
+            self::CardKey => ['retry_times' => 60,'retry_timeout' => 900,'per_secs' => 60],
+            self::ThirdShop => ['retry_times' => 60,'retry_timeout' => 900,'per_secs' => 600],
+            self::Slow => ['retry_times' => 60,'retry_timeout' => 86400,'per_secs' => 3600],
+
+            self::DefNormal => ['retry_times' => 60,'retry_timeout' => 900,'per_secs' => 60],
+            self::DefSuccess => ['retry_times' => 60,'retry_timeout' => 900,'per_secs' => 60],
+        ];
+
+        $this->mQualities = [
+            self::Normal => [self::Normal],
+            self::Quick => [self::Quick],
+            self::CardKey => [self::CardKey],
+            self::ThirdShop => [self::ThirdShop],
+            self::Slow => [self::Slow],
+
+            self::DefNormal  => [self::ThirdShop,self::Normal],
+            self::DefSuccess => [self::ThirdShop,self::CardKey,self::Normal,self::Quick]
+        ];
+    }
+}

+ 19 - 16
mobile/control/refill.php

@@ -66,7 +66,8 @@ class refillControl extends merchantControl
         $amount = intval($_GET['amount']);
         $card_no = $_GET['cardno'];
         $notify_url = $_GET['notifyurl'];
-        $mch_order = $_GET['order_sn']; //对方的order编号
+        $mch_order = $_GET['order_sn'];   //对方的order编号
+        $quality = $_GET['quality'] ?? 0;
 
         if(!$this->check_mchorder($this->mchid(),$mch_order)) {
             return self::outerr(205,"客户订单号重复或者为空.");
@@ -76,27 +77,29 @@ class refillControl extends merchantControl
             return self::outerr(206,"平台不支持该卡充值.");
         }
 
-//        $card_type = mtopcard\card_type($card_no);
-//        if($card_type === mtopcard\SinopecCard || $card_type === mtopcard\PetroChinaCard)
-//        {
-//            $allow = refill\RefillFactory::instance()->allow($this->mchid(),$card_type,$amount,$quality);
-//            if(!$allow) {
-//                if ($card_type === mtopcard\SinopecCard) {
-//                    $text = "中石化";
-//                }
-//                else {
-//                    $text = "中石油";
-//                }
-//                return self::outerr(207,"今日贵司{$amount}{$text}充值库存已经用完.");
-//            }
-//        }
+        $card_type = mtopcard\card_type($card_no);
+        if($card_type === mtopcard\SinopecCard || $card_type === mtopcard\PetroChinaCard)
+        {
+            $allow = refill\RefillFactory::instance()->allow($this->mchid(),$card_type,$amount,$quality);
+            if(!$allow) {
+                if ($card_type === mtopcard\SinopecCard) {
+                    $text = "中石化";
+                }
+                else {
+                    $text = "中石油";
+                }
+                return self::outerr(207,"今日贵司{$amount}{$text}充值库存已经用完.");
+            }
+        }
 
         $params = [ 'mchid' => $this->mchid(),
             'buyer_id' => $this->adminid(),
             'amount' => $amount,
             'card_no' => $card_no,
             'mch_order' => $mch_order,
-            'notify_url' => $notify_url];
+            'notify_url' => $notify_url,
+            'org_quality' => $quality
+            ];
 
         $state = refill\util::push_add($params);
         if($state === true) {

+ 4 - 1
racc/control/lzrefill.php

@@ -74,6 +74,7 @@ class lzrefillControl extends lzbaseControl
         $card_no = $_GET['mob'];
         $notify_url = $_GET['notifyurl'];
         $mch_order = $_GET['ord']; //对方的order编号
+        $quality = $_GET['quality'] ?? 0;
 
         //此处判断是对的
         if($amount > $this->member_available) {
@@ -93,7 +94,9 @@ class lzrefillControl extends lzbaseControl
             'amount' => $amount,
             'card_no' => $card_no,
             'mch_order' => $mch_order,
-            'notify_url' => $notify_url];
+            'notify_url' => $notify_url,
+            'org_quality' => $quality
+        ];
 
         $ret = refill\util::push_add($params);
         if($ret) {

+ 9 - 8
racc/control/refill.php

@@ -65,8 +65,7 @@ class refillControl extends merchantControl
         $card_no = $_GET['cardno'];
         $notify_url = $_GET['notifyurl'];
         $mch_order = $_GET['order_sn']; //对方的order编号
-        $idcard = $_GET['idcard'] ?? '';
-        $card_name = $_GET['card_name'] ?? '';
+        $quality = $_GET['quality'] ?? 0;
 
         if(!$this->check_mchorder($this->mchid(),$mch_order)) {
             return self::outerr(205,"客户订单号重复或者为空.");
@@ -98,12 +97,14 @@ class refillControl extends merchantControl
             return self::outerr(203, "余额不足");
         }
 
-        $params = [ 'mchid' => $this->mchid(),
-                    'buyer_id' => $this->adminid(),
-                    'amount' => $amount,
-                    'card_no' => $card_no,
-                    'mch_order' => $mch_order,
-                    'notify_url' => $notify_url];
+        $params = ['mchid' => $this->mchid(),
+            'buyer_id' => $this->adminid(),
+            'amount' => $amount,
+            'card_no' => $card_no,
+            'mch_order' => $mch_order,
+            'notify_url' => $notify_url,
+            'org_quality' => $quality
+        ];
 
         refill\util::push_add($params);
         return self::outsuccess(['state' => true]);

+ 0 - 1
rdispatcher/codispatcher.php

@@ -18,7 +18,6 @@ require_once(BASE_HELPER_PATH . '/queue/rdispatcher.php');
 require_once(BASE_HELPER_PATH . '/algorithm.php');
 require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
 require_once(BASE_PATH . '/processor.php');
-require_once(BASE_PATH . '/coprocessor.php');
 require_once(BASE_PATH . '/proxy.php');
 
 Co::set(['hook_flags' => SWOOLE_HOOK_NATIVE_CURL]);

+ 0 - 17
rdispatcher/coprocessor.php

@@ -1,17 +0,0 @@
-<?php
-
-
-class coprocessor extends processor
-{
-    public function __construct()
-    {
-        parent::__construct(true);
-    }
-
-    protected function handle($msg)
-    {
-        go(function() use ($msg) {
-            parent::handle($msg);
-        });
-    }
-}

+ 35 - 13
rdispatcher/proxy.php

@@ -1,10 +1,10 @@
 <?php
 
-
-use refill\util;
-
 require_once (BASE_ROOT_PATH . '/helper/model_helper.php');
 
+use mtopcard;
+use refill;
+
 class proxy
 {
     const max_retry = 5;
@@ -28,17 +28,35 @@ class proxy
         $commit_times = $params['commit_times'] ?? 0;
         $last_order_id = $params['order_id'] ?? 0;
 
-        $quality = intval($params['quality']);
+        $org_quality = intval($params['org_quality']) ?? 0;
+        $card_type   = intval($params['card_type']) ?? 0;
 
-        if($quality != 1 && $quality != 2) {
-            $quality =  refill\RefillFactory::instance()->first_quality($mchid);
-            Log::record("add first_quality quality = {$quality}",Log::DEBUG);
+        $need_check = false;
+        if($card_type == 0)
+        {
+            $card_type = mtopcard\card_type($card_no);
+            $params['card_type'] = $card_type;
+            if($card_type != mtopcard\PetroChinaCard && $card_type != mtopcard\SinopecCard) {
+                $need_check = true;
+            }
         }
 
+        [$org_quality,$quality] = refill\RefillFactory::instance()->find_quality($mchid,$amount,$card_type,$org_quality,$commit_times,time() - $order_time);
+        if ($need_check)
+        {
+            $valided = mtopcard\valid_phone($card_no);
+            if (!$valided) {
+                $order_id = refill\RefillFactory::instance()->zero_order($mchid, $buyer_id, $amount, $card_no,
+                    $mch_order, $idcard, $card_name, $notify_url, $quality, $org_quality, $order_time, $commit_times,
+                    "无效的手机号");
+                QueueClient::push("NotifyMerchantComplete", ['order_id' => $order_id, 'manual' => false]);
+                return;
+            }
+        }
 
-        [$errcode, $errmsg,$order_id,$neterr] = refill\RefillFactory::instance()->add($mchid, $buyer_id, $amount, $card_no,
-            $mch_order, $idcard, $card_name, $notify_url,$quality, $order_time, $commit_times,$last_order_id);
-
+        [$errcode, $errmsg, $order_id, $neterr] = refill\RefillFactory::instance()->add($mchid, $buyer_id, $amount, $card_no,
+            $mch_order, $idcard, $card_name, $notify_url, $quality,$org_quality,
+            $order_time, $commit_times, $last_order_id,$card_type);
         $params['commit_times'] += 1;
         $commit_times += 1;
 
@@ -47,13 +65,17 @@ class proxy
             $fNotify = true;
             if(($errcode === refill\errcode::MERCHANT_REFILL_ERROR && $neterr) || $errcode == refill\errcode::PROVIDER_OVERLOAD)
             {
-                if (refill\RefillFactory::instance()->can_nettry($mchid, $quality, $order_time, $commit_times)) {
+                [$org_quality,$quality] = refill\RefillFactory::instance()->find_quality($mchid,$amount,$card_type,$org_quality,$commit_times,time() - $order_time);
+                if ($quality > 0) {
                     $fNotify = false;
                     $params['order_id'] = $order_id;
-                    refill\util::push_add($params);
                     if($order_id > 0) {
                         $refill_order->edit($order_id, ['is_retrying' => 1]);
                     }
+//                    if(defined('USE_COROUTINE') && USE_COROUTINE) {
+//                        \Swoole\Coroutine::sleep(2);
+//                    }
+                    refill\util::push_add($params);
                 }
             }
 
@@ -64,7 +86,7 @@ class proxy
                     $order_info = $this->latest_order($refill_order, $mchid, $mch_order);
                     if (empty($order_info)) {
                         $order_id = refill\RefillFactory::instance()->zero_order($mchid, $buyer_id, $amount, $card_no,
-                            $mch_order, $idcard, $card_name, $notify_url, $quality, $order_time, $commit_times, $errmsg);
+                            $mch_order, $idcard, $card_name, $notify_url, $quality, $org_quality, $order_time, $commit_times, $errmsg);
                     } else {
                         $order_id = $order_info['order_id'];
                     }

+ 4 - 4
test/TestDispatcher.php

@@ -100,15 +100,15 @@ class TestDispatcher extends TestCase
 
     private function make_order()
     {
-//        $mchid = 1092;//
-        $mchid = $this->mMchid;
+        $mchid = 1092;//
+//        $mchid = $this->mMchid;
         $mchinfo = Model('merchant')->getMerchantInfo(['mchid' => $mchid]);
         $buyer_id = intval($mchinfo['admin_id']);
 
         $params = [ 'mchid' => $mchid,
             'buyer_id' => $buyer_id,
-            'amount' => 10,
-            'card_no' => 13911129867,
+            'amount' => 100,
+            'card_no' => 15120035568,
             'mch_order' => $this->make_sn(),
             'notify_url' => 'https://www.xyzshops.cn/mobile/signature.php'];
 

+ 1 - 0
test/TestMemberCard.php

@@ -474,6 +474,7 @@ class TestMemberCard extends TestCase
     public function testPhoneZone()
     {
         $x = $this->carrier_type('13911129867');
+        $x = $this->carrier_type('13886396292');
     }
     public function testCheckMobileChannel(){
         $mobile = 17801048874;

+ 85 - 7
test/TestRefill.php

@@ -294,7 +294,7 @@ class TestRefill extends TestCase
     public function testPrice()
     {
         $amounts = [10,20,30,50,100,200,300,500];
-        $rate = 0.94;
+        $rate = 0.96;
         foreach ($amounts as $amount){
             $price[] = $amount * $rate;
         }
@@ -311,7 +311,15 @@ class TestRefill extends TestCase
     public function testXcPhone()
     {
         $providers = new refill\xc\RefillPhone([]);
-        $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
+        $resp = $providers->add(13699279618, 5, 100, ['order_sn' => $this->make_sn()]);
+//        $resp = $providers->query(['order_sn' => '87961616926444043617']);
+        $params['pay_orderid'] = '87961616926444043617';
+        $params['pay_iphone'] = '18500608333';
+        $params['pay_money'] = '100';
+        $params['wt_orderid'] = '202103281816121070';
+        $params['status'] = '1';
+        $params['sign'] = 'f7be2e859a5a6dc7b1a8273361617752';
+//        refill\RefillFactory::instance()->notify('xc',$params);
     }
 
     public function testAfandPhone()
@@ -325,9 +333,9 @@ class TestRefill extends TestCase
     public function testAfandengPhone()
     {
         $providers = new refill\afandeng\RefillPhone([]);
-        for ($i = 5; $i > 0; --$i) {
+//        for ($i = 5; $i > 0; --$i) {
             $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
-        }
+//        }
 //        $resp = $providers->query(['order_sn' => '20941616115610023539']);
 //        $params['usr'] = 'afandeng';
 //        $params['ord'] = '20941616115610023539';
@@ -714,6 +722,76 @@ class TestRefill extends TestCase
         return false;
     }
 
+    public function testcreateSign()
+    {
+        $params['act'] = 'refill';
+        $params['amount'] = '100';
+        $params['cardno'] = '1000111200006005872';
+        $params['mchid'] = '1092';
+        $params['notifyurl'] = 'http://202.85.213.156:8080//YeZiYKCallBackOrderServlet';
+        $params['op'] = 'balance';
+        $params['order_sn'] = 'jftest0000123';
+        $sign = $this->md5_sign($params);
+    }
+
+    public function testCheckphone()
+    {
+        $check = function($phone){
+            $url = 'https://mobileempty.shumaidata.com/mobileempty';
+            $params['mobile'] = $phone;
+            $headers = array();
+            array_push($headers, "Authorization:APPCODE " . '8f92d951293f4d2ea48ff86d5a70c537');
+            $resp = http_request($url,$params,'GET',false,$headers);
+            $resp = json_decode($resp , true);
+            if($resp['success'] == true && $resp['code'] == 200) {
+                Log::record("data phone:{$phone} , status : {$resp['data']['status']}" , Log::DEBUG);
+                if(in_array($resp['data']['status'] , [0,3,4,5])){
+                    return false;
+                }
+            }else{
+                Log::record("data phone:{$phone} , 不支持的号段" , Log::DEBUG);
+            }
+        };
+
+        $phone_data = [18257939501,
+            13972748464,
+            18804840184,
+            13502425355,
+            13556439026,
+            13886396292,
+            13423847565,
+            15027241848,
+            13720147356,
+            19847641519,
+            13566127267,
+            13566127267,
+            13566127267,
+            13566127267,
+            13725375875,
+            15802795200,
+            15908618099,
+            13597965447,
+            13667173026,
+            13409875787,
+            13517990683,
+            13972431922,
+            15902769986,
+            13796242526,
+            15245806675,
+            15846255524,
+            18333061403,
+            15931693241,
+            15146725715,
+            13945133691,
+            15046744787,
+            18745128978,
+            15711015722];
+        foreach ($phone_data as $phone) {
+//            $check($phone);
+        }
+        $check(17801048874);
+    }
+
     private function md5_sign($params)
     {
         ksort($params);
@@ -723,15 +801,15 @@ class TestRefill extends TestCase
         foreach ($params as $k => $v) {
             if (false === $this->check_empty($v) && "@" != substr($v, 0, 1)) {
                 if ($i == 0) {
-                    $body .= "{$k}" . "=" . urldecode($v);
+                    $body .= "{$k}" . "=" . urlencode($v);
                 } else {
-                    $body .= "&" . "{$k}" . "=" . urldecode($v);
+                    $body .= "&" . "{$k}" . "=" . urlencode($v);
                 }
                 $i++;
             }
         }
 
-        $body .= "&key=7yDCLS6S2KzSAJQOUc3vsa";
+        $body .= "&key=af7145fc9e2d8dc3d20b341c3fa582b8";
 
         return md5($body);
     }