Browse Source

Merge branch 'raccount' into rgoods

xiaoyu 2 years atrás
parent
commit
3e2f597964
100 changed files with 3896 additions and 573 deletions
  1. 10 4
      admin/config/config.ini.php
  2. 6 3
      admin/control/arw_monitor.php
  3. 113 0
      admin/control/provider_province_cfg.php
  4. 5 4
      admin/control/refill_company.php
  5. 1 0
      admin/include/limit.php
  6. 1 0
      admin/include/menu.php
  7. 85 13
      admin/templates/default/analysis.provider.php
  8. 28 20
      admin/templates/default/arw.monitor.php
  9. 1 1
      admin/templates/default/merchant.index.php
  10. 1 1
      admin/templates/default/provider.amount.php
  11. 79 1
      admin/templates/default/refill.company.add.php
  12. 78 1
      admin/templates/default/refill.company.edit.php
  13. 398 0
      admin/templates/default/refill.provider.province.cfg.php
  14. 9 0
      core/framework/cache/cache.redis.php
  15. 5 5
      core/framework/libraries/log.php
  16. 43 19
      core/framework/libraries/model.php
  17. 30 4
      crontab/control/minutes.php
  18. 2 2
      data/config/win/base.ini.php
  19. 705 188
      data/config/xyz/refill.ini.php
  20. 432 157
      data/config/yl/refill.ini.php
  21. 32 8
      data/logic/vr_order.logic.php
  22. 8 3
      data/model/refill_order.model.php
  23. 44 0
      data/model/vr_order.model.php
  24. 2 2
      docker/compose/homecuda/cli/docker-compose.yml
  25. 1 1
      docker/compose/workcuda/acc/docker-compose.yml
  26. 1 1
      docker/compose/workcuda/admin/docker-compose.yml
  27. 2 2
      docker/compose/workcuda/cli/docker-compose.yml
  28. 1 1
      docker/compose/xiaoyu/conf/nginx/nginx.conf
  29. 1 1
      docker/compose/xyz/worker/docker-compose.yml
  30. 1 1
      docker/compose/yl/ylworker/docker-compose.yml
  31. 0 15
      document/ugc.txt
  32. 1 1
      helper/bonus/factory.php
  33. 1 1
      helper/queue/iqueue.php
  34. 2 0
      helper/rbridge/RBridgeFactory.php
  35. 18 8
      helper/rbridge/fulu/Bridge.php
  36. 4 1
      helper/rbridge/fulu/readme.txt
  37. 159 0
      helper/rbridge/fulu_ylyw/Bridge.php
  38. 23 0
      helper/rbridge/fulu_ylyw/config.php
  39. 14 0
      helper/rbridge/fulu_ylyw/product.php
  40. 31 0
      helper/rbridge/fulu_ylyw/readme.txt
  41. 159 0
      helper/rbridge/fulu_youjun/Bridge.php
  42. 23 0
      helper/rbridge/fulu_youjun/config.php
  43. 17 0
      helper/rbridge/fulu_youjun/product.php
  44. 25 0
      helper/rbridge/fulu_youjun/readme.txt
  45. 4 1
      helper/rbridge/wsd/Bridge.php
  46. 110 66
      helper/refill/RefillBase.php
  47. 4 2
      helper/refill/XYZRefillFactory.php
  48. 1 1
      helper/refill/api/xyz/afand/RefillCallBack.php
  49. 1 1
      helper/refill/api/xyz/afandeng/RefillCallBack.php
  50. 1 1
      helper/refill/api/xyz/afandfs/RefillCallBack.php
  51. 1 1
      helper/refill/api/xyz/afandnew/RefillCallBack.php
  52. 1 1
      helper/refill/api/xyz/afd/RefillCallBack.php
  53. 1 1
      helper/refill/api/xyz/ainika/RefillCallBack.php
  54. 1 1
      helper/refill/api/xyz/ainika_high/RefillCallBack.php
  55. 1 1
      helper/refill/api/xyz/bailian/RefillCallBack.php
  56. 1 1
      helper/refill/api/xyz/baixuan/RefillCallBack.php
  57. 1 1
      helper/refill/api/xyz/baixuan_normal/RefillCallBack.php
  58. 1 1
      helper/refill/api/xyz/baixuannew_high/RefillCallBack.php
  59. 1 1
      helper/refill/api/xyz/baixuannew_normal/RefillCallBack.php
  60. 1 1
      helper/refill/api/xyz/bdt/RefillCallBack.php
  61. 1 1
      helper/refill/api/xyz/beixt/RefillCallBack.php
  62. 46 0
      helper/refill/api/xyz/bier/RefillCallBack.php
  63. 155 0
      helper/refill/api/xyz/bier/RefillPhone.php
  64. 51 0
      helper/refill/api/xyz/bier/config.php
  65. 43 0
      helper/refill/api/xyz/bier/椰子.txt
  66. BIN
      helper/refill/api/xyz/bier/话费API接口文档.docx
  67. 46 0
      helper/refill/api/xyz/bier_fs/RefillCallBack.php
  68. 174 0
      helper/refill/api/xyz/bier_fs/RefillPhone.php
  69. 154 0
      helper/refill/api/xyz/bier_fs/config.php
  70. 147 0
      helper/refill/api/xyz/bier_fs/椰子.txt
  71. BIN
      helper/refill/api/xyz/bier_fs/话费API接口文档.docx
  72. 1 1
      helper/refill/api/xyz/bingdht/RefillCallBack.php
  73. 1 1
      helper/refill/api/xyz/bjb/RefillCallBack.php
  74. 1 1
      helper/refill/api/xyz/bjbnew/RefillCallBack.php
  75. 1 1
      helper/refill/api/xyz/bjbyd/RefillCallBack.php
  76. 1 1
      helper/refill/api/xyz/bodian/RefillCallBack.php
  77. 50 0
      helper/refill/api/xyz/bodian_dx/RefillCallBack.php
  78. 140 0
      helper/refill/api/xyz/bodian_dx/RefillPhone.php
  79. 15 0
      helper/refill/api/xyz/bodian_dx/api.txt
  80. 27 0
      helper/refill/api/xyz/bodian_dx/config.php
  81. 1 1
      helper/refill/api/xyz/bodian_yd/RefillCallBack.php
  82. 1 1
      helper/refill/api/xyz/bxtwt/RefillCallBack.php
  83. 1 1
      helper/refill/api/xyz/cangbu/RefillCallBack.php
  84. 1 1
      helper/refill/api/xyz/cangbu_high/RefillCallBack.php
  85. 1 1
      helper/refill/api/xyz/cangbukami/RefillCallBack.php
  86. 1 1
      helper/refill/api/xyz/cangbuyd/RefillCallBack.php
  87. 1 1
      helper/refill/api/xyz/cangxin/RefillCallBack.php
  88. 2 0
      helper/refill/api/xyz/cangxin/RefillPhone.php
  89. 30 0
      helper/refill/api/xyz/cangxin/config.php
  90. 61 0
      helper/refill/api/xyz/cangxin/开户信息.txt
  91. 1 1
      helper/refill/api/xyz/cangxin_doubi/RefillCallBack.php
  92. 1 1
      helper/refill/api/xyz/cangxin_high/RefillCallBack.php
  93. 1 1
      helper/refill/api/xyz/cangxin_yi/RefillCallBack.php
  94. 1 1
      helper/refill/api/xyz/chending_df/RefillCallBack.php
  95. 1 1
      helper/refill/api/xyz/chending_tax/RefillCallBack.php
  96. 1 1
      helper/refill/api/xyz/chizeng/RefillCallBack.php
  97. 1 1
      helper/refill/api/xyz/chizeng_normal/RefillCallBack.php
  98. 1 1
      helper/refill/api/xyz/chizeng_yi/RefillCallBack.php
  99. 1 1
      helper/refill/api/xyz/dashang/RefillCallBack.php
  100. 0 0
      helper/refill/api/xyz/dashang_kami/RefillCallBack.php

+ 10 - 4
admin/config/config.ini.php

@@ -20,7 +20,13 @@ $config['receive_bank'] = [
         '趣带娃招行',
         '椰林浦发',
         '椰林平安',
-        '椰林广发'
+        '椰林广发',
+        '酉俊交行',
+        '酉俊中信',
+        '多益优平安',
+        '多益优招行',
+        '多益优交行',
+        '游来有旺招行',
     ],
     'LZKJ_COMPANY' => [
         '琳珠收款'
@@ -37,9 +43,9 @@ $config['server'] = [
     '121.89.201.55' => 'worker服务器',
     '121.89.223.81' => 'worker服务器',
     '39.101.140.116' => 'worker服务器',
-
-    '39.99.250.165' => '数据库服务器',
-    '39.103.201.41' => '备份数据库服务器',
+    '' => '',
+    '39.99.250.165' => '数据库服务器',
+    '39.103.201.41' => '数据库服务器',
     '39.103.141.163' => '后台服务器',
 ];
 

+ 6 - 3
admin/control/arw_monitor.php

@@ -53,7 +53,10 @@ class arw_monitorControl extends SystemControl
                     } elseif (strpos($key, 'dev') !== false) {
                         $key = str_replace('_', "/", $key);
                         $value = explode(',', $value);
-                        $value = "{$value[1]}/{$value[0]}";
+                        if(strpos($value[0], 'T') !== false) $value[0] = $value[0] * 1024 . 'G';
+                        if(strpos($value[1], 'T') !== false) $value[1] = $value[1] * 1024 . 'G';
+                        $percent = $value[1]/$value[0]*100;
+                        $value = "{$value[1]}/{$value[0]} (" . round($percent,2). "%)";
                     } else {
                         $key = str_replace('_', "/", $key);
                         $value = rtrim($value, '.');
@@ -62,10 +65,10 @@ class arw_monitorControl extends SystemControl
                     ksort($item);
                 }
             }
-            $result[$ip . "({$server_name})"] = $item;
+            $result[$ip . "{$server_name}"] = $item;
         }
         Tpl::output('data', $result);
         Tpl::output('ago_time', $this->elapse_time($ago_time));
         Tpl::showpage('arw.monitor');
     }
-}
+}

+ 113 - 0
admin/control/provider_province_cfg.php

@@ -0,0 +1,113 @@
+<?php
+
+class provider_province_cfgControl extends SystemControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    public function indexOp()
+    {
+        $card_type = $_GET['card_type'] ?? $_POST['card_type'];
+        if (empty($card_type)) $card_type = mtopcard\ChinaMobileCard;
+        $provider_list = $this->providers(['opened' => 1]);
+
+        if(chksubmit())
+        {
+            $items = $_POST['items'];
+            $provider_model = Model('refill_provider');
+            foreach ($provider_list as $provider)
+            {
+                $pid = $provider['provider_id'];
+                $province_value = $items[$pid];
+                if(empty($province_value)) continue;
+                $provinces = unserialize($provider['provinces']);
+                if(!is_array($province_value) && $province_value == -1)
+                {
+                    $provinces[$card_type] = $province_value;
+                }else{
+                    $provinces[$card_type] = implode(',', $province_value);
+                }
+                $provider_model->editProvider(['provinces' => serialize($provinces)], ['provider_id' => $pid]);
+            }
+            showMessage('编辑成功', "index.php?act=provider_province_cfg&op=index&card_type={$card_type}");
+        }
+        else
+        {
+            $prov_cfgs = [];
+            $provs = [];
+            foreach ($provider_list as $provider)
+            {
+                $pid = $provider['provider_id'];
+                $name = $provider['name'];
+                if (!$this->isfs($card_type,$name)) continue;
+                $provs[] = $provider;
+
+                $provinces = unserialize($provider['provinces']);
+                if (empty($provinces)) {
+                    $prov_cfgs[$pid] = [-1];
+                }
+                elseif (array_key_exists($card_type, $provinces)) {
+                    $prov_cfgs[$pid] = explode(',', $provinces[$card_type]);
+                } else {
+                    $prov_cfgs[$pid] = [-1];
+                }
+            }
+
+            $province_list = mtopcard\ProvinceList;
+            Tpl::output('province_list', $province_list);
+            Tpl::output('provider_list', $provs);
+            Tpl::output('province_cfg', $prov_cfgs);
+            Tpl::showpage('refill.provider.province.cfg');
+        }
+    }
+
+    private function isfs($card_type, $name)
+    {
+        $str_ends_with = function (string $haystack, string $needle): bool
+        {
+            if ('' === $needle || $needle === $haystack) {
+                return true;
+            }
+
+            if ('' === $haystack) {
+                return false;
+            }
+
+            $needleLength = strlen($needle);
+
+            return $needleLength <= strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength);
+        };
+        
+        $excludes = [
+            mtopcard\ChinaMobileCard => [
+                'guochuang',
+                'cangxin'
+            ],
+            mtopcard\ChinaUnicomCard => [
+                'guochuang'
+            ],
+            mtopcard\ChinaTelecomCard => [
+                'guochuang',
+                'cangxin'
+            ]
+        ];
+
+        if(in_array($name,$excludes[$card_type])) {
+            return true;
+        }
+
+        if($str_ends_with($name,'fs')) return true;
+
+        $fragments = explode('_', $name);
+        foreach ($fragments as $fragment)
+        {
+            if($fragment == 'fs') {
+                return true;
+            }
+        }
+
+        return false;
+    }
+}

+ 5 - 4
admin/control/refill_company.php

@@ -337,6 +337,7 @@ class refill_companyControl extends SystemControl
         }
         $bz = '批量打款';
 
+        $time = time();
         foreach ($params as $item)
         {
             try {
@@ -350,7 +351,7 @@ class refill_companyControl extends SystemControl
                         'bz' => $bz
                     ];
                     $this->credit_save_money($money, 'add', $providers[$pid]['account_id'], $bz);
-                    $this->ct_provider_amount($amount_data, $providers[$pid]);
+                    $this->ct_provider_amount($amount_data, $providers[$pid], $time);
                     $remit_total += $money;
                 }
                 $trans->commit();
@@ -364,13 +365,13 @@ class refill_companyControl extends SystemControl
         showMessage('操作成功!');
     }
 
-    private function ct_provider_amount($params, $provider_info)
+    private function ct_provider_amount($params, $provider_info, $time)
     {
         $input['provider_id'] = $provider_info['provider_id'];
         $input['memeber_id'] = $provider_info['account_id'];
         $input['amount'] = $params['pointsnum'];
         $input['operation'] = $params['operation'];
-        $input['add_time'] = time();
+        $input['add_time'] = $time;
         $input['bz'] = $params['bz'] ?? '';
 
         return Model('provider_amount')->addAmount($input);
@@ -458,4 +459,4 @@ class refill_companyControl extends SystemControl
         $excel_obj->addWorksheet($excel_obj->charset(L('exp_od_order'), CHARSET));
         $excel_obj->generateXML($file_name);
     }
-}
+}

+ 1 - 0
admin/include/limit.php

@@ -36,6 +36,7 @@ $_limit =  array(
         array('name'=> '通道列表', 'op'=>null, 'act'=>'provider'),
         array('name'=> '通道控制', 'op'=>null, 'act'=>'provider_ctl'),
         array('name'=> '机构通道配置', 'op'=>null, 'act'=>'refill_merchant_channel_cfg'),
+        array('name'=> '通道省份配置', 'op'=>null, 'act'=>'provider_province_cfg'),
         array('name'=> '通道组管理', 'op'=> null, 'act'=>'provider_group'),
         array('name'=> '订单监控', 'op'=>null, 'act'=>'ordersendlist'),
         array('name'=> '对账管理', 'op'=>null, 'act'=>'orderstats'),

+ 1 - 0
admin/include/menu.php

@@ -113,6 +113,7 @@ $arr = array(
 					array('args'=>'index,provider,merchant',				'text'=>'通道列表'),
 					array('args'=>'index,provider_ctl,merchant',			'text'=>'通道控制'),
 					array('args'=>'index,refill_merchant_channel_cfg,merchant',			'text'=>'机构通道配置'),
+					array('args'=>'index,provider_province_cfg,merchant',			'text'=>'通道省份配置'),
 					array('args'=>'index,provider_group,merchant',			'text'=>'通道组管理'),
 					array('args'=>'index,ordersendlist,merchant',			'text'=>'订单监控'),
 					array('args'=>'index,orderstats,merchant',				'text'=>'对账管理'),

+ 85 - 13
admin/templates/default/analysis.provider.php

@@ -16,7 +16,7 @@
     }
 
     #checkChannel tr {
-        height: 20px;
+        height: 26px;
     }
 
     #checkChannel thead tr {
@@ -153,6 +153,25 @@
                     </a>
                 </td>
             </tr>
+            <tr>
+                <td></td>
+                <td>
+                    <select name="msec">
+                        <option value="1800000">半小时</option>
+                        <option value="3600000">1小时</option>
+                        <option value="7200000">2小时</option>
+                    </select>
+                    <a href="#" class="btns time_rder" data-type='before'>
+                        <span><i class="icon-edit"></i>向前</span>
+                    </a>
+                    <a href="#" class="btns time_rder" data-type='after'>
+                        <span><i class="icon-edit"></i>向后</span>
+                    </a>
+                    <a href="#" class="btns" id="0_rder">
+                        <span><i class="icon-edit"></i>当天零点</span>
+                    </a>
+                </td>
+            </tr>
         </table>
 
         <div class="echartsContent">
@@ -208,7 +227,44 @@
         let sortType = 'ratio1';
         let pageInit = false;
 
-        const defaultChannelType = <?php echo refill\Quality::Normal; ?>;
+        // 30分钟订单
+        $('.time_rder').click(function() {
+            let date = new Date()
+            let type = $(this).data('type');
+            let msec = $("select[name=msec]").val()
+            msec = parseInt(msec);
+            let startTime = $('#startTime').val();
+            if(startTime === '') {
+                startTime = date.getTime() - 1800000
+                startTime = moment(startTime).format("YYYY-M-DD HH:mm:ss")
+            }
+            let endTime = $('#endTime').val();
+            if(endTime === '') {
+                endTime = moment(date.getTime()).format("YYYY-M-DD HH:mm:ss")
+            }
+
+            if(type === 'before')
+            {
+                startTime = Date.parse(startTime) - msec
+                endTime = Date.parse(endTime) - msec
+            }
+            else
+            {
+                startTime = Date.parse(startTime) + msec
+                endTime = Date.parse(endTime) + msec
+            }
+            let startTimeStr = moment(startTime).format("YYYY-M-DD HH:mm:ss")
+            let endtTimeStr = moment(endTime).format("YYYY-M-DD HH:mm:ss")
+            $('#startTime').val(startTimeStr)
+            $('#endTime').val(endtTimeStr)
+        });
+
+        // 当前零点钟订单
+        $('#0_rder').click(function() {
+            let str = moment().startOf('day').format('YYYY-MM-DD HH:mm:ss');
+            $('#startTime').val(str)
+            $('#endTime').val('')
+        })
 
         $.get(`index.php?act=refill_analysis&op=provider_data`, function(data) {
             data = JSON.parse(data)
@@ -223,6 +279,25 @@
             }
         })
 
+        $('.querySelect').on('change', function() {
+            const qualityType = $(this).val();
+            console.log('qualityType', $(this).val());
+            $.get(`index.php?act=refill_analysis&op=provider_data&quality=${qualityType}`, function(data) {
+                console.log('querySelectChangeData', JSON.parse(data));
+                const channeValues = [];
+                JSON.parse(data).map(item => {
+                    channeValues.push(item.value)
+                })
+                $('#checkChannelContent tr').css('display', 'none');
+                $(`tr[name = "all"]`).css('display', 'block');
+                channeValues.map(item => {
+                    $(`tr[name = "${item}"]`).css('display', 'block');
+                })
+            })
+
+        })
+
+
         function init_channels(data) {
             let result = {};
             data.map(item => {
@@ -257,7 +332,7 @@
                 if (item.name) {
                     if (sortType == 'ratio1') {
                         tableHTML += `
-                            <tr>
+                            <tr name="${item.value}">
                                 <td>
                                     <label>
                                     <input type="checkbox" name="channelValue" ${item.checked?'checked="checked"':''}  value="${item.value}" />
@@ -269,7 +344,7 @@
                         `;
                     } else {
                         tableHTML += `
-                            <tr>
+                            <tr name="${item.value}">
                                 <td>
                                     <label>
                                     <input type="checkbox" name="channelValue" ${item.checked?'checked="checked"':''}  value="${item.value}" />
@@ -334,12 +409,11 @@
             return selectStr
         }
 
-        function sortQualityTable()
-        {
+        function sortQualityTable() {
             let headers = []
             let others = qualitys
 
-            if(qualitys['all']) {
+            if (qualitys['all']) {
                 headers.push(qualitys['all'])
                 delete others['all']
             }
@@ -370,8 +444,7 @@
             formatChannelTable([...headers, ...checkedSortQualitys, ...unCheckedSortQualitys]);
         }
 
-        function updateQualityTable()
-        {
+        function updateQualityTable() {
             const allQualityList = JSON.parse(JSON.stringify(qualitys));
             Object.keys(allQualityList).map(key => {
                 allQualityList[key].checked = false;
@@ -389,7 +462,7 @@
             let end_time = parseInt((new Date(query_end_time)).getTime() / 1000);
 
             if (!start_time && !end_time) {
-                start_time = Date.parse(new Date()) / 1000 - 7200;
+                start_time = Date.parse(new Date()) / 1000 - 1800;
                 end_time = Date.parse(new Date()) / 1000;
             }
 
@@ -399,8 +472,8 @@
                     key = $(this).attr('value')
                     if (key != 'all') {
                         chnamesList.push(key)
+                        qualitys[key]['checked'] = true
                     }
-                    qualitys[key]['checked'] = true
                 }
             })
 
@@ -441,8 +514,7 @@
                 url += '&only_all=' + only_all;
             }
 
-            $.get(url, function(data)
-            {
+            $.get(url, function(data) {
                 if (data.state === 'success') {
                     $('#echart').html(`<img src='data:image/png;base64,${data.img}'/>`)
 

+ 28 - 20
admin/templates/default/arw.monitor.php

@@ -26,7 +26,6 @@
                 </td>
                 <td>
                     距上次更新时间:<span style="color: red; font-size: 16px"><?php echo $output['ago_time'];?></span>
-
                 </td>
             </tr>
             </tbody>
@@ -35,32 +34,41 @@
         <thead>
         <tr class="thead">
             <th class="align-center">服务器ip</th>
-            <th class="align-left">详细信息</th>
+            <th class="align-left">更新时间</th>
+            <th class="align-left">mnt目录</th>
+            <th class="align-left">data目录</th>
+            <th class="align-left">日志</th>
+            <th class="align-left">stdata</th>
+            <th class="align-left">data/mysqlundo</th>
+            <th class="align-left">mysql/xyzshop</th>
         </thead>
         <tbody id="tbody">
         <?php if (count($output['data']) > 0) { ?>
             <?php
             foreach ($output['data'] as $key => $value) { ?>
-                <tr class="hover trFlex" style="height: 150px;">
-                    <td class="align-center"><span style="color: red; font-size: 16px"><?php echo $key; ?></span></td>
+                <tr class="hover trFlex">
+                    <td class="align-center"><span style=" font-size: 16px"><?php echo $key; ?></span></td>
+                    <td class="align-left">
+                        <span style=" font-size: 16px"><?php echo $value['cur_time'] ?? ''; ?></span>
+                    </td>
+                    <td class="align-left">
+                        <span style=" font-size: 16px"><?php echo $value['dev/vdb1'] ?? ''; ?></span>
+                    </td>
+                    <td class="align-left">
+                        <span style=" font-size: 16px"><?php echo $value['dev/vdc1'] ?? ''; ?></span>
+                    </td>
+                    <td class="align-left">
+                        <span style=" font-size: 16px"><?php echo $value['mnt/shoplog'] ?? ''; ?></span>
+                    </td>
+                    <td class="align-left">
+                        <span style=" font-size: 16px"><?php echo $value['mnt/stdata'] ?? ''; ?></span>
+                    </td>
+                    <td class="align-left">
+                        <span style=" font-size: 16px"><?php echo $value['data/mysqlundo'] ?? ''; ?></span>
+                    </td>
                     <td class="align-left">
-                    <?php
-                        if(!empty($value)) {
-                            foreach ($value as $k => $v){
-                    ?>
-                            <span style="color: red; font-size: 16px">
-                                    <?php echo $k;?>:
-                            </span>
-                            <span style="color: green; font-size: 16px">
-                                    <?php echo $v;?>
-                            </span>
-                            <br/>
-                    <?php   }
-                        }else{
-                    ?>
-                        <span style="color: red; font-size: 16px">无统计数据</span>
+                        <span style=" font-size: 16px"><?php echo $value['mnt/mysql/xyzshop'] ?? ''; ?></span>
                     </td>
-                    <?php } ?>
                 </tr>
             <?php } ?>
         <?php } else { ?>

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

@@ -124,7 +124,7 @@ defined('InShopNC') or exit('Access Invalid!'); ?>
                                     <td class="align-right"><?php echo $v['debt']['send_amounts']; ?></td>
                                     <td class="align-right"><?php echo $v['credit_bonus']; ?></td>
 
-                                    <td class="align-right"><?php echo number_format($v['debt']['debt'],2,'.',''); ?></td>
+                                    <td class="align-right"><?php echo -1 * number_format($v['debt']['debt'],2,'.',''); ?></td>
                                     <td class="align-right"><?php echo $v['debt']['lack_amounts']; ?></td>
 
                                     <td class="align-right"><?php echo $v['alarm_amount']; ?></td>

+ 1 - 1
admin/templates/default/provider.amount.php

@@ -122,7 +122,7 @@
                         <td class="align-center">
                             <a href="index.php?act=provider&op=provider_amount_edit&amount_id=<?php echo $v['id'] ?>">编辑</a>
                             |
-                            <a href="#" class="copy" data-name="<?php echo $v['name']; ?> (<?php echo $v['store_name'];?>)" data-amount="<?php echo $v['amount']; ?>">拷贝</a>
+                            <a href="Javascript:void(0);" class="copy" data-name="<?php echo $v['name']; ?> (<?php echo $v['store_name'];?>)" data-amount="<?php echo $v['amount']; ?>">拷贝</a>
                             <?php if(!empty($v['voucher_name'])) {?>
                                 |
                                 <a target="_blank"

+ 79 - 1
admin/templates/default/refill.company.add.php

@@ -50,6 +50,7 @@
                 </td>
                 <td class="vatop tips"></td>
             </tr>
+
             <tr class="noborder">
                 <td colspan="2" class="required"><label class="validation" for="co_name">公司名称:</label></td>
             </tr>
@@ -84,7 +85,10 @@
                 <td colspan="2" class="required"><label for="max_debt">最大欠款额度:</label></td>
             </tr>
             <tr class="noborder">
-                <td class="vatop rowform"><input type="text" id="max_debt" name="max_debt" class="txt"></td>
+                <td class="vatop rowform">
+                    <input type="text" id="max_debt" name="max_debt" class="priceInput">
+                    <div id="money" style="color:red; display: inline-block" ></div>
+                </td>
                 <td class="vatop tips"></td>
             </tr>
             <tr>
@@ -221,5 +225,79 @@
                 })
             })
         }
+
+        $('.priceInput').blur(function (){
+            let money = $(this).val();
+            money = parseFloat(money)
+            if(money < 10000) {
+                $(this).next().css('color','green')
+                $(this).next().html(money)
+            }else{
+                $(this).next().css('color','red')
+                let chineseStr = cnMoneyFormat(money);
+                $(this).next().html(chineseStr)
+            }
+        })
+
+        function cnMoneyFormat(money) {
+            let number_data = money;
+            if (number_data < 0) {
+                number_data = number_data.toString();
+                let num_data = number_data.substring(1, number_data.length)
+                number_data = parseInt(num_data);
+            } else {
+                number_data = parseInt(number_data);
+            }
+            let yi = 0; //亿
+            let wan = 0; //万
+            let wan_s = 10000; //万
+            let yi_s = 100000000; //亿
+            //取整
+            function qz(data) {
+                data = Math.floor(data);
+                return data;
+            }
+
+            //为0判断输出
+            function data_if(data, amount) {
+                if (data === 0) {
+                    return '';
+                } else {
+                    return data + amount;
+                }
+            }
+
+            //亿
+            function yi_f(data) {
+                yi = qz(data / 100000000);
+                data = data - (yi * yi_s);
+                let data_json = {
+                    data1: data_if(yi, '亿'),
+                    data2: data,
+                }
+                return data_json;
+            }
+
+            //万
+            function wan_f(data) {
+                wan = qz(data / 10000);
+                data = data - (wan * wan_s);
+                let data_json = {
+                    data1: data_if(wan, '万'),
+                    data2: data,
+                }
+                return data_json;
+            }
+
+            yi = yi_f(number_data);
+            number_data = yi.data2;
+            wan = wan_f(number_data);
+            number_data = wan.data2;
+            let result = yi.data1 + wan.data1;
+            if (result === 0) {
+                return ''
+            }
+            return result
+        }
     });
 </script>

+ 78 - 1
admin/templates/default/refill.company.edit.php

@@ -98,7 +98,10 @@
                 <td colspan="2" class="required"><label for="max_debt">最大欠款额度:</label></td>
             </tr>
             <tr class="noborder">
-                <td class="vatop rowform"><input type="text" id="max_debt" name="max_debt" value="<?php echo $output['company_info']['max_debt']; ?>" class="txt"></td>
+                <td class="vatop rowform">
+                    <input type="text" id="max_debt" name="max_debt" value="<?php echo $output['company_info']['max_debt']; ?>" class="priceInput">
+                    <div id="money" style="color:red; display: inline-block" ></div>
+                </td>
                 <td class="vatop tips"></td>
             </tr>
             <tr>
@@ -251,5 +254,79 @@
                 })
             })
         }
+
+        $('.priceInput').blur(function (){
+            let money = $(this).val();
+            money = parseFloat(money)
+            if(money < 10000) {
+                $(this).next().css('color','green')
+                $(this).next().html(money)
+            }else{
+                $(this).next().css('color','red')
+                let chineseStr = cnMoneyFormat(money);
+                $(this).next().html(chineseStr)
+            }
+        })
+
+        function cnMoneyFormat(money) {
+            let number_data = money;
+            if (number_data < 0) {
+                number_data = number_data.toString();
+                let num_data = number_data.substring(1, number_data.length)
+                number_data = parseInt(num_data);
+            } else {
+                number_data = parseInt(number_data);
+            }
+            let yi = 0; //亿
+            let wan = 0; //万
+            let wan_s = 10000; //万
+            let yi_s = 100000000; //亿
+            //取整
+            function qz(data) {
+                data = Math.floor(data);
+                return data;
+            }
+
+            //为0判断输出
+            function data_if(data, amount) {
+                if (data === 0) {
+                    return '';
+                } else {
+                    return data + amount;
+                }
+            }
+
+            //亿
+            function yi_f(data) {
+                yi = qz(data / 100000000);
+                data = data - (yi * yi_s);
+                let data_json = {
+                    data1: data_if(yi, '亿'),
+                    data2: data,
+                }
+                return data_json;
+            }
+
+            //万
+            function wan_f(data) {
+                wan = qz(data / 10000);
+                data = data - (wan * wan_s);
+                let data_json = {
+                    data1: data_if(wan, '万'),
+                    data2: data,
+                }
+                return data_json;
+            }
+
+            yi = yi_f(number_data);
+            number_data = yi.data2;
+            wan = wan_f(number_data);
+            number_data = wan.data2;
+            let result = yi.data1 + wan.data1;
+            if (result === 0) {
+                return ''
+            }
+            return result
+        }
     });
 </script>

+ 398 - 0
admin/templates/default/refill.provider.province.cfg.php

@@ -0,0 +1,398 @@
+<link href="<?php echo ADMIN_TEMPLATES_URL; ?>/css/recharge.css?<?php echo rand(1, 10); ?>" rel="stylesheet" type="text/css" id="cssfile2" />
+<style>
+    .batch {
+        vertical-align: middle;
+        display: inline-block;
+        *display: inline
+            /*IE7*/
+        ;
+        margin-left: 4px;
+        position: relative;
+        z-index: 1;
+        *zoom: 1
+            /*IE7*/
+        ;
+    }
+
+    .batch i {
+        cursor: pointer;
+    }
+
+    .batch-input {
+        background-color: #FFF;
+        white-space: nowrap;
+        padding: 4px 9px;
+        border: solid 1px #BCE8F1;
+        position: absolute;
+        z-index: 1;
+        bottom: -75px;
+        left: -88px;
+        box-shadow: 3px 3px 0 rgba(153, 153, 153, 0.25);
+    }
+
+    .batch-input h6 {
+        font-size: 12px;
+        color: #555;
+    }
+
+    .batch-input .text {
+        vertical-align: middle;
+        clear: both;
+        padding: 0 4px;
+        vertical-align: middle;
+        margin-right: 4px;
+    }
+
+    .batch-input .arrow {
+        background: url(<?php echo SHOP_SITE_URL; ?>/templates/default/images/seller/ncsc_bg_img.png) no-repeat -240px -20px;
+        display: block;
+        width: 10px;
+        height: 5px;
+        margin-left: 1px;
+        top: -5px;
+        left: 50%;
+        position: absolute;
+        z-index: 2;
+        transform: rotate(180deg);
+    }
+
+    .batch-input a.close {
+        font-size: 11px;
+        line-height: 12px;
+        color: #BCE8F1;
+        text-decoration: none;
+        background-color: #FFF;
+        text-align: center;
+        display: block;
+        width: 12px;
+        height: 12px;
+        border-radius: 7px;
+        border: solid 1px #BCE8F1;
+        top: -7px;
+        right: -7px;
+        position: absolute;
+        z-index: 2;
+    }
+
+    .text.price {
+        width: 40px;
+    }
+
+    .text.pricee {
+        width: 40px;
+    }
+
+    .fixed-bar {
+        width: 100%;
+    }
+
+    #price_table {
+        table-layout: fixed;
+        width: 100%;
+        height: calc(100vh - 212px);
+        overflow: auto;
+        display: block;
+        margin-top: 80px;
+        border-bottom: 1px dotted #CBE9F3;
+    }
+
+    #price_table tr th:first-child {
+        position: sticky;
+        top: 0;
+        left: 0;
+        background: #fff;
+        box-shadow: 2px 0 2px rgb(0 0 0 / 10%);
+        z-index: 11;
+    }
+
+    #price_table tr:first-child {
+        position: sticky;
+        top: 0;
+        z-index: 11;
+        background: #fff;
+    }
+
+    /* #price_table tr:nth-child(2) {
+        position: sticky;
+        top: 41px;
+        z-index: 11;
+        background: #fff;
+    } */
+
+    #price_table tr td:first-child {
+        display: block;
+        position: sticky;
+        left: 0;
+        box-shadow: 2px 0 2px rgb(0 0 0 / 10%);
+        z-index: 10;
+    }
+
+    #price_table tbody tr:hover .batch-td {
+        background: #cbe9f3 !important;
+    }
+
+    .provider_amount_control .batch-td {
+        width: 45px !important;
+        min-width: 45px !important;
+        padding: 0 !important;
+    }
+
+    .tb-type2 th {
+        transform: scale(0.9);
+        line-height: 1.2 !important;
+    }
+
+    .table th,
+    .table td {
+        padding: 2px !important;
+    }
+
+    #price_table tr:nth-child(2) td {
+        border: none;
+    }
+</style>
+<?php defined('InShopNC') or exit('Access Invalid!'); ?>
+<div class="page provider_amount_control">
+    <div class="fixed-bar">
+        <div class="item-title">
+            <h3>通道省份配置</h3>
+            <ul class="tab-base">
+                <li><a href="index.php?act=provider_province_cfg&op=index&card_type=<?php echo mtopcard\ChinaMobileCard; ?>" class="classA" data-type="<?php echo mtopcard\ChinaMobileCard; ?>"><span>移动省份控制</span></a></li>
+                <li><a href="index.php?act=provider_province_cfg&op=index&card_type=<?php echo mtopcard\ChinaUnicomCard; ?>" class="classA" data-type="<?php echo mtopcard\ChinaUnicomCard; ?>"><span>联通省份控制</span></a></li>
+                <li><a href="index.php?act=provider_province_cfg&op=index&card_type=<?php echo mtopcard\ChinaTelecomCard; ?>" class="classA" data-type="<?php echo mtopcard\ChinaTelecomCard; ?>"><span>电信省份控制</span></a></li>
+            </ul>
+        </div>
+    </div>
+    <div class="fixed-empty"></div>
+    <form id="province_form" enctype="multipart/form-data" method="post">
+        <input type="hidden" name="form_submit" value="ok" />
+        <table class="table tb-type2 tableFixed">
+            <tbody class="tbody">
+                <tr>
+                    <td colspan="2" class="required"><label>通道省份配置:</label></td>
+                </tr>
+                <tr class="noborder">
+                    <table class="table tb-type2" id="price_table">
+                        <tbody class="tbody tableContent">
+                            <tr style="box-shadow:0 2px 2px rgba(0,0,0,0.1)">
+                                <th class="align-center w130 mw130" style="transform: scale(1);">通道名称</th>
+                                <th>
+                                    <span style="color: #48975A">
+                                        全国
+                                    </span>
+                                </th>
+                                <?php foreach ($output['province_list'] as $k => $province) { ?>
+                                    <th class="align-center" style="vertical-align: top;">
+<!--                                        <div><input type="checkbox" name="chbox" value="" class="checkAllCol" data-index="--><?php //echo $k; ?><!--"></div>-->
+                                        <span style="color: #48975A">
+                                            <?php echo $province; ?>
+                                        </span>
+
+                                    </th>
+                                <?php } ?>
+                            </tr>
+                            <?php foreach ($output['provider_list'] as $key => $provider) { ?>
+                                <tr class="w500 trFlex">
+                                    <td style="white-space: nowrap;display: flex;align-items: center;" class="tbFlex">
+                                        <span style="color: #48975A">
+                                            <?php echo "{$provider['store_name']}-({$provider['name']})-{$provider['provider_id']}"; ?>
+                                        </span>
+                                    </td>
+                                    <td class="batch-td">
+                                        <input type="checkbox" name="items[<?php echo $provider['provider_id'] ?>]" class="checkAllRow" value="-1" <?php
+                                                                                                                                                    if (!empty($output['province_cfg']) && array_key_exists($provider['provider_id'], $output['province_cfg']) && in_array('-1', $output['province_cfg'][$provider['provider_id']])) {
+                                                                                                                                                        echo 'checked';
+                                                                                                                                                    }
+                                                                                                                                                    ?> />
+                                    </td>
+                                    <?php foreach ($output['province_list'] as $pk => $province_value) { ?>
+                                        <td class="batch-td">
+                                            <input type="checkbox" class="cellCheckBox cellCheckBox-<?php echo $key ?>" id="checkBoxList" name="items[<?php echo $provider['provider_id'] ?>][]" value="<?php echo $pk; ?>" <?php
+                                                                                                                                                                                                                            if (!empty($output['province_cfg']) && array_key_exists($provider['provider_id'], $output['province_cfg']) && in_array($pk, $output['province_cfg'][$provider['provider_id']])) {
+                                                                                                                                                                                                                                echo 'checked';
+                                                                                                                                                                                                                            }
+                                                                                                                                                                                                                            ?>>
+                                        </td>
+                                    <?php } ?>
+                                </tr>
+                            <?php } ?>
+                        </tbody>
+                    </table>
+                </tr>
+            </tbody>
+            <tfoot>
+                <tr class="tfoot">
+                    <td colspan="15"><a href="JavaScript:void(0);" class="btn" style="margin-top: 15px" id="submitBtn"><span><?php echo $lang['nc_submit']; ?></span></a></td>
+                </tr>
+            </tfoot>
+        </table>
+    </form>
+</div>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/dialog/dialog.js" id="dialog_js" charset="utf-8"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/jquery.ui.js"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/ajaxfileupload/ajaxfileupload.js"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.Jcrop/jquery.Jcrop.js"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/refill/layer.js"></script>
+<link href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.Jcrop/jquery.Jcrop.min.css" rel="stylesheet" type="text/css" id="cssfile2" />
+<script type="text/javascript">
+    $(function() {
+        // 开始获取当前卡类型
+        let type = '<?php echo $_GET['card_type'] ?? mtopcard\ChinaMobileCard; ?>';
+        $(".classA").each(function() {
+            if (type === $(this).attr("data-type")) {
+                $(this).addClass('current')
+                $(this).attr('href', 'JavaScript:void(0);')
+            }
+        })
+
+        // 提交
+        $("#submitBtn").click(function() {
+            console.log('#submitBtn', $("#province_form").serializeArray())
+            $("#province_form").submit();
+        })
+
+        // tab样式
+        $(".tab-base a").click(function() {
+            $(this).addClass('current')
+            $(this).siblings().removeClass('current')
+        })
+        // 表格hover时背景
+        $('#price_table td').each(function() {
+            let colorIndex = $(this).attr('data-color')
+            const colorArr = ['#fff', '#f1dde6', '#c8c6f3', '#fff', '#f1dde6', '#c8c6f3', '#f2f3c6', '#fff'];
+            if (colorArr[colorIndex]) {
+                $(this).css('background', colorArr[colorIndex]);
+            } else {
+                $(this).css('background', '#fff');
+            }
+
+            // if (color == 4 || color == 1) {
+            //     $(this).css('background', '#f1dde6')
+            // } else if (color == 5 || color == 2) {
+            //     $(this).css('background', '#c8c6f3')
+            // } else if (color == 6) {
+            //     $(this).css('background', '#f2f3c6')
+            // } else {
+            //     $(this).css('background', '#fff')
+            // }
+        })
+
+
+        // 批量设置开关
+        $('.batch > .icon-edit').click(function() {
+            $('.batch > .batch-input').hide();
+            $(this).next().show();
+        });
+        $('.batch-input > .close').click(function() {
+            $(this).parent().hide();
+        });
+        $('.price').change(function() {
+            let val = $(this).val()
+            if (val != '1' && val != '0') {
+                layer.msg('开关只能设置0或1');
+            }
+        })
+        // 点击设置
+        $('.ncsc-btn-mini').click(function() {
+            let price = $(this).siblings('.price').val()
+            if (price != '1' && price != '0') {
+                layer.msg('开关只能设置0或1');
+                return
+            }
+            var lie = $(this).parents('.batch-td').prevAll().length
+            $('.input-three').each(function() {
+                let tdCon = $(this).parents('td').prevAll().length / 2
+                let readOnly = $(this).attr('readOnly')
+                if (lie == tdCon && !readOnly) {
+                    $(this).val(price)
+                }
+            })
+
+        })
+        // 单量设置开关
+        $('.batch > .icon-edit').click(function() {
+            $('.batch > .batch-input').hide();
+            $(this).next().show();
+        });
+        $('.batch-input > .close').click(function() {
+            $(this).parent().hide();
+        });
+        $('.pricee').change(function() {
+            let val = $(this).val()
+            if (val <= -2) {
+                layer.msg('单量只能设置大于-1');
+            }
+        })
+        // 点击设置
+        $('.ncsc-btn-quantity').click(function() {
+            let quantity = $(this).siblings('.quantity').val()
+            if (quantity <= -2) {
+                layer.msg('单量只能设置大于-1');
+                return
+            }
+            let lie = $(this).parents('.batch-td').prevAll().length;
+            $('.input-one').each(function(index, item) {
+                let tdCon = $(this).parents('td').prevAll().length / 2
+                let readOnly = $(this).attr('readOnly')
+                if (lie == tdCon && !readOnly) {
+                    $(this).val(quantity)
+                }
+            })
+        })
+
+        $('.checkAllCol').click(function() {
+            const index = $(this).attr('data-index');
+            const batchTd = $('.trFlex').find('.batch-td');
+
+            console.log('checkAllCol', $('.trFlex'));
+            if ($(this).is(':checked')) {
+                for (let i = 0; i < $('.trFlex').length; i++) {
+                    $('.trFlex').eq(i).find('.batch-td').eq(index).find('input').attr('checked', true)
+                }
+            } else {
+                for (let i = 0; i < $('.trFlex').length; i++) {
+                    $('.trFlex').eq(i).find('.batch-td').eq(index).find('input').attr('checked', false)
+                }
+            }
+
+        })
+
+        $('.batch-td').mouseenter(function() {
+            const index = $(this).index() - 1;
+            for (let i = 0; i < $('.trFlex').length; i++) {
+                $('.trFlex').eq(i).find('.batch-td').eq(index).css('background', '#cbe9f3')
+            }
+        })
+
+        $('.batch-td').mouseleave(function() {
+            const index = $(this).index() - 1;
+            for (let i = 0; i < $('.trFlex').length; i++) {
+                $('.trFlex').eq(i).find('.batch-td').eq(index).css('background', '')
+            }
+        })
+
+
+
+        $('.checkAllRow').click(function() {
+            if ($(this).is(':checked')) {
+                $(this).parent().siblings('td').find('.cellCheckBox').attr({
+                    'disabled': 'disabled',
+                    'checked': false
+                })
+            } else {
+                $(this).parent().siblings('td').find('.cellCheckBox').removeAttr('disabled');
+            }
+
+        })
+
+        for (let i = 0; i < $('.checkAllRow').length; i++) {
+            if ($('.checkAllRow').eq(i).is(':checked')) {
+                $('.checkAllRow').eq(i).parent().siblings('td').find('.cellCheckBox').attr({
+                    'disabled': 'disabled',
+                    'checked': false
+                })
+            }
+        }
+
+    });
+</script>

+ 9 - 0
core/framework/cache/cache.redis.php

@@ -359,6 +359,15 @@ class Cacheredis extends Cache
         return $this->handler->keys($this->_key($key, $prefix));
     }
 
+    public function hkeys($key = '',$prefix = '')
+    {
+        $this->init_slave();
+        if(!isset($key) || empty($key)) {
+            $key = '*';
+        }
+        return $this->handler->hkeys($this->_key($key, $prefix));
+    }
+
     public function del($key)
     {
         $this->init_master();

+ 5 - 5
core/framework/libraries/log.php

@@ -146,11 +146,14 @@ class Log
             if($this->mOpenAll) $this->write_all($content);
         }
 
-        if ($lev == self::ERR) {
+        if ($lev == self::ERR)
+        {
             $msg = $this->msg();
             $content = $this->format_msg($msg,$slevel);
             $this->write($content);
-            if($this->mOpenAll) $this->write_all($content);
+            if($this->mOpenAll) {
+                $this->write_all($content);
+            }
         }
     }
 
@@ -202,9 +205,6 @@ class Log
             fwrite($this->mAppFile, $content);
             fflush($this->mAppFile);
         }
-        else {
-            exit();
-        }
     }
 
     private function write_all($content)

+ 43 - 19
core/framework/libraries/model.php

@@ -176,9 +176,10 @@ class Model
 
     public function __call($method,$args) 
     {
-        if(in_array(strtolower($method), ['table','order','where','on','limit','having','group','lock','master','distinct','index','attr','key'],true))
+//        Log::record("method={$method}, args={$args[0]}",Log::DEBUG);
+        if(in_array(strtolower($method), ['table','partition','order','where','on','limit','having','group','lock','master','distinct','index','attr','key'],true))
         {
-            $this->options[strtolower($method)] =   $args[0];
+            $this->options[strtolower($method)] = $args[0];
             if (strtolower($method) == 'table')
             {
             	if (strpos($args[0],',') !== false)
@@ -775,7 +776,7 @@ class ModelDb
         'not in'=>'NOT IN'];
     
     // 查询表达式
-    protected $selectSql = 'SELECT%DISTINCT% %FIELD% FROM %TABLE%%INDEX%%JOIN%%WHERE%%GROUP%%HAVING%%ORDER%%LIMIT% %UNION%';
+    protected $selectSql = 'SELECT%DISTINCT% %FIELD% FROM %TABLE%%PARTITION%%INDEX%%JOIN%%WHERE%%GROUP%%HAVING%%ORDER%%LIMIT% %UNION%';
 
     public function select($options= [])
     {
@@ -821,21 +822,24 @@ class ModelDb
 
     public function parseSql($sql,$options= [])
     {
-        $sql   = str_replace(
-            ['%TABLE%','%DISTINCT%','%FIELD%','%JOIN%','%WHERE%','%GROUP%','%HAVING%','%ORDER%','%LIMIT%','%UNION%','%INDEX%'],
-            [
-                $this->parseTable($options),
-                $this->parseDistinct(isset($options['distinct']) ? $options['distinct'] : false),
-                $this->parseField(isset($options['field']) ? $options['field'] : '*'),
-                $this->parseJoin(isset($options['on']) ? $options : []),
-                $this->parseWhere(isset($options['where']) ? $options['where'] : ''),
-                $this->parseGroup(isset($options['group']) ? $options['group'] : ''),
-                $this->parseHaving(isset($options['having']) ? $options['having'] : ''),
-                $this->parseOrder(isset($options['order']) ? $options['order'] : ''),
-                $this->parseLimit(isset($options['limit']) ? $options['limit'] : ''),
-                $this->parseUnion(isset($options['union']) ? $options['union'] : ''),
-                $this->parseIndex(isset($options['index']) ? $options['index'] : '')
-            ],$sql);
+//        Log::record("sql={$sql}", Log::DEBUG);
+        $fields = [
+            $this->parseTable($options),
+            $this->parseDistinct($options['distinct'] ?? false),
+            $this->parseField(isset($options['field']) ? $options['field'] : '*'),
+            $this->parseJoin(isset($options['on']) ? $options : []),
+            $this->parseWhere(isset($options['where']) ? $options['where'] : ''),
+            $this->parseGroup(isset($options['group']) ? $options['group'] : ''),
+            $this->parseHaving(isset($options['having']) ? $options['having'] : ''),
+            $this->parseOrder(isset($options['order']) ? $options['order'] : ''),
+            $this->parseLimit(isset($options['limit']) ? $options['limit'] : ''),
+            $this->parseUnion(isset($options['union']) ? $options['union'] : ''),
+            $this->parseIndex(isset($options['index']) ? $options['index'] : ''),
+            $this->parsePartition(isset($options['partition']) ? $options['partition'] : ''),
+        ];
+
+        $sql = str_replace(['%TABLE%', '%DISTINCT%', '%FIELD%', '%JOIN%', '%WHERE%', '%GROUP%', '%HAVING%', '%ORDER%', '%LIMIT%', '%UNION%', '%INDEX%','%PARTITION%'],
+            $fields, $sql);
         return $sql;
     }
 
@@ -852,6 +856,24 @@ class ModelDb
 		return empty($value) ? '':' USE INDEX ('.$value.') ';
 	}
 
+    protected function parsePartition($value)
+    {
+        if(empty($value)) {
+            return '';
+        }
+        elseif(is_string($value)) {
+            return ' PARTITION (' . $value . ') ';
+        }
+        elseif (is_array($value))
+        {
+            $spart = implode(',', $value);
+            return ' PARTITION (' . $spart . ') ';
+        }
+        else {
+            return '';
+        }
+    }
+
     protected function parseValue($value) 
     {
         //|| is_numeric($value)
@@ -1130,6 +1152,7 @@ class ModelDb
     {
         $sql   = 'DELETE '.$this->parseAttr($options).' FROM '
             .$this->parseTable($options)
+            .$this->parsePartition(isset($options['partition'])?$options['partition']:'')
             .$this->parseWhere(isset($options['where'])?$options['where']:'')
             .$this->parseOrder(isset($options['order'])?$options['order']:'')
             .$this->parseLimit(isset($options['limit'])?$options['limit']:'');
@@ -1146,6 +1169,7 @@ class ModelDb
         $sql   = 'UPDATE '
         	.$this->parseAttr($options)
             .$this->parseTable($options)
+            .$this->parsePartition(isset($options['partition'])?$options['partition']:'')
             .$this->parseSet($data)
             .$this->parseWhere(isset($options['where'])?$options['where']:'')
             .$this->parseOrder(isset($options['order'])?$options['order']:'')
@@ -1289,7 +1313,7 @@ class ModelDb
         return $str;
     }
 
-    protected function parseKey(&$key) {
+    protected function parseKey($key) {
         return $key;
     }
 

+ 30 - 4
crontab/control/minutes.php

@@ -487,13 +487,35 @@ class minutesControl extends BaseCronControl
 
     private function _calc_arrears()
     {
-        $send_amount_reader = function()
-        {
+        $send_amount_reader = function () {
             $val = rkcachex('stat-merchant-sendamount', 'refill-');
-            $val = json_decode($val,true);
+            $val = json_decode($val, true);
             return $val;
         };
 
+        $del_stop = function ($amounts)
+        {
+            $ins = Cache::getInstance('cacheredis');
+            $items = $ins->hkeys('merchant-debts-detail','refill-');
+            if(empty($items)) {
+                return;
+            }
+
+            $keys = [];
+            foreach ($items as $key) {
+                $keys[] = intval($key);
+            }
+
+            foreach ($keys as $mchid)
+            {
+                if(array_key_exists($mchid,$amounts)) {
+                    continue;
+                } else {
+                    $ins->hdel('merchant-debts-detail','refill-',$mchid);
+                }
+            }
+        };
+
         $debts_detail_fun = function ($amounts)
         {
             $debts_detail = [];
@@ -525,8 +547,9 @@ class minutesControl extends BaseCronControl
                         $send_amounts = 0;
                         $lack_amounts = 0;
                     }
+                    Log::record("co_id={$co_id} mchid={$mchid} send_amounts={$send_amounts} lack_amounts={$lack_amounts}",Log::DEBUG);
 
-                    $available = $available_predeposit - $credit_bonus + $send_amounts - $lack_amounts;
+                    $available = $available_predeposit - $credit_bonus + $send_amounts;// - $lack_amounts;
                     $debt = -$available;
                     $debts_detail[$co_id][$mchid] = $debt;
 
@@ -616,12 +639,15 @@ class minutesControl extends BaseCronControl
         };
 
         $result = $send_amount_reader();
+        $del_stop($result);
+
         if (!empty($result) && $need_calc(intval($result['time']))) {
             $mch_amounts = $result['send_amounts'];
             $debts_detail = $debts_detail_fun($mch_amounts);
             $co_debts = $company_debt_fun();
             $judge_stop($co_debts, $debts_detail);
         }
+
     }
 
     /**

+ 2 - 2
data/config/win/base.ini.php

@@ -10,13 +10,13 @@ define('BONUS_EXPIRY_DATE',true);
 define('USE_BONUS_RATE',false);
 define('SERVER_TYPE','panda');
 define('CROSS_DOAMIN',true);
-define('COOKIE_DOMAIN','192.168.3.218');
+define('COOKIE_DOMAIN','192.168.1.218');
 define('COMPANY_NAME', 'XYZ_COMPANY');
 define('NET_IP','123.117.109.96');
 define('ZERO_GOODS_ID', 6666);
 define('ADMIN_NAME', 'YELIN');
 
-$SRV_HOST = 'http://192.168.3.218';
+$SRV_HOST = 'http://192.168.1.218';
 $REMOTE_IMG_HOST = $SRV_HOST;
 
 $config = [];

File diff suppressed because it is too large
+ 705 - 188
data/config/xyz/refill.ini.php


+ 432 - 157
data/config/yl/refill.ini.php

@@ -230,6 +230,17 @@ $xunyin_kami_oil = ['name' => 'xunyin_kami', 'store_id' => 228, 'qualitys' => '3
     ],
     'period' => [], 'refill_type' => 'api'];
 
+$jumi_sec_oil = ['name' => 'jumi_sec', 'store_id' => 257,'qualitys' => '5',
+    'amount' => [
+//        50 => [['goods_id' => 8139, 'price' => 49.35, 'quality' => 5, 'card_type' => 'sinopec']],
+        100 => [['goods_id' => 8140, 'price' => 98.7, 'quality' => 5, 'card_type' => 'sinopec']],
+        200 => [['goods_id' => 8141, 'price' => 197.4, 'quality' => 5, 'card_type' => 'sinopec']],
+        500 => [['goods_id' => 8142, 'price' => 493.5, 'quality' => 5, 'card_type' => 'sinopec']],
+        1000 => [['goods_id' => 8143, 'price' => 987, 'quality' => 5, 'card_type' => 'sinopec']],
+//        2000 => [['goods_id' => 8144, 'price' => 1974, 'quality' => 5, 'card_type' => 'sinopec']]
+    ],
+    'period' => [], 'refill_type' => 'api'];
+
 $oil_providers = [
 //    ['name' => 'tianjt', 'cfg' => $tianjt_oil],
 //    ['name' => 'suhctm', 'cfg' => $suhctm_oil],
@@ -251,6 +262,7 @@ $oil_providers = [
 //    ['name' => 'xunyinoil', 'cfg' => $xunyinoil_oil],
 //    ['name' => 'menggu', 'cfg' => $menggu_oil]
     ['name' => 'xunyin_kami', 'cfg' => $xunyin_kami_oil],
+    ['name' => 'jumi_sec', 'cfg' => $jumi_sec_oil],
 
 ];
 $config['oil_providers'] = $oil_providers;
@@ -1648,31 +1660,31 @@ $hongxudagy_phone = ['name' => 'hongxudagy', 'store_id' => 86, 'qualitys' => '2'
 
 $yunchonggong_phone = ['name' => 'yunchonggong', 'store_id' => 87,'qualitys' => '1',
     'amount' => [
-//        10 => [
-//            ['goods_id' => 6797, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinamobile'],
+        10 => [
+            ['goods_id' => 6797, 'price' => 9.7, 'quality' => 1, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 6797, 'price' => 9.47, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
-//        ],
-//        20 => [
-//            ['goods_id' => 6798, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinamobile'],
+        ],
+        20 => [
+            ['goods_id' => 6798, 'price' => 19.4, 'quality' => 1, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 6798, 'price' => 18.94, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
-//        ],
+        ],
         30 => [
-            ['goods_id' => 6799, 'price' => 28.8, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6799, 'price' => 28.95, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6799, 'price' => 28.35, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6799, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         50 => [
-            ['goods_id' => 6800, 'price' => 48, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6800, 'price' => 48.25, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6800, 'price' => 47.25, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6800, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
-            ['goods_id' => 6801, 'price' => 96, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6801, 'price' => 96.5, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6801, 'price' => 94.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6801, 'price' => 95, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 6802, 'price' => 192, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6802, 'price' => 193, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6802, 'price' => 189, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6802, 'price' => 190, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
@@ -3445,39 +3457,39 @@ $yiqian_phone = ['name' => 'yiqian', 'store_id' => 158,'qualitys' => '2',
         ],
 
         30 => [
-//            ['goods_id' => 7335, 'price' => 30.3, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7335, 'price' => 30.69, 'quality' => 2, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 7335, 'price' => 30.12, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 7335, 'price' => 30.648, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         50 => [
-//            ['goods_id' => 7336, 'price' => 49.925, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7336, 'price' => 51.15, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 7336, 'price' => 49.975, 'quality' => 2, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7336, 'price' => 49.925, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7336, 'price' => 50.5, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         100 => [
-            ['goods_id' => 7337, 'price' => 100.07, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7337, 'price' => 102.3, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 7337, 'price' => 99.95, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7337, 'price' => 100.1, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7337, 'price' => 101.6, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         200 => [
-            ['goods_id' => 7338, 'price' => 200.14, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7338, 'price' => 204.6, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 7338, 'price' => 199.9, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7338, 'price' => 200.2, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7338, 'price' => 201.2, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         300 => [
-            ['goods_id' => 7339, 'price' => 300.21, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7339, 'price' => 306.9, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 7339, 'price' => 299.85, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7339, 'price' => 300.3, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7339, 'price' => 301.8, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         500 => [
-            ['goods_id' => 7340, 'price' => 500.35, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7340, 'price' => 511.5, 'quality' => 2, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 7340, 'price' => 500.75, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7340, 'price' => 500.5, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7340, 'price' => 503, 'quality' => 2, 'card_type' => 'chinatelecom']
         ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
@@ -3937,45 +3949,45 @@ $cangbu_high_phone = ['name' => 'cangbu_high', 'store_id' => 168, 'qualitys' =>
 $ruixunda_phone = ['name' => 'ruixunda', 'store_id' => 169, 'qualitys' => '1',
     'amount' => [
         10 => [
-//            ['goods_id' => 7439, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7439, 'price' => 9.05, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7439, 'price' => 9.55, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7439, 'price' => 9.05, 'quality' => 1, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7439, 'price' => 9.45, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         20 => [
-//            ['goods_id' => 7440, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7440, 'price' => 18.1, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7440, 'price' => 19.1, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7440, 'price' => 18.1, 'quality' => 1, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7440, 'price' => 18.9, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         30 => [
             ['goods_id' => 7441, 'price' => 28.8, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7441, 'price' => 27.15, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7441, 'price' => 27.51, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 7441, 'price' => 28.44, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         50 => [
             ['goods_id' => 7442, 'price' => 48, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7442, 'price' => 45.25, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7442, 'price' => 47.4, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7442, 'price' => 45.85, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7442, 'price' => 48.25, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
             ['goods_id' => 7443, 'price' => 96, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7443, 'price' => 90.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7443, 'price' => 94.8, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7443, 'price' => 91.7, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7443, 'price' => 96.5, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
             ['goods_id' => 7444, 'price' => 192, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7444, 'price' => 181, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7444, 'price' => 189.6, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7444, 'price' => 183.4, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7444, 'price' => 193, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
-        300 => [
+//        300 => [
 //            ['goods_id' => 7445, 'price' => 288, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7445, 'price' => 271.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7445, 'price' => 271.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7445, 'price' => 283.5, 'quality' => 1, 'card_type' => 'chinatelecom']
-        ],
-        500 => [
+//        ],
+//        500 => [
 //            ['goods_id' => 7446, 'price' => 480, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7446, 'price' => 452.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7446, 'price' => 452.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7446, 'price' => 472.5, 'quality' => 1, 'card_type' => 'chinatelecom']
-        ],
+//        ],
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
@@ -4273,35 +4285,35 @@ $baixuannew_normal_phone = ['name' => 'baixuannew_normal', 'store_id' => 178,'qu
 
 $youhenew_phone = ['name' => 'youhenew', 'store_id' => 179,'qualitys' => '1',
     'amount' => [
-//        10 => [
-//            ['goods_id' => 7512, 'price' => 9.58, 'quality' => 1, 'card_type' => 'chinamobile'],
+        10 => [
+            ['goods_id' => 7512, 'price' => 9.75, 'quality' => 1, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 7512, 'price' => 9.53, 'quality' => 1, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7512, 'price' => 9.53, 'quality' => 1, 'card_type' => 'chinatelecom']
-//        ],
-//        20 => [
-//            ['goods_id' => 7513, 'price' => 19.16, 'quality' => 1, 'card_type' => 'chinamobile'],
+        ],
+        20 => [
+            ['goods_id' => 7513, 'price' => 19.5, 'quality' => 1, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 7513, 'price' => 19.06, 'quality' => 1, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7513, 'price' => 19.06, 'quality' => 1, 'card_type' => 'chinatelecom']
-//        ],
+        ],
         30 => [
-//            ['goods_id' => 7514, 'price' => 28.74, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7514, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7514, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7514, 'price' => 28.86, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7514, 'price' => 28.14, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7514, 'price' => 28.71, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         50 => [
-            ['goods_id' => 7515, 'price' => 47.9, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7515, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7515, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7515, 'price' => 48.1, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7515, 'price' => 46.9, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7515, 'price' => 48.75, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
-            ['goods_id' => 7516, 'price' => 95.8, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7516, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7516, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7516, 'price' => 96.2, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7516, 'price' => 93.8, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7516, 'price' => 97.5, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 7517, 'price' => 191.6, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7517, 'price' => 190.6, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7517, 'price' => 190.6, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7517, 'price' => 192.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7517, 'price' => 187.6, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7517, 'price' => 195, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
 //        300 => [
 //            ['goods_id' => 7518, 'price' => 287.4, 'quality' => 1, 'card_type' => 'chinamobile'],
@@ -4509,34 +4521,34 @@ $tianchen_phone = ['name' => 'tianchen', 'store_id' => 184,'qualitys' => '2',
 //            ['goods_id' => 7562, 'price' => 20.04, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         30 => [
-//            ['goods_id' => 7563, 'price' => 30.06, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7563, 'price' => 30.06, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 7563, 'price' => 30.06, 'quality' => 2, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7563, 'price' => 30.06, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         50 => [
-//            ['goods_id' => 7564, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7564, 'price' => 51, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 7564, 'price' => 50.05, 'quality' => 2, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7564, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7564, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         100 => [
-            ['goods_id' => 7565, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7565, 'price' => 102, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 7565, 'price' => 100.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7565, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7565, 'price' => 100.8, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 7566, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7566, 'price' => 204, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 7566, 'price' => 200.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7566, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7566, 'price' => 200.6, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         300 => [
-            ['goods_id' => 7567, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7567, 'price' => 306, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 7567, 'price' => 300.3, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7567, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7567, 'price' => 300.9, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         500 => [
-            ['goods_id' => 7568, 'price' => 501, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7568, 'price' => 510, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 7568, 'price' => 501, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7568, 'price' => 501, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7568, 'price' => 501.5, 'quality' => 2, 'card_type' => 'chinatelecom']
         ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
@@ -6054,44 +6066,44 @@ $huoshenguo_yd_phone = ['name' => 'huoshenguo_yd', 'store_id' => 225, 'qualitys'
 
 $xinruiheng_phone = ['name' => 'xinruiheng', 'store_id' => 226, 'qualitys' => '1',
     'amount' => [
-//        10 => [
-//            ['goods_id' => 7898, 'price' => 9.66, 'quality' => 1, 'card_type' => 'chinamobile'],
+        10 => [
+            ['goods_id' => 7898, 'price' => 9.7, 'quality' => 1, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 7898, 'price' => 9.45, 'quality' => 1, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7898, 'price' => 9.47, 'quality' => 1, 'card_type' => 'chinatelecom']
-//        ],
-//        20 => [
-//            ['goods_id' => 7899, 'price' => 19.32, 'quality' => 1, 'card_type' => 'chinamobile'],
+        ],
+        20 => [
+            ['goods_id' => 7899, 'price' => 19.4, 'quality' => 1, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 7899, 'price' => 18.9, 'quality' => 1, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7899, 'price' => 18.94, 'quality' => 1, 'card_type' => 'chinatelecom']
-//        ],
+        ],
         30 => [
-            ['goods_id' => 7900, 'price' => 28.98, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7900, 'price' => 28.26, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7900, 'price' => 28.41, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7900, 'price' => 28.86, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7900, 'price' => 26.64, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7900, 'price' => 28.68, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         50 => [
-            ['goods_id' => 7901, 'price' => 48.3, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7901, 'price' => 47.1, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7901, 'price' => 47.35, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7901, 'price' => 48.1, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7901, 'price' => 44.4, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7901, 'price' => 47.8, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
-            ['goods_id' => 7902, 'price' => 96.6, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7902, 'price' => 94.2, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7902, 'price' => 94.7, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7902, 'price' => 96.2, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7902, 'price' => 88.8, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7902, 'price' => 95.6, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 7903, 'price' => 193.2, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7903, 'price' => 188.4, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7903, 'price' => 189.4, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7903, 'price' => 192.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7903, 'price' => 177.6, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7903, 'price' => 191.2, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         300 => [
 //            ['goods_id' => 7904, 'price' => 289.8, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7904, 'price' => 282.6, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7904, 'price' => 266.4, 'quality' => 1, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7904, 'price' => 284.1, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         500 => [
 //            ['goods_id' => 7905, 'price' => 483, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7905, 'price' => 471, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7905, 'price' => 444, 'quality' => 1, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7905, 'price' => 473.5, 'quality' => 1, 'card_type' => 'chinatelecom']
         ]
     ],
@@ -6101,42 +6113,42 @@ $dezhi_phone = ['name' => 'dezhi', 'store_id' => 227, 'qualitys' => '1',
     'amount' => [
         10 => [
 //            ['goods_id' => 7906, 'price' => 9.67, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7906, 'price' => 9.3, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7906, 'price' => 9.1, 'quality' => 1, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7906, 'price' => 9.55, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         20 => [
 //            ['goods_id' => 7907, 'price' => 19.34, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7907, 'price' => 18.6, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7907, 'price' => 18.2, 'quality' => 1, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7907, 'price' => 19.1, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         30 => [
-            ['goods_id' => 7908, 'price' => 28.86, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7908, 'price' => 27.9, 'quality' => 1, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7908, 'price' => 28.65, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7908, 'price' => 29.04, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7908, 'price' => 28.05, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7908, 'price' => 28.95, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         50 => [
-            ['goods_id' => 7909, 'price' => 48.1, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7909, 'price' => 46.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7909, 'price' => 47.75, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7909, 'price' => 49, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7909, 'price' => 46.75, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7909, 'price' => 48.25, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
-            ['goods_id' => 7910, 'price' => 96.2, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7910, 'price' => 93, 'quality' => 1, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7910, 'price' => 95.5, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7910, 'price' => 98, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7910, 'price' => 93.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7910, 'price' => 96.5, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 7911, 'price' => 192.4, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7911, 'price' => 186, 'quality' => 1, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7911, 'price' => 191, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7911, 'price' => 196, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7911, 'price' => 187, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7911, 'price' => 193, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         300 => [
 //            ['goods_id' => 7912, 'price' => 290.1, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7912, 'price' => 279, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7912, 'price' => 277.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7912, 'price' => 286.5, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         500 => [
 //            ['goods_id' => 7913, 'price' => 483.5, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7913, 'price' => 465, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7913, 'price' => 462.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7913, 'price' => 477.5, 'quality' => 1, 'card_type' => 'chinatelecom']
         ]
     ],
@@ -6244,20 +6256,24 @@ $ziyugui_phone = ['name' => 'ziyugui', 'store_id' => 231, 'qualitys' => '1',
 //            ['goods_id' => 7932, 'price' => 18.88, 'quality' => 1, 'card_type' => 'chinaunicom']
 //        ],
         30 => [
-            ['goods_id' => 7933, 'price' => 28.83, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7933, 'price' => 28.32, 'quality' => 1, 'card_type' => 'chinaunicom']
+            ['goods_id' => 7933, 'price' => 29.25, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7933, 'price' => 27.6, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7933, 'price' => 28.32, 'quality' => 1, 'card_type' => 'chinatelecom'],
         ],
         50 => [
-            ['goods_id' => 7934, 'price' => 48.05, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7934, 'price' => 47.2, 'quality' => 1, 'card_type' => 'chinaunicom']
+            ['goods_id' => 7934, 'price' => 48.75, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7934, 'price' => 46, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7934, 'price' => 47.2, 'quality' => 1, 'card_type' => 'chinatelecom'],
         ],
         100 => [
-            ['goods_id' => 7935, 'price' => 96.1, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7935, 'price' => 94.4, 'quality' => 1, 'card_type' => 'chinaunicom']
+            ['goods_id' => 7935, 'price' => 97.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7935, 'price' => 92, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7935, 'price' => 94.4, 'quality' => 1, 'card_type' => 'chinatelecom'],
         ],
         200 => [
-            ['goods_id' => 7936, 'price' => 192.2, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7936, 'price' => 188.8, 'quality' => 1, 'card_type' => 'chinaunicom']
+            ['goods_id' => 7936, 'price' => 195, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7936, 'price' => 184, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7936, 'price' => 188.8, 'quality' => 1, 'card_type' => 'chinatelecom'],
         ],
 //        300 => [
 //            ['goods_id' => 7937, 'price' => 288.3, 'quality' => 1, 'card_type' => 'chinamobile'],
@@ -6327,27 +6343,31 @@ $dazhanggui_phone = ['name' => 'dazhanggui', 'store_id' => 233, 'qualitys' => '1
 //        ],
         30 => [
             ['goods_id' => 7949, 'price' => 28.8, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7949, 'price' => 27.42, 'quality' => 1, 'card_type' => 'chinaunicom']
+            ['goods_id' => 7949, 'price' => 28.35, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7949, 'price' => 29.25, 'quality' => 1, 'card_type' => 'chinatelecom'],
         ],
         50 => [
             ['goods_id' => 7950, 'price' => 48, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7950, 'price' => 45.7, 'quality' => 1, 'card_type' => 'chinaunicom']
+            ['goods_id' => 7950, 'price' => 47.25, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7950, 'price' => 48.75, 'quality' => 1, 'card_type' => 'chinatelecom'],
         ],
         100 => [
             ['goods_id' => 7951, 'price' => 96, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7951, 'price' => 91.4, 'quality' => 1, 'card_type' => 'chinaunicom']
+            ['goods_id' => 7951, 'price' => 94.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7951, 'price' => 97.5, 'quality' => 1, 'card_type' => 'chinatelecom'],
         ],
         200 => [
             ['goods_id' => 7952, 'price' => 192, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7952, 'price' => 182.8, 'quality' => 1, 'card_type' => 'chinaunicom']
+            ['goods_id' => 7952, 'price' => 189, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7952, 'price' => 195, 'quality' => 1, 'card_type' => 'chinatelecom'],
         ],
         300 => [
 //            ['goods_id' => 7953, 'price' => 289.5, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7953, 'price' => 274.2, 'quality' => 1, 'card_type' => 'chinaunicom']
+            ['goods_id' => 7953, 'price' => 283.5, 'quality' => 1, 'card_type' => 'chinaunicom']
         ],
         500 => [
 //            ['goods_id' => 7954, 'price' => 482.5, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7954, 'price' => 457, 'quality' => 1, 'card_type' => 'chinaunicom']
+            ['goods_id' => 7954, 'price' => 472.5, 'quality' => 1, 'card_type' => 'chinaunicom']
         ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
@@ -6409,19 +6429,23 @@ $weixue_phone = ['name' => 'weixue', 'store_id' => 235, 'qualitys' => '1',
         ],
         30 => [
             ['goods_id' => 7965, 'price' => 28.95, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7965, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom']
+            ['goods_id' => 7965, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7965, 'price' => 29.1, 'quality' => 1, 'card_type' => 'chinatelecom'],
         ],
         50 => [
             ['goods_id' => 7966, 'price' => 48.25, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7966, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom']
+            ['goods_id' => 7966, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7966, 'price' => 48.5, 'quality' => 1, 'card_type' => 'chinatelecom'],
         ],
         100 => [
             ['goods_id' => 7967, 'price' => 96.5, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7967, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom']
+            ['goods_id' => 7967, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7967, 'price' => 97, 'quality' => 1, 'card_type' => 'chinatelecom'],
         ],
         200 => [
             ['goods_id' => 7968, 'price' => 193, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7968, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom']
+            ['goods_id' => 7968, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7968, 'price' => 194, 'quality' => 1, 'card_type' => 'chinatelecom'],
         ],
         300 => [
 //            ['goods_id' => 7969, 'price' => 290.1, 'quality' => 1, 'card_type' => 'chinamobile'],
@@ -6446,25 +6470,25 @@ $dazhanggui_high_phone = ['name' => 'dazhanggui_high', 'store_id' => 236, 'quali
 //            ['goods_id' => 7972, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7972, 'price' => 19, 'quality' => 1, 'card_type' => 'chinatelecom']
 //        ],
-//        30 => [
-//            ['goods_id' => 7973, 'price' => 28.8, 'quality' => 1, 'card_type' => 'chinamobile'],
+        30 => [
+            ['goods_id' => 7973, 'price' => 29.25, 'quality' => 1, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 7973, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7973, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinatelecom']
-//        ],
+        ],
         50 => [
             ['goods_id' => 7974, 'price' => 48.75, 'quality' => 1, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 7974, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7974, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7974, 'price' => 48.75, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
             ['goods_id' => 7975, 'price' => 97.5, 'quality' => 1, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 7975, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7975, 'price' => 95, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7975, 'price' => 97.5, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
             ['goods_id' => 7976, 'price' => 195, 'quality' => 1, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 7976, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7976, 'price' => 190, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7976, 'price' => 195, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
 //        300 => [
 //            ['goods_id' => 7977, 'price' => 288, 'quality' => 1, 'card_type' => 'chinamobile'],
@@ -6526,14 +6550,14 @@ $yingdian_hf_phone = ['name' => 'yingdian_hf', 'store_id' => 237, 'qualitys' =>
 
 $dazhanggui_fs_phone = ['name' => 'dazhanggui_fs', 'store_id' => 238, 'qualitys' => '1',
     'amount' => [
-        10 => [['goods_id' => 7987, 'price' => 9.99, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
-        20 => [['goods_id' => 7988, 'price' => 19.98, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        10 => [['goods_id' => 7987, 'price' => 9.99, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        20 => [['goods_id' => 7988, 'price' => 19.98, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
         30 => [['goods_id' => 7989, 'price' => 29.97, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
         50 => [['goods_id' => 7990, 'price' => 49.95, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
         100 => [['goods_id' => 7991, 'price' => 99.9, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
         200 => [['goods_id' => 7992, 'price' => 199.8, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
-        300 => [['goods_id' => 7993, 'price' => 299.7, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
-        500 => [['goods_id' => 7994, 'price' => 499.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']]
+//        300 => [['goods_id' => 7993, 'price' => 299.7, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        500 => [['goods_id' => 7994, 'price' => 499.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
@@ -6572,47 +6596,47 @@ $jinfeng_fs_phone = ['name' => 'jinfeng_fs', 'store_id' => 240, 'qualitys' => '1
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$douxun_phone = ['name' => 'douxun', 'store_id' => 241, 'qualitys' => '2',
+$douxun_phone = ['name' => 'douxun', 'store_id' => 241, 'qualitys' => '3',
     'amount' => [
 //        10 => [
-//            ['goods_id' => 8011, 'price' => 10.01, 'quality' => 2, 'card_type' => 'chinamobile'],
-//            ['goods_id' => 8011, 'price' => 10.01, 'quality' => 2, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 8011, 'price' => 10.01, 'quality' => 2, 'card_type' => 'chinatelecom']
+//            ['goods_id' => 8011, 'price' => 10.01, 'quality' => 3, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8011, 'price' => 10.01, 'quality' => 3, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8011, 'price' => 10.01, 'quality' => 3, 'card_type' => 'chinatelecom']
 //        ],
 //        20 => [
-//            ['goods_id' => 8012, 'price' => 20.02, 'quality' => 2, 'card_type' => 'chinamobile'],
-//            ['goods_id' => 8012, 'price' => 20.02, 'quality' => 2, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 8012, 'price' => 20.02, 'quality' => 2, 'card_type' => 'chinatelecom']
+//            ['goods_id' => 8012, 'price' => 20.02, 'quality' => 3, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8012, 'price' => 20.02, 'quality' => 3, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8012, 'price' => 20.02, 'quality' => 3, 'card_type' => 'chinatelecom']
 //        ],
 //        30 => [
-//            ['goods_id' => 8013, 'price' => 30.03, 'quality' => 2, 'card_type' => 'chinamobile'],
-//            ['goods_id' => 8013, 'price' => 30.03, 'quality' => 2, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 8013, 'price' => 30.03, 'quality' => 2, 'card_type' => 'chinatelecom']
+//            ['goods_id' => 8013, 'price' => 30.03, 'quality' => 3, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8013, 'price' => 30.03, 'quality' => 3, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8013, 'price' => 30.03, 'quality' => 3, 'card_type' => 'chinatelecom']
 //        ],
         50 => [
-//            ['goods_id' => 8014, 'price' => 50.05, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8014, 'price' => 51.3, 'quality' => 2, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 8014, 'price' => 50.05, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 8014, 'price' => 51.6, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8014, 'price' => 51.2, 'quality' => 3, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8014, 'price' => 51.75, 'quality' => 3, 'card_type' => 'chinatelecom']
         ],
         100 => [
-            ['goods_id' => 8015, 'price' => 102.7, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8015, 'price' => 102.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 8015, 'price' => 103.2, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 8015, 'price' => 102.6, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8015, 'price' => 102.4, 'quality' => 3, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8015, 'price' => 103, 'quality' => 3, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 8016, 'price' => 205.4, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8016, 'price' => 205.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 8016, 'price' => 206.2, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 8016, 'price' => 205.2, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8016, 'price' => 204.8, 'quality' => 3, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8016, 'price' => 206, 'quality' => 3, 'card_type' => 'chinatelecom']
         ],
         300 => [
-            ['goods_id' => 8017, 'price' => 308.1, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8017, 'price' => 307.8, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 8017, 'price' => 309.3, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 8017, 'price' => 307.8, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8017, 'price' => 307.2, 'quality' => 3, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8017, 'price' => 309, 'quality' => 3, 'card_type' => 'chinatelecom']
         ],
         500 => [
-            ['goods_id' => 8018, 'price' => 513.5, 'quality' => 2, 'card_type' => 'chinamobile'],
-//            ['goods_id' => 8018, 'price' => 500.5, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 8018, 'price' => 515.5, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 8018, 'price' => 513, 'quality' => 3, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8018, 'price' => 500.5, 'quality' => 3, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8018, 'price' => 515, 'quality' => 3, 'card_type' => 'chinatelecom']
         ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
@@ -6728,6 +6752,246 @@ $qianqian_fs_phone = ['name' => 'qianqian_fs', 'store_id' => 247, 'qualitys' =>
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$xinruiheng_yd_phone = ['name' => 'xinruiheng_yd', 'store_id' => 248, 'qualitys' => '1',
+    'amount' => [
+//        10 => [['goods_id' => 8067, 'price' => 9.73, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        20 => [['goods_id' => 8068, 'price' => 19.46, 'quality' => 1, 'card_type' => 'chinamobile']],
+        30 => [
+            ['goods_id' => 8069, 'price' => 29.04, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8069, 'price' => 26.7, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        50 => [
+            ['goods_id' => 8070, 'price' => 48.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8070, 'price' => 44.5, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        100 => [
+            ['goods_id' => 8071, 'price' => 96.8, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8071, 'price' => 89, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        200 => [
+            ['goods_id' => 8072, 'price' => 193.6, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8072, 'price' => 178, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        300 => [['goods_id' => 8073, 'price' => 290.4, 'quality' => 1, 'card_type' => 'chinamobile']],
+        500 => [['goods_id' => 8074, 'price' => 484, 'quality' => 1, 'card_type' => 'chinamobile']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$dazhanggui_fs_gd_phone = ['name' => 'dazhanggui_fs_gd', 'store_id' => 249, 'qualitys' => '1',
+    'amount' => [
+//        10 => [['goods_id' => 8075, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        20 => [['goods_id' => 8076, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        30 => [['goods_id' => 8077, 'price' => 28.8, 'quality' => 1, 'card_type' => 'chinamobile']],
+        50 => [['goods_id' => 8078, 'price' => 48, 'quality' => 1, 'card_type' => 'chinamobile']],
+        100 => [['goods_id' => 8079, 'price' => 96, 'quality' => 1, 'card_type' => 'chinamobile']],
+        200 => [['goods_id' => 8080, 'price' => 192, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        300 => [['goods_id' => 8081, 'price' => 288, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        500 => [['goods_id' => 8082, 'price' => 480, 'quality' => 1, 'card_type' => 'chinamobile']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$qianqian_fs_gd_phone = ['name' => 'qianqian_fs_gd', 'store_id' => 250, 'qualitys' => '1',
+    'amount' => [
+//        10 => [['goods_id' => 8083, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        20 => [['goods_id' => 8084, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        30 => [['goods_id' => 8085, 'price' => 28.8, 'quality' => 1, 'card_type' => 'chinamobile']],
+        50 => [['goods_id' => 8086, 'price' => 48, 'quality' => 1, 'card_type' => 'chinamobile']],
+        100 => [['goods_id' => 8087, 'price' => 96, 'quality' => 1, 'card_type' => 'chinamobile']],
+        200 => [['goods_id' => 8088, 'price' => 192, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        300 => [['goods_id' => 8089, 'price' => 288, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        500 => [['goods_id' => 8090, 'price' => 480, 'quality' => 1, 'card_type' => 'chinamobile']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$bier_phone = ['name' => 'bier', 'store_id' => 251, 'qualitys' => '1',
+    'amount' => [
+        10 => [['goods_id' => 8091, 'price' => 9.85, 'quality' => 1, 'card_type' => 'chinamobile']],
+        20 => [['goods_id' => 8092, 'price' => 19.7, 'quality' => 1, 'card_type' => 'chinamobile']],
+        30 => [
+            ['goods_id' => 8093, 'price' => 28.95, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8093, 'price' => 28.44, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8093, 'price' => 28.95, 'quality' => 1, 'card_type' => 'chinatelecom'],
+        ],
+        50 => [
+            ['goods_id' => 8094, 'price' => 48.25, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8094, 'price' => 47.4, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8094, 'price' => 48.25, 'quality' => 1, 'card_type' => 'chinatelecom'],
+        ],
+        100 => [
+            ['goods_id' => 8095, 'price' => 96.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8095, 'price' => 94.8, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8095, 'price' => 96.5, 'quality' => 1, 'card_type' => 'chinatelecom'],
+        ],
+        200 => [
+            ['goods_id' => 8096, 'price' => 193, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8096, 'price' => 189.6, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8096, 'price' => 193, 'quality' => 1, 'card_type' => 'chinatelecom'],
+        ],
+//        300 => [['goods_id' => 8097, 'price' => 288, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        500 => [['goods_id' => 8098, 'price' => 480, 'quality' => 1, 'card_type' => 'chinamobile']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$youhe_fs_phone = ['name' => 'youhe_fs', 'store_id' => 252, 'qualitys' => '1',
+    'amount' => [
+//        10 => [['goods_id' => 8099, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinatelecom']],
+//        20 => [['goods_id' => 8100, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinatelecom']],
+        30 => [['goods_id' => 8101, 'price' => 28.8, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        50 => [['goods_id' => 8102, 'price' => 48, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        100 => [['goods_id' => 8103, 'price' => 96, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        200 => [['goods_id' => 8104, 'price' => 192, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        300 => [['goods_id' => 8105, 'price' => 288, 'quality' => 1, 'card_type' => 'chinatelecom']],
+//        500 => [['goods_id' => 8106, 'price' => 480, 'quality' => 1, 'card_type' => 'chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$yangchi_phone = ['name' => 'yangchi', 'store_id' => 253, 'qualitys' => '1',
+    'amount' => [
+//        10 => [['goods_id' => 8107, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        20 => [['goods_id' => 8108, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinamobile']],
+        30 => [
+//            ['goods_id' => 8109, 'price' => 28.98, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8109, 'price' => 28.05, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8109, 'price' => 29.04, 'quality' => 1, 'card_type' => 'chinatelecom'],
+        ],
+        50 => [
+            ['goods_id' => 8110, 'price' => 48.3, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8110, 'price' => 46.75, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8110, 'price' => 48.4, 'quality' => 1, 'card_type' => 'chinatelecom'],
+        ],
+        100 => [
+            ['goods_id' => 8111, 'price' => 96.6, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8111, 'price' => 93.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8111, 'price' => 96.8, 'quality' => 1, 'card_type' => 'chinatelecom'],
+        ],
+        200 => [
+            ['goods_id' => 8112, 'price' => 193.2, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8112, 'price' => 187, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8112, 'price' => 193.6, 'quality' => 1, 'card_type' => 'chinatelecom'],
+        ],
+//        300 => [
+//            ['goods_id' => 8113, 'price' => 267, 'quality' => 1, 'card_type' => 'chinaunicom']
+//        ],
+//        500 => [
+//            ['goods_id' => 8114, 'price' => 445, 'quality' => 1, 'card_type' => 'chinaunicom']
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$yangchi_fs_phone = ['name' => 'yangchi_fs', 'store_id' => 254, 'qualitys' => '1',
+    'amount' => [
+//        10 => [['goods_id' => 8115, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        20 => [['goods_id' => 8116, 'price' => 19, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        30 => [['goods_id' => 8117, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        50 => [['goods_id' => 8118, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        100 => [['goods_id' => 8119, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        200 => [['goods_id' => 8120, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        300 => [['goods_id' => 8121, 'price' => 285, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        500 => [['goods_id' => 8122, 'price' => 475, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$bier_fs_phone = ['name' => 'bier_fs', 'store_id' => 255, 'qualitys' => '1',
+    'amount' => [
+//        10 => [['goods_id' => 8123, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        20 => [['goods_id' => 8124, 'price' => 19, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        30 => [['goods_id' => 8125, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        50 => [['goods_id' => 8126, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        100 => [['goods_id' => 8127, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+        200 => [['goods_id' => 8128, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        300 => [['goods_id' => 8129, 'price' => 285, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']],
+//        500 => [['goods_id' => 8130, 'price' => 475, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$feimingyu_fs_phone = ['name' => 'feimingyu_fs', 'store_id' => 256, 'qualitys' => '1',
+    'amount' => [
+//        10 => [['goods_id' => 8131, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinatelecom']],
+//        20 => [['goods_id' => 8132, 'price' => 19, 'quality' => 1, 'card_type' => 'chinatelecom']],
+        30 => [['goods_id' => 8133, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile, chinatelecom']],
+        50 => [['goods_id' => 8134, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile, chinatelecom']],
+        100 => [['goods_id' => 8135, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile, chinatelecom']],
+        200 => [['goods_id' => 8136, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile, chinatelecom']],
+//        300 => [['goods_id' => 8137, 'price' => 285, 'quality' => 1, 'card_type' => 'chinatelecom']],
+//        500 => [['goods_id' => 8138, 'price' => 475, 'quality' => 1, 'card_type' => 'chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$hanwei_phone = ['name' => 'hanwei', 'store_id' => 258, 'qualitys' => '1',
+    'amount' => [
+//        10 => [['goods_id' => 8145, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        20 => [['goods_id' => 8146, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinamobile']],
+        30 => [
+//            ['goods_id' => 8147, 'price' => 28.98, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8147, 'price' => 28.2, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        50 => [
+            ['goods_id' => 8148, 'price' => 48.3, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8148, 'price' => 47, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        100 => [
+            ['goods_id' => 8149, 'price' => 96.6, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8149, 'price' => 94, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        200 => [
+            ['goods_id' => 8150, 'price' => 193.2, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8150, 'price' => 188, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+//        300 => [
+//            ['goods_id' => 8151, 'price' => 267, 'quality' => 1, 'card_type' => 'chinaunicom']
+//        ],
+//        500 => [
+//            ['goods_id' => 8152, 'price' => 445, 'quality' => 1, 'card_type' => 'chinaunicom']
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$hanwei_fs_phone = ['name' => 'hanwei_fs', 'store_id' => 259, 'qualitys' => '1',
+    'amount' => [
+//        10 => [['goods_id' => 8153, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        20 => [['goods_id' => 8154, 'price' => 19, 'quality' => 1, 'card_type' => 'chinamobile']],
+        30 => [['goods_id' => 8155, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile']],
+        50 => [['goods_id' => 8156, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile']],
+        100 => [['goods_id' => 8157, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile']],
+        200 => [['goods_id' => 8158, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        300 => [['goods_id' => 8159, 'price' => 285, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        500 => [['goods_id' => 8160, 'price' => 475, 'quality' => 1, 'card_type' => 'chinamobile']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$yuewen_phone = ['name' => 'yuewen', 'store_id' => 260, 'qualitys' => '1',
+    'amount' => [
+        10 => [
+            ['goods_id' => 8161, 'price' => 9.65, 'quality' => 1, 'card_type' => 'chinamobile']
+        ],
+        20 => [
+            ['goods_id' => 8162, 'price' => 19.3, 'quality' => 1, 'card_type' => 'chinamobile']
+        ],
+        30 => [
+            ['goods_id' => 8163, 'price' => 28.95, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8163, 'price' => 27.9, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8163, 'price' => 28.89, 'quality' => 1, 'card_type' => 'chinatelecom'],
+        ],
+        50 => [
+            ['goods_id' => 8164, 'price' => 48.25, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8164, 'price' => 46.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8164, 'price' => 48.15, 'quality' => 1, 'card_type' => 'chinatelecom'],
+        ],
+        100 => [
+            ['goods_id' => 8165, 'price' => 96.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8165, 'price' => 93, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8165, 'price' => 96.3, 'quality' => 1, 'card_type' => 'chinatelecom'],
+        ],
+        200 => [
+            ['goods_id' => 8166, 'price' => 193, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8166, 'price' => 186, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8166, 'price' => 192.6, 'quality' => 1, 'card_type' => 'chinatelecom'],
+        ],
+//        300 => [['goods_id' => 8167, 'price' => 288, 'quality' => 1, 'card_type' => 'chinamobile']],
+//        500 => [['goods_id' => 8168, 'price' => 480, 'quality' => 1, 'card_type' => 'chinamobile']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -6936,7 +7200,18 @@ $phone_providers = [
     ['name' => 'dezhi_fs', 'cfg' => $dezhi_fs_phone],
     ['name' => 'yezi_kc', 'cfg' => $yezi_kc_phone],
     ['name' => 'qianqian_fs', 'cfg' => $qianqian_fs_phone],
-
+    ['name' => 'xinruiheng_yd', 'cfg' => $xinruiheng_yd_phone],
+    ['name' => 'dazhanggui_fs_gd', 'cfg' => $dazhanggui_fs_gd_phone],
+    ['name' => 'qianqian_fs_gd', 'cfg' => $qianqian_fs_gd_phone],
+    ['name' => 'bier', 'cfg' => $bier_phone],
+    ['name' => 'youhe_fs', 'cfg' => $youhe_fs_phone],
+    ['name' => 'yangchi', 'cfg' => $yangchi_phone],
+    ['name' => 'yangchi_fs', 'cfg' => $yangchi_fs_phone],
+    ['name' => 'bier_fs', 'cfg' => $bier_fs_phone],
+    ['name' => 'feimingyu_fs', 'cfg' => $feimingyu_fs_phone],
+    ['name' => 'hanwei', 'cfg' => $hanwei_phone],
+    ['name' => 'hanwei_fs', 'cfg' => $hanwei_fs_phone],
+    ['name' => 'yuewen', 'cfg' => $yuewen_phone],
 ];
 $config['phone_providers'] = $phone_providers;
 

+ 32 - 8
data/logic/vr_order.logic.php

@@ -10,6 +10,27 @@ require_once(BASE_HELPER_PATH . '/vrorder_helper.php');
 
 class vr_orderLogic
 {
+    private static function part_calcer($add_time)
+    {
+        $namer = function ($time) {
+            return 'p' . date('Ym', $time);
+        };
+
+        if (defined('DB_PARTIONED') && DB_PARTIONED) {
+            if (is_string($add_time)) {
+                $add_time = intval($add_time);
+            }
+
+            if ($add_time == 0) {
+                return '';
+
+            } else {
+                return $namer($add_time);
+            }
+        } else {
+            return '';
+        }
+    }
     /**
      * 取消订单
      * @param array $order_info
@@ -20,8 +41,9 @@ class vr_orderLogic
      */
     public function changeOrderStateCancel($order_info, $role, $msg, $if_queue = true,$fRefill = false)
     {
-
-        try {
+        try
+        {
+            $add_time = $order_info['add_time'];
             $model_vr_order = Model('vr_order');
             $trans = new trans_wapper($model_vr_order, __METHOD__);
 
@@ -65,7 +87,7 @@ class vr_orderLogic
                 'close_time' => time(),
                 'close_reason' => $msg
             ];
-            $update = $model_vr_order->editOrder($update_order, ['order_id' => $order_info['order_id']]);
+            $update = $model_vr_order->partition(self::part_calcer($add_time))->editOrder($update_order, ['order_id' => $order_info['order_id']]);
             if (!$update) {
                 throw new Exception('保存失败');
             } elseif(!$fRefill) {
@@ -91,7 +113,9 @@ class vr_orderLogic
      */
     public function changeOrderStatePay($order_info, $role, $post)
     {
-        try {
+        try
+        {
+            $add_time = $order_info['add_time'];
             $model_vr_order = Model('vr_order');
             $trans = new trans_wapper($model_vr_order, __METHOD__);
 
@@ -126,7 +150,7 @@ class vr_orderLogic
             $update_order['payment_time'] = $post['payment_time'] ? strtotime($post['payment_time']) : time();
             $update_order['payment_code'] = $post['payment_code'];
             $update_order['trade_no'] = $post['trade_no'];
-            $update = $model_vr_order->editOrder($update_order, ['order_id' => $order_info['order_id']]);
+            $update = $model_vr_order->partition(self::part_calcer($add_time))->editOrder($update_order, ['order_id' => $order_info['order_id']]);
             if (!$update) {
                 throw new Exception(L('nc_common_save_fail'));
             }
@@ -163,13 +187,13 @@ class vr_orderLogic
         }
     }
 
-    public function changeOrderStateSend($order_id,$fRefill = false)
+    public function changeOrderStateSend($order_id,$fRefill = false,$part = [])
     {
         $model_vr_order = Model('vr_order');
 
         if($fRefill)
         {
-            $update = $model_vr_order->editOrder(['order_state' => ORDER_STATE_SEND], ['order_id' => $order_id]);
+            $update = $model_vr_order->partition($part)->editOrder(['order_state' => ORDER_STATE_SEND], ['order_id' => $order_id]);
             if (!$update) {
                 return callback(false, '更新失败');
             }
@@ -181,7 +205,7 @@ class vr_orderLogic
             $condition['refund_lock'] = ['in', [0, 1]];
             $condition['order_id'] = $order_id;
             $condition['vr_indate'] = ['gt', time()];
-            $order_code_info = $model_vr_order->getOrderCodeInfo($condition, '*', true);
+            $order_code_info = $model_vr_order->partition($part)->getOrderCodeInfo($condition, '*', true);
             if (!empty($order_code_info)) {
                 $update = $model_vr_order->editOrder(['order_state' => ORDER_STATE_SEND], ['order_id' => $order_id]);
                 if (!$update) {

+ 8 - 3
data/model/refill_order.model.php

@@ -37,6 +37,11 @@ class refill_orderModel extends Model
         return $this->table('refill_order')->where(['order_id' => $order_id])->update($data);
     }
 
+    public function edit_part($cond,$data)
+    {
+        return $this->table('refill_order')->where($cond)->update($data);
+    }
+
     public function getMerchantOrderList($condition, $pagesize = '', $total = 0, $field = '*', $order = 'refill_order.order_id desc', $limit = '', $master = false)
     {
         $list = $this->table('refill_order,vr_order')
@@ -105,10 +110,10 @@ class refill_orderModel extends Model
         return $this->table('refill_detail')->where(['mchid' => $mchid,'mch_order' => $mch_order])->update($datas);
     }
 
-    public function exist($mchid,$mch_order)
+    public function exist($mchid, $mch_order, $part = '')
     {
-        $item = $this->table('refill_detail')->where(['mchid' => $mchid,'mch_order' => $mch_order])->select();
-        return !empty($item);
+        $items = $this->table('refill_detail')->partition($part)->field('detail_id')->where(['mchid' => $mchid,'mch_order' => $mch_order])->select();
+        return !empty($items);
     }
 
     public function getAllOrders($condition)

+ 44 - 0
data/model/vr_order.model.php

@@ -34,6 +34,50 @@ class vr_orderModel extends Model
         return $order_info;
     }
 
+    public function getOrderInfoForNotify($condition = array(), $fields = '*', $master = false,$lock=false)
+    {
+        $part_calcer = function ($sub_period, $add_period)
+        {
+            //查询30天的订单
+            $miner = function ($time) use ($sub_period) {
+                return strtotime(date('Y-m-d', $time)) - $sub_period;
+            };
+            $maxer = function ($time) use ($add_period) {
+                return $time + $add_period;
+            };
+            $namer = function ($time) {
+                return 'p' . date('Ym', $time);
+            };
+
+            if (defined('DB_PARTIONED') && DB_PARTIONED)
+            {
+                    $now = time();
+                    $a = $namer($miner($now));
+                    $b = $namer($maxer($now));
+
+                    if ($a != $b) {
+                        return [$a, $b];
+                    } else {
+                        return $a;
+                    }
+            } else {
+                return '';
+            }
+        };
+        $part = $part_calcer(3600 * 12, 3600);
+        $order_info = $this->table('vr_order')->partition($part)->field($fields)->where($condition)->master($master)->lock($lock)->find();
+        if (empty($order_info) && !empty($part)) {
+            $order_info = $this->table('vr_order')->field($fields)->where($condition)->master($master)->lock($lock)->find();
+        }
+
+        if(empty($order_info)) {
+            return [];
+        }
+        else {
+            return $order_info;
+        }
+    }
+
     /**
      * 新增订单
      * @param array $data

+ 2 - 2
docker/compose/homecuda/cli/docker-compose.yml

@@ -40,8 +40,8 @@ services:
 
   pythoncli:
     image: pycpu:3.7.10
-    ports:
-      - 5000:5000
+#    ports:
+#      - 5000:5000
     volumes:
       - /mnt/xyzshop/docker/compose/homecuda/conf/etc/localtime:/etc/localtime:ro
       - /mnt/xyzshop:/var/www/html

+ 1 - 1
docker/compose/workcuda/acc/docker-compose.yml

@@ -45,7 +45,7 @@ services:
     volumes:
       - ../../../../:/var/www/html
       - ../conf/etc/localtime:/etc/localtime:ro
-      - ../conf/php/php-debug.ini:/usr/local/etc/php/php.ini
+      - ../conf/php/php.ini:/usr/local/etc/php/php.ini
       - /mnt/upload:/var/www/html/data/upload
       - /mnt/shoplog:/var/www/html/data/log
       - ../conf/php/vapi-spwan-start:/usr/local/bin/docker-spwan-start

+ 1 - 1
docker/compose/workcuda/admin/docker-compose.yml

@@ -26,7 +26,7 @@ services:
     volumes:
       - ../../../../:/var/www/html
       - ../conf/etc/localtime:/etc/localtime:ro
-      - ../conf/php/php-debug.ini:/usr/local/etc/php/php.ini
+      - ../conf/php/php.ini:/usr/local/etc/php/php.ini
       - ../conf/php-fpm/php-fpm.conf:/usr/local/etc/php-fpm.conf
       - /mnt/upload:/var/www/html/data/upload
       - /mnt/shoplog:/var/www/html/data/log

+ 2 - 2
docker/compose/workcuda/cli/docker-compose.yml

@@ -41,8 +41,8 @@ services:
 
   pythoncli:
     image: pyflask:3.7.10
-    ports:
-      - 5000:5000
+#    ports:
+#      - 5000:5000
     volumes:
       - /mnt/xyzshop/docker/compose/workcuda/conf/etc/localtime:/etc/localtime:ro
       - /mnt/xyzshop:/var/www/html

+ 1 - 1
docker/compose/xiaoyu/conf/nginx/nginx.conf

@@ -28,7 +28,7 @@ http
     {
     	listen       80;
         set  $folder_name /var/www/html;
-        server_name 192.168.3.218 www.xyxy.com;
+        server_name 192.168.1.218 www.xyxy.com;
         root $folder_name;
         index index.html index.php;
     	client_max_body_size 100m;

+ 1 - 1
docker/compose/xyz/worker/docker-compose.yml

@@ -10,7 +10,7 @@ services:
       - /nfs/upload:/var/www/html/data/upload
       - /mnt/shoplog:/var/www/html/data/log
     container_name: "panda-codispatcher"
-    command: [php,"/var/www/html/rdispatcher/codispatcher.php","32"]
+    command: [php,"/var/www/html/rdispatcher/codispatcher.php","16"]
     deploy:
       resources:
         limits:

+ 1 - 1
docker/compose/yl/ylworker/docker-compose.yml

@@ -10,7 +10,7 @@ services:
       - /nfs/ylupload:/var/www/html/data/upload
       - /mnt/yllog:/var/www/html/data/log
     container_name: "yl-codispatcher"
-    command: [php,"/var/www/html/rdispatcher/codispatcher.php","32"]
+    command: [php,"/var/www/html/rdispatcher/codispatcher.php","16"]
     deploy:
       resources:
         limits:

+ 0 - 15
document/ugc.txt

@@ -1,15 +0,0 @@
-mb_special 表修改
-
-ALTER TABLE pandashop.lrlz_mb_special ADD category_id INT DEFAULT 0 NULL;
-ALTER TABLE pandashop.lrlz_mb_special ADD comments INT DEFAULT 0 NULL;
-ALTER TABLE pandashop.lrlz_mb_special ADD clicks INT DEFAULT 0 NULL;
-ALTER TABLE pandashop.lrlz_mb_special ADD likes INT DEFAULT 0 NULL;
-ALTER TABLE pandashop.lrlz_mb_special ADD state INT DEFAULT 0 NULL;
-ALTER TABLE pandashop.lrlz_mb_special ADD origin_data TEXT DEFAULT NULL  NULL;
-ALTER TABLE pandashop.lrlz_mb_special ADD share_image VARCHAR(200) DEFAULT '' NULL;
-ALTER TABLE pandashop.lrlz_mb_special ADD share_title VARCHAR(200) DEFAULT '' NULL;
-ALTER TABLE pandashop.lrlz_mb_special ADD addtime INT(11) DEFAULT 0 NULL;
-ALTER TABLE pandashop.lrlz_mb_special ADD member_id INT DEFAULT 0 NULL;
-ALTER TABLE pandashop.lrlz_mb_special ADD from_user TINYINT(1) DEFAULT 0 NULL;
-ALTER TABLE pandashop.lrlz_mb_special
-  MODIFY COLUMN special_desc VARCHAR(20) NOT NULL COMMENT '专题描述' AFTER from_user;

+ 1 - 1
helper/bonus/factory.php

@@ -7,7 +7,7 @@
  */
 namespace bonus;
 
-use \Exception;
+use Exception;
 
 class factory
 {

+ 1 - 1
helper/queue/iqueue.php

@@ -231,7 +231,7 @@ abstract class ILooper
     private $_cid = 0;
 
     private $mServer;
-    const MAX_COROUTINE = 300;
+    const MAX_COROUTINE = 20;
 
     protected function __construct($server)
     {

+ 2 - 0
helper/rbridge/RBridgeFactory.php

@@ -6,6 +6,8 @@ require_once(BASE_HELPER_PATH . '/refill_proxy.php');
 require_once(BASE_HELPER_PATH . '/rbridge/IBridge.php');
 require_once(BASE_HELPER_PATH . '/rbridge/wsd/Bridge.php');
 require_once(BASE_HELPER_PATH . '/rbridge/fulu/Bridge.php');
+require_once(BASE_HELPER_PATH . '/rbridge/fulu_ylyw/Bridge.php');
+require_once(BASE_HELPER_PATH . '/rbridge/fulu_youjun/Bridge.php');
 
 use Exception;
 use Log;

+ 18 - 8
helper/rbridge/fulu/Bridge.php

@@ -53,20 +53,30 @@ class Bridge implements IBridge
         $mchinfo = Model('merchant')->getMerchantInfo(['mchid' => $mchid]);
         $userid = intval($mchinfo['admin_id']);
 
+        $order_time = time();
+        $mch_order = $params['Id'];
+        $card_no = $params['ChargeAccount'];
         $input = [ 'mchid' => $mchid,
             'buyer_id' => $userid,
             'amount' => $params['SupProductFaceValue'],
-            'card_no' => $params['ChargeAccount'],
-            'mch_order' => $params['Id'],
+            'card_no' => $card_no,
+            'mch_order' => $mch_order,
             'mch_card_types' => $mch_card_types,
-            'notify_url' => config::MCH_NOTIFY_URL];
+            'notify_url' => config::MCH_NOTIFY_URL,
+            'order_time' => $order_time
+        ];
+
+        refill\util::push_queue_order($mchid,$mch_order,ORDER_STATE_QUEUE);
+        Model('refill_order')->add_detail($mchid,$mch_order,$order_time,$params,ORDER_STATE_QUEUE);
 
-        $code = refill\util::push_add($input);
-        if($code) {
-            refill\util::push_queue_order($mchid,$params['Id'],ORDER_STATE_QUEUE);
+        $state = refill\util::push_add($input);
+        if ($state === true) {
+            Log::record("fulu::Bridge refill::util::push_add success mchid={$mchid} mch_order={$mch_order} state={$state}",Log::DEBUG);
             return [true, '提交成功'];
-        }
-        else {
+        } else {
+            refill\util::del_queue_order($mchid,$mch_order);
+            Model('refill_order')->del_detail($mchid,$mch_order);
+            Log::record("fulu::Bridge refill::util::push_add error mchid={$mchid} mch_order={$mch_order} state={$state}",Log::DEBUG);
             return [false, '提交失败'];
         }
     }

+ 4 - 1
helper/rbridge/fulu/readme.txt

@@ -10,4 +10,7 @@ http://console.open.fulu.com/
 
 公司:北京趣带娃科技有限公司
 账号:15136908757
-密码:qudaiwa123
+密码:qudaiwa123
+
+
+https://www.xyzshops.cn/mobile/bridge/fulu.php

+ 159 - 0
helper/rbridge/fulu_ylyw/Bridge.php

@@ -0,0 +1,159 @@
+<?php
+
+namespace rbridge\fulu_ylyw;
+
+require_once(BASE_HELPER_PATH . '/rbridge/fulu_ylyw/config.php');
+
+use rbridge\IBridge;
+use refill;
+use Log;
+use StatesHelper;
+
+class Bridge implements IBridge
+{
+    public function add($params)
+    {
+        if(StatesHelper::fetch_state('bridge')) {
+            include (BASE_HELPER_PATH . '/rbridge/fulu_ylyw/product.php');
+        }
+
+        $dispatcher = function ($product_num)
+        {
+            global $fulu_ylyw_product;
+            if(empty($fulu_ylyw_product)) return [config::DEFAULT_MCHID,[]];
+
+            foreach ($fulu_ylyw_product as $mchid => $product_infos)
+            {
+                if(array_key_exists($product_num, $product_infos)) {
+                    $card_types = $product_infos[$product_num];
+                    return [$mchid,$card_types];
+                }
+            }
+
+            return [config::DEFAULT_MCHID,[]];
+        };
+
+        $params = $this->aes_decrypt($params);
+        if (empty($params)) {
+            return [false, '数据解密失败'];
+        }
+        $json_str = json_encode($params);
+        Log::record("fulu_ylyw add params: {$json_str}", Log::DEBUG);
+
+        $SupProductId = $params['SupProductId'];
+        [$mchid,$mch_card_types] = $dispatcher($SupProductId);
+        $chargeType = intval($params['OrderType']);
+
+        //订单类型:1话费 2流量 3卡密 4直充,
+        if (!in_array($chargeType, [1, 3, 4], true)) {
+            return [false, '订单类型不支持'];
+        }
+
+        Model('merchant_query')->add_info($mchid, $params['Id'], json_encode($params));
+        $mchinfo = Model('merchant')->getMerchantInfo(['mchid' => $mchid]);
+        $userid = intval($mchinfo['admin_id']);
+
+        $order_time = time();
+        $mch_order = $params['Id'];
+        $card_no = $params['ChargeAccount'];
+        $input = [ 'mchid' => $mchid,
+            'buyer_id' => $userid,
+            'amount' => $params['SupProductFaceValue'],
+            'card_no' => $card_no,
+            'mch_order' => $mch_order,
+            'mch_card_types' => $mch_card_types,
+            'notify_url' => config::MCH_NOTIFY_URL,
+            'order_time' => $order_time
+        ];
+
+        refill\util::push_queue_order($mchid,$mch_order,ORDER_STATE_QUEUE);
+        Model('refill_order')->add_detail($mchid,$mch_order,$order_time,$params,ORDER_STATE_QUEUE);
+
+        $state = refill\util::push_add($input);
+        if ($state === true) {
+            Log::record("fulu_ylyw::Bridge refill::util::push_add success mchid={$mchid} mch_order={$mch_order} state={$state}",Log::DEBUG);
+            return [true, '提交成功'];
+        } else {
+            refill\util::del_queue_order($mchid,$mch_order);
+            Model('refill_order')->del_detail($mchid,$mch_order);
+            Log::record("fulu_ylyw::Bridge refill::util::push_add error mchid={$mchid} mch_order={$mch_order} state={$state}",Log::DEBUG);
+            return [false, '提交失败'];
+        }
+    }
+
+    public function notify($params)
+    {
+        $mchid = $params['mchid'];
+        $mch_ordersn = $params['order_sn'];
+        $body = $this->notify_body($params);
+
+        $userID = config::USER_ID;
+        $header = [
+            'Content-Type: application/json',
+            "OrderNo: {$mch_ordersn}",
+            "UserID: {$userID}",
+        ];
+
+        $body = json_encode($body, JSON_UNESCAPED_UNICODE);
+        $body = $this->aes_encrypt($body);
+        $reqData['PostData'] = $body;
+        $reqData = json_encode($reqData, JSON_UNESCAPED_UNICODE);
+
+        $resp = http_post_data(config::ORDER_COMPLETE_URL, $reqData, $header, $net_errno);
+        if (empty($resp)) {
+            Log::record("回调下游,请求超时 mchid = {$mchid} mch_order = {$mch_ordersn}", Log::ERR);
+            return false;
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                Log::record("回调下游,返回数据格式有误 mchid = {$mchid} mch_order = {$mch_ordersn}", Log::ERR);
+                return false;
+            } elseif ($resp['code'] === '200' && $resp['data'] === true) {
+                return true;
+            } else {
+                Log::record("回调下游,返回失败 mchid = {$mchid} mch_order = {$mch_ordersn} message = {$resp['message']}", Log::ERR);
+                return false;
+            }
+        }
+    }
+
+    private function notify_body($params)
+    {
+        $success = $params['state'] == 'SUCCESS';
+        $body = [
+            "OrderNo" => $params['order_sn'],
+            "Status" => $success ? 1 : 2,
+            "Description" => '',
+            "RealCost" => "",
+            "SubstituteAccount" => "",
+            "ChannelAccountId" => "",
+            "InventoryId" => "",
+            "OperatorSerialNumber" => ""
+        ];
+
+        if($body['Status'] === 1) {
+            $body['OperatorSerialNumber'] = $params['official_sn'];
+        }
+
+        return $body;
+    }
+
+    private function aes_encrypt($data) {
+        $str_padded = $data;
+        if (strlen($str_padded) % 16) {
+            $str_padded = str_pad($str_padded,strlen($str_padded) + 16 - strlen($str_padded) % 16, "\0");
+        }
+        $data =  openssl_encrypt($str_padded, 'AES-128-CBC', config::KEY, OPENSSL_NO_PADDING, config::AES_IV);
+        return base64_encode($data);
+    }
+
+    //AES-128-ECB解密  data 字符串
+    private function aes_decrypt($data) {
+        $encrypted = base64_decode($data);
+        $params = openssl_decrypt($encrypted, 'AES-128-CBC', config::KEY, OPENSSL_NO_PADDING, config::AES_IV);
+        return json_decode(trim($params), true);
+    }
+}

+ 23 - 0
helper/rbridge/fulu_ylyw/config.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace rbridge\fulu_ylyw;
+
+class config
+{
+    const DEFAULT_MCHID = 10320;
+    const MCH_KEY  = '';
+    const MCH_NOTIFY_URL = 'fulu_ylyw';
+
+    const AES_IV = '1111111111111111';
+    const KEY   = 'RERQ6J&p1nJ8*4Lt';
+    const USER_ID = '3973213e-ec7a-4a96-a163-d7b9dd10f9a0';
+
+    const ORDER_SEND_URL = 'https://public-robot.open.fulu.com/api/OutOrder/UpdateStatusProcess'; //配送中
+    const ORDER_COMPLETE_URL = 'https://public-robot.open.fulu.com/api/OutOrder/UpdateStatus'; //成功/失败/可疑
+
+    const ORDER_STATUS = [
+        ORDER_STATE_SUCCESS => 1,
+        ORDER_STATE_CANCEL  => 2,
+    ];
+}
+

+ 14 - 0
helper/rbridge/fulu_ylyw/product.php

@@ -0,0 +1,14 @@
+<?php
+
+namespace rbridge\fulu_ylyw;
+
+global $fulu_ylyw_product;
+$fulu_ylyw_product = [
+    10320 => [
+        //移动
+        502540719 => [4, 5, 6],
+        503196622 => [4, 5, 6],
+        508604768 => [4, 5, 6],
+    ],
+];
+

+ 31 - 0
helper/rbridge/fulu_ylyw/readme.txt

@@ -0,0 +1,31 @@
+福禄开放平台我要供货教程-客户版 https://docs.qq.com/doc/DVmZ5QWhhQnFMQUNW
+物流自助服务使用教程-客户版 https://docs.qq.com/doc/DVnVQSERJdnZWTFRZ
+物流接口文档-V2.0 https://www.yuque.com/docs/share/4d5956bb-ca0f-46a2-a5e3-dd110f81a7ec?#
+
+http://console.open.fulu.com/
+
+游来有旺
+账号:13916932570
+密码:youjun131419
+
+UserId:
+3973213e-ec7a-4a96-a163-d7b9dd10f9a0
+UserKey:
+RERQ6J&p1nJ8*4Lt
+aesIV=1111111111111111
+
+游来有旺-福禄:
+502927639 三网通话费-全国-50元
+509379809 三网通话费-全国-100元
+
+机构id:10320 fuludaip 66575 福禄-带票
+
+https://www.xyzshops.cn/mobile/bridge/fulu_ylyw.php
+
+2022.12.12
+
+502540719  50
+503196622  100
+
+2022.12.21
+508604768

+ 159 - 0
helper/rbridge/fulu_youjun/Bridge.php

@@ -0,0 +1,159 @@
+<?php
+
+namespace rbridge\fulu_youjun;
+
+require_once(BASE_HELPER_PATH . '/rbridge/fulu_youjun/config.php');
+
+use rbridge\IBridge;
+use refill;
+use Log;
+use StatesHelper;
+
+class Bridge implements IBridge
+{
+    public function add($params)
+    {
+        if(StatesHelper::fetch_state('bridge')) {
+            include (BASE_HELPER_PATH . '/rbridge/fulu_youjun/product.php');
+        }
+
+        $dispatcher = function ($product_num)
+        {
+            global $fulu_youjun_product;
+            if(empty($fulu_youjun_product)) return [config::DEFAULT_MCHID,[]];
+
+            foreach ($fulu_youjun_product as $mchid => $product_infos)
+            {
+                if(array_key_exists($product_num, $product_infos)) {
+                    $card_types = $product_infos[$product_num];
+                    return [$mchid,$card_types];
+                }
+            }
+
+            return [config::DEFAULT_MCHID,[]];
+        };
+
+        $params = $this->aes_decrypt($params);
+        if (empty($params)) {
+            return [false, '数据解密失败'];
+        }
+        $json_str = json_encode($params);
+        Log::record("fulu_youjun add params: {$json_str}", Log::DEBUG);
+
+        $SupProductId = $params['SupProductId'];
+        [$mchid,$mch_card_types] = $dispatcher($SupProductId);
+        $chargeType = intval($params['OrderType']);
+
+        //订单类型:1话费 2流量 3卡密 4直充,
+        if (!in_array($chargeType, [1, 3, 4], true)) {
+            return [false, '订单类型不支持'];
+        }
+
+        Model('merchant_query')->add_info($mchid, $params['Id'], json_encode($params));
+        $mchinfo = Model('merchant')->getMerchantInfo(['mchid' => $mchid]);
+        $userid = intval($mchinfo['admin_id']);
+
+        $order_time = time();
+        $mch_order = $params['Id'];
+        $card_no = $params['ChargeAccount'];
+        $input = [ 'mchid' => $mchid,
+            'buyer_id' => $userid,
+            'amount' => $params['SupProductFaceValue'],
+            'card_no' => $card_no,
+            'mch_order' => $mch_order,
+            'mch_card_types' => $mch_card_types,
+            'notify_url' => config::MCH_NOTIFY_URL,
+            'order_time' => $order_time
+        ];
+
+        refill\util::push_queue_order($mchid,$mch_order,ORDER_STATE_QUEUE);
+        Model('refill_order')->add_detail($mchid,$mch_order,$order_time,$params,ORDER_STATE_QUEUE);
+
+        $state = refill\util::push_add($input);
+        if ($state === true) {
+            Log::record("fulu_youjun::Bridge refill::util::push_add success mchid={$mchid} mch_order={$mch_order} state={$state}",Log::DEBUG);
+            return [true, '提交成功'];
+        } else {
+            refill\util::del_queue_order($mchid,$mch_order);
+            Model('refill_order')->del_detail($mchid,$mch_order);
+            Log::record("fulu_youjun::Bridge refill::util::push_add error mchid={$mchid} mch_order={$mch_order} state={$state}",Log::DEBUG);
+            return [false, '提交失败'];
+        }
+    }
+
+    public function notify($params)
+    {
+        $mchid = $params['mchid'];
+        $mch_ordersn = $params['order_sn'];
+        $body = $this->notify_body($params);
+
+        $userID = config::USER_ID;
+        $header = [
+            'Content-Type: application/json',
+            "OrderNo: {$mch_ordersn}",
+            "UserID: {$userID}",
+        ];
+
+        $body = json_encode($body, JSON_UNESCAPED_UNICODE);
+        $body = $this->aes_encrypt($body);
+        $reqData['PostData'] = $body;
+        $reqData = json_encode($reqData, JSON_UNESCAPED_UNICODE);
+
+        $resp = http_post_data(config::ORDER_COMPLETE_URL, $reqData, $header, $net_errno);
+        if (empty($resp)) {
+            Log::record("回调下游,请求超时 mchid = {$mchid} mch_order = {$mch_ordersn}", Log::ERR);
+            return false;
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                Log::record("回调下游,返回数据格式有误 mchid = {$mchid} mch_order = {$mch_ordersn}", Log::ERR);
+                return false;
+            } elseif ($resp['code'] === '200' && $resp['data'] === true) {
+                return true;
+            } else {
+                Log::record("回调下游,返回失败 mchid = {$mchid} mch_order = {$mch_ordersn} message = {$resp['message']}", Log::ERR);
+                return false;
+            }
+        }
+    }
+
+    private function notify_body($params)
+    {
+        $success = $params['state'] == 'SUCCESS';
+        $body = [
+            "OrderNo" => $params['order_sn'],
+            "Status" => $success ? 1 : 2,
+            "Description" => '',
+            "RealCost" => "",
+            "SubstituteAccount" => "",
+            "ChannelAccountId" => "",
+            "InventoryId" => "",
+            "OperatorSerialNumber" => ""
+        ];
+
+        if($body['Status'] === 1) {
+            $body['OperatorSerialNumber'] = $params['official_sn'];
+        }
+
+        return $body;
+    }
+
+    private function aes_encrypt($data) {
+        $str_padded = $data;
+        if (strlen($str_padded) % 16) {
+            $str_padded = str_pad($str_padded,strlen($str_padded) + 16 - strlen($str_padded) % 16, "\0");
+        }
+        $data =  openssl_encrypt($str_padded, 'AES-128-CBC', config::KEY, OPENSSL_NO_PADDING, config::AES_IV);
+        return base64_encode($data);
+    }
+
+    //AES-128-ECB解密  data 字符串
+    private function aes_decrypt($data) {
+        $encrypted = base64_decode($data);
+        $params = openssl_decrypt($encrypted, 'AES-128-CBC', config::KEY, OPENSSL_NO_PADDING, config::AES_IV);
+        return json_decode(trim($params), true);
+    }
+}

+ 23 - 0
helper/rbridge/fulu_youjun/config.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace rbridge\fulu_youjun;
+
+class config
+{
+    const DEFAULT_MCHID = 10319;
+    const MCH_KEY  = '';
+    const MCH_NOTIFY_URL = 'fulu_youjun';
+
+    const AES_IV = '1111111111111111';
+    const KEY   = 'LiJqfCbI%mqny3mD';
+    const USER_ID = '8d91fd4c-2309-4949-9676-6c20084d57cd';
+
+    const ORDER_SEND_URL = 'https://public-robot.open.fulu.com/api/OutOrder/UpdateStatusProcess'; //配送中
+    const ORDER_COMPLETE_URL = 'https://public-robot.open.fulu.com/api/OutOrder/UpdateStatus'; //成功/失败/可疑
+
+    const ORDER_STATUS = [
+        ORDER_STATE_SUCCESS => 1,
+        ORDER_STATE_CANCEL  => 2,
+    ];
+}
+

+ 17 - 0
helper/rbridge/fulu_youjun/product.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace rbridge\fulu_youjun;
+
+global $fulu_youjun_product;
+$fulu_youjun_product = [
+    10319 => [
+        //移动
+        506122366 => [4, 5, 6],
+        505045388 => [4, 5, 6],
+        509984818 => [4, 5, 6],
+        503711825 => [4, 5, 6],
+        505659723 => [4, 5, 6],
+        503633222 => [4, 5, 6],
+    ],
+];
+

+ 25 - 0
helper/rbridge/fulu_youjun/readme.txt

@@ -0,0 +1,25 @@
+福禄开放平台我要供货教程-客户版 https://docs.qq.com/doc/DVmZ5QWhhQnFMQUNW
+物流自助服务使用教程-客户版 https://docs.qq.com/doc/DVnVQSERJdnZWTFRZ
+物流接口文档-V2.0 https://www.yuque.com/docs/share/4d5956bb-ca0f-46a2-a5e3-dd110f81a7ec?#
+
+http://console.open.fulu.com/
+
+福禄-酉俊
+账号:13916932570
+密码:youjun131419
+
+UserId:
+8d91fd4c-2309-4949-9676-6c20084d57cd
+UserKey:
+LiJqfCbI%mqny3mD
+aesIV=1111111111111111
+
+503633222 移动话费- 500
+505659723 移动话费- 300
+503711825 移动话费- 200
+509984818 移动话费- 100
+505045388 移动话费- 50
+506122366 移动话费- 30
+
+
+https://www.xyzshops.cn/mobile/bridge/fulu_youjun.php

+ 4 - 1
helper/rbridge/wsd/Bridge.php

@@ -39,12 +39,15 @@ class Bridge implements IBridge
         $mchinfo = Model('merchant')->getMerchantInfo(['mchid' => $mchid]);
         $userid = intval($mchinfo['admin_id']);
 
+        $order_time = time();
         $input = [ 'mchid' => $mchid,
             'buyer_id' => $userid,
             'amount' => $params['chargeCash'],
             'card_no' => $params['chargeAcct'],
             'mch_order' => $params['chargeId'],
-            'notify_url' => config::MCH_NOTIFY_URL];
+            'notify_url' => config::MCH_NOTIFY_URL,
+            'order_time' => $order_time
+        ];
 
         $code = refill\util::push_add($input);
         if($code) {

+ 110 - 66
helper/refill/RefillBase.php

@@ -59,13 +59,20 @@ class RefillBase
         }
         elseif ($caller->verify($input))
         {
-            [$order_id, $success, $can_try, $need_handle] = $caller->notify($input);
+            $values = $caller->notify($input);
+            if(count($values) == 4) { //老的接口返回四个参数
+                [$order_id, $success, $can_try, $need_handle] = $values;
+                $official_sn = false;
+            } else {
+                [$order_id, $success, $can_try, $need_handle, $official_sn] = $values;
+            }
+
             if (!$need_handle) {
                 return true;
             }
 
             if ($order_id !== false) {
-                return $this->proc_notify($order_id, $success, $can_try, $chname,$input);
+                return $this->proc_notify($order_id, $success, $can_try, $chname, $input, $official_sn);
             } else {
                 Log::record("{$chname} callback 系统无此订单ID:{$order_id}", Log::ERR);
             }
@@ -78,7 +85,7 @@ class RefillBase
         return true;
     }
 
-    private function risksn_check($refill_info)
+    private function risksn_check($refill_info,$org_official_sn)
     {
         $card_type = intval($refill_info['card_type']);
         $chk_types = [mtopcard\ChinaMobileCard , mtopcard\ChinaUnicomCard , mtopcard\ChinaTelecomCard];
@@ -87,6 +94,10 @@ class RefillBase
             return false;
         }
 
+        if ($org_official_sn !== false and strlen($org_official_sn) > 48) {
+            return true;
+        }
+
         $quality = intval($refill_info['quality']);
         $official_sn = $refill_info['official_sn'];
 
@@ -99,7 +110,7 @@ class RefillBase
             return (substr($haystack, 0, $length) === $needle);
         };
 
-        $headers = ['0095', 'SP', 'J98', 'WX', '11010336J'];
+        $headers = ['0095', 'SP', 'J98', 'WX']; //, '11010336J'
         $spcheker = function () use ($start_with, $headers, $official_sn)
         {
             $official_sn = strtoupper($official_sn);
@@ -116,10 +127,10 @@ class RefillBase
         return $spcheker();
     }
 
-    private function proc_notify($order_id, $success, $can_try, $chname, $input = [])
+    private function proc_notify($order_id, $success, $can_try, $chname, $input = [], $official_sn = false)
     {
         $mod_order = Model('vr_order');
-        $order_info = $mod_order->getOrderInfo(['order_id' => $order_id]);
+        $order_info = $mod_order->partition(util::part_notify())->getOrderInfo(['order_id' => $order_id]);
         $order_state = intval($order_info['order_state']);
 
         if ($order_state == ORDER_STATE_PAY)
@@ -142,7 +153,7 @@ class RefillBase
         try
         {
             $tran = new trans_wapper($mod_order,'notify change order state trans');
-            $order_info = $mod_order->getOrderInfo(['order_id' => $order_id], '*', true, true);
+            $order_info = $mod_order->partition(util::part_notify())->getOrderInfo(['order_id' => $order_id], '*', true, true);
             $order_state = intval($order_info['order_state']);
 
             if ($order_state != ORDER_STATE_SEND) {
@@ -150,7 +161,7 @@ class RefillBase
                 return false;
             }
 
-            $refill_info = $mod_refill->getOrderInfo(['order_id' => $order_id,'inner_status' => 0]);
+            $refill_info = $mod_refill->partition(util::part_notify())->getOrderInfo(['order_id' => $order_id, 'inner_status' => 0]);
             if(empty($refill_info)) {
                 $tran->commit();
                 return false;
@@ -163,7 +174,7 @@ class RefillBase
             $mch_order = $refill_info['mch_order'];
             $order_time = intval($refill_info['order_time']);
 
-            if($success && $this->risksn_check($refill_info)) {
+            if ($success && $this->risksn_check($refill_info, $official_sn)) {
                 $tran->commit();
                 $params = ['store_id' => $order_info['store_id'],
                     'channel_name' => $refill_info['channel_name'],
@@ -183,12 +194,12 @@ class RefillBase
                 $logic_vr_order->changeOrderStateSuccess($order_id,true);
                 $tran->commit();
                 util::onOrderSuccess($refill_info,$order_info);
-                util::monitor_callback($mchid, $spec,$card_type,$refill_info['mch_amount'], $refill_info['channel_amount'], true,$order_time);
+                util::monitor_callback($mchid, $spec, $card_type, $refill_info['mch_amount'], $refill_info['channel_amount'], true, $order_time);
             }
             elseif ($can_try)
             {
-                $logic_vr_order->changeOrderStateCancel($order_info, '', "{$chname}接口回调通知失败,正在重试",true,true);
-                $mod_refill->edit($order_id, ['is_retrying' => 1,'notify_time' => time()]);
+                $logic_vr_order->changeOrderStateCancel($order_info, '', "{$chname}接口回调通知失败,正在重试", true, true);
+                $mod_refill->partition(util::part_refill($order_time))->edit($order_id, ['is_retrying' => 1,'notify_time' => time()]);
                 $tran->commit();
 
                 [$can_retry,$params] = $this->retry($refill_info, $order_info);
@@ -206,8 +217,8 @@ class RefillBase
                 util::monitor_callback($mchid, $spec, $card_type, $refill_info['mch_amount'], 0, false, $order_time);
             }
 
-            $mod_refill->edit($order_id, ['notify_time' => time(), 'is_retrying' => 0,'notify_state' => 1]);
-            util::pop_queue_order($mchid,$mch_order);
+            $mod_refill->partition(util::part_refill($order_time))->edit($order_id, ['notify_time' => time(), 'is_retrying' => 0,'notify_state' => 1]);
+            util::pop_queue_order($mchid,$mch_order,$order_time);
             QueueClient::push("NotifyMerchantComplete", ['order_id' => $order_id,'manual' => false]);
 
             return true;
@@ -244,7 +255,7 @@ class RefillBase
         $last_orderid = $order->last_order_id();
 
         $mchid = $order->mchid();
-        $mch_order = $order->mch_order();
+        $order_time = $order->order_time();
 
         try
         {
@@ -281,7 +292,7 @@ class RefillBase
         else {
             $logic_vr_order = Logic("vr_order");
             $logic_vr_order->changeOrderStateSuccess($order_id,true);
-            $mod_refill->edit($order_id, ['commit_time' => time(),'notify_time' => time(), 'is_retrying' => 0,'notify_state' => 1]);
+            $mod_refill->partition(util::part_refill($order_time))->edit($order_id, ['commit_time' => time(),'notify_time' => time(), 'is_retrying' => 0,'notify_state' => 1]);
             util::monitor_callback($mchid, $order->spec(), $order->card_type(), $mch_amount, $channel_amount, true, $order->order_time());
 
             return [true,$order_id,''];
@@ -313,7 +324,7 @@ class RefillBase
             $order_id = $result['data']['order_id'];
 
             $logic_vr_order = Logic("vr_order");
-            $order_info = Model('vr_order')->getOrderInfo(['order_id' => $order_id]);
+            $order_info = Model('vr_order')->partition(util::part_vr_create())->getOrderInfo(['order_id' => $order_id]);
             $logic_vr_order->changeOrderStateCancel($order_info, '', '无法下单创建0元订单',true,true);
 
             $mch_order = $order->mch_order();
@@ -373,6 +384,7 @@ class RefillBase
     public function add(order $order)
     {
         $last_orderid = $order->last_order_id();
+        $order_time = $order->order_time();
 
         $mchid = $order->mchid();
         $mch_order = $order->mch_order();
@@ -449,14 +461,16 @@ class RefillBase
 
                 $trade_no = $errmsg;
                 $refill_type = $provider->refill_type();
+                $vr_part = util::part_vr_order_time($order_time);
+
                 if ($refill_type == 'api') {
                     $logic_vr_order = Logic("vr_order");
-                    $logic_vr_order->changeOrderStateSend($order_id,true);
+                    $logic_vr_order->changeOrderStateSend($order_id, true, $vr_part);
                 } elseif($refill_type == 'fetch') {
                     $logic_vr_order = Logic("vr_order");
-                    $logic_vr_order->changeOrderStateSend($order_id,true);
+                    $logic_vr_order->changeOrderStateSend($order_id, true, $vr_part);
 
-                    $order_info = Model('vr_order')->getOrderInfo(['order_id' => $order_id]);
+                    $order_info = Model('vr_order')->partition($vr_part)->getOrderInfo(['order_id' => $order_id]);
                     $mod_fetch_order = Model('fetch_order');
                     $fetch_datas = ['order_id' => $order_id, 'order_sn' => $order_sn, 'store_id' => $order_info['store_id'],'channel_name' => $channel_name,
                         'fetch_status' => 1, 'card_no' => $card_no, 'card_type' => $card_type, 'refill_amount' => $spec,
@@ -468,7 +482,7 @@ class RefillBase
                 }
 
                 $data = ['commit_time' => $commit_time, 'ch_trade_no' => $trade_no];
-                $mod_refill->edit($order_id, $data);
+                $mod_refill->partition(util::part_refill($order_time))->edit($order_id, $data);
                 $refill_state = true;
 
                 //如果对方没有回调能力,则启动主动查询.
@@ -482,7 +496,7 @@ class RefillBase
             {
                 $chfilters->add_channel($channel_name,false);
                 if(!empty($neterr) && util::need_check($net_errno)) {
-                    $mod_refill->edit($order_id, ['commit_time' => time(),'neterr' => 1,'err_msg' => "neterr={$net_errno}"]);
+                    $mod_refill->partition(util::part_refill($order_time))->edit($order_id, ['commit_time' => time(),'neterr' => 1,'err_msg' => "neterr={$net_errno}"]);
                     util::monitor_netchk($channel_name,false);
                     break;
                 } else {
@@ -498,7 +512,7 @@ class RefillBase
                 if(!is_string($errmsg)) {
                     $errmsg = "{$errmsg}";
                 }
-                $mod_refill->edit($order_id, ['commit_time' => time(), 'err_msg' => $errmsg]);
+                $mod_refill->partition(util::part_refill($order_time))->edit($order_id, ['commit_time' => time(), 'err_msg' => $errmsg]);
             }
         }
 
@@ -519,7 +533,8 @@ class RefillBase
             try
             {
                 if($last_orderid > 0) {
-                    $mod_refill->edit($last_orderid, ['inner_status' => 1]);
+                    $order_time = $order->order_time();
+                    $mod_refill->partition(util::part_refill($order_time))->edit($last_orderid, ['inner_status' => 1]);
                 }
                 $order->set_last_orderid($order_id);
 
@@ -627,11 +642,17 @@ class RefillBase
             return [false, "订单ID小于0"];
         }
 
-        $vr_order = Model('vr_order');
-        $refill_order = Model('refill_order');
+        $mod_order = Model('vr_order');
+        $mod_refill = Model('refill_order');
+
+        if ($manual) {
+            $part = '';
+        } else {
+            $part = util::part_notify();
+        }
 
-        $order_info = $vr_order->getOrderInfo(['order_id' => $order_id]);
-        $refill_info = $refill_order->getOrderInfo(['order_id' => $order_id,'inner_status' => 0,'is_retrying' => 0]);
+        $order_info = $mod_order->partition($part)->getOrderInfo(['order_id' => $order_id]);
+        $refill_info = $mod_refill->partition($part)->getOrderInfo(['order_id' => $order_id,'inner_status' => 0,'is_retrying' => 0]);
 
         if (empty($order_info) || empty($refill_info)) {
             return [false, "无此订单"];
@@ -643,8 +664,11 @@ class RefillBase
         }
 
         $notify_url = $refill_info['notify_url'];
+        $order_time = intval($refill_info['order_time']);
+        $part = util::part_refill($order_time);
+
         if (empty($notify_url)) {
-            $refill_order->edit($order_id, ['mch_notify_state' => 1, 'mch_notify_times' => 0]);
+            $mod_refill->partition($part)->edit($order_id, ['mch_notify_state' => 1, 'mch_notify_times' => 0]);
             return [false, "回调地址为空"];
         }
 
@@ -657,16 +681,16 @@ class RefillBase
         $resp = $this->mPolicy->notify($order_info,$refill_info);
         ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
         if ($resp) {
-            $refill_order->edit($order_id, ['mch_notify_state' => 1, 'mch_notify_times' => ['exp', 'mch_notify_times+1']]);
+            $mod_refill->partition($part)->edit($order_id, ['mch_notify_state' => 1, 'mch_notify_times' => ['exp', 'mch_notify_times+1']]);
             return [true, ""];
         }
         else
         {
-            $refill_order->edit($order_id, ['mch_notify_times' => ['exp', 'mch_notify_times+1']]);
+            $mod_refill->partition($part)->edit($order_id, ['mch_notify_times' => ['exp', 'mch_notify_times+1']]);
             $times = $refill_info['mch_notify_times'] + 1;
 
             if ($times > 100) {
-                $refill_order->edit($order_id, ['mch_notify_state' => 2]);
+                $mod_refill->partition($part)->edit($order_id, ['mch_notify_state' => 2]);
             } else {
                 $period = 5;
                 QueueClient::async_push("NotifyMerchantComplete", ['order_id' => $order_id,'manual' => false], $period);
@@ -706,27 +730,31 @@ class RefillBase
             $provider = $this->mPolicy->provider($chname);
             if(empty($provider)) return false;
 
-            [$state, $order_state] = $provider->query($refill_info);
-            if(!$state) {
-                return false;
-            }
-            elseif($order_state == ORDER_STATE_SUCCESS) {
-                $this->proc_notify($order_id,true,false,$chname);
-            }
-            elseif($order_state == ORDER_STATE_CANCEL) {
-                $this->proc_notify($order_id,false,true,$chname);
+            $values = $provider->query($refill_info);
+            if (count($values) == 2) {
+                [$state, $order_state] = $values;
+                $official_sn = false;
+            } else {
+                [$state, $order_state, $official_sn] = $values;
             }
-            else {
-                Log::record("RefillBase::query order_state={$order_state}",Log::DEBUG);
+
+            if (!$state) {
+                return false;
+            } elseif ($order_state == ORDER_STATE_SUCCESS) {
+                $this->proc_notify($order_id, true, false, $chname, $official_sn);
+            } elseif ($order_state == ORDER_STATE_CANCEL) {
+                $this->proc_notify($order_id, false, true, $chname, $official_sn);
+            } else {
+                Log::record("RefillBase::query order_state={$order_state}", Log::DEBUG);
             }
         }
-        
+
         return true;
     }
 
     public function query_net($order_id)
     {
-        $query_handler = function ($order_id, $order_info, $state, $order_state, $chname)
+        $query_handler = function ($order_id, $order_info, $state, $order_state, $chname,$order_time)
         {
             $mod_refill = Model('refill_order');
             if ($order_info['order_state'] == ORDER_STATE_PAY) {
@@ -734,6 +762,7 @@ class RefillBase
             } else {
                 $query_able = false;
             }
+            $vr_part = util::part_vr_order(intval($order_info['add_time']));
 
             $can_try = false;
             if($query_able)
@@ -746,16 +775,16 @@ class RefillBase
                 {
                     $neterr = false;
                     $logic_vr_order = Logic("vr_order");
-                    $logic_vr_order->changeOrderStateSend($order_id, true);
+                    $logic_vr_order->changeOrderStateSend($order_id, true, $vr_part);
 
                     $data = ['commit_time' => time()];
-                    $mod_refill->edit($order_id, $data);
+                    $mod_refill->partition(util::part_refill($order_time))->edit($order_id, $data);
                     QueueClient::async_push("QueryRefillState", ['order_id' => $order_id], 1);
                 }
                 elseif ($order_state == ORDER_STATE_NOEXIST) {
                     $neterr = false;
                     $logic_vr_order = Logic("vr_order");
-                    $logic_vr_order->changeOrderStateSend($order_id, true);
+                    $logic_vr_order->changeOrderStateSend($order_id, true, $vr_part);
                     $can_try = true;
                 }
                 else {
@@ -769,23 +798,32 @@ class RefillBase
             return [true,$can_try];
         };
 
+        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
         $mod_order = Model('vr_order');
-        $order_info = $mod_order->getOrderInfo(['order_id' => $order_id]);
+        $order_info = $mod_order->partition(util::part_notify())->getOrderInfo(['order_id' => $order_id]);
         if (empty($order_info) || $order_info['order_state'] != ORDER_STATE_PAY) return false;
 
         $mod_refill = Model('refill_order');
-        $refill_info = $mod_refill->getOrderInfo(['order_id' => $order_id,'inner_status' => 0]);
+        $refill_info = $mod_refill->partition(util::part_notify())->getOrderInfo(['order_id' => $order_id,'inner_status' => 0]);
+
         $chname = $refill_info['channel_name'];
         $provider = $this->mPolicy->provider($chname);
         if(empty($provider)) return false;
 
-        [$state, $order_state] = $provider->query($refill_info);
+        $values = $provider->query($refill_info);
+        if (count($values) == 2) {
+            [$state, $order_state] = $values;
+            $official_sn = false;
+        } else {
+            [$state, $order_state, $official_sn] = $values;
+        }
 
         try {
             $can_try = false;
             $tran = new trans_wapper($mod_order, 'query_net change order state trans');
-            $order_info = $mod_order->getOrderInfo(['order_id' => $order_id], '*', true, true);
-            [$ret, $can_try] = $query_handler($order_id, $order_info, $state, $order_state, $chname);
+            $order_info = $mod_order->partition(util::part_notify())->getOrderInfo(['order_id' => $order_id], '*', true, true);
+            $order_time = intval($refill_info['order_time']);
+            [$ret, $can_try] = $query_handler($order_id, $order_info, $state, $order_state, $chname,$order_time);
             $tran->commit();
             $trans_succ = true;
         }
@@ -799,7 +837,7 @@ class RefillBase
         if($can_try)
         {
             if($trans_succ) {
-                $this->proc_notify($order_id, false, true, $chname);
+                $this->proc_notify($order_id, false, true, $chname, $official_sn);
             } else {
                 QueueClient::async_push("QueryOrderNeterr",['order_id' => $order_id],30);
             }
@@ -823,12 +861,16 @@ class RefillBase
 
                 $logic_vr_order = Logic("vr_order");
                 $logic_vr_order->changeOrderStateSuccess($order_id,true);
-                $refill_order = Model('refill_order');
-                $refill_order->edit($order_id, ['notify_time' => time(), 'notify_state' => 1,'is_retrying' => 0]);
+
+                $mod_refill = Model('refill_order');
+                $refill_info = $mod_refill->getOrderInfo(['order_id' => $order_id]);
+                $order_time = intval($refill_info['order_time']);
+
+                $mod_refill->partition(util::part_refill($order_time))->edit($order_id, ['notify_time' => time(), 'notify_state' => 1,'is_retrying' => 0]);
                 mtopcard\cards_helper::assign($order_id);
 
-                $refill_info = $refill_order->getOrderInfo(['order_id' => $order_id]);
-                util::pop_queue_order($refill_info['mchid'],$refill_info['mch_order']);
+
+                util::pop_queue_order($refill_info['mchid'], $refill_info['mch_order'], $order_time);
             }
             else {
                 $tran->commit();
@@ -859,12 +901,14 @@ class RefillBase
 
                 $logic_vr_order = Logic("vr_order");
                 $logic_vr_order->changeOrderStateCancel($order_info, '', "后台手动回调通知失败",true,true);
-                $refill_order = Model('refill_order');
-                $refill_order->edit($order_id, ['notify_time' => time(), 'notify_state' => 1,'is_retrying' => 0]);
-                mtopcard\cards_helper::reuse($order_id);
 
-                $refill_info = $refill_order->getOrderInfo(['order_id' => $order_id]);
-                util::pop_queue_order($refill_info['mchid'],$refill_info['mch_order']);
+                $mod_refill = Model('refill_order');
+                $refill_info = $mod_refill->getOrderInfo(['order_id' => $order_id]);
+                $order_time = intval($refill_info['order_time']);
+                $mod_refill->partition(util::part_refill($order_time))->edit($order_id, ['notify_time' => time(), 'notify_state' => 1,'is_retrying' => 0]);
+
+                mtopcard\cards_helper::reuse($order_id);
+                util::pop_queue_order($refill_info['mchid'], $refill_info['mch_order'], $order_time);
             }
             else {
                 $tran->commit();
@@ -888,9 +932,9 @@ class RefillBase
     {
         return $this->mPolicy->region_intercept($quality,$card_type,$region_no);
     }
-    public function UpdateMchRatios($gross,$detail)
+    public function UpdateMchRatios($gross,$detail,$types)
     {
-        $this->mPolicy->update_mchratios($gross,$detail);
+        $this->mPolicy->update_mchratios($gross, $detail, $types);
     }
     public function UpdateChctl($params)
     {
@@ -900,4 +944,4 @@ class RefillBase
     {
         $this->mPolicy->update_maxspeeds($params);
     }
-}
+}

+ 4 - 2
helper/refill/XYZRefillFactory.php

@@ -27,10 +27,12 @@ require_once(BASE_HELPER_PATH . '/refill/policy/PolicyUtil.php');
 require_once(BASE_HELPER_PATH . '/refill/policy/xyz/quality_ploy.php');
 require_once(BASE_HELPER_PATH . '/refill/policy/mgroup.php');
 require_once(BASE_HELPER_PATH . '/refill/policy/channel_filter.php');
-
 require_once(BASE_HELPER_PATH . '/refill/policy/mratio_control.php');
 require_once(BASE_HELPER_PATH . '/refill/policy/mratio_controlex.php');
-
+require_once(BASE_HELPER_PATH . '/refill/policy/match/mixed_match.php');
+require_once(BASE_HELPER_PATH . '/refill/policy/match/whole_match.php');
+require_once(BASE_HELPER_PATH . '/refill/policy/match/type_match.php');
+require_once(BASE_HELPER_PATH . '/refill/policy/match/type_spec_match.php');
 require_once(BASE_HELPER_PATH . '/refill/policy/overload_assigner.php');
 require_once(BASE_HELPER_PATH . '/refill/policy/interceptor.php');
 require_once(BASE_HELPER_PATH . '/refill/policy/transfer.php');

+ 1 - 1
helper/refill/api/xyz/afand/RefillCallBack.php

@@ -32,7 +32,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['status']);
         $order_sn = $params['mch_order_id'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/afandeng/RefillCallBack.php

@@ -30,7 +30,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['state']);
         $order_sn = $params['ord'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/afandfs/RefillCallBack.php

@@ -28,7 +28,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['code']);
         $order_sn = $params['partner_order_no'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false, false];
         }

+ 1 - 1
helper/refill/api/xyz/afandnew/RefillCallBack.php

@@ -53,7 +53,7 @@ class RefillCallBack implements refill\IRefillCallBack
         $status = intval($params['orderStatus']);
         $order_sn = $params['orderNo'];
 
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false, false];
         }

+ 1 - 1
helper/refill/api/xyz/afd/RefillCallBack.php

@@ -32,7 +32,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['rechargestate']);
         $order_sn = $params['merchantorderId'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/ainika/RefillCallBack.php

@@ -29,7 +29,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['resultno']);
         $order_sn = $params['sporderid'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/ainika_high/RefillCallBack.php

@@ -29,7 +29,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['resultno']);
         $order_sn = $params['sporderid'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/bailian/RefillCallBack.php

@@ -22,7 +22,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = $params['status'];
         $order_sn = $params['orderId'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/baixuan/RefillCallBack.php

@@ -48,7 +48,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['orderStatus']);
         $order_sn = $params['outOrderId'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/baixuan_normal/RefillCallBack.php

@@ -48,7 +48,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['orderStatus']);
         $order_sn = $params['outOrderId'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/baixuannew_high/RefillCallBack.php

@@ -29,7 +29,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['resultno']);
         $order_sn = $params['sporderid'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/baixuannew_normal/RefillCallBack.php

@@ -29,7 +29,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['resultno']);
         $order_sn = $params['sporderid'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/bdt/RefillCallBack.php

@@ -58,7 +58,7 @@ class RefillCallBack implements refill\IRefillCallBack
         $status = intval($params['orderStatus']);
         $order_sn = $params['cardOwnerOrderNo'];
 
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false];
         }

+ 1 - 1
helper/refill/api/xyz/beixt/RefillCallBack.php

@@ -33,7 +33,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['shipping_status']);
         $order_sn = $params['tradeNo'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

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

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

+ 155 - 0
helper/refill/api/xyz/bier/RefillPhone.php

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

+ 51 - 0
helper/refill/api/xyz/bier/config.php

@@ -0,0 +1,51 @@
+<?php
+
+
+namespace refill\bier;
+use mtopcard;
+
+class config
+{
+    const ORDER_URL = 'http://47.108.202.150/flow-receiver/api/recharge/feecbk';
+    const QUERY_URL = 'http://47.108.202.150/flow-receiver/api/query/feecbk';
+    const BALANCE_URL = 'http://47.108.202.150/flow-receiver/api/balance/feecbk';
+    const NOTIFY_URL = BASE_SITE_URL . '/mobile/callback/refill_bier.php';
+
+    const ACCOUNT = 'lzyezi';
+    const KEY = '01dfa36eed7847958d93ab82bc28dc23';
+    const operator = [
+        mtopcard\ChinaMobileCard  => 'CMCC',
+        mtopcard\ChinaUnicomCard  => 'CUCC',
+        mtopcard\ChinaTelecomCard => 'CTCC'
+    ];
+    const ProductIDS = [
+        mtopcard\ChinaMobileCard => [
+            10 => 'CMCCALLr10r',
+            20 => 'CMCCALLr20r',
+            30 => 'CMCCALLr30r',
+            50 => 'CMCCALLr50r',
+            100 => 'CMCCALLr100r',
+            200 => 'CMCCALLr200r',
+        ],
+        mtopcard\ChinaUnicomCard => [
+            30 => 'CUCCALLr30r',
+            50 => 'CUCCALLr50r',
+            100 => 'CUCCALLr100r',
+            200 => 'CUCCALLr200r',
+        ],
+        mtopcard\ChinaTelecomCard => [
+            30 => 'CTCCALLr30r',
+            50 => 'CTCCALLr50r',
+            100 => 'CTCCALLr100r',
+            200 => 'CTCCALLr200r',
+        ],
+    ];
+
+    const NotifyErrCodes = [
+        '003','004','005','006','007','008','015','016','017','018','019','020','021','022','023','025','027','028','098','099'
+    ];
+
+    const QueryErrCodes = [
+        '003','004','005','006','007','008','015','016','017','018','019','020','021','022','023','024','025','026','027','028','098','099'
+    ];
+}

+ 43 - 0
helper/refill/api/xyz/bier/椰子.txt

@@ -0,0 +1,43 @@
+
+账号:lzyezi
+密码:yz123456
+密钥:01dfa36eed7847958d93ab82bc28dc23
+
+客户后台地址:http://47.108.202.150/flow-consumer/login.html
+
+下单地址
+http://47.108.202.150/flow-receiver/api/recharge/feecbk
+查询地址
+http://47.108.202.150/flow-receiver/api/query/feecbk
+余额查询地址
+http://47.108.202.150/flow-receiver/api/balance/feecbk
+
+
+请务必绑定我们回调IP:47.108.202.150
+
+产品编码可登录客户后台查看:个人信息>产品编码
+
+全国移动产品编码			面值
+CMCCALLr30r					30
+CMCCALLr50r					50
+CMCCALLr100r				100
+CMCCALLr200r				200
+
+全国联通产品编码			面值
+CUCCALLr30r					30
+CUCCALLr50r					50
+CUCCALLr100r				100
+CUCCALLr200r				200
+
+2022.11.23
+全国移动 10-20 面值 0.995
+CMCCALLr10r
+CMCCALLr20r
+
+2022.11.29
+折扣96.5
+全国电信
+CTCCALLr30r
+CTCCALLr50r
+CTCCALLr100r
+CTCCALLr200r

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


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

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

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

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

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

@@ -0,0 +1,154 @@
+<?php
+
+
+namespace refill\bier_fs;
+use mtopcard;
+
+class config
+{
+    const ORDER_URL = 'http://47.108.202.150/flow-receiver/api/recharge/feecbk';
+    const QUERY_URL = 'http://47.108.202.150/flow-receiver/api/query/feecbk';
+    const BALANCE_URL = 'http://47.108.202.150/flow-receiver/api/balance/feecbk';
+    const NOTIFY_URL = BASE_SITE_URL . '/mobile/callback/refill_bier_fs.php';
+
+    const ACCOUNT = 'yzfs1688';
+    const KEY = '257d28723a814bbcbc8b8f21edf669fe';
+    const operator = [
+        mtopcard\ChinaMobileCard  => 'CMCC',
+        mtopcard\ChinaUnicomCard  => 'CUCC',
+        mtopcard\ChinaTelecomCard => 'CTCC'
+    ];
+    const ProductIDS = [
+        mtopcard\ChinaMobileCard => [
+            //福建
+            13 => [
+                30 => 'CMCCFJr30r', 50 => 'CMCCFJr50r',
+                100 => 'CMCCFJr100r', 200 => 'CMCCFJr200r'
+            ],
+            //贵州
+            24 => [
+                30 => 'CMCCGZr30r', 50 => 'CMCCGZr50r',
+                100 => 'CMCCGZr100r', 200 => 'CMCCGZr200r'
+            ],
+            //广东
+            19 => [
+                30 => 'CMCCGDr30r', 50 => 'CMCCGDr50r',
+                100 => 'CMCCGDr100r', 200 => 'CMCCGDr200r'
+            ],
+            //山东
+            15 => [
+                50 => 'CMCCSDr50r',
+                100 => 'CMCCSDr100r', 200 => 'CMCCSDr200r'
+            ],
+            //江苏
+            10 => [
+                30 => 'CMCCJSr30r', 50 => 'CMCCJSr50r',
+                100 => 'CMCCJSr100r', 200 => 'CMCCJSr200r'
+            ],
+            //云南
+            25 => [
+                30 => 'CMCCYNr30r', 50 => 'CMCCYNr50r',
+                100 => 'CMCCYNr100r', 200 => 'CMCCYNr200r'
+            ],
+            16 => [
+                30 => 'CMCCYUr30r', 50 => 'CMCCYUr50r',
+                100 => 'CMCCYUr100r', 200 => 'CMCCYUr200r'
+            ], //河南
+            11 => [
+                30 => 'CMCCZJr30r', 50 => 'CMCCZJr50r',
+                100 => 'CMCCZJr100r', 200 => 'CMCCZJr200r'
+            ], //浙江
+            3 => [
+                50 => 'CMCCJIr50r',
+                100 => 'CMCCJIr100r', 200 => 'CMCCJIr200r'
+            ], //河北
+            20 => [
+                30 => 'CMCCGXr30r', 50 => 'CMCCGXr50r',
+                100 => 'CMCCGXr100r', 200 => 'CMCCGXr200r'
+            ],//广西
+            23 => [
+                50  => 'CMCCSCr50r',
+                100 => 'CMCCSCr100r', 200 => 'CMCCSCr200r',
+            ],//四川
+            22 => [
+                50  => 'CMCCCQr50r',
+                100 => 'CMCCCQr100r', 200 => 'CMCCCQr200r',
+            ],//重庆
+        ],
+        mtopcard\ChinaTelecomCard => [
+            //四川
+            23 => [
+                30 => 'CTCCSCr30r', 50 => 'CTCCSCr50r',
+                100 => 'CTCCSCr100r', 200 => 'CTCCSCr200r'
+            ],
+            //山东
+            15 => [
+                30 => 'CTCCSDr30r', 50 => 'CTCCSDr50r',
+                100 => 'CTCCSDr100r', 200 => 'CTCCSDr200r'
+            ],
+            //天津
+            2 => [
+                30 => 'CTCCTJr30r', 50 => 'CTCCTJr50r',
+                100 => 'CTCCTJr100r', 200 => 'CTCCTJr200r'
+            ],
+            //云南
+            25 => [
+                30 => 'CTCCYNr30r', 50 => 'CTCCYNr50r',
+                100 => 'CTCCYNr100r', 200 => 'CTCCYNr200r'
+            ],
+            //广东
+            19 => [
+                30 => 'CTCCGDr30r', 50 => 'CTCCGDr50r',
+                100 => 'CTCCGDr100r', 200 => 'CTCCGDr200r'
+            ],
+            //上海
+            9 => [
+                50 => 'CTCCSHr50r',
+                100 => 'CTCCSHr100r', 200 => 'CTCCSHr200r'
+            ],
+            //湖南
+            18 => [
+                30 => 'CTCCHNr30r', 50 => 'CTCCHNr50r',
+                100 => 'CTCCHNr100r', 200 => 'CTCCHNr200r'
+            ],
+            //安徽
+            12 => [
+                30 => 'CTCCAHr30r', 50 => 'CTCCAHr50r',
+                100 => 'CTCCAHr100r', 200 => 'CTCCAHr200r'
+            ],
+        ]
+    ];
+
+    const NotifyErrCodes = [
+        '003','004','005','006','007','008','015','016','017','018','019','020','021','022','023','025','027','028','098','099'
+    ];
+
+    const QueryErrCodes = [
+        '003','004','005','006','007','008','015','016','017','018','019','020','021','022','023','024','025','026','027','028','098','099'
+    ];
+
+    const Price = [
+        // 移动
+        "4-30-13" => 28.8, "4-50-13" => 48, "4-100-13" => 96, "4-200-13" => 192,//福建 13
+        "4-30-24" => 28.65, "4-50-24" => 47.75, "4-100-24" => 95.5, "4-200-24" => 191,//贵州 24
+        "4-30-19" => 28.8, "4-50-19" => 48, "4-100-19" => 96, "4-200-19" => 192,//广东 19
+        "4-50-15" => 47.75, "4-100-15" => 95.5, "4-200-15" => 191,//山东 15
+        "4-30-10" => 28.65, "4-50-10" => 47.75, "4-100-10" => 95.5, "4-200-10" => 191,//江苏 10
+        "4-30-25" => 28.65, "4-50-25" => 47.75, "4-100-25" => 95.5, "4-200-25" => 191,//云南 25
+        "4-30-16" => 28.8, "4-50-16" => 48, "4-100-16" => 96, "4-200-16" => 192,//河南 16
+        "4-30-11" => 28.95, "4-50-11" => 48.25, "4-100-11" => 96.5, "4-200-11" => 193,//浙江 11
+        "4-50-3" => 48, "4-100-3" => 96, "4-200-3" => 192,//河北 3
+        "4-30-20" => 28.8, "4-50-20" => 48, "4-100-20" => 96, "4-200-20" => 192,//广西 20
+        "4-50-23" => 48, "4-100-23" => 96, "4-200-23" => 192,//四川 23
+        "4-50-22" => 47.75, "4-100-22" => 95.5, "4-200-22" => 191,//重庆 22
+
+        "6-30-23" => 28.65, "6-50-23" => 47.75, "6-100-23" => 95.5, "6-200-23" => 191,//四川 23
+        "6-30-15" => 28.65, "6-50-15" => 47.75, "6-100-15" => 95.5, "6-200-15" => 191,//山东 15
+        "6-30-2" => 28.65, "6-50-2" => 47.75, "6-100-2" => 95.5, "6-200-2" => 191,//天津 2
+        "6-30-25" => 28.65, "6-50-25" => 47.75, "6-100-25" => 95.5, "6-200-25" => 191,//云南 25
+        "6-30-19" => 28.8, "6-50-19" => 48, "6-100-19" => 96, "6-200-19" => 192,//广东 19
+        "6-50-9" => 47.75, "6-100-9" => 95.5, "6-200-9" => 191,//上海 9
+        "6-30-18" => 28.8, "6-50-18" => 48, "6-100-18" => 96, "6-200-18" => 192,//湖南 18
+        "6-30-12" => 28.8, "6-50-12" => 48, "6-100-12" => 96, "6-200-12" => 192,//安徽 12
+    ];
+}

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

@@ -0,0 +1,147 @@
+账号:yzfs1688
+密码:yz123456
+密钥:257d28723a814bbcbc8b8f21edf669fe
+
+客户后台地址:http://47.108.202.150/flow-consumer/login.html
+
+下单地址
+http://47.108.202.150/flow-receiver/api/recharge/feecbk
+查询地址
+http://47.108.202.150/flow-receiver/api/query/feecbk
+余额查询地址
+http://47.108.202.150/flow-receiver/api/balance/feecbk
+
+
+请务必绑定我们回调IP:47.108.202.150
+
+产品编码可登录客户后台查看:个人信息>产品编码
+
+福建移动分省
+CMCCFJr30r	折扣96
+CMCCFJr50r	折扣96
+CMCCFJr100r	折扣96
+CMCCFJr200r	折扣96
+
+贵州分省
+CMCCGZr30r	折扣95.5
+CMCCGZr50r	折扣95.5
+CMCCGZr100r	折扣95.5
+CMCCGZr200r	折扣95.5
+
+广东移动
+CMCCGDr30r	折扣96
+CMCCGDr50r	折扣96
+CMCCGDr100r	折扣96
+CMCCGDr200r	折扣96
+
+山东移动
+没有30面值
+CMCCSDr50r	折扣96
+CMCCSDr100r	折扣96
+CMCCSDr200r	折扣96
+
+江苏移动
+CMCCJSr30r	折扣95.5
+CMCCJSr50r	折扣95.5
+CMCCJSr100r	折扣95.5
+CMCCJSr200r	折扣95.5
+
+
+四川电信分省
+CTCCSCr30r 	折扣95.5
+CTCCSCr50r 	折扣95.5
+CTCCSCr100r 	折扣95.5
+CTCCSCr200r   	折扣95.5
+
+
+
+山东电信分省	折扣95.5
+CTCCSDr30r	折扣95.5
+CTCCSDr50r	折扣95.5
+CTCCSDr100r	折扣95.5
+CTCCSDr200r
+
+天津电信分省
+CTCCTJr30r	折扣95.5
+CTCCTJr50r	折扣95.5
+CTCCTJr100r	折扣95.5
+CTCCTJr200r	折扣95.5
+
+云南电信分省
+CTCCYNr30r	折扣95.5
+CTCCYNr50r	折扣95.5
+CTCCYNr100r	折扣95.5
+CTCCYNr200r	折扣95.5
+
+广东电信分省
+CTCCGDr30r	折扣96
+CTCCGDr50r	折扣96
+CTCCGDr100r	折扣96
+CTCCGDr200r	折扣96
+
+上海电信
+CTCCSHr50r
+CTCCSHr100r
+CTCCSHr200r
+
+2022.11.20
+云南分省移动  折扣96
+商品编码
+CMCCYNr30r
+CMCCYNr50r
+CMCCYNr100r
+CMCCYNr200r
+
+2022.11.23
+河南移动
+CMCCYUr30r
+CMCCYUr50r
+CMCCYUr100r
+CMCCYUr200r
+
+2022.11.24
+湖南电信
+CTCCHNr30r
+CTCCHNr50r
+CTCCHNr100r
+CTCCHNr200r
+
+2022.12.2
+比尔   折扣 96.5
+浙江移动分省
+CMCCZJr30r
+CMCCZJr50r
+CMCCZJr100r
+CMCCZJr200r
+
+2022.12.7
+河北移动
+CMCCJIr50r
+CMCCJIr100r
+CMCCJIr200r
+
+2022.12.8
+ 广西移动
+CMCCGXr30r
+CMCCGXr50r
+CMCCGXr100r
+CMCCGXr200r
+
+2022.12.9
+安微电信分省
+CTCCAHr30r
+CTCCAHr50r
+CTCCAHr100r
+CTCCAHr200r
+
+2022.12.11
+四川移动
+CMCCSCr50r
+CMCCSCr100r
+CMCCSCr200r
+
+2022.12.17
+重庆移动分省
+CMCCCQr50r
+CMCCCQr100r
+CMCCCQr200r

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


+ 1 - 1
helper/refill/api/xyz/bingdht/RefillCallBack.php

@@ -29,7 +29,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['nFlag']);
         $order_sn = $params['szOrderId'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/bjb/RefillCallBack.php

@@ -30,7 +30,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['state']);
         $order_sn = $params['ord'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/bjbnew/RefillCallBack.php

@@ -32,7 +32,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['orderstatus']);
         $order_sn = $params['orderno'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/bjbyd/RefillCallBack.php

@@ -30,7 +30,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['state']);
         $order_sn = $params['ord'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/bodian/RefillCallBack.php

@@ -29,7 +29,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['nFlag']);
         $order_sn = $params['szOrderId'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

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

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

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

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

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

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

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

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

+ 1 - 1
helper/refill/api/xyz/bodian_yd/RefillCallBack.php

@@ -30,7 +30,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['nFlag']);
         $order_sn = $params['szOrderId'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/bxtwt/RefillCallBack.php

@@ -33,7 +33,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['shipping_status']);
         $order_sn = $params['tradeNo'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/cangbu/RefillCallBack.php

@@ -49,7 +49,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['code']);
         $order_sn = $params['tmporder'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/cangbu_high/RefillCallBack.php

@@ -49,7 +49,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['code']);
         $order_sn = $params['tmporder'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/cangbukami/RefillCallBack.php

@@ -49,7 +49,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['code']);
         $order_sn = $params['tmporder'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/cangbuyd/RefillCallBack.php

@@ -49,7 +49,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['code']);
         $order_sn = $params['tmporder'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/cangxin/RefillCallBack.php

@@ -47,7 +47,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['status']);
         $order_sn = $params['clientOrderNo'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 2 - 0
helper/refill/api/xyz/cangxin/RefillPhone.php

@@ -22,6 +22,8 @@ class RefillPhone extends refill\IRefillPhone
         $params['account'] = $phone;
         if ($card_type === mtopcard\ChinaMobileCard) {
             $params['skuCode'] = config::CMCC_product_code[$regin_no][$amount];
+        } elseif ($card_type === mtopcard\ChinaTelecomCard){
+            $params['skuCode'] = config::CTCC_product_code[$regin_no][$amount];
         } else {
             $params['skuCode'] = config::PRODUCT[$card_type][$amount];
         }

+ 30 - 0
helper/refill/api/xyz/cangxin/config.php

@@ -46,6 +46,36 @@ class config
         24 => [
             30 => '1260030', 50 => '1260050', 100 => '1260100', 200 => '1260200'
         ], //贵州
+        13 => [
+            50 => 'fjyd50', 100 => 'fjyd100', 200 => 'fjyd200'
+        ], //福建
+        16 => [
+            30 => 'hnyd30', 50 => 'hnyd50', 100 => 'hnyd100', 200 => 'hnyd200'
+        ], //河南
+        25 => [
+            50 => 'ynyd50', 100 => 'ynyd100', 200 => 'ynyd200'
+        ], //云南
+        20 => [
+            50 => '1080050', 100 => '1080100', 200 => '1080200'
+        ], //广西
+        3 => [
+            30 => 'hbyd30', 50 => 'hbyd50', 100 => 'hbyd100', 200 => 'hbyd200'
+        ], //河北
+        23 => [
+            50 => 'scyd50', 100 => 'scyd100', 200 => 'scyd200'
+        ], //四川
+    ];
+
+    const CTCC_product_code = [
+        23 => [
+            30 => 'scdx30', 50 => 'scdx50', 100 => 'scdx100', 200 => 'scdx200'
+        ], //四川
+        9 => [
+            30 => '2060030', 50 => '2060050', 100 => '20600100', 200 => '20600200'
+        ], //上海
+        2 => [
+            30 => '2150030', 50 => '2150050', 100 => '21500100', 200 => '21500200'
+        ], //天津
     ];
     const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
 }

+ 61 - 0
helper/refill/api/xyz/cangxin/开户信息.txt

@@ -32,3 +32,64 @@ jsyd200 江苏移动200元
 sdyd50  山东移动50元
 sdyd100 山东移动100元
 sdyd200 山东移动200元
+
+2022.11.21
+fjyd50
+fjyd100
+fjyd200
+
+2022.11.28
+河南移动 面值30-200 折扣935
+hnyd30
+hnyd50
+hnyd100
+hnyd200
+
+2022.12.6
+沧辛低价
+云南移动
+商品编码
+ynyd50
+ynyd100
+ynyd200
+
+2022.12.8
+沧辛广西移动编码
+1080050
+1080100
+1080200
+
+2022.12.14
+河北移动 30-200
+hbyd30
+hbyd50
+hbyd100
+hbyd200
+
+2022.12.16
+四川移动50-200
+scyd50
+scyd100
+scyd200
+
+2022.12.19
+ 沧兴 电信分省 价格942
+
+电信四川
+scdx30
+scdx50
+scdx100
+scdx200
+
+电信上海
+2060030
+2060050
+20600100
+20600200
+
+
+电信天津
+2150030
+2150050
+21500100
+21500200

+ 1 - 1
helper/refill/api/xyz/cangxin_doubi/RefillCallBack.php

@@ -47,7 +47,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['status']);
         $order_sn = $params['clientOrderNo'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/cangxin_high/RefillCallBack.php

@@ -47,7 +47,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['status']);
         $order_sn = $params['clientOrderNo'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/cangxin_yi/RefillCallBack.php

@@ -47,7 +47,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['status']);
         $order_sn = $params['clientOrderNo'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/chending_df/RefillCallBack.php

@@ -48,7 +48,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['orderStatus']);
         $order_sn = $params['outOrderId'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/chending_tax/RefillCallBack.php

@@ -48,7 +48,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['orderStatus']);
         $order_sn = $params['outOrderId'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/chizeng/RefillCallBack.php

@@ -29,7 +29,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['resultno']);
         $order_sn = $params['sporderid'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/chizeng_normal/RefillCallBack.php

@@ -29,7 +29,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['resultno']);
         $order_sn = $params['sporderid'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/chizeng_yi/RefillCallBack.php

@@ -29,7 +29,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['resultno']);
         $order_sn = $params['sporderid'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 1 - 1
helper/refill/api/xyz/dashang/RefillCallBack.php

@@ -29,7 +29,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $status = intval($params['status']);
         $order_sn = $params['downstreamSerialno'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }

+ 0 - 0
helper/refill/api/xyz/dashang_kami/RefillCallBack.php


Some files were not shown because too many files changed in this diff