Browse Source

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

ayHaru 4 years ago
parent
commit
1c62368b7e
100 changed files with 4767 additions and 545 deletions
  1. 3 1
      .gitignore
  2. 66 27
      admin/control/merchant.php
  3. 2 2
      admin/templates/default/merchant.edit.php
  4. 2 2
      admin/templates/default/merchant.price.php
  5. 43 15
      admin/templates/default/merchant.refill.evidence_list.php
  6. 3 3
      admin/templates/default/provider.index.php
  7. 29 15
      admin/templates/default/provider.successful.php
  8. 54 2
      admin/templates/default/refill.order.index.php
  9. 11 0
      admin/templates/default/refill.order.send.index.php
  10. 673 260
      admin/templates/default/refill_stock.php
  11. 1 1
      core/framework/libraries/log.php
  12. 35 16
      data/config/lingzh/refill.ini.php
  13. 170 54
      data/config/win/refill.ini.php
  14. 200 55
      data/config/xyz/refill.ini.php
  15. 18 2
      docker/compose/lz-acc/docker-compose.yml
  16. 26 0
      docker/compose/lz-stat/docker-compose.yml
  17. 20 2
      docker/compose/stanley/docker-compose.yml
  18. 16 1
      docker/compose/xiaoyu/docker-compose.yml
  19. 18 2
      docker/compose/xyz-acc/docker-compose.yml
  20. 1 1
      docker/compose/xyz-stat/docker-compose.yml
  21. 11 0
      docker/conf/nginx/nginx-linzh-https.conf
  22. 9 0
      docker/conf/nginx/nginx-stanley-http.conf
  23. 9 1
      docker/conf/nginx/nginx-xyz-https.conf
  24. 12 0
      docker/conf/php/mch-spwan-start
  25. 11 0
      docker/conf/php/mch-spwan-start-lz
  26. 1 0
      docker/conf/php/php-local-debug.ini
  27. 1 1
      docker/conf/php/xyz-php.ini
  28. 16 6
      helper/fcgisrv/BaseServer.php
  29. 1 1
      helper/fcgisrv/LZRAccServer.php
  30. 111 0
      helper/fcgisrv/MerchantServer.php
  31. 52 29
      helper/fcgisrv/MobileServer.php
  32. 2 2
      helper/http_header.php
  33. 1 1
      helper/performance_helper.php
  34. 2 1
      helper/refill/RefillBase.php
  35. 1 1
      helper/refill/api/lingzh/amingjd/RefillCallBack.php
  36. 51 0
      helper/refill/api/lingzh/amingjdman/RefillCallBack.php
  37. 103 0
      helper/refill/api/lingzh/amingjdman/RefillPhone.php
  38. 5 0
      helper/refill/api/lingzh/amingjdman/api.txt
  39. 21 0
      helper/refill/api/lingzh/amingjdman/config.php
  40. 2 2
      helper/refill/api/lingzh/binghc/config.php
  41. 1 1
      helper/refill/api/lingzh/fensheng/config.php
  42. 2 2
      helper/refill/api/lingzh/weishengy/config.php
  43. 3 5
      helper/refill/api/xyz/afandfs/config.php
  44. 67 0
      helper/refill/api/xyz/jumi/RefillCallBack.php
  45. 107 0
      helper/refill/api/xyz/jumi/RefillPhone.php
  46. 10 0
      helper/refill/api/xyz/jumi/api.txt
  47. 18 0
      helper/refill/api/xyz/jumi/config.php
  48. 39 0
      helper/refill/api/xyz/qianqian/RefillCallBack.php
  49. 106 0
      helper/refill/api/xyz/qianqian/RefillPhone.php
  50. 42 0
      helper/refill/api/xyz/qianqian/config.php
  51. 3 0
      helper/refill/api/xyz/qianqian/琳珠网络科技话费接口充值协议.doc
  52. BIN
      helper/refill/api/xyz/qianqian/琳珠网络科技话费接口状态码详解.docx
  53. 52 0
      helper/refill/api/xyz/tiancheng/RefillCallBack.php
  54. 101 0
      helper/refill/api/xyz/tiancheng/RefillPhone.php
  55. 20 0
      helper/refill/api/xyz/tiancheng/config.php
  56. BIN
      helper/refill/api/xyz/tiancheng/话费供货商对接文档.docx
  57. 5 0
      helper/refill/api/xyz/tiancheng/账号.txt
  58. 50 0
      helper/refill/api/xyz/weiyiman/RefillCallBack.php
  59. 96 0
      helper/refill/api/xyz/weiyiman/RefillPhone.php
  60. 13 0
      helper/refill/api/xyz/weiyiman/config.php
  61. 72 0
      helper/refill/api/xyz/xunao/RefillCallBack.php
  62. 111 0
      helper/refill/api/xyz/xunao/RefillPhone.php
  63. 8 0
      helper/refill/api/xyz/xunao/api.txt
  64. 21 0
      helper/refill/api/xyz/xunao/config.php
  65. 50 0
      helper/refill/api/xyz/yonghe/RefillCallBack.php
  66. 103 0
      helper/refill/api/xyz/yonghe/RefillPhone.php
  67. 11 0
      helper/refill/api/xyz/yonghe/api.txt
  68. 21 0
      helper/refill/api/xyz/yonghe/config.php
  69. 100 0
      helper/refill/policy/mgroup.php
  70. 2 2
      helper/refill/policy/rlock.php
  71. 13 2
      helper/refill/policy/rstorage.php
  72. 1 1
      helper/request_helper.php
  73. 4 2
      helper/session.php
  74. 1 1
      helper/statistics/stat_refill.php
  75. 2 1
      index.php
  76. 3 0
      mchsrv/config/config.ini.php
  77. 146 0
      mchsrv/control/merchant.php
  78. 7 0
      mchsrv/control/merchant_admin.php
  79. 559 0
      mchsrv/control/merchant_info.php
  80. 54 0
      mchsrv/control/merchant_login.php
  81. 287 0
      mchsrv/control/merchant_order.php
  82. 132 0
      mchsrv/control/merchant_refill.php
  83. 159 0
      mchsrv/control/merchantweb.php
  84. 91 0
      mchsrv/control/refill_evidence.php
  85. 124 0
      mchsrv/framework/function/function.php
  86. 1 0
      mchsrv/framework/index.html
  87. 7 0
      mchsrv/index.php
  88. 0 0
      mchsrv/language/index.html
  89. 10 0
      mchsrv/language/zh_cn/mobile.php
  90. 73 0
      mchsrv/mchsrv_run.php
  91. 1 0
      mchsrv/templates/index.html
  92. 10 0
      mobile/callback/qianqian.php
  93. 5 0
      mobile/callback/refill_jumi.php
  94. 4 0
      mobile/callback/refill_yonghe.php
  95. 1 1
      mobile/control/member_order.php
  96. 1 1
      mobile/control/merchant_info.php
  97. 2 2
      mobile/control/refill.php
  98. 18 18
      mobile/mobile_run.php
  99. 4 0
      mobile/refill_tiancheng.php
  100. 0 0
      mobile/refill_weiyiman.php

+ 3 - 1
.gitignore

@@ -88,4 +88,6 @@ server/mac_start.sh
 /composer.phar
 /composer.lock
 /vendor
-phpunit.xml
+phpunit.xml
+/project
+upfile.php

+ 66 - 27
admin/control/merchant.php

@@ -32,7 +32,7 @@ class merchantControl extends SystemControl
             Tpl::output('merchant_name', $_GET['merchant_name']);
         }
 
-        $merchant_list = $model_merchant->getMerchantList($condition, 25, 'available_predeposit desc');
+        $merchant_list = $model_merchant->getMerchantList($condition, 100, 'available_predeposit desc,merchant_state asc,mchid desc');
 
         $merchant_state_text = ['使用中', '已禁用'];
         Tpl::output('merchant_state_text', $merchant_state_text);
@@ -139,7 +139,7 @@ class merchantControl extends SystemControl
             $update['password'] = md5($update['org_pwd']);
             $update['alarm_amount'] = $_POST['alarm_amount'] ?? 0;
             $update['credit_bonus'] = ncPriceFormat($_POST['credit_bonus']);
-            $update['time_out'] = intval($_POST['time_out'] * 60);
+            $update['time_out'] = intval($_POST['time_out']);
             $update['quality'] = intval($_POST['quality']);
             $member_id = $merchant['admin_id'];
             try {
@@ -413,13 +413,46 @@ class merchantControl extends SystemControl
         } else {
         }
 
+        $start_unixtime = intval(strtotime($_GET['query_start_time']));
+        $end_unixtime = intval(strtotime($_GET['query_end_time']));
+
+        if ($start_unixtime > 0 && $end_unixtime > $start_unixtime) {
+            $condition['add_time'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
+        } elseif ($start_unixtime > 0) {
+            $condition['add_time'] = ['egt', $start_unixtime];
+        } elseif ($end_unixtime > 0) {
+            $condition['add_time'] = ['lt', $end_unixtime];
+        }
+
         //充值申请列表
         $evidence_list = $model_merchant->getRefillEvidence($condition, 20, '*,member.available_predeposit', 'refill_evidence.add_time desc');
         $status_text = ['申请中', '已通过', '已驳回'];
         $operation_text = ['未预存', '已预存'];
+        $add_type_text = ['商户预存','后台手动预存'];
+
+        $counts = Model('')->table('refill_evidence')
+            ->field('sum(amount) as amounts,status')
+            ->where($condition)
+            ->group('status')
+            ->select();
+        $success_amount = $send_amount = $cancel_amount = 0;
+        foreach ($counts as $count) {
+            if($count['status'] == 1) {
+                $send_amount += $count['amounts'];
+            }elseif ($count['status'] == 2) {
+                $success_amount += $count['amounts'];
+            }elseif ($count['status'] == 3) {
+                $cancel_amount += $count['amounts'];
+            }
+        }
+        $stats['send_amount'] = $send_amount;
+        $stats['success_amount'] = $success_amount;
+        $stats['cancel_amount'] = $cancel_amount;
+        Tpl::output('stats', $stats);
         Tpl::output('evidence_list', $evidence_list);
         Tpl::output('status_text', $status_text);
         Tpl::output('operation_text', $operation_text);
+        Tpl::output('add_type_text', $add_type_text);
         Tpl::output('page', $model_merchant->showpage('2'));
         Tpl::showpage('merchant.refill.evidence_list');
     }
@@ -574,6 +607,7 @@ class merchantControl extends SystemControl
         $input['after_available'] = ncPriceFormat($mem_info['available_predeposit'] + $params['pointsnum']);
         $input['admin_name'] = $admininfo['name'];
         $input['admin_id'] = $admininfo['id'];
+        $input['add_type'] = 2;
 
         $model_merchant = Model('merchant');
         return $model_merchant->addRefillEvidence($input);
@@ -898,13 +932,18 @@ class merchantControl extends SystemControl
         if (in_array($_GET['type'], [1, 2])) {
             $condition['type'] = $_GET['type'];
         }
-        $provider_list = $provider_model->getProviderList($condition, 1000);
+        $store_list = Model('store')->getStoreList(['store_id' => ['gt',0]], '', '', 'store_id,store_name');
+        foreach ($store_list as $store) {
+            $stores[$store['store_id']] = $store['store_name'];
+        }
+        $provider_list = $provider_model->getProviderList($condition, 100);
         foreach ($provider_list as $key => $provider) {
             if (!empty($provider['start_period']) && !empty($provider['end_period'])) {
                 $provider_list[$key]['period'] = $provider['start_period'] . '~' . $provider['end_period'];
             } else {
                 $provider_list[$key]['period'] = '全时间段';
             }
+            $provider_list[$key]['store_name'] = $stores[$provider['store_id']];
         }
         $opened_text = ['使用中', '已禁用'];
         $type_text = ['油卡', '手机充值卡'];
@@ -1378,17 +1417,31 @@ class merchantControl extends SystemControl
         foreach ($merchant_list as $key => $value) {
             $merchants[$value['mchid']] = $value;
         }
+        $time_cond = [
+            ['between', [(time() - 3600), (time() - 1800)]],
+            ['lt', (time() - 3600)]];
         if ($_GET['time'] == 1) {
             $condition['refill_order.order_time'] = ['between', [(time() - 3600), (time() - 1800)]];
         }
         if ($_GET['time'] == 2) {
             $condition['refill_order.order_time'] = ['lt', (time() - 3600)];
         }
-        if ($_GET['card_type'] == 'oil') {
-            $condition['refill_order.card_type'] = ['in', ['1', '2']];
+        $time_out_order = function($time_out, $condition){
+            $mchids = Model('')->table('merchant')->where(['time_out' => ['elt', $time_out]])->field('mchid')->select();
+            $mchids = array_column($mchids, 'mchid');
+            $mchids = implode(',', $mchids);
+
+            $condition['refill_order.order_time'] = ['lt', (time() - $time_out)];
+            $condition['refill_order.mchid'] = ['in',$mchids];
+            return $condition;
+        };
+        if ($_GET['time'] == 3) {
+            $condition = $time_out_order(300, $condition);
+            $time_cond[] = ['lt', (time() - 300)];
         }
-        if ($_GET['card_type'] == 'phone') {
-            $condition['refill_order.card_type'] = ['in', ['4', '5', '6']];
+        if ($_GET['time'] == 4) {
+            $condition = $time_out_order(900, $condition);
+            $time_cond[] = ['lt', (time() - 900)];
         }
         if (!empty($_GET['card_type'])) {
             if (in_array($_GET['card_type'], ['1', '2', '4', '5', '6'])) {
@@ -1402,23 +1455,19 @@ class merchantControl extends SystemControl
             }
         }
 
-        $order_list = $model_refill_order->getMerchantOrderList($condition, 100, 'refill_order.*,vr_order.order_state', 'refill_order.order_time desc');
+        $order_list = $model_refill_order->getMerchantOrderList($condition, 50, 'refill_order.*,vr_order.order_state', 'refill_order.order_time desc');
 
         $stat = Model('')->table('refill_order,vr_order')->join('inner')
             ->on('refill_order.order_id=vr_order.order_id')
             ->field('count(*) as order_count ,sum(refill_amount) as refill_amounts, sum(channel_amount) as channel_amounts, sum(mch_amount) as mch_amounts')
             ->where($condition)->find();
-        $count = $this->refill_stat($condition,
-            [['between', [(time() - 3600), (time() - 1800)]],
-                ['lt', (time() - 3600)]]
-        );
+        $count = $this->refill_stat($condition,$time_cond);
         foreach ($order_list as $order_id => $order_info) {
             $order_list[$order_id]['card_type_text'] = $this->scard_type($order_info['card_type']);
             $order_list[$order_id]['mch_name'] = $merchants[$order_info['mchid']]['company_name'];
             $order_list[$order_id]['diff_time_text'] = $this->elapse_time(time() - $order_info['order_time']);
             $order_list[$order_id]['diff_time'] = time() - $order_info['order_time'];
         }
-        $merchant_list = Model('')->table('merchant')->limit(1000)->select();
         $provider_list = Model('')->table('refill_provider,store')
             ->field('refill_provider.*,store.store_name')
             ->join('inner')
@@ -1616,13 +1665,8 @@ class merchantControl extends SystemControl
     }
 
     private function successful_where() {
-        if(defined('COMPANY_NAME') && COMPANY_NAME === 'LZKJ_COMPANY') {
-            $url = 'https://www.lzkj168.cn/plot/days';
-        }
-        else {
-            $url = 'https://www.xyzshops.cn/plot/days';
-        }
-
+        $url = BASE_SITE_URL . '/plot/days';
+        Log::record("successful get timestamp url : {$url}", Log::DEBUG);
         $data = http_request($url);
         if(empty($data)) return [];
         preg_match_all('/\d{10}/', $data, $matches);
@@ -1636,13 +1680,8 @@ class merchantControl extends SystemControl
     }
 
     public function successful_time_get_whereOp(){
-        if(defined('COMPANY_NAME') && COMPANY_NAME === 'LZKJ_COMPANY') {
-            $url = 'https://www.lzkj168.cn/plot/paths?time_stamp='.$_GET['timestamp'];
-        }
-        else {
-            $url = 'https://www.xyzshops.cn/plot/paths?time_stamp='.$_GET['timestamp'];
-        }
-
+        $url = BASE_SITE_URL . '/plot/paths?time_stamp='.$_GET['timestamp'];
+        Log::record("successful get where url : {$url}", Log::DEBUG);
         $data = http_request($url);
         preg_match_all('/\d{10}\/[a-z]+\/\d{1,2}\/\d\/\d{2,4}/', $data, $matches);
         $conds = $matches[0];

+ 2 - 2
admin/templates/default/merchant.edit.php

@@ -52,10 +52,10 @@
                 <td class="vatop tips"></td>
             </tr>
             <tr>
-                <td colspan="2" class="required"><label class="validation" for="time_out">失效时间(分钟):</label></td>
+                <td colspan="2" class="required"><label class="validation" for="time_out">失效时间(秒数):</label></td>
             </tr>
             <tr class="noborder">
-                <td class="vatop"><input type="text" id="time_out" name="time_out" class="txt" value="<?php echo $output['merchant']['time_out'] / 60;?>"></td>
+                <td class="vatop"><input type="text" id="time_out" name="time_out" class="txt" value="<?php echo $output['merchant']['time_out'];?>"></td>
                 <td class="vatop tips"></td>
             </tr>
             <tr>

+ 2 - 2
admin/templates/default/merchant.price.php

@@ -380,7 +380,7 @@
             })
             // console.log('trsArr', trsArr)
             var _valArr = []
-            if (_value && _value > 0 && _value <= 100) {
+            if (_value && _value > 0 && _value <= 200) {
                 for (var i = 0; i < trsArr.length; i++) {
                     _valArr[i] = (parseInt(trsArr[i]) / 100 * _value).toFixed(2)
                 }
@@ -392,7 +392,7 @@
                     vals[j].value = _valArr[j]
                 }
                 // console.log('_valArr', _valArr)
-            } else if (_value && _value == 0 && _value <= 100) {
+            } else if (_value && _value == 0 && _value <= 200) {
                 for (let i = 0; i < trsArr.length; i++) {
                     _valArr[i] = 0
                 }

+ 43 - 15
admin/templates/default/merchant.refill.evidence_list.php

@@ -28,6 +28,14 @@
                         <option value="4">全部</option>
                     </select>
                 </td>
+                <th><label for="query_start_time">下单时间</label></th>
+                <td>
+                    <input class="txt date" type="text" value="<?php echo $_GET['query_start_time']; ?>"
+                           id="startTime" name="query_start_time" autocomplete="off" style="width:120px" />
+                    <label for="query_start_time">~</label>
+                    <input class="txt date" type="text" value="<?php echo $_GET['query_end_time']; ?>"
+                           id="endTime" name="query_end_time" autocomplete="off" style="width:120px" />
+                </td>
                 <td><a href="javascript:void(0);" id="ncsubmit" class="btn-search "
                        title="<?php echo $lang['nc_query']; ?>">&nbsp;</a>
                     <?php if ($output['mch_name'] != '') { ?>
@@ -38,20 +46,24 @@
             </tbody>
         </table>
     </form>
-    <!--   <table class="table tb-type2" id="prompt">-->
-    <!--    <tbody>-->
-    <!--      <tr class="space odd">-->
-    <!--        <th colspan="12"><div class="title">-->
-    <!--            <h5>--><?php //echo $lang['nc_prompts'];?><!--</h5>-->
-    <!--            <span class="arrow"></span></div></th>-->
-    <!--      </tr>-->
-    <!--      <tr>-->
-    <!--        <td><ul>-->
-    <!--            <li>--><?php //echo $lang['store_help1'];?><!--</li>-->
-    <!--          </ul></td>-->
-    <!--      </tr>-->
-    <!--    </tbody>-->
-    <!--  </table>-->
+       <table class="table tb-type2" id="prompt">
+        <tbody>
+          <tr class="space odd">
+            <th><div class="title">
+                <h5>金额统计:</h5>
+                <span class="arrow"></span></div></th>
+          </tr>
+          <tr>
+            <td>
+                <ul>
+                    <li>充值成功金额:<?php echo $output['stats']['success_amount'];?></li>
+                    <li>已驳回金额:<?php echo $output['stats']['cancel_amount'];?></li>
+                    <li>待处理充值金额:<?php echo $output['stats']['send_amount'];?></li>
+                </ul>
+            </td>
+          </tr>
+        </tbody>
+      </table>
     <form method="post" id="merchant_name_form">
         <input type="hidden" name="form_submit" value="ok"/>
         <table class="table tb-type2">
@@ -60,7 +72,7 @@
                 <th>申请编号</th>
                 <th>机构名称</th>
                 <th>申请金额</th>
-                <th>申请后额</th>
+                <th>申请后可用金额</th>
                 <th class="align-center">转账银行开户人姓名</th>
                 <th class="align-center">转账银行名称</th>
                 <th class="align-center">申请状态</th>
@@ -69,6 +81,7 @@
                 <th class="align-center">审核日期</th>
                 <th class="align-center">审核管理员</th>
                 <th class="align-center">备注信息</th>
+                <th class="align-center">预存方式</th>
                 <th class="align-center"><?php echo $lang['operation']; ?></th>
             </tr>
             </thead>
@@ -117,6 +130,7 @@
                         <td class="nowarp align-center"><?php echo $v['check_time'] ? date('Y-m-d H:i', $v['check_time']) : $lang['no_limit']; ?></td>
                         <td class="nowarp align-center"><?php echo $v['admin_name']?></td>
                         <td class="nowarp align-center"><?php echo $v['bz']?></td>
+                        <td class="nowarp align-center"><?php echo $output['add_type_text'][$v['add_type'] - 1]; ?></td>
                         <td class="align-center w200">
                             <?php if($v['voucher_name'] != '/') {?>
                             <a target="_blank"
@@ -159,9 +173,23 @@
         </table>
     </form>
 </div>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/laydate/laydate.js"></script>
 <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.edit.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/jquery-ui/i18n/zh-CN.js" charset="utf-8"></script>
 <script>
     $(function () {
+        $('#query_start_time').datepicker({dateFormat: 'yy-mm-dd'});
+        $('#query_end_time').datepicker({dateFormat: 'yy-mm-dd'});
+        // 日期选择器
+        laydate.render({
+            elem: '#startTime',
+            type: 'datetime'
+        });
+        laydate.render({
+            elem: '#endTime',
+            type: 'datetime'
+        });
         $('#ncsubmit').click(function () {
             $('input[name="op"]').val('refill_evidence');
             $('#formSearch').submit();

+ 3 - 3
admin/templates/default/provider.index.php

@@ -13,7 +13,7 @@
                 <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=slow"><span>慢充话费单量控制</span></a></li>
 
                 <li><a href="index.php?act=merchant&op=provider_amount_control&type=1&form=common"><span>普通油卡单量控制</span></a></li>
-                <li><a href="index.php?act=merchant&op=provider_amount_control&type=1&form=fast"><span>普通油卡单量控制</span></a></li>
+                <li><a href="index.php?act=merchant&op=provider_amount_control&type=1&form=fast"><span>快充油卡单量控制</span></a></li>
             </ul>
         </div>
     </div>
@@ -82,7 +82,7 @@
                 <?php foreach ($output['provider_list'] as $k => $v) { ?>
                     <tr class="trFlex">
                         <td><?php echo $v['provider_id']; ?></td>
-                        <td><?php echo $v['name']; ?></td>
+                        <td><?php echo $v['name']; ?> (<?php echo $v['store_name'];?>)</td>
                         <td><?php echo $output['type_text'][$v['type']-1]; ?></td>
                         <td><?php echo $v['store_id']; ?></td>
                         <td class="align-center"><?php echo $v['sort']; ?></td>
@@ -128,7 +128,7 @@
             <tr class="tfoot">
                 <td></td>
                 <td colspan="16">
-                    <div class="pagination"><?php echo $output['page']; ?></div>
+                    <div class="pagination"><?php echo $output['show_page']; ?></div>
                 </td>
             </tr>
             </tfoot>

+ 29 - 15
admin/templates/default/provider.successful.php

@@ -38,10 +38,12 @@
                 <td>
                     <select name="interval">
                         <option value=""><?php echo $lang['nc_please_choose']; ?></option>
-                        <option value="900">15分钟</option>
-                        <option value="1200">20分钟</option>
-                        <option value="1800">半小时</option>
                         <option value="3600">一小时</option>
+                        <option value="1800">半小时</option>
+                        <option value="900" selected>15分钟</option>
+                        <option value="600" selected>10分钟</option>
+                        <option value="300" selected>5分钟</option>
+                        <option value="60">1分钟</option>
                     </select>
                 </td>
                 <th><label>通道</label></th>
@@ -99,6 +101,28 @@
             // $(this).attr("width",iframeWidth) 
             // console.log('iframeHeight', iframeHeight, iframeWidth);
         });
+        //默认获取 当前日期 当前时间点前一个小时, 间隔15 900
+        // 前一个小时
+        let frontOneHour = new Date(new Date().getTime() - 1 * 60 * 60 * 1000)
+        let year = frontOneHour.getFullYear();
+        let month = frontOneHour.getMonth() + 1;
+        let date = frontOneHour.getDate();
+        let hour = frontOneHour.getHours()
+        let timestr = year+'-'+month+'-'+date
+        let stamp = new Date(timestr).getTime()/1000
+        $("select[name=time_stamp]").val(stamp)
+        $("select[name=time_hour]").val(hour)
+        // console.log('frontOneHour', frontOneHour,hour, stamp);
+        let t = stamp + hour*3600
+        let interval = $("select[name=interval]").val()
+        let s = window.location.origin + "/plot/index?time_stamp=" + t + "&interval=" + interval
+        $.get( s, function (data){
+            if (!data) {
+                return
+            }
+            $('iframe').attr('src',s)
+        });
+
         $('#timeSelect').change(function () {
             let val = $(this).val()
             // console.log('val', val);
@@ -147,15 +171,7 @@
                 layer.msg('请选择时间');
                 return
             }
-            let base_src = ''
-            <?php
-            if (defined('COMPANY_NAME') && COMPANY_NAME === 'LZKJ_COMPANY'){?>
-                base_src = 'https://www.lzkj168.cn';
-            <?php }else{?>
-                base_src = 'https://www.xyzshops.cn';
-            <?php }?>
-            // console.log('val', time_stamp, interval,chname,quality,card_type,amount);
-            let src = base_src+"/plot/index?time_stamp="+time+"&interval="+interval+"&chname="+chname+"&quality="+quality+"&card_type="+card_type+"&amount="+amount
+            let src = window.location.origin + "/plot/index?time_stamp=" + time + "&interval=" + interval + "&chname=" + chname + "&quality=" + quality + "&card_type=" + card_type + "&amount=" + amount
             if (!interval) {
                 src = src.replace("&interval=", "")
             }
@@ -171,14 +187,12 @@
             if (!amount) {
                 src = src.replace("&amount=", "")
             }
-            // $('iframe').attr('src',src)
-            // console.log('src',src);
+
             $.get(src, function (data){
                 if (!data) {
                     return
                 }
                 $('iframe').attr('src',src)
-                // console.log('data', data);
             });
         });
     })

+ 54 - 2
admin/templates/default/refill.order.index.php

@@ -167,9 +167,18 @@
                     <a href="index.php?act=merchant&op=OrderQuery" class="btns" >
                         <span><i class="icon-edit"></i>更新待收货订单状态</span>
                     </a>
+                </td>
+                <td></td>
+                <td>
                     <a href="index.php?act=merchant&op=mch_notify" class="btns" >
                         <span><i class="icon-edit"></i>向客户回调</span>
                     </a>
+                    <a href="#" class="btns" id="10_rder">
+                        <span><i class="icon-edit"></i>10分钟订单</span>
+                    </a>
+                    <a href="#" class="btns" id="30_rder">
+                        <span><i class="icon-edit"></i>半小时订单</span>
+                    </a>
                 </td>
             </tr>
             </tbody>
@@ -216,6 +225,19 @@
                         <li class="lineLi">总计充值失败供方扣款金额:<?php echo $output['stat']['cancel']['channel_amounts'] ?? 0?></li>
                         <li class="lineLi">总计充值失败利润:<?php echo ncPriceFormat($output['stat']['cancel']['mch_amounts'] - $output['stat']['cancel']['channel_amounts'])?></li>
                     </div>
+                    <div>
+                        <li class="lineLi">成功率:
+                            <?php
+                                $count = $output['stat']['success']['order_count'] + $output['stat']['cancel']['order_count'];
+                                if($count == 0) {
+                                    echo '0%';
+                                } else {
+                                  $ratio = sprintf("%.2f",$output['stat']['success']['order_count'] / $count);
+                                  $ratio = $ratio * 100;
+                                    echo "{$ratio}%";
+                                }
+                            ?></li>
+                    </div>
                 </ul>
             </td>
           </tr>
@@ -242,7 +264,7 @@
             <th class="align-center">次数</th>
             <th class="align-center">质量</th>
             <th class="align-center">初始质量</th>
-            <th class="align-center">扣款金额</th>
+<!--            <th class="align-center">扣款金额</th>-->
             <th class="align-center"><?php echo $lang['nc_handle']; ?></th>
         </tr>
         </thead>
@@ -282,7 +304,7 @@
                     <td class="align-center"><?php echo $order['commit_times']; ?></td>
                     <td class="align-center"><?php echo $order['quality']; ?></td>
                     <td class="align-center"><?php echo $order['org_quality']; ?></td>
-                    <td class="align-center"><?php echo $order['mch_amount']; ?></td>
+<!--                    <td class="align-center">--><?php //echo $order['mch_amount']; ?><!--</td>-->
                     <td class="w144 align-center">
                         <a href="index.php?act=merchant&op=notify_merchant&order_id=<?php echo $order['order_id']; ?>">
                                 回调</a>
@@ -351,6 +373,36 @@
                 $(this).css('color', 'red')
             }
         })
+        // 十分钟订单
+        $('#10_rder').click(function () {
+            let date=new Date();
+            let min=date.getMinutes();
+            date.setMinutes(min-10);
+            let y = date.getFullYear();
+            let m = (date.getMonth() + 1) < 10 ? ("0" + (date.getMonth() + 1)) : (date.getMonth() + 1);
+            let d = date.getDate() < 10 ? ("0" + date.getDate()) : date.getDate();
+            let h = date.getHours() < 10 ? ('0' + date.getHours()) : date.getHours()
+            let f = date.getMinutes() < 10 ? ('0' + date.getMinutes()) : date.getMinutes()
+            let s = date.getSeconds() < 10 ? ('0' + date.getseconds()) : date.getSeconds()
+            let formatdate = y+'-'+m+'-'+d + " " + h + ":" + f + ":" + s;
+            // console.log(formatdate) 
+            $('#startTime').val(formatdate)
+        })
+        // 30分钟订单
+        $('#30_rder').click(function () {
+            let date=new Date(); 
+            let min=date.getMinutes();
+            date.setMinutes(min-30);
+            let y = date.getFullYear();
+            let m = (date.getMonth() + 1) < 10 ? ("0" + (date.getMonth() + 1)) : (date.getMonth() + 1);
+            let d = date.getDate() < 10 ? ("0" + date.getDate()) : date.getDate();
+            let h = date.getHours() < 10 ? ('0' + date.getHours()) : date.getHours()
+            let f = date.getMinutes() < 10 ? ('0' + date.getMinutes()) : date.getMinutes()
+            let s = date.getSeconds() < 10 ? ('0' + date.getseconds()) : date.getSeconds()
+            let formatdate = y+'-'+m+'-'+d + " " + h + ":" + f + ":" + s;
+            // console.log(formatdate) 
+            $('#startTime').val(formatdate)
+        })
     });
     function hCopyChannel(e) {
         let str = ''

+ 11 - 0
admin/templates/default/refill.order.send.index.php

@@ -93,6 +93,12 @@
                     <a href="index.php?act=merchant&op=OrderSendList&time=2&card_type=<?php echo $_GET['card_type']?>" class="btns" >
                         <span><i class="icon-edit"></i>耗时一小时订单</span>
                     </a>
+                    <a href="index.php?act=merchant&op=OrderSendList&time=3&card_type=<?php echo $_GET['card_type']?>" class="btns" >
+                        <span><i class="icon-edit"></i>特定耗时5分钟订单</span>
+                    </a>
+                    <a href="index.php?act=merchant&op=OrderSendList&time=4&card_type=<?php echo $_GET['card_type']?>" class="btns" >
+                        <span><i class="icon-edit"></i>特定耗时15分钟订单</span>
+                    </a>
                 </td>
             </tr>
         </table>
@@ -110,6 +116,11 @@
                     <li class="lineLi" style="color:#000;">总计订单数量:<?php echo $output['stat']['order_count'] ?? 0?></li>
                     <li class="lineLi" style="color:#000;">超过30分钟订单数量:<?php echo $output['count'][0] ?? 0?></li>
                     <li class="lineLi" style="color:#000;">超过1小时订单数量:<?php echo $output['count'][1] ?? 0?></li>
+                    <?php if($_GET['time'] == 3) {?>
+                    <li class="lineLi" style="color:#000;">超过5分钟订单数量:<?php echo $output['count'][2] ?? 0?></li>
+                    <?php }elseif($_GET['time'] == 4) {?>
+                    <li class="lineLi" style="color:#000;">超过15分钟订单数量:<?php echo $output['count'][2] ?? 0?></li>
+                    <?php }?>
                 </ul>
             </td>
         </tr>

File diff suppressed because it is too large
+ 673 - 260
admin/templates/default/refill_stock.php


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

@@ -52,7 +52,7 @@ class Log
 
     public static function end_sql_log()
     {
-        self::$sqlog = false;
+        self::$sqlog = [];
     }
 
     private static function add_sql_log($log)

+ 35 - 16
data/config/lingzh/refill.ini.php

@@ -337,28 +337,28 @@ $riying_phone = ['name' => 'riying', 'store_id' => 49, 'qualitys' => '5',
 $weishengy_phone = ['name' => 'weishengy', 'store_id' => 50, 'qualitys' => '5',
     'amount' => [
         10 => [
-            ['goods_id' => 87, 'price' => 9.2, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+            ['goods_id' => 87, 'price' => 8.95, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
         ],
         20 => [
-            ['goods_id' => 88, 'price' => 18.4, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+            ['goods_id' => 88, 'price' => 17.9, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
         ],
         30 => [
-            ['goods_id' => 89, 'price' => 27.6, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+            ['goods_id' => 89, 'price' => 26.85, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
         ],
         50 => [
-            ['goods_id' => 90, 'price' => 46, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+            ['goods_id' => 90, 'price' => 44.75, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
         ],
         100 => [
-            ['goods_id' => 91, 'price' => 92, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+            ['goods_id' => 91, 'price' => 89.5, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
         ],
         200 => [
-            ['goods_id' => 92, 'price' => 184, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+            ['goods_id' => 92, 'price' => 179, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
         ],
         300 => [
-            ['goods_id' => 93, 'price' => 276, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+            ['goods_id' => 93, 'price' => 268.5, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
         ],
         500 => [
-            ['goods_id' => 94, 'price' => 460, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+            ['goods_id' => 94, 'price' => 447.5, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
         ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
@@ -419,15 +419,33 @@ $shengying_phone = ['name' => 'shengying', 'store_id' => 52, 'qualitys' => '1',
         ],
     ],
     'official_sn' => true, 'refill_type' => 'api'];
+
+$amingjdman_phone = ['name' => 'amingjdman', 'store_id' => 53, 'qualitys' => '5',
+    'amount' => [
+        30 => [
+            ['goods_id' => 111, 'price' => 26.55, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 112, 'price' => 44.25, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 113, 'price' => 88.5, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 114, 'price' => 177, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
-    ['name' => 'baizeyd', 'cfg' => $baizeyd, 'opened' => true, 'sort' => 1],
-    ['name' => 'aming', 'cfg' => $aming_phone, 'opened' => true, 'sort' => 1],
-    ['name' => 'binghc', 'cfg' => $binghc_phone, 'opened' => true, 'sort' => 1],
-    ['name' => 'ruishun', 'cfg' => $ruishun_phone, 'opened' => true, 'sort' => 1],
-    ['name' => 'wuchen', 'cfg' => $wuchen_phone, 'opened' => true, 'sort' => 1],
-    ['name' => 'yibao', 'cfg' => $yibao_phone, 'opened' => true, 'sort' => 1],
-    ['name' => 'amingyd', 'cfg' => $amingyd_phone, 'opened' => true, 'sort' => 1],
-    ['name' => 'chuka', 'cfg' => $chuka_phone, 'opened' => true, 'sort' => 1],
+    ['name' => 'baizeyd', 'cfg' => $baizeyd],
+    ['name' => 'aming', 'cfg' => $aming_phone],
+    ['name' => 'binghc', 'cfg' => $binghc_phone],
+    ['name' => 'ruishun', 'cfg' => $ruishun_phone],
+    ['name' => 'wuchen', 'cfg' => $wuchen_phone],
+    ['name' => 'yibao', 'cfg' => $yibao_phone],
+    ['name' => 'amingyd', 'cfg' => $amingyd_phone],
+    ['name' => 'chuka', 'cfg' => $chuka_phone],
     ['name' => 'amingjd', 'cfg' => $amingjd_phone],
     ['name' => 'legou', 'cfg' => $legou_phone],
     ['name' => 'feiniao', 'cfg' => $feiniao_phone],
@@ -436,5 +454,6 @@ $phone_providers = [
     ['name' => 'weishengy', 'cfg' => $weishengy_phone],
     ['name' => 'wailing', 'cfg' => $wailing_phone],
     ['name' => 'shengying', 'cfg' => $shengying_phone],
+    ['name' => 'amingjdman', 'cfg' => $amingjdman_phone],
 ];
 $config['phone_providers'] = $phone_providers;

+ 170 - 54
data/config/win/refill.ini.php

@@ -141,49 +141,49 @@ $lingzh_phone = ['name' => 'lingzh', 'store_id' => 28,'qualitys' => '1,3,5',
             ['goods_id' => 6389, 'price' => 9.53, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6389, 'price' => 9.51, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
             ['goods_id' => 6389, 'price' => 9.53, 'quality' => 3, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 6389, 'price' => 9.25, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+            ['goods_id' => 6389, 'price' => 9, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
         ],
         20 => [
             ['goods_id' => 6390, 'price' => 19.06, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6390, 'price' => 19.02, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
             ['goods_id' => 6390, 'price' => 19.06, 'quality' => 3, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 6390, 'price' => 18.50, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+            ['goods_id' => 6390, 'price' => 18, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
         ],
         30 => [
             ['goods_id' => 6391, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6391, 'price' => 28.53, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
             ['goods_id' => 6391, 'price' => 28.59, 'quality' => 3, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 6391, 'price' => 27.75, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+            ['goods_id' => 6391, 'price' => 27, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
         ],
         50 => [
             ['goods_id' => 6392, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6392, 'price' => 47.55, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
             ['goods_id' => 6392, 'price' => 47.65, 'quality' => 3, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 6392, 'price' => 46.25, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+            ['goods_id' => 6392, 'price' => 45, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
         ],
         100 => [
             ['goods_id' => 6393, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6393, 'price' => 95.1, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
             ['goods_id' => 6393, 'price' => 95.3, 'quality' => 3, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 6393, 'price' => 92.5, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+            ['goods_id' => 6393, 'price' => 90, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
         ],
         200 => [
             ['goods_id' => 6394, 'price' => 190.60, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6394, 'price' => 190.20, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
             ['goods_id' => 6394, 'price' => 190.60, 'quality' => 3, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 6394, 'price' => 185.00, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+            ['goods_id' => 6394, 'price' => 180, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
         ],
         300 => [
             ['goods_id' => 6395, 'price' => 285.90, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6395, 'price' => 285.30, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
             ['goods_id' => 6395, 'price' => 285.90, 'quality' => 3, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 6395, 'price' => 277.50, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+            ['goods_id' => 6395, 'price' => 270, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
         ],
         500 => [
             ['goods_id' => 6396, 'price' => 476.50, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6396, 'price' => 475.50, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
             ['goods_id' => 6396, 'price' => 476.50, 'quality' => 3, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 6396, 'price' => 462.50, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+            ['goods_id' => 6396, 'price' => 450, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
         ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
@@ -343,14 +343,38 @@ $tongy_phone = ['name' => 'tongy', 'store_id' => 31,'qualitys' => '2',
 
 $weiyi_phone = ['name' => 'weiyi', 'store_id' => 32,'qualitys' => '1',
     'amount' => [
-        10 => [['goods_id' => 6414, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        20 => [['goods_id' => 6415, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        30 => [['goods_id' => 6416, 'price' => 28.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        50 => [['goods_id' => 6417, 'price' => 48, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        100 => [['goods_id' => 6418, 'price' => 96, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        200 => [['goods_id' => 6419, 'price' => 192, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        300 => [['goods_id' => 6420, 'price' => 288, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        500 => [['goods_id' => 6421, 'price' => 480, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+        10 => [
+            ['goods_id' => 6414, 'price' => 9.48, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6414, 'price' => 9.45, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 6415, 'price' => 18.96, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6415, 'price' => 18.9, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 6416, 'price' => 28.44, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6416, 'price' => 28.35, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 6417, 'price' => 47.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6417, 'price' => 47.25, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 6418, 'price' => 94.8, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6418, 'price' => 94.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 6419, 'price' => 189.6, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6419, 'price' => 189, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 6420, 'price' => 284.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6420, 'price' => 283.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 6421, 'price' => 474, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6421, 'price' => 472.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
@@ -430,19 +454,6 @@ $wantong_phone = ['name' => 'wantong', 'store_id' => 36, 'qualitys' => '4',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$yunling_phone = ['name' => 'yunling', 'store_id' => 37, 'qualitys' => '1',
-    'amount' => [
-        10 => [['goods_id' => 6456, 'price' => 9.56, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        20 => [['goods_id' => 6457, 'price' => 19.12, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        30 => [['goods_id' => 6458, 'price' => 28.68, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        50 => [['goods_id' => 6459, 'price' => 47.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        100 => [['goods_id' => 6460, 'price' => 95.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        200 => [['goods_id' => 6461, 'price' => 191.2, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        300 => [['goods_id' => 6462, 'price' => 286.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        500 => [['goods_id' => 6463, 'price' => 478, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
-    ],
-    'official_sn' => true, 'refill_type' => 'api'];
-
 $zhongst_phone = ['name' => 'zhongst', 'store_id' => 39, 'qualitys' => '4',
     'amount' => [
         10 => [['goods_id' => 6464, 'price' => 9.35, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
@@ -471,54 +482,154 @@ $luqian_phone = ['name' => 'luqian', 'store_id' => 40, 'qualitys' => '1',
 
 $afandfs_phone = ['name' => 'afandfs', 'store_id' => 41, 'qualitys' => '1',
     'amount' => [
+        10 => [['goods_id' => 6480, 'price' => 9.45, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6481, 'price' => 18.9, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6482, 'price' => 28.35, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6483, 'price' => 47.25, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6484, 'price' => 94.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6485, 'price' => 189, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6486, 'price' => 283.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6487, 'price' => 472.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$yunling_phone = ['name' => 'yunling', 'store_id' => 37, 'qualitys' => '1',
+    'amount' => [
+        10 => [['goods_id' => 6456, 'price' => 9.53, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6457, 'price' => 19.02, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6458, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6459, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6460, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6461, 'price' => 190.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6462, 'price' => 285.9, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6463, 'price' => 476.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$yunlingfs_phone = ['name' => 'yunlingfs', 'store_id' => 42, 'qualitys' => '1',
+    'amount' => [
+        10 => [['goods_id' => 6488, 'price' => 9.53, 'quality' => 1, 'card_type' => 'chinamobile']],
+        20 => [['goods_id' => 6489, 'price' => 19.06, 'quality' => 1, 'card_type' => 'chinamobile']],
+        30 => [['goods_id' => 6490, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinamobile']],
+        50 => [['goods_id' => 6491, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinamobile']],
+        100 => [['goods_id' => 6492, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinamobile']],
+        200 => [['goods_id' => 6493, 'price' => 190.6, 'quality' => 1, 'card_type' => 'chinamobile']],
+        300 => [['goods_id' => 6494, 'price' => 285.9, 'quality' => 1, 'card_type' => 'chinamobile']],
+        500 => [['goods_id' => 6495, 'price' => 476.5, 'quality' => 1, 'card_type' => 'chinamobile']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$tiancheng_phone = ['name' => 'tiancheng', 'store_id' => 43, 'qualitys' => '1',
+    'amount' => [
         10 => [
-            ['goods_id' => 6480, 'price' => 9.48, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6480, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6496, 'price' => 9.51, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6496, 'price' => 9.45, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         20 => [
-            ['goods_id' => 6481, 'price' => 18.96, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6481, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6497, 'price' => 19.02, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6497, 'price' => 18.9, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         30 => [
-            ['goods_id' => 6482, 'price' => 28.44, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6482, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6498, 'price' => 28.53, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6498, 'price' => 28.35, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         50 => [
-            ['goods_id' => 6483, 'price' => 47.4, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6483, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6499, 'price' => 47.55, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6499, 'price' => 47.25, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         100 => [
-            ['goods_id' => 6484, 'price' => 94.8, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6484, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6500, 'price' => 95.1, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6500, 'price' => 94.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         200 => [
-            ['goods_id' => 6485, 'price' => 189.6, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6485, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6501, 'price' => 190.2, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6501, 'price' => 189, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         300 => [
-            ['goods_id' => 6486, 'price' => 284.4, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6486, 'price' => 285, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6502, 'price' => 285.3, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6502, 'price' => 283.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         500 => [
-            ['goods_id' => 6487, 'price' => 474, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6487, 'price' => 475, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']
+            ['goods_id' => 6503, 'price' => 475.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6503, 'price' => 472.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']
         ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$yunlingfs_phone = ['name' => 'yunlingfs', 'store_id' => 40, 'qualitys' => '1',
+$suyuan_phone = ['name' => 'suyuan', 'store_id' => 39, 'qualitys' => '1',
     'amount' => [
-        10 => [['goods_id' => 6472, 'price' => 9.4, 'quality' => 1, 'card_type' => 'chinamobile']],
-        20 => [['goods_id' => 6473, 'price' => 18.8, 'quality' => 1, 'card_type' => 'chinamobile']],
-        30 => [['goods_id' => 6474, 'price' => 28.2, 'quality' => 1, 'card_type' => 'chinamobile']],
-        50 => [['goods_id' => 6475, 'price' => 47, 'quality' => 1, 'card_type' => 'chinamobile']],
-        100 => [['goods_id' => 6476, 'price' => 94, 'quality' => 1, 'card_type' => 'chinamobile']],
-        200 => [['goods_id' => 6477, 'price' => 188, 'quality' => 1, 'card_type' => 'chinamobile']],
-        300 => [['goods_id' => 6478, 'price' => 282, 'quality' => 1, 'card_type' => 'chinamobile']],
-        500 => [['goods_id' => 6479, 'price' => 470, 'quality' => 1, 'card_type' => 'chinamobile']]
+        10 => [['goods_id' => 6464, 'price' => 9.53, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6465, 'price' => 19.06, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6466, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6467, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6468, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6469, 'price' => 190.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6470, 'price' => 285.9, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6471, 'price' => 476.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$xunao_phone = ['name' => 'xunao', 'store_id' => 44, 'qualitys' => '1',
+    'amount' => [
+        10 => [['goods_id' => 6504, 'price' => 9.45, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6505, 'price' => 18.9, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6506, 'price' => 28.35, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6507, 'price' => 47.25, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6508, 'price' => 94.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6509, 'price' => 189, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6510, 'price' => 283.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6511, 'price' => 472.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$weiyiman_phone = ['name' => 'weiyiman', 'store_id' => 45, 'qualitys' => '5',
+    'amount' => [
+        10 => [['goods_id' => 6512, 'price' => 8.8, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6513, 'price' => 17.6, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6514, 'price' => 26.4, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6515, 'price' => 44, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6516, 'price' => 88, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6517, 'price' => 176, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6518, 'price' => 264, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6519, 'price' => 440, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$yonghe_phone = ['name' => 'yonghe', 'store_id' => 46,'qualitys' => '2',
+    'amount' => [
+        30 => [['goods_id' => 6520, 'price' => 29.955, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6520, 'price' => 29.985, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6520, 'price' => 29.82, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        50 => [['goods_id' => 6521, 'price' => 49.925, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6521, 'price' => 49.975, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6521, 'price' => 49.7, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        100 => [['goods_id' => 6522, 'price' => 99.85, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6522, 'price' => 99.95, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6522, 'price' => 99.4, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        200 => [['goods_id' => 6523, 'price' => 199.7, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6523, 'price' => 199.9, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6523, 'price' => 198.8, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        300 => [['goods_id' => 6524, 'price' => 299.55, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6524, 'price' => 299.85, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6524, 'price' => 298.2, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        500 => [['goods_id' => 6525, 'price' => 499.25, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6525, 'price' => 499.75, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6525, 'price' => 497, 'quality' => 2, 'card_type' => 'chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$jumi_phone = ['name' => 'jumi', 'store_id' => 47, 'qualitys' => '2',
+    'amount' => [
+        50 => [['goods_id' => 6526, 'price' => 48.6, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6527, 'price' => 97.2, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6528, 'price' => 194.4, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
 
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
@@ -544,5 +655,10 @@ $phone_providers = [
     ['name' => 'luqian', 'cfg' => $luqian_phone],
     ['name' => 'afandfs', 'cfg' => $afandfs_phone],
     ['name' => 'yunlingfs', 'cfg' => $yunlingfs_phone],
+    ['name' => 'tiancheng', 'cfg' => $tiancheng_phone],
+    ['name' => 'xunao', 'cfg' => $xunao_phone],
+    ['name' => 'weiyiman', 'cfg' => $weiyiman_phone],
+    ['name' => 'yonghe', 'cfg' => $yonghe_phone],
+    ['name' => 'jumi', 'cfg' => $jumi_phone],
 ];
 $config['phone_providers'] = $phone_providers;

+ 200 - 55
data/config/xyz/refill.ini.php

@@ -132,7 +132,7 @@ $bjb_phone = ['name' => 'bjb', 'store_id' => 12,'qualitys' => '1',
         200 => [['goods_id' => 6304, 'price' => 190.20, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
         300 => [['goods_id' => 6327, 'price' => 285.30, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']],
         500 => [['goods_id' => 6328, 'price' => 475.50, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']]
-        ],
+    ],
     'official_sn' => true, 'refill_type' => 'api'];
 
 $lingzh_phone = ['name' => 'lingzh', 'store_id' => 28,'qualitys' => '1,3,5',
@@ -141,49 +141,49 @@ $lingzh_phone = ['name' => 'lingzh', 'store_id' => 28,'qualitys' => '1,3,5',
             ['goods_id' => 6389, 'price' => 9.53, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6389, 'price' => 9.51, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
             ['goods_id' => 6389, 'price' => 9.53, 'quality' => 3, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 6389, 'price' => 9.25, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+            ['goods_id' => 6389, 'price' => 9, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
         ],
         20 => [
             ['goods_id' => 6390, 'price' => 19.06, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6390, 'price' => 19.02, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
             ['goods_id' => 6390, 'price' => 19.06, 'quality' => 3, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 6390, 'price' => 18.50, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+            ['goods_id' => 6390, 'price' => 18, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
         ],
         30 => [
             ['goods_id' => 6391, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6391, 'price' => 28.53, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
             ['goods_id' => 6391, 'price' => 28.59, 'quality' => 3, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 6391, 'price' => 27.75, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+            ['goods_id' => 6391, 'price' => 27, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
         ],
         50 => [
             ['goods_id' => 6392, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6392, 'price' => 47.55, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
             ['goods_id' => 6392, 'price' => 47.65, 'quality' => 3, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 6392, 'price' => 46.25, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+            ['goods_id' => 6392, 'price' => 45, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
         ],
         100 => [
             ['goods_id' => 6393, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6393, 'price' => 95.1, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
             ['goods_id' => 6393, 'price' => 95.3, 'quality' => 3, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 6393, 'price' => 92.5, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+            ['goods_id' => 6393, 'price' => 90, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
         ],
         200 => [
             ['goods_id' => 6394, 'price' => 190.60, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6394, 'price' => 190.20, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
             ['goods_id' => 6394, 'price' => 190.60, 'quality' => 3, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 6394, 'price' => 185.00, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+            ['goods_id' => 6394, 'price' => 180, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
         ],
         300 => [
             ['goods_id' => 6395, 'price' => 285.90, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6395, 'price' => 285.30, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
             ['goods_id' => 6395, 'price' => 285.90, 'quality' => 3, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 6395, 'price' => 277.50, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+            ['goods_id' => 6395, 'price' => 270, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
         ],
         500 => [
             ['goods_id' => 6396, 'price' => 476.50, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6396, 'price' => 475.50, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom'],
             ['goods_id' => 6396, 'price' => 476.50, 'quality' => 3, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
-            ['goods_id' => 6396, 'price' => 462.50, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+            ['goods_id' => 6396, 'price' => 450, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
         ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
@@ -343,14 +343,38 @@ $tongy_phone = ['name' => 'tongy', 'store_id' => 31,'qualitys' => '2',
 
 $weiyi_phone = ['name' => 'weiyi', 'store_id' => 32,'qualitys' => '1',
     'amount' => [
-        10 => [['goods_id' => 6414, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        20 => [['goods_id' => 6415, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        30 => [['goods_id' => 6416, 'price' => 28.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        50 => [['goods_id' => 6417, 'price' => 48, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        100 => [['goods_id' => 6418, 'price' => 96, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        200 => [['goods_id' => 6419, 'price' => 192, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        300 => [['goods_id' => 6420, 'price' => 288, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        500 => [['goods_id' => 6421, 'price' => 480, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+        10 => [
+            ['goods_id' => 6414, 'price' => 9.48, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6414, 'price' => 9.45, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 6415, 'price' => 18.96, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6415, 'price' => 18.9, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 6416, 'price' => 28.44, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6416, 'price' => 28.35, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 6417, 'price' => 47.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6417, 'price' => 47.25, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 6418, 'price' => 94.8, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6418, 'price' => 94.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 6419, 'price' => 189.6, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6419, 'price' => 189, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 6420, 'price' => 284.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6420, 'price' => 283.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 6421, 'price' => 474, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6421, 'price' => 472.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
@@ -430,19 +454,6 @@ $wantong_phone = ['name' => 'wantong', 'store_id' => 36, 'qualitys' => '4',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$yunling_phone = ['name' => 'yunling', 'store_id' => 37, 'qualitys' => '1',
-    'amount' => [
-        10 => [['goods_id' => 6456, 'price' => 9.56, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        20 => [['goods_id' => 6457, 'price' => 19.12, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        30 => [['goods_id' => 6458, 'price' => 28.68, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        50 => [['goods_id' => 6459, 'price' => 47.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        100 => [['goods_id' => 6460, 'price' => 95.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        200 => [['goods_id' => 6461, 'price' => 191.2, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        300 => [['goods_id' => 6462, 'price' => 286.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        500 => [['goods_id' => 6463, 'price' => 478, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
-    ],
-    'official_sn' => true, 'refill_type' => 'api'];
-
 $zhongst_phone = ['name' => 'zhongst', 'store_id' => 39, 'qualitys' => '4',
     'amount' => [
         10 => [['goods_id' => 6464, 'price' => 9.35, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
@@ -471,51 +482,179 @@ $luqian_phone = ['name' => 'luqian', 'store_id' => 40, 'qualitys' => '1',
 
 $afandfs_phone = ['name' => 'afandfs', 'store_id' => 41, 'qualitys' => '1',
     'amount' => [
+        10 => [['goods_id' => 6480, 'price' => 9.45, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6481, 'price' => 18.9, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6482, 'price' => 28.35, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6483, 'price' => 47.25, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6484, 'price' => 94.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6485, 'price' => 189, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6486, 'price' => 283.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6487, 'price' => 472.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$yunling_phone = ['name' => 'yunling', 'store_id' => 37, 'qualitys' => '1',
+    'amount' => [
+        10 => [['goods_id' => 6456, 'price' => 9.53, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6457, 'price' => 19.02, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6458, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6459, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6460, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6461, 'price' => 190.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6462, 'price' => 285.9, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6463, 'price' => 476.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$yunlingfs_phone = ['name' => 'yunlingfs', 'store_id' => 42, 'qualitys' => '1',
+    'amount' => [
+        10 => [['goods_id' => 6488, 'price' => 9.53, 'quality' => 1, 'card_type' => 'chinamobile']],
+        20 => [['goods_id' => 6489, 'price' => 19.06, 'quality' => 1, 'card_type' => 'chinamobile']],
+        30 => [['goods_id' => 6490, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinamobile']],
+        50 => [['goods_id' => 6491, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinamobile']],
+        100 => [['goods_id' => 6492, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinamobile']],
+        200 => [['goods_id' => 6493, 'price' => 190.6, 'quality' => 1, 'card_type' => 'chinamobile']],
+        300 => [['goods_id' => 6494, 'price' => 285.9, 'quality' => 1, 'card_type' => 'chinamobile']],
+        500 => [['goods_id' => 6495, 'price' => 476.5, 'quality' => 1, 'card_type' => 'chinamobile']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$tiancheng_phone = ['name' => 'tiancheng', 'store_id' => 43, 'qualitys' => '1',
+    'amount' => [
         10 => [
-            ['goods_id' => 6480, 'price' => 9.48, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6480, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6496, 'price' => 9.51, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6496, 'price' => 9.45, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         20 => [
-            ['goods_id' => 6481, 'price' => 18.96, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6481, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6497, 'price' => 19.02, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6497, 'price' => 18.9, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         30 => [
-            ['goods_id' => 6482, 'price' => 28.44, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6482, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6498, 'price' => 28.53, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6498, 'price' => 28.35, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         50 => [
-            ['goods_id' => 6483, 'price' => 47.4, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6483, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6499, 'price' => 47.55, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6499, 'price' => 47.25, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         100 => [
-            ['goods_id' => 6484, 'price' => 94.8, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6484, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6500, 'price' => 95.1, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6500, 'price' => 94.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         200 => [
-            ['goods_id' => 6485, 'price' => 189.6, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6485, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6501, 'price' => 190.2, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6501, 'price' => 189, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         300 => [
-            ['goods_id' => 6486, 'price' => 284.4, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6486, 'price' => 285, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6502, 'price' => 285.3, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6502, 'price' => 283.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         500 => [
-            ['goods_id' => 6487, 'price' => 474, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6487, 'price' => 475, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']
+            ['goods_id' => 6503, 'price' => 475.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6503, 'price' => 472.5, 'quality' => 1, 'card_type' => 'chinamobile,chinatelecom']
         ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$yunlingfs_phone = ['name' => 'yunlingfs', 'store_id' => 42, 'qualitys' => '1',
+$suyuan_phone = ['name' => 'suyuan', 'store_id' => 39, 'qualitys' => '1',
+    'amount' => [
+        10 => [['goods_id' => 6464, 'price' => 9.53, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6465, 'price' => 19.06, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6466, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6467, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6468, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6469, 'price' => 190.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6470, 'price' => 285.9, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6471, 'price' => 476.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$xunao_phone = ['name' => 'xunao', 'store_id' => 44, 'qualitys' => '1',
+    'amount' => [
+        10 => [['goods_id' => 6504, 'price' => 9.45, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6505, 'price' => 18.9, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6506, 'price' => 28.35, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6507, 'price' => 47.25, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6508, 'price' => 94.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6509, 'price' => 189, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6510, 'price' => 283.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6511, 'price' => 472.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$weiyiman_phone = ['name' => 'weiyiman', 'store_id' => 45, 'qualitys' => '5',
+    'amount' => [
+        10 => [['goods_id' => 6512, 'price' => 8.8, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6513, 'price' => 17.6, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6514, 'price' => 26.4, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6515, 'price' => 44, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6516, 'price' => 88, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6517, 'price' => 176, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6518, 'price' => 264, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6519, 'price' => 440, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$yonghe_phone = ['name' => 'yonghe', 'store_id' => 46,'qualitys' => '2',
     'amount' => [
-        10 => [['goods_id' => 6488, 'price' => 9.56, 'quality' => 1, 'card_type' => 'chinamobile']],
-        20 => [['goods_id' => 6489, 'price' => 19.12, 'quality' => 1, 'card_type' => 'chinamobile']],
-        30 => [['goods_id' => 6490, 'price' => 28.68, 'quality' => 1, 'card_type' => 'chinamobile']],
-        50 => [['goods_id' => 6491, 'price' => 47.8, 'quality' => 1, 'card_type' => 'chinamobile']],
-        100 => [['goods_id' => 6492, 'price' => 95.6, 'quality' => 1, 'card_type' => 'chinamobile']],
-        200 => [['goods_id' => 6493, 'price' => 191.2, 'quality' => 1, 'card_type' => 'chinamobile']],
-        300 => [['goods_id' => 6494, 'price' => 286.8, 'quality' => 1, 'card_type' => 'chinamobile']],
-        500 => [['goods_id' => 6495, 'price' => 478, 'quality' => 1, 'card_type' => 'chinamobile']]
+        30 => [['goods_id' => 6520, 'price' => 29.955, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6520, 'price' => 29.985, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6520, 'price' => 29.82, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        50 => [['goods_id' => 6521, 'price' => 49.925, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6521, 'price' => 49.975, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6521, 'price' => 49.7, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        100 => [['goods_id' => 6522, 'price' => 99.85, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6522, 'price' => 99.95, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6522, 'price' => 99.4, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        200 => [['goods_id' => 6523, 'price' => 199.7, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6523, 'price' => 199.9, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6523, 'price' => 198.8, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        300 => [['goods_id' => 6524, 'price' => 299.55, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6524, 'price' => 299.85, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6524, 'price' => 298.2, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        500 => [['goods_id' => 6525, 'price' => 499.25, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6525, 'price' => 499.75, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6525, 'price' => 497, 'quality' => 2, 'card_type' => 'chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$jumi_phone = ['name' => 'jumi', 'store_id' => 47, 'qualitys' => '2',
+    'amount' => [
+        50 => [['goods_id' => 6526, 'price' => 48.6, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6527, 'price' => 97.2, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6528, 'price' => 194.4, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$qianqian_phone = ['name' => 'qianqian', 'store_id' => 48, 'qualitys' => '1',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 6529, 'price' => 9.53, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+//        ],
+//        20 => [
+//            ['goods_id' => 74, 'price' => 19.06, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+//        ],
+        30 => [
+            ['goods_id' => 6529, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6529, 'price' => 28.53, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 6530, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6530, 'price' => 47.55, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 6531, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6531, 'price' => 95.1, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 6532, 'price' => 190.6, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6532, 'price' => 190.2, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
@@ -543,5 +682,11 @@ $phone_providers = [
     ['name' => 'luqian', 'cfg' => $luqian_phone],
     ['name' => 'afandfs', 'cfg' => $afandfs_phone],
     ['name' => 'yunlingfs', 'cfg' => $yunlingfs_phone],
+    ['name' => 'tiancheng', 'cfg' => $tiancheng_phone],
+    ['name' => 'xunao', 'cfg' => $xunao_phone],
+    ['name' => 'weiyiman', 'cfg' => $weiyiman_phone],
+    ['name' => 'yonghe', 'cfg' => $yonghe_phone],
+    ['name' => 'jumi', 'cfg' => $jumi_phone],
+    ['name' => 'qianqian', 'cfg' => $qianqian_phone],
 ];
 $config['phone_providers'] = $phone_providers;

+ 18 - 2
docker/compose/lz-acc/docker-compose.yml

@@ -46,7 +46,7 @@ services:
     command: [redis-server,"/etc/redis/redis.conf"]
 
   mobilesrv:
-    image: php-zts-debug:7.3.18
+    image: php-zts:7.3.18
     ports:
       - "9100:9100"
     volumes:
@@ -62,7 +62,7 @@ services:
       - "redisrv"
 
   raccsrv:
-    image: php-zts-debug:7.3.18
+    image: php-zts:7.3.18
     ports:
       - "9101:9101"
     volumes:
@@ -77,6 +77,22 @@ services:
     depends_on:
       - "redisrv"
 
+  mchsrv:
+    image: php-zts:7.3.18
+    ports:
+      - "9102:9102"
+    volumes:
+      - ../../conf/etc/localtime:/etc/localtime:ro
+      - ../../../:/var/www/html
+      - ../../conf/php/lz-php.ini:/usr/local/etc/php/php.ini
+      - /nfs/upload:/var/www/html/data/upload
+      - /mnt/shoplog:/var/www/html/data/log
+      - ../../conf/php/mch-spwan-start-lz:/usr/local/bin/docker-spwan-start
+    container_name: "panda-merchant"
+    command: [docker-spwan-start]
+    depends_on:
+       - "redisrv"
+
   websrv:
     image: php-fpm:alpine
     ports:

+ 26 - 0
docker/compose/lz-stat/docker-compose.yml

@@ -0,0 +1,26 @@
+version: "3.7"
+
+services:
+  readersrv:
+    image: pycpu:3.7.10
+    volumes:
+      - ../../conf/etc/localtime:/etc/localtime:ro
+      - ../../../:/var/www/html
+      - /nfs/upload:/var/www/html/data/upload
+      - /mnt/shoplog:/var/www/html/data/log
+      - /mnt/stdata:/var/www/html/data/stdata
+    container_name: "panda-reader"
+    command: ['python','reader.py','-h', '172.16.110.28', '-p', '6379']
+
+  flasksrv:
+    image: pycpu:3.7.10
+    ports:
+      - "5000:5000"
+    volumes:
+      - ../../conf/etc/localtime:/etc/localtime:ro
+      - ../../../:/var/www/html
+      - /nfs/upload:/var/www/html/data/upload
+      - /mnt/shoplog:/var/www/html/data/log
+      - /mnt/stdata:/var/www/html/data/stdata
+    container_name: "panda-flask"
+    command: ['python','app.py']

+ 20 - 2
docker/compose/stanley/docker-compose.yml

@@ -27,7 +27,7 @@ services:
     command: [redis-server,"/etc/redis/redis.conf"]
 
   mobilesrv:
-    image: php-zts-debug:7.3.18
+    image: php-zts:7.3.18
     ports:
       - "9100:9100"
     volumes:
@@ -46,7 +46,7 @@ services:
       - "searcher"
 
   raccsrv:
-    image: php-zts-debug:7.3.18
+    image: php-zts:7.3.18
     ports:
       - "9101:9101"
     volumes:
@@ -63,6 +63,24 @@ services:
     depends_on:
        - "redisrv"
 
+  mchsrv:
+    image: php-zts:7.3.18
+    ports:
+      - "9102:9102"
+    volumes:
+      - ../../conf/etc/localtime:/etc/localtime:ro
+      - ../../../:/var/www/html
+      - ../../conf/php/php-local-debug.ini:/usr/local/etc/php/php.ini
+      - /Volumes/Transcend/upload:/var/www/html/data/upload
+      - /Users/stanley-king/work/PHPProject/shoplog:/var/www/html/data/log
+      - ../../conf/php/mch-spwan-start:/usr/local/bin/docker-spwan-start
+    links:
+      - redisrv
+    container_name: "panda-merchant"
+    command: [docker-spwan-start]
+    depends_on:
+       - "redisrv"
+
   cordsrv:
     image: php-swool-redis:latest
     volumes:

+ 16 - 1
docker/compose/xiaoyu/docker-compose.yml

@@ -59,7 +59,22 @@ services:
     depends_on:
       - "redisrv"
       - "searcher"
-
+  mchsrv:
+    image: php-zts-debug:7.3.18
+    ports:
+      - "9102:9102"
+    volumes:
+      - ../../conf/etc/localtime:/etc/localtime:ro
+      - ../../../:/var/www/html
+      - ../../conf/php/php-local-debug.ini:/usr/local/etc/php/php.ini
+      - /d/phpstudy_pro/WWW/xyzshop/data/upload:/var/www/html/data/upload
+      - ../../conf/php/mch-spwan-start:/usr/local/bin/docker-spwan-start
+    links:
+      - redisrv
+    container_name: "panda-merchant"
+    command: [docker-spwan-start]
+    depends_on:
+      - "redisrv"
   websrv:
     image: php-fpm:alpine
     volumes:

+ 18 - 2
docker/compose/xyz-acc/docker-compose.yml

@@ -30,7 +30,7 @@ services:
     command: [redis-server,"/etc/redis/redis.conf"]
 
   mobilesrv:
-    image: php-zts-debug:7.3.18
+    image: php-zts:7.3.18
     ports:
       - "9100:9100"
     volumes:
@@ -46,7 +46,7 @@ services:
       - "redisrv"
 
   raccsrv:
-    image: php-zts-debug:7.3.18
+    image: php-zts:7.3.18
     ports:
       - "9101:9101"
     volumes:
@@ -61,6 +61,22 @@ services:
     depends_on:
       - "redisrv"
 
+  mchsrv:
+    image: php-zts:7.3.18
+    ports:
+      - "9102:9102"
+    volumes:
+      - ../../conf/etc/localtime:/etc/localtime:ro
+      - ../../../:/var/www/html
+      - ../../conf/php/xyz-php.ini:/usr/local/etc/php/php.ini
+      - /nfs/upload:/var/www/html/data/upload
+      - /mnt/shoplog:/var/www/html/data/log
+      - ../../conf/php/mch-spwan-start-lz:/usr/local/bin/docker-spwan-start
+    container_name: "panda-merchant"
+    command: [docker-spwan-start]
+    depends_on:
+       - "redisrv"
+
   websrv:
     image: php-fpm:alpine
     ports:

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

@@ -10,7 +10,7 @@ services:
       - /mnt/shoplog:/var/www/html/data/log
       - /mnt/stdata:/var/www/html/data/stdata
     container_name: "panda-reader"
-    command: ['python','reader.py']
+    command: ['python','reader.py', '-h', '172.26.105.125', '-p', '6379']
 
   flasksrv:
     image: pycpu:3.7.10

+ 11 - 0
docker/conf/nginx/nginx-linzh-https.conf

@@ -71,6 +71,17 @@ http
             try_files $uri $uri/ /mshop/index.html;
         }
 
+        location /plot {
+            root $folder_name;
+            proxy_pass         http://172.16.110.30:5000;
+              proxy_redirect     off;
+
+            proxy_set_header   Host                 $host;
+            proxy_set_header   X-Real-IP            $remote_addr;
+            proxy_set_header   X-Forwarded-For      $proxy_add_x_forwarded_for;
+            proxy_set_header   X-Forwarded-Proto    $scheme;
+        }
+
         location /merchant {
             root $folder_name;
             autoindex on;

+ 9 - 0
docker/conf/nginx/nginx-stanley-http.conf

@@ -94,6 +94,15 @@ http
             include fastcgi_params;
         }
 
+        location ~ /mchsrv/[/\w]+\.php$ {
+            root           $folder_name;
+            fastcgi_pass   host.docker.internal:9102;
+            fastcgi_index  index.php;
+            fastcgi_param  SCRIPT_FILENAME  $folder_name$fastcgi_script_name;
+            fastcgi_param SIGN $http_sign;
+            include fastcgi_params;
+        }
+
         location ~ \.php$ {
 	        add_header Cache-Control no-store;
             root           $folder_name;

+ 9 - 1
docker/conf/nginx/nginx-xyz-https.conf

@@ -90,7 +90,6 @@ http
             index  index.html index.htm index.php;
             try_files $uri $uri/ /merchant/index.html;
         }
-
         location ~ /mobile/[/\w]+\.php$ {
             root           $folder_name;
             fastcgi_pass   docker.hostip:9100;
@@ -113,6 +112,15 @@ http
             include fastcgi_params;
         }
 
+        location ~ /mchsrv/[/\w]+\.php$ {
+            root           $folder_name;
+            fastcgi_pass   docker.hostip:9102;
+            fastcgi_index  index.php;
+            fastcgi_param  SCRIPT_FILENAME  $folder_name$fastcgi_script_name;
+            fastcgi_param SIGN $http_sign;
+            include fastcgi_params;
+        }
+
         location ~ \.php$ {
             add_header Cache-Control no-store;
             root           $folder_name;

+ 12 - 0
docker/conf/php/mch-spwan-start

@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+spawn-fcgi -a 0.0.0.0 -p 9102 -F 1 -f "php /var/www/html/mchsrv/mchsrv_run.php"
+
+
+time=$(date "+%Y%m%d")
+
+if [ ! -f "/var/www/html/data/log/${time}-mchsrv.log" ]; then
+    touch "/var/www/html/data/log/${time}-mchsrv.log"
+fi
+
+tail -f "/var/www/html/data/log/${time}-mchsrv.log"

+ 11 - 0
docker/conf/php/mch-spwan-start-lz

@@ -0,0 +1,11 @@
+#!/bin/sh
+set -e
+spawn-fcgi -a 0.0.0.0 -p 9102 -F 6 -f "php /var/www/html/mchsrv/mchsrv_run.php"
+
+time=$(date "+%Y%m%d")
+
+if [ ! -f "/var/www/html/data/log/${time}-mchsrv.log" ]; then
+    touch "/var/www/html/data/log/${time}-mchsrv.log"
+fi
+
+tail -f "/var/www/html/data/log/${time}-mchsrv.log"

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

@@ -1944,6 +1944,7 @@ output_buffering = On
 xdebug.default_enable=1
 xdebug.remote_enable=1
 xdebug.remote_handler=dbgp
+;xdebug.remote_host=docker.for.mac.localhost
 xdebug.remote_host=host.docker.internal
 xdebug.remote_port=9300
 xdebug.remote_mode = "req"

+ 1 - 1
docker/conf/php/xyz-php.ini

@@ -401,7 +401,7 @@ max_input_vars = 5000
 
 ; Maximum amount of memory a script may consume (128MB)
 ; http://php.net/memory-limit
-memory_limit = 128M
+memory_limit = 256M
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ; Error handling and logging ;

+ 16 - 6
helper/fcgisrv/BaseServer.php

@@ -62,15 +62,20 @@ abstract class BaseServer
         Log::record(__FUNCTION__,Log::DEBUG);
         $this->preLooper();
         Log::record('Waiting......',Log::DEBUG);
+        $i = 0;
+        fcgi_init();
         while(($ret = fcgi_accept()) >= 0)
         {
-            $start = microtime(true);
+            $mem = memory_get_usage();
+            Log::record("index = {$i} memory={$mem} ",Log::DEBUG);
+            ++$i;
 
+            $start = microtime(true);
             ob_start();
             $this->clear_global();
             perfor_clear();
-
             perfor_start();
+
             Log::start_sql_log();
             init_request();
             init_cookie($_SERVER['HTTP_COOKIE']);
@@ -82,12 +87,17 @@ abstract class BaseServer
             fcgi_headers_sent();
             $contents = ob_get_clean();
             fcgi_echo($contents);
-            Log::end_sql_log();
-            $msg = sprintf("request time=%.6f\r\n\r\n",microtime(true) - $start);
-            Log::record($msg ,Log::DEBUG);
 
+            Log::end_sql_log();
             $perlog = perfor_log();
-            Log::record("perlog = {$perlog}" ,Log::DEBUG);
+
+            $mem = memory_get_usage();
+            Log::record("memory={$mem} perlog = {$perlog}" ,Log::DEBUG);
+            $ret = fcgi_fini();
+
+            $mem = memory_get_usage();
+            $msg = sprintf("memory={$mem} isCgi = {$ret} request time=%.6f\r\n\r\n",microtime(true) - $start);
+            Log::record($msg ,Log::DEBUG);
         }
 
         fcgi_fini();

+ 1 - 1
helper/fcgisrv/LZRAccServer.php

@@ -30,7 +30,7 @@ class LZRAccServer extends BaseServer
             'callback/lingzh/amingyd.php','callback/lingzh/chuka.php'  ,'callback/lingzh/amingjd.php',
             'callback/lingzh/legou.php'  ,'callback/lingzh/feiniao.php','callback/lingzh/fensheng.php',
             'callback/lingzh/riying.php' ,'callback/lingzh/wailing.php','callback/lingzh/weishengy.php',
-            'callback/lingzh/shengying.php'
+            'callback/lingzh/shengying.php','callback/lingzh/amingjdman.php'
         ];
 
         $this->setExFiles($exfiles);

+ 111 - 0
helper/fcgisrv/MerchantServer.php

@@ -0,0 +1,111 @@
+<?php
+
+/**
+ * Created by PhpStorm.
+ * User: stanley-king
+ * Date: 16/3/10
+ * Time: 下午9:08
+ */
+
+namespace fcgisrv;
+
+require_once(BASE_ROOT_PATH . '/helper/area_helper.php');
+require_once(BASE_CORE_PATH . '/framework/function/http.php');
+require_once(BASE_ROOT_PATH . '/helper/session_helper.php');
+require_once(BASE_ROOT_PATH . '/helper/sensitive_word/dfa.php');
+require_once(BASE_ROOT_PATH . '/helper/exceptionex.php');
+require_once(BASE_ROOT_PATH . '/helper/session_helper.php');
+require_once(BASE_HELPER_PATH . '/fcgisrv/BaseServer.php');
+require_once(BASE_HELPER_PATH . '/session.php');
+
+use DFAFilter;
+use area_helper;
+use Log;
+use session;
+use session_helper;
+use Base;
+use UnloginException;
+use Exception;
+use mobileControl;
+use errcode;
+
+class MerchantServer extends BaseServer
+{
+    static private $stInstance = NULL;
+    static public function instance()
+    {
+        if(self::$stInstance == NULL) {
+            self::$stInstance = new MerchantServer('mchsrv');
+
+        }
+        return self::$stInstance;
+    }
+
+    public function __construct($subPath)
+    {
+        parent::__construct($subPath);
+        $this->setExFiles([]);
+    }
+
+    protected function preLooper()
+    {
+        parent::preLooper();
+        DFAFilter::instance();
+        area_helper::instance();
+    }
+
+    public function handle_req($file)
+    {
+        try
+        {
+            if(file_exists($file))
+            {
+                if(defined('CROSS_DOAMIN') && CROSS_DOAMIN == true) {
+                    $host = 'http://192.168.1.130:3333';
+                    fcgi_header("Access-Control-Allow-Headers:DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type, Accept-Language, Origin, Accept-Encoding");
+                    fcgi_header("Content-Type: text/html; charset=UTF-8");
+                    fcgi_header("Access-Control-Allow-Credentials: true");
+                    fcgi_header("Access-Control-Allow-Origin: {$host}");
+                    fcgi_header('Access-Control-Allow-Methods: GET, POST, PUT,DELETE,PATCH');
+                }
+
+                if($this->is_exclude($file)) {
+                    include $file;
+                }
+                else
+                {
+                    if(!isset($_GET['act'])) {
+                        $_GET['act'] = 'index';
+                    }
+                    if(!isset($_GET['op'])) {
+                        $_GET['op'] = 'index';
+                    }
+                    if(!isset($_POST['act'])) {
+                        $_POST['act'] = 'index';
+                    }
+                    if(!isset($_POST['op'])) {
+                        $_POST['op'] = 'index';
+                    }
+
+                    //部分控制器不需要使用session.
+                    session::instance()->start();
+                    Base::mobile_control();
+                }
+            }
+            else
+            {
+                Log::record("Can Not call file: {$file}",Log::DEBUG);
+                fcgi_header("Content-Type: text/html; charset=UTF-8");
+                echo "no such file.";
+            }
+        }
+        catch (UnloginException $ex) {
+            mobileControl::outerr(errcode::ErrUnLogin,errcode::msg(errcode::ErrUnLogin),'','android');
+        }
+        catch (Exception $ex) {
+            mobileControl::outerr($ex->getCode(),$ex->getMessage(),'','android');
+            Log::record("run_looper exception catch code={$ex->getCode()} msg={$ex->getMessage()} trace={$ex->getTraceAsString()}",Log::ERR);
+        }
+        session::instance()->end();
+    }
+}

+ 52 - 29
helper/fcgisrv/MobileServer.php

@@ -33,6 +33,7 @@ use errcode;
 class MobileServer extends BaseServer
 {
     static private $stInstance = NULL;
+    private $dir_name = 'callback';
     static public function instance()
     {
         if(self::$stInstance == NULL) {
@@ -58,12 +59,27 @@ class MobileServer extends BaseServer
             'refill_afandnew.php','refill_lingzh.php','refill_lingzhdl.php','refill_tongy.php',
             'refill_weiyi.php','refill_tonglu.php','refill_xc.php','refill_xunyin.php',
             'refill_yunling.php','refill_wantong.php','refill_zhongst.php',
-            'refill_luqian.php','refill_afandfs.php','refill_yunlingfs.php'
+            'refill_luqian.php','refill_afandfs.php','refill_yunlingfs.php',
+            'refill_tiancheng.php','refill_xunao.php','refill_weiyiman.php'
         ];
 
         $this->setExFiles($exfiles);
     }
 
+    protected function is_exclude($file)
+    {
+        $ret = parent::is_exclude($file);
+        if ($ret) {
+            return true;
+        } else {
+            $path = BASE_ROOT_PATH . "/" . $this->mSubPath . "/callback";
+            $basename = basename($file);
+            $tmp = "{$path}/{$basename}";
+
+            return file_exists($tmp);
+        }
+    }
+
     protected function preLooper()
     {
         parent::preLooper();
@@ -77,42 +93,49 @@ class MobileServer extends BaseServer
         {
             if(file_exists($file))
             {
-                if(defined('CROSS_DOAMIN') && CROSS_DOAMIN == true) {
-                    $host = 'http://192.168.1.130:3333';
-                    fcgi_header("Access-Control-Allow-Headers:DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type, Accept-Language, Origin, Accept-Encoding");
-                    fcgi_header("Content-Type: text/html; charset=UTF-8");
-                    fcgi_header("Access-Control-Allow-Credentials: true");
-                    fcgi_header("Access-Control-Allow-Origin: {$host}");
-                    fcgi_header('Access-Control-Allow-Methods: GET, POST, PUT,DELETE,PATCH');
-                }
-
                 if($this->is_exclude($file)) {
                     Log::record("Call {$file}",Log::DEBUG);
                     include $file;
                 }
                 else
                 {
-                    if(!isset($_GET['act'])) {
-                        $_GET['act'] = 'index';
-                    }
-                    if(!isset($_GET['op'])) {
-                        $_GET['op'] = 'index';
-                    }
-                    if(!isset($_POST['act'])) {
-                        $_POST['act'] = 'index';
-                    }
-                    if(!isset($_POST['op'])) {
-                        $_POST['op'] = 'index';
-                    }
-
                     //部分控制器不需要使用session.
-                    $act = $_GET['act'];
-                    if($act != 'refill') {
-                        session::instance()->start();
-                        Log::record("member_id=" . session_helper::memberid(),Log::DEBUG);
+                    if(defined('COMPANY_NAME') && COMPANY_NAME === 'XYZ_COMPANY')
+                    {
+                        $act = $_GET['act'];
+                        if ($act == 'refill') {
+                            Base::mobile_control();
+                        } else {
+                            fcgi_header("Content-Type: text/html; charset=UTF-8");
+                            echo "no such file.";
+                        }
+                        session::instance()->end(false);
                     }
+                    else
+                    {
+                        if(!isset($_GET['act'])) {
+                            $_GET['act'] = 'index';
+                        }
+                        if(!isset($_GET['op'])) {
+                            $_GET['op'] = 'index';
+                        }
+                        if(!isset($_POST['act'])) {
+                            $_POST['act'] = 'index';
+                        }
+                        if(!isset($_POST['op'])) {
+                            $_POST['op'] = 'index';
+                        }
 
-                    Base::mobile_control();
+                        //部分控制器不需要使用session.
+                        $act = $_GET['act'];
+                        if($act != 'refill') {
+                            session::instance()->start();
+                            Log::record("member_id=" . session_helper::memberid(),Log::DEBUG);
+                        }
+
+                        Base::mobile_control();
+                        session::instance()->end(true);
+                    }
                 }
             }
             else
@@ -129,6 +152,6 @@ class MobileServer extends BaseServer
             mobileControl::outerr($ex->getCode(),$ex->getMessage(),'','android');
             Log::record("run_looper exception catch code={$ex->getCode()} msg={$ex->getMessage()} trace={$ex->getTraceAsString()}",Log::ERR);
         }
-        session::instance()->end();
+
     }
 }

+ 2 - 2
helper/http_header.php

@@ -255,14 +255,14 @@ class http_header
                         $method = strtolower(request_helper::method());
                         if ($http_response_code) { /* user specified redirect code */
                             $this->mStatusCode = $http_response_code;
-                        } else if ($method == 'get') {
+                        } elseif ($method == 'get') {
                             $this->mStatusCode = 303;
                         } else {
                             $this->mStatusCode = 302;
                         }
                     }
                 }
-                else if(!strncasecmp($header_line, "WWW-Authenticate",strlen("WWW-Authenticate"))) {
+                elseif(!strncasecmp($header_line, "WWW-Authenticate",strlen("WWW-Authenticate"))) {
                     $this->mStatusCode = 401;
                 }
             }

+ 1 - 1
helper/performance_helper.php

@@ -13,7 +13,7 @@ class performance_helper
     static private $stInstance = NULL;
 
     public function __construct() {
-        $this->mMsgs = array();
+        $this->mMsgs = [];
         $this->mStart = microtime(true);
     }
     static public function instance()

+ 2 - 1
helper/refill/RefillBase.php

@@ -282,7 +282,7 @@ class RefillBase
 
             //通道价格大于客户价格,换通道.
             [$goods_id, $price] = $provider->goods($quality,$amount,$card_type);
-            if ($price >= $mch_amount) continue;
+            if ($price > $mch_amount) continue;
 
             Log::record("start create order",Log::DEBUG);
 
@@ -344,6 +344,7 @@ class RefillBase
             util::decr_amount_lock($mchid,$card_type,$amount);
 
             $start = microtime(true);
+            Log::record("start commit order card_no={$card_no}", Log::DEBUG);
             [$state, $errmsg, $neterr] = $provider->add($card_no, $card_type, $amount, $params);
             Log::record(sprintf(" %s add request time=%.6f", $channel_name,microtime(true) - $start), Log::DEBUG);
 

+ 1 - 1
helper/refill/api/lingzh/amingjd/RefillCallBack.php

@@ -45,7 +45,7 @@ class RefillCallBack implements refill\IRefillCallBack
             return [$order_id, true, false,true];
         }
         elseif ($status === 0) {
-            return [$order_id, false, true,true];
+            return [$order_id, false, false,true];
         }
         else {
             return [$order_id, false, false,false];

+ 51 - 0
helper/refill/api/lingzh/amingjdman/RefillCallBack.php

@@ -0,0 +1,51 @@
+<?php
+namespace refill\amingjdman;
+
+require_once(BASE_HELPER_RAPI_PATH . '/amingjdman/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)
+    {
+        $content  = $params['order_id'] . $params['out_order_id'] . config::MCHID . $params['tel'] . $params['price'];
+        $content .= $params['status'] . config::KEY;
+        return md5($content);
+    }
+
+    //[$order_id, $success, $can_try, $need_handle]
+    public function notify($params)
+    {
+        $status = intval($params['status']);
+        $order_sn = $params['order_id'];
+        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+        $order_id = $order_info['order_id'];
+        
+        $data['official_sn'] = strtolower($params['out_order_id']) == 'null' ? '' : $params['out_order_id'];
+
+        if ($status === 1) {
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif ($status === 0) {
+            return [$order_id, false, false,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
+}

+ 103 - 0
helper/refill/api/lingzh/amingjdman/RefillPhone.php

@@ -0,0 +1,103 @@
+<?php
+
+namespace refill\amingjdman;
+
+require_once(BASE_HELPER_RAPI_PATH . '/amingjdman/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['mchid'] = config::MCHID;
+        $params['tel'] = $phone;
+        $params['orderid'] = $order_sn;
+        $params['price'] = $amount;
+        $params['teltype'] = config::operator[$card_type];
+        $params['timeout'] = config::TIMEOUT;
+        $params['notify'] = config::NOTIFY_URL;
+        $params['time'] = time();
+        $params['rand'] = rand(100000,999999);
+
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params)
+    {
+        $params = $this->req_params($card_no, $amount, $card_type, $params['order_sn']);
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params , 'POST' , false);
+        if (empty($resp)) {
+            return [false, '系统错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['code'] == 0) {
+                return [true, $resp['order_id'], false];
+            } else {
+                return [false, $resp['msg'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['mchid'] = config::MCHID;
+        $params['orderid'] = $refill_info['order_sn'];
+        $content = $params['mchid'] . $params['orderid'] . config::KEY;
+        $params['sign'] = md5($content);
+
+        $resp = http_request(config::QUERY_URL, $params , 'POST' , false);
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['code'] == 100)
+            {
+                if ($resp['status'] == 3) {
+                    $order_state = ORDER_STATE_SUCCESS;
+                    $save['official_sn'] = strtolower($resp['out_order_id']) == 'null' ? '' : $resp['out_order_id'];
+                    Model('refill_order')->edit($refill_info['order_id'], $save);
+                } elseif ($resp['status'] == 4) {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif (in_array($resp['status'] , [1 , 2])) {
+                    $order_state = ORDER_STATE_SEND;
+                } else {
+                    return [false, $resp['msg']];
+                }
+
+                return [true, $order_state];
+            }
+            else {
+                return [false, $resp['msg']];
+            }
+        }
+    }
+
+    private function sign($params)
+    {
+        $content  = $params['mchid'] . $params['tel'] . $params['price'] . $params['orderid'] . $params['teltype'] . $params['timeout'] . $params['notify'];
+        $content .= $params['time'] . $params['rand'] . config::KEY;
+        return md5($content);
+    }
+}

+ 5 - 0
helper/refill/api/lingzh/amingjdman/api.txt

@@ -0,0 +1,5 @@
+后台地址:http://156.240.108.208:8088/
+账号ID:10045
+密码:lz123456
+提交地址:http://156.240.108.208:8088/api/telpay
+查单地址:http://156.240.108.208:8088/api/telpay/query

+ 21 - 0
helper/refill/api/lingzh/amingjdman/config.php

@@ -0,0 +1,21 @@
+<?php
+
+
+namespace refill\amingjdman;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://www.826866.com/api/telpay';
+    const QUERY_URL = 'http://www.826866.com/api/telpay/query';
+
+    const MCHID = 10045;
+    const KEY = 'a1b2f886cfda41170547cd6cfc1cf16b';
+    const NOTIFY_URL = BASE_SITE_URL . "/racc/callback/lingzh/amingjdman.php";
+    const TIMEOUT = 7200;
+    const operator = [
+        mtopcard\ChinaMobileCard  => 0,
+        mtopcard\ChinaUnicomCard  => 1,
+        mtopcard\ChinaTelecomCard => 2
+    ];
+}

+ 2 - 2
helper/refill/api/lingzh/binghc/config.php

@@ -6,8 +6,8 @@ namespace refill\binghc;
 
 class config
 {
-    const ORDER_URL = 'http://8.136.216.154:9009/Order/Api/invest';
-    const QUERY_URL = 'http://8.136.216.154:9009/Order/Api/queryStatus';
+    const ORDER_URL = 'http://8.136.239.223:9009/Order/Api/invest';
+    const QUERY_URL = 'http://8.136.239.223:9009/Order/Api/queryStatus';
 
     const SID = '16133049250783350350';
     const KEY = 'f2vxbLarSpPfcpxPXqwfUYcFCvCiyj3a3jY0Lp292OgD1ic25AQUhlTQ9e7lV8O5';

+ 1 - 1
helper/refill/api/lingzh/fensheng/config.php

@@ -15,7 +15,7 @@ class config
 
     const ProductIDS = [
         mtopcard\ChinaMobileCard  => [
-            10 => 'CUCCALLr10r', 20 => 'CMCCALLr20r', 30 => 'CMCCALLr30r',
+            10 => 'CMCCALLr10r', 20 => 'CMCCALLr20r', 30 => 'CMCCALLr30r',
             50 => 'CMCCALLr50r', 100 => 'CMCCALLr100r', 200 => 'CMCCALLr200r'
         ],
         mtopcard\ChinaUnicomCard  => [

+ 2 - 2
helper/refill/api/lingzh/weishengy/config.php

@@ -5,8 +5,8 @@ namespace refill\weishengy;
 
 class config
 {
-    const ORDER_URL = 'http://www.dabjweb.com/api/order/jdTelPay';
-    const QUERY_URL = 'http://www.dabjweb.com/api/order/jdTelGet';
+    const ORDER_URL = 'http://www.lwdbj.com/api/order/jdTelPay';
+    const QUERY_URL = 'http://www.lwdbj.com/api/order/jdTelGet';
 
     const masId = '699270071532654592';
     const appKey = '8sa877sdj219sda';

+ 3 - 5
helper/refill/api/xyz/afandfs/config.php

@@ -1,16 +1,14 @@
 <?php
-
-
 namespace refill\afandfs;
 
 use mtopcard;
 class config
 {
-    const ORDER_URL = 'http://119.8.102.95/api/receiveOrder';
-    const QUERY_URL = 'http://119.8.102.95/api/queryOrder';
+    const ORDER_URL = 'http://150.107.3.58/api/receiveOrder';
+    const QUERY_URL = 'http://150.107.3.58/api/queryOrder';
 
     const PARTNER_ID = '52';
-    const KEY = '130c44ac97bf094b6c7e448be1fbee8f';
+    const KEY = '8dd29f631f84b11f4ed4c2fbfcfc4057';
     const NOTIFY_URL =  BASE_SITE_URL."/mobile/refill_afandfs.php";
     const operator = [
         mtopcard\ChinaMobileCard  => 2,

+ 67 - 0
helper/refill/api/xyz/jumi/RefillCallBack.php

@@ -0,0 +1,67 @@
+<?php
+namespace refill\jumi;
+require_once(BASE_HELPER_RAPI_PATH . '/jumi/config.php');
+
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $input = $params;
+        unset($input['sign']);
+        $sign = $this->sign($input);
+        if ($params['sign'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    protected function check_empty($value)
+    {
+        if (!isset($value))
+            return true;
+        if ($value === null)
+            return true;
+        if (trim($value) === "")
+            return true;
+
+        return false;
+    }
+
+    private function sign($params)
+    {
+        $content = '';
+        ksort($params);
+        foreach ($params as $key => $val){
+            $content .= "{$key}={$val}&";
+        }
+        $content .= "token=".config::Token;
+
+        return md5($content);
+    }
+
+    //[$order_id, $success, $can_try, $need_handle]
+    public function notify($params)
+    {
+        $status = intval($params['status']);
+        $order_sn = $params['order_no'];
+        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+        $order_id = $order_info['order_id'];
+
+        if ($status === 1) {
+            $data['official_sn'] = strtolower($params['official_sn']) == 'null' ? '' : $params['official_sn'];
+            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];
+        }
+    }
+}

+ 107 - 0
helper/refill/api/xyz/jumi/RefillPhone.php

@@ -0,0 +1,107 @@
+<?php
+
+namespace refill\jumi;
+
+require_once(BASE_HELPER_RAPI_PATH . '/jumi/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, string $order_sn)
+    {
+        $params['mch_no'] = config::MCH_ID;
+        $params['order_no'] = $order_sn;
+        $params['product_id'] = config::product_id[$amount];
+        $params['account'] = $phone;
+        $params['notify_url'] = config::NOTIFY_URL;
+
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params)
+    {
+        $params = $this->req_params($card_no, $amount, $params['order_sn']);
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $params = json_encode($params);
+        $resp = http_post_data(config::ORDER_URL, $params , config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '系统错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['code'] === '0000') {
+                return [true, $resp['data']['channel_order_no'], false];
+            } else {
+                return [false, $resp['msg'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['mch_no'] = config::MCH_ID;
+        $params['order_no'] = $refill_info['order_sn'];
+        $params['sign'] = $this->sign($params);
+        $params = json_encode($params);
+
+        $resp = http_post_data(config::QUERY_URL, $params , config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['code'] == '0000')
+            {
+                $status = intval($resp['data']['status']);
+                if ($status === 1) {
+                    $updata['official_sn'] = $resp['data']['official_sn'];
+                    Model('refill_order')->edit($refill_info['order_id'], $updata);
+                    $order_state = ORDER_STATE_SUCCESS;
+                } elseif ($status === 3) {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif (in_array($status, [0,2])) {
+                    $order_state = ORDER_STATE_SEND;
+                } else {
+                    return [false, $resp['msg']];
+                }
+                return [true, $order_state];
+            }
+            else {
+                return [false, $resp['msg']];
+            }
+
+        }
+    }
+
+    private function sign($params)
+    {
+        $content = '';
+        ksort($params);
+        foreach ($params as $key => $val){
+            $content .= "{$key}={$val}&";
+        }
+        $content .= "token=".config::Token;
+
+        return md5($content);
+    }
+}

+ 10 - 0
helper/refill/api/xyz/jumi/api.txt

@@ -0,0 +1,10 @@
+新系统登录地址https://sever.jumiit.com/admin
+账号:yezi
+密码:yezihuafei
+技术信息
+商户号:210303112631
+api-token:7e145747925c1619c341ab6d4f6a2e71
+api文档地址 https://www.showdoc.cc/1278445497608240
+api提单使用需要提供提单ip加白名单。
+话费面额50/100/200
+话费系列产品id请登录商户首页

+ 18 - 0
helper/refill/api/xyz/jumi/config.php

@@ -0,0 +1,18 @@
+<?php
+namespace refill\jumi;
+
+class config
+{
+    const ORDER_URL = 'https://sever.jumiit.com/api/mch-api/createOrder';
+    const QUERY_URL = 'https://sever.jumiit.com/api/mch-api/getOrderInfo';
+
+    const MCH_ID = '210303112631';
+    const Token = '7e145747925c1619c341ab6d4f6a2e71';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_jumi.php";
+    const ExtHeaders = ['Content-Type: application/json'];
+    const product_id = [
+        50  => 10343,
+        100 => 10344,
+        200 => 10347
+    ];
+}

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

@@ -0,0 +1,39 @@
+<?php
+
+
+namespace refill\qianqian;
+
+require_once(BASE_HELPER_RAPI_PATH . '/qianqian/config.php');
+
+
+use refill;
+
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+       return true;
+    }
+
+    public function notify($params)
+    {
+        $status = $params['status'];
+        $order_sn = $params['consumerNo'];
+
+        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+
+        $order_id = $order_info['order_id'];
+        if ($status === '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)) {
+            return [$order_id, false, false, true];
+        } else {
+            return [$order_id, false, false, false];
+        }
+    }
+}

+ 106 - 0
helper/refill/api/xyz/qianqian/RefillPhone.php

@@ -0,0 +1,106 @@
+<?php
+
+namespace refill\qianqian;
+
+require_once(BASE_HELPER_RAPI_PATH . '/qianqian/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    private function req_params(int $phone, string $order_sn)
+    {
+        $params['account'] = config::ACCOUNT;
+        $params['consumerNo'] = $order_sn;
+        $params['mobile'] = $phone;
+        $params['timestamp'] = date("YmdHis");
+
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params)
+    {
+        $params = $this->req_params($card_no, $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);
+
+        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['consumerNo'] = $refill_info['order_sn'];
+        $params['account'] = config::ACCOUNT;
+        $params['timestamp'] = date("YmdHis");
+        $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)) {
+                $order_state = ORDER_STATE_CANCEL;
+            } elseif ($status === '002') {
+                $order_state = ORDER_STATE_SEND;
+            } else {
+                return [false, $status];
+            }
+
+            return [true, $order_state];
+        }
+    }
+
+    private function sign($params)
+    {
+        $data['account'] = $params['account'];
+        $data['timestamp'] = $params['timestamp'];
+        $data['secret'] = config::KEY;
+        asort($data);
+        $content = '';
+        foreach ($data as $key => $val){
+            $content .= $val;
+        }
+        return sha1($content);
+    }
+}

+ 42 - 0
helper/refill/api/xyz/qianqian/config.php

@@ -0,0 +1,42 @@
+<?php
+
+
+namespace refill\qianqian;
+use mtopcard;
+
+class config
+{
+    const ORDER_URL = 'http://112.124.55.235/flow-receiver/fee/recharge';
+    const QUERY_URL = 'http://112.124.55.235/flow-receiver/fee/query/single';
+    const NOTIFY_URL = BASE_SITE_URL . '/mobile/callback/qianqian.php';
+
+    const ACCOUNT = 'lz16888';
+    const KEY = '5ea089c7f54a4ee692cfe8a84fcaee4b';
+
+    const ProductIDS = [
+        mtopcard\ChinaMobileCard  => [
+            10 => 'CMCCALLr10r', 20 => 'CMCCALLr20r', 30 => 'CMCCALLr30r',
+            50 => 'CMCCALLr50r', 100 => 'CMCCALLr100r', 200 => 'CMCCALLr200r'
+        ],
+        mtopcard\ChinaUnicomCard  => [
+            10 => 'CUCCALLr10r', 20 => 'CUCCALLr20r', 30 => 'CUCCALLr30r',
+            50 => 'CUCCALLr50r', 100 => 'CUCCALLr100r', 200 => 'CUCCALLr200r'
+        ],
+        mtopcard\ChinaTelecomCard => [
+            10 => 'CTCCALLr10r', 20 => 'CTCCALLr20r', 30 => 'CTCCALLr30r',
+            50 => 'CTCCALLr50r', 100 => 'CTCCALLr100r', 200 => 'CTCCALLr200r'
+        ]
+    ];
+
+    const AddErrCodes = [
+        '003','004','005','006','007','008','009','010','011','012','013','014','015','016','017','018','019','020','021','022','023','024','025','027','028','098','099'
+    ];
+
+    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'
+    ];
+}

File diff suppressed because it is too large
+ 3 - 0
helper/refill/api/xyz/qianqian/琳珠网络科技话费接口充值协议.doc


BIN
helper/refill/api/xyz/qianqian/琳珠网络科技话费接口状态码详解.docx


+ 52 - 0
helper/refill/api/xyz/tiancheng/RefillCallBack.php

@@ -0,0 +1,52 @@
+<?php
+
+
+namespace refill\tiancheng;
+
+require_once(BASE_HELPER_RAPI_PATH . '/tiancheng/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)
+    {
+        $content = $params['result'] . $params['msg'] . $params['order'];
+        $content .= $params['phone_no'] . $params['amount'] . $params['op_no'] . $params['settle'] . config::KEY;
+        return strtoupper(md5($content));
+    }
+
+
+    public function notify($params)
+    {
+        $status = $params['result'];
+        $order_sn = $params['op_no'];
+        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+        $order_id = $order_info['order_id'];
+
+        if ($status === 'success') {
+            $data['official_sn'] = strtolower($params['order']) == 'null' ? '' : $params['order'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif ($status === 'fail') {
+            return [$order_id, false, false,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
+}

+ 101 - 0
helper/refill/api/xyz/tiancheng/RefillPhone.php

@@ -0,0 +1,101 @@
+<?php
+
+namespace refill\tiancheng;
+
+require_once(BASE_HELPER_RAPI_PATH . '/tiancheng/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['phone'] = $phone;
+        $params['order_no'] = $order_sn;
+        $params['s_id'] = config::SID;
+        $params['amount'] = $amount;
+        $params['notify_url'] = config::NOTIFY_URL;
+        $params['lx'] = config::operator[$card_type];
+
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params)
+    {
+        $params = $this->req_params($card_no, $amount, $card_type, $params['order_sn']);
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params);
+
+        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['result'] == 'SUCCESS') {
+                return [true, $resp['data'], false];
+            } else {
+                return [false, $resp['msg'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['sid'] = config::SID;
+        $params['orderId'] = $refill_info['order_sn'];
+        $content = $params['orderId'] . $params['sid'] . config::KEY;
+        $params['sign'] = strtoupper(md5($content));
+
+        $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, '系统错误'];
+            }
+            elseif ($resp['result'] == 'SUCCESS')
+            {
+                $status = $resp['msg'];
+                if ($status == '充值成功') {
+                    $order_state = ORDER_STATE_SUCCESS;
+                    $save['official_sn'] = strtolower($resp['data']) == 'null' ? '' : $resp['data'];
+                    Model('refill_order')->edit($refill_info['order_id'], $save);
+                } elseif ($status == '充值失败') {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif (in_array($status, ['充值中','匹配中'])) {
+                    $order_state = ORDER_STATE_SEND;
+                } else {
+                    return [false, $resp['msg']];
+                }
+
+                return [true, $order_state];
+            }
+            else {
+                return [false, $resp['msg']];
+            }
+        }
+    }
+
+    private function sign($params)
+    {
+        $key = config::KEY;
+        $content = $params['amount'] . $params['notify_url'] . $params['order_no'] . $params['phone'] . $params['s_id'] . $key;
+        return strtoupper(md5($content));
+    }
+}

+ 20 - 0
helper/refill/api/xyz/tiancheng/config.php

@@ -0,0 +1,20 @@
+<?php
+
+
+namespace refill\tiancheng;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://182.255.61.11/api/order/invest';
+    const QUERY_URL = 'http://182.255.61.11/api/order/queryStatus';
+
+    const SID = '16193208193424561706';
+    const KEY = 'CwVAoQboguX2DZkdDXk0AIA2csWWnAp1gmKS0KyKKVoX8cX8qJLQa3exEfGevM5J';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/refill_tiancheng.php";
+    const operator = [
+        mtopcard\ChinaMobileCard  => 1,
+        mtopcard\ChinaUnicomCard  => 2,
+        mtopcard\ChinaTelecomCard => 3
+    ];
+}

BIN
helper/refill/api/xyz/tiancheng/话费供货商对接文档.docx


+ 5 - 0
helper/refill/api/xyz/tiancheng/账号.txt

@@ -0,0 +1,5 @@
+http://182.255.61.11/company/
+yezi
+123456
+
+网关:http://182.255.61.11/api

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

@@ -0,0 +1,50 @@
+<?php
+namespace refill\weiyiman;
+
+require_once(BASE_HELPER_RAPI_PATH . '/weiyiman/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)
+    {
+        $content  = config::USER_ID . $params['ordernum'] . $params['timestamp'] . config::KEY;
+        return md5($content);
+    }
+
+    //[$order_id, $success, $can_try, $need_handle]
+    public function notify($params)
+    {
+        $status = intval($params['state']);
+        $order_sn = $params['ordernum'];
+        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+        $order_id = $order_info['order_id'];
+        
+        $data['official_sn'] = strtolower($params['serialno']) == 'null' ? '' : $params['serialno'];
+
+        if ($status === 2) {
+            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];
+        }
+    }
+}

+ 96 - 0
helper/refill/api/xyz/weiyiman/RefillPhone.php

@@ -0,0 +1,96 @@
+<?php
+namespace refill\weiyiman;
+
+require_once(BASE_HELPER_RAPI_PATH . '/weiyiman/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, string $order_sn)
+    {
+        $params['userid'] = config::USER_ID;
+        $params['orderid'] = $order_sn;
+        $params['echo'] = rand(100000,999999);
+        $params['timestamp'] = date("YmdHis");
+        $params['version'] = '1.0';
+        $params['packcode'] = $amount;
+        $params['mobile'] = $phone;
+        $params['flowtype'] = '1001';
+        $params['callback_url'] = config::NOTIFY_URL;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params)
+    {
+        $params = $this->req_params($card_no, $amount, $params['order_sn']);
+        $sign = $this->sign($params);
+        $params['chargeSign'] = $sign;
+
+        $params = json_encode($params);
+
+        $resp = http_post_data(config::ORDER_URL, $params , config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '系统错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['code'] === '0000') {
+                return [true, '', false];
+            } else {
+                return [false, $resp['desc'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['orderid'] = $refill_info['order_sn'];
+        $params['userid'] = config::USER_ID;
+        $params['timestamp'] = date("YmdHis");
+        $content = $params['userid'] . $params['orderid'] . $params['timestamp'] . config::KEY;
+        $params['sign'] = md5($content);
+        $params = json_encode($params);
+
+        $resp = http_post_data(config::QUERY_URL, $params , config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            } elseif ($resp['code'] === '0000') {
+                $order_state = ORDER_STATE_SUCCESS;
+            } elseif ($resp['code'] === '0004') {
+                $order_state = ORDER_STATE_CANCEL;
+            } elseif ($resp['code'] === '0002' || $resp['code'] === '0003') {
+                $order_state = ORDER_STATE_SEND;
+            } else {
+                return [false, $resp['desc']];
+            }
+            return [true, $order_state];
+        }
+    }
+
+    private function sign($params)
+    {
+        $content  = $params['userid'] . $params['orderid'] . config::KEY . $params['echo'] . $params['timestamp'];
+        return md5($content);
+    }
+
+}

+ 13 - 0
helper/refill/api/xyz/weiyiman/config.php

@@ -0,0 +1,13 @@
+<?php
+namespace refill\weiyiman;
+
+class config
+{
+    const ORDER_URL = 'http://115.28.209.246:8081/api/charge.do';
+    const QUERY_URL = 'http://115.28.209.246:8081/api/query_chargestate.do';
+
+    const USER_ID = 'd62df4c1fc804cd48f86';
+    const KEY = '7f3feb5e0c1049f4b839';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/refill_weiyiman.php";
+    const ExtHeaders = ['Content-Type: application/json'];
+}

+ 72 - 0
helper/refill/api/xyz/xunao/RefillCallBack.php

@@ -0,0 +1,72 @@
+<?php
+
+
+namespace refill\xunao;
+
+require_once(BASE_HELPER_RAPI_PATH . '/xunao/config.php');
+
+use refill;
+
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $input = $params;
+        unset($input['sign']);
+        $sign = $this->sign($input);
+        if ($params['sign'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    protected function check_empty($value)
+    {
+        if (!isset($value))
+            return true;
+        if ($value === null)
+            return true;
+        if (trim($value) === "")
+            return true;
+
+        return false;
+    }
+
+    private function sign($data)
+    {
+        $str = "";
+        ksort($data);
+        $data['queryUrl'] = urlencode($data['queryUrl']);
+        foreach($data as $k => $v){
+            if($this->check_empty($v) === false){
+                $str .= $v;
+            }
+        }
+        return md5($str.config::KEY);
+    }
+
+    //[$order_id, $success, $can_try, $need_handle]
+    public function notify($params)
+    {
+        $status = intval($params['status']);
+        $order_sn = $params['orderNo'];
+        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+        $order_id = $order_info['order_id'];
+
+        if ($status === 2) {
+            $data['official_sn'] = strtolower($params['ticketNo']) == 'null' ? '' : $params['ticketNo'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif (in_array($status, [0,1,3])) {
+            return [$order_id, false, true,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
+}

+ 111 - 0
helper/refill/api/xyz/xunao/RefillPhone.php

@@ -0,0 +1,111 @@
+<?php
+
+namespace refill\xunao;
+
+require_once(BASE_HELPER_RAPI_PATH . '/xunao/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['supplierId'] = config::USER_ID;
+        $params['orderNo'] = $order_sn;
+        $params['company'] = config::operator[$card_type];
+        $params['amount'] = $amount;
+        $params['phoneNo'] = $phone;
+        $params['notifyUrl'] = config::NOTIFY_URL;
+
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params)
+    {
+        $params = $this->req_params($card_no, $amount, $card_type, $params['order_sn']);
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $params = json_encode($params);
+
+        $resp = http_post_data(config::ORDER_URL, $params , config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '系统错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['code'] === 200) {
+                return [true, $resp['data']['orderId'], false];
+            } else {
+                return [false, $resp['msg'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['supplierId'] = config::USER_ID;
+        $params['orderNo'] = $refill_info['order_sn'];
+        $params['phoneNo'] = $refill_info['card_no'];
+        $params['company'] = config::operator[$refill_info['card_type']];
+        $params['sign'] = $this->sign($params);
+        $params = json_encode($params);
+
+        $resp = http_post_data(config::QUERY_URL, $params , config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['code'] == 200)
+            {
+                $status = intval($resp['data']['status']);
+                if ($status === 2) {
+                    $updata['official_sn'] = $resp['data']['ticketNo'];
+                    Model('refill_order')->edit($refill_info['order_id'], $updata);
+                    $order_state = ORDER_STATE_SUCCESS;
+                } elseif ($status === 3) {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif (in_array($status, [0,1])) {
+                    $order_state = ORDER_STATE_SEND;
+                } else {
+                    return [false, $resp['msg']];
+                }
+                return [true, $order_state];
+            }
+            else {
+                return [false, $resp['msg']];
+            }
+
+        }
+    }
+
+    private function sign($data)
+    {
+        $str = "";
+        ksort($data);
+        foreach($data as $k => $v){
+            if($this->check_empty($v) === false){
+                $str .= $v;
+            }
+        }
+        return md5($str.config::KEY);
+    }
+}

+ 8 - 0
helper/refill/api/xyz/xunao/api.txt

@@ -0,0 +1,8 @@
+后台:http://47.118.36.120/supplier/
+账号:yzdz01 
+密码:12345678 
+接口网关:http://47.118.36.120:9009/prod-produce/api/provide
+
+对接文档
+访问地址: https://www.showdoc.com.cn/1236371818470662?page_id=6222602518495888
+访问密码: 123456

+ 21 - 0
helper/refill/api/xyz/xunao/config.php

@@ -0,0 +1,21 @@
+<?php
+
+
+namespace refill\xunao;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://47.118.36.120:9009/prod-produce/api/provide';
+    const QUERY_URL = 'http://47.118.36.120:9009/prod-produce/api/query';
+
+    const USER_ID = '10';
+    const KEY = 'e4aa17f34d5ef57271b3fce13d938185';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/refill_xunao.php";
+    const ExtHeaders = ['Content-Type: application/json'];
+    const operator = [
+        mtopcard\ChinaMobileCard  => 'yd',
+        mtopcard\ChinaUnicomCard  => 'lt',
+        mtopcard\ChinaTelecomCard => 'dx'
+    ];
+}

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

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

+ 103 - 0
helper/refill/api/xyz/yonghe/RefillPhone.php

@@ -0,0 +1,103 @@
+<?php
+
+namespace refill\yonghe;
+
+require_once(BASE_HELPER_RAPI_PATH . '/yonghe/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)
+    {
+        $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);
+
+        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['nRtn'] == 0) {
+                return [true, '', false];
+            } else {
+                return [false, $resp['szRtnCode'], false];
+            }
+        }
+    }
+
+    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 = intval($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])) {
+                $order_state = ORDER_STATE_SEND;
+            } else {
+                return [false, $resp['szRtnMsg']];
+            }
+
+            return [true, $order_state];
+        }
+    }
+
+    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);
+    }
+}

+ 11 - 0
helper/refill/api/xyz/yonghe/api.txt

@@ -0,0 +1,11 @@
+北京椰子
+ID:200115
+账号:bjyz
+登录密码:123456
+秘钥:9147cb5fdf3e41699dab66626d1b741c
+系统地址:http://8.129.227.254:10089/plat/index
+下单地址:http://8.129.227.254:10089/plat/api/old/submitorder
+查询地址:http://8.129.227.254:10089/plat/api/old/queryorder
+查询余额地址:http://8.129.227.254:10089/plat/api/old/queryBalance
+
+【腾讯文档】增值业务接口文档V2.3  https://docs.qq.com/doc/DWkV1VkxQVk13eEtQ

+ 21 - 0
helper/refill/api/xyz/yonghe/config.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace refill\yonghe;
+
+use mtopcard;
+
+class config
+{
+    const ORDER_URL = 'http://8.129.227.254:10089/plat/api/old/submitorder';
+    const QUERY_URL = 'http://8.129.227.254:10089/plat/api/old/queryorder';
+
+    const USER_ID = '200115';
+    const KEY = '9147cb5fdf3e41699dab66626d1b741c';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_yonghe.php";
+    const operator = [
+        mtopcard\ChinaMobileCard => 1,
+        mtopcard\ChinaUnicomCard => 2,
+        mtopcard\ChinaTelecomCard => 3
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
+}

+ 100 - 0
helper/refill/policy/mgroup.php

@@ -0,0 +1,100 @@
+<?php
+
+//机构指定通道分配
+
+namespace refill;
+
+class mchannel_item
+{
+    private $mMchid;
+    private $mChannelMap;
+    public function __construct($mchid)
+    {
+        $this->mMchid = $mchid;
+        $this->mChannelMap = [];
+    }
+
+    public function add_channel($spec,$card_type,$quality,$chname)
+    {
+        $key = "{$quality}-{$card_type}-{$spec}";
+        if(array_key_exists($key,$this->mChannelMap))
+        {
+            $chanels = $this->mChannelMap[$key];
+            if(!in_array($chname,$chanels)) {
+                $this->mChannelMap[$key][] = $chname;
+            }
+        }
+    }
+    public function find($spec,$card_type,$quality)
+    {
+        $key = "{$quality}-{$card_type}-{$spec}";
+        $chanels = $this->mChannelMap[$key];
+
+        return $chanels;
+    }
+}
+
+class rgroup
+{
+    private $mGroupID;
+    private $mQca2Channels;
+    public function __construct($group_id)
+    {
+        $this->mGroupID = $group_id;
+        $this->load();
+    }
+    private function load()
+    {
+        //加载后形成:quality-card_type-amount: channels 映射成一个数组,而不是单个通道
+        //将信息存储到$mQca2Channels 中
+    }
+
+}
+
+//通道控制
+class rgroup_ctl
+{
+    private $mMch2Channel;
+
+    public function __construct()
+    {
+        $this->load();
+    }
+
+    public function load()
+    {
+        //加载所有的通道组
+        $groups = $this->load_groups();
+        $this->load_merchant($groups);
+    }
+
+    public function find_providers($mchid,$spec,$card_type,$quality)
+    {
+        if (!array_key_exists($mchid,$this->mMch2Channel)) {
+            return [false,[]];
+        }
+        else {
+            $item = $this->mMch2Channel[$mchid];
+            $channels = $item->find($spec,$card_type,$quality);
+            return [true,$channels];
+        }
+    }
+
+    private function load_groups()
+    {
+        $groups = [];
+        //遍历所有的group 表
+        $group_id = 0;
+        $group = new rgroup($group_id);
+        $groups[$group_id] = $group;
+
+        //返回 groupid-> rgroup 的映射数组。
+        return $groups;
+    }
+
+    private function load_merchant($groups)
+    {
+        //查出所有指定了通道的机构,找到分组ids
+        //通过分组ids,在groups 中找到分组信息。
+    }
+}

+ 2 - 2
helper/refill/policy/rlock.php

@@ -71,8 +71,8 @@ class rlock
     public static function clear_all()
     {
         $ins = Cache::getInstance('cacheredis');
-        $ins->hdel(self::sys_storage_name);
-        $ins->hdel(self::mch_storage_name);
+        $ins->hdel(self::sys_storage_name,'');
+        $ins->hdel(self::mch_storage_name,'');
     }
 
     //merchant 总金额分配策略开关,及剩余金额变动和获取

+ 13 - 2
helper/refill/policy/rstorage.php

@@ -1,6 +1,7 @@
 <?php
 
 namespace refill;
+use Log;
 
 class system
 {
@@ -165,20 +166,27 @@ class rstorage
 
     public function allow($mchid,$card_type,$spec) : bool
     {
+        Log::record("rstorage::allow mchid={$mchid} card_type={$card_type} spec={$spec}",Log::DEBUG);
         if(!$this->locked($card_type)) {
+            Log::record("rstorage::allow {$card_type} locked",Log::DEBUG);
             return true;
         }
 
         [$total_lock_type,$spec_lock_type] = $this->merchant_lock_type($mchid,$card_type,$spec);
         $merchant = $this->mMerchants[$mchid];
 
+        Log::record("{$mchid} total_lock:{$total_lock_type} spec_lock:{$spec_lock_type}",Log::DEBUG);
+
         if($spec_lock_type == rlock::ASSIGN) {
-            return $merchant->spec_total($spec) >= $spec;
+            $mch_spec_total = $merchant->spec_total($spec);
+            Log::record("ASSIGN {$mchid} spec_total:{$mch_spec_total}",Log::DEBUG);
+            return $mch_spec_total >= $spec;
         }
         elseif($spec_lock_type == rlock::RETAIN)
         {
             //是否已经满足 Spec
             $mch_spec_total = $merchant->spec_total($card_type);
+            Log::record("ASSIGN {$mchid} spec_total:{$mch_spec_total}",Log::DEBUG);
             if($mch_spec_total >= $spec) return true;
         }
         else {
@@ -197,6 +205,8 @@ class rstorage
         $diff_total = $total - $this->lowest_total($mchid,$card_type);
         $diff_spec_total = $spec_total - $this->lowest_spec_total($mchid,$card_type,$spec);
 
+        Log::record("mchid:{$mchid} total:{$total} spec_total:{$spec_total} diff_total:{$diff_total} diff_spec_total={$diff_spec_total}",Log::DEBUG);
+
         return $diff_spec_total >= $spec && $diff_total >= $spec;
     }
 
@@ -211,7 +221,7 @@ class rstorage
         return $merchant->lock_type($card_type, $spec);
     }
 
-    //需要为锁定的机构保留的最低量
+    //需要为锁定的机构保留的最低
     private function lowest_total($mchid,$card_type)
     {
         $total = 0;
@@ -224,6 +234,7 @@ class rstorage
         return $total;
     }
 
+     //需要为锁定的机构保留的最低总量
     private function lowest_spec_total($mchid,$card_type,$spec)
     {
         $total = 0;

+ 1 - 1
helper/request_helper.php

@@ -279,7 +279,7 @@ class request_helper
 
             $checker = function ($stype)
             {
-                $formtypes = ['application/x-www-form-urlencoded','text/xml','text/html','multipart/form-data'];
+                $formtypes = ['application/x-www-form-urlencoded','text/xml','text/html','multipart/form-data','application/octet-stream'];
                 foreach ($formtypes as $type) {
                     if(self::start_with($stype,$type)) {
                         return true;

+ 4 - 2
helper/session.php

@@ -47,10 +47,12 @@ class session
         $_SESSION['MPHPSESSID'] = $this->sessid;
     }
 
-    public function end()
+    public function end($need_close = true)
     {
         // 会触发write 和 close 函数
-        session_write_close();
+        if($need_close) {
+            session_write_close();
+        }
 
         foreach ($_SESSION as $key => $value) {
             unset($_SESSION[$key]);

+ 1 - 1
helper/statistics/stat_refill.php

@@ -15,7 +15,7 @@ class stat_refill
         $items = $mod_merchant->getMerchantList(['mchid' => ['gt',0]]);
         foreach ($items as $item) {
             $mchid = intval($item['mchid']);
-            $this->mMerchantNames[$mchid] = $item['name'];
+            $this->mMerchantNames[$mchid] = !empty($item['company_name']) ? $item['company_name'] : $item['name'];
         }
 
         $items = Model('')->table('refill_provider,store')

+ 2 - 1
index.php

@@ -2,4 +2,5 @@
 declare(strict_types=0);
 
 $site_url = strtolower('http://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/index.php')).'/shop/index.php');
-include('shop/index.php');
+//include('shop/index.php');
+header('Location: /project/index.html');

+ 3 - 0
mchsrv/config/config.ini.php

@@ -0,0 +1,3 @@
+<?php
+defined('InShopNC') or exit('Access Invalid!');
+

+ 146 - 0
mchsrv/control/merchant.php

@@ -0,0 +1,146 @@
+<?php
+
+
+class merchantControl
+{
+    private $mMchid;
+    private $mAdminid;
+    private $mUseKey;
+    public function __construct()
+    {
+        $mchid = $_POST['mchid'];
+        $mchinfo = Model('merchant')->getMerchantInfo(['mchid' => $mchid]);
+        if(empty($mchinfo)) {
+            throw new Exception("合作方ID:{$mchid}不存在");
+        }
+        else {
+            $this->mAdminid = intval($mchinfo['admin_id']);
+        }
+
+        if ($mchinfo['merchant_state'] != 1) {
+            throw new Exception("机构已被关闭。");
+        }
+
+        $ips = unserialize($mchinfo['ip_white_list']);
+
+        if(!empty($ips)) {
+            $addr = $_SERVER['REMOTE_ADDR'];
+            Log::record("request ip:{$addr}",Log::DEBUG);
+
+            if(!in_array($addr,$ips)) {
+                throw new Exception("请求地址不在白名单中");
+            }
+        }
+
+        $this->mUseKey = intval($mchinfo['use_key']);
+        if($this->mUseKey && !$this->verify_md5($mchinfo['secure_key'])) {
+            throw new UnSignException();
+        }
+
+        $this->mMchid = intval($mchid);
+    }
+
+    public function mchid() : int
+    {
+        return $this->mMchid;
+    }
+    public function adminid() : int {
+        return $this->mAdminid;
+    }
+
+    private function pubKey($mchid)
+    {
+        static $pubs = [];
+
+        if(array_key_exists($mchid,$pubs)) {
+            return $pubs[$mchid];
+        }
+        else {
+            $pub_key = BASE_DATA_PATH . "/api/merchant/key/{$mchid}_pub.pem";
+            $key = file_get_contents($pub_key);
+            $pub = openssl_get_publickey($key);
+            $pubs[$mchid] = $pub;
+            return $pub;
+        }
+    }
+
+    private function verify_md5($key)
+    {
+        $input = $_GET;
+        $sign = $input['sign'];
+
+        $input['sign'] = null;
+        $input['from'] = null;
+
+        $body = $this->sign_body($input);
+
+        if($this->mUseKey) {
+            $body .= "&key={$key}";
+        }
+
+        return ($sign == md5($body));
+    }
+
+    private function verify_rsa($mchid)
+    {
+        $pub = $this->pubKey($mchid);
+        if(empty($pub)) {
+            return false;
+        }
+        $input = $_GET;
+        $sign = $input['sign'];
+        $input['sign'] = null;
+        $input['from'] = null;
+
+        $data = $this->sign_body($input);
+        $res = openssl_verify($data,base64_decode($sign),$pub);
+        Log::record("openssl_verify res={$res}",Log::DEBUG);
+
+        return ($res == 1);
+    }
+
+    protected function check_empty($value)
+    {
+        if (!isset($value))
+            return true;
+        if ($value === null)
+            return true;
+        if (trim($value) === "")
+            return true;
+
+        return false;
+    }
+
+    private function sign_body($params)
+    {
+        ksort($params);
+
+        $content = "";
+        $i = 0;
+        foreach ($params as $k => $v)
+        {
+            if (false === $this->check_empty($v) && "@" != substr($v, 0, 1))
+            {
+                if ($i == 0) {
+                    $content .= "{$k}" . "=" . urlencode($v);
+                } else {
+                    $content .= "&" . "{$k}" . "=" . urlencode($v);
+                }
+                $i++;
+            }
+        }
+
+        return $content;
+    }
+
+    public static function outsuccess($data)
+    {
+        joutput_data($data);
+        return true;
+    }
+    public static function outerr($code, $msg = '')
+    {
+        joutput_error($code, $msg);
+        return true;
+    }
+}

+ 7 - 0
mchsrv/control/merchant_admin.php

@@ -0,0 +1,7 @@
+<?php
+
+
+class merchant_admin
+{
+
+}

+ 559 - 0
mchsrv/control/merchant_info.php

@@ -0,0 +1,559 @@
+<?php
+require_once(BASE_ROOT_PATH . '/mobile/control/merchantweb.php');
+
+class merchant_infoControl extends mbMerchantControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    public function indexOp()
+    {
+        $mchid = $this->mchid();
+        $model_merchant = Model('merchant');
+        $field = 'mchid,admin_id,name,alarm_amount,ip_white_list,use_key,contact_name,contact_phone,warning_phone,company_name,quality,time_out,credit_bonus';
+        $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid], $field);
+        $model_member = Model('member');
+        $member_info = $model_member->getMemberInfo(['member_id' => $merchant_info['admin_id']], 'available_predeposit');
+        if (empty($member_info)) {
+            $member_info['available_predeposit'] = 0;
+        }
+        if(!empty($merchant_info['credit_bonus'])) {
+            $member_info['available_predeposit'] = ncPriceFormat($member_info['available_predeposit'] - $member_info['credit_bonus']);
+        }
+        $merchant_info['member'] = $member_info;
+
+        if (empty($merchant_info['ip_white_list'])) {
+            $merchant_info['ips'] = [];
+        } else {
+            $merchant_info['ips'] = unserialize($merchant_info['ip_white_list']);
+        }
+        if (empty($merchant_info['warning_phone'])) {
+            $merchant_info['warning_phone'] = [];
+        } else {
+            $merchant_info['warning_phone'] = unserialize($merchant_info['warning_phone']);
+        }
+
+        $cond['status'] = $cond['is_operation'] = 2;
+        $cond['mchid'] = $mchid;
+        $stats = Model('')->table('refill_evidence')
+            ->field('sum(amount) as amounts')
+            ->where($cond)->select();
+        $merchant_info['evidence_amounts'] = empty($stats) ? 0 : $stats[0]['amounts'];
+        $cond['add_time'] = ['between', [strtotime(date("Y-m-d",time())), time()]];
+        $day_evidence = $model_merchant->getRefillEvidence($cond);
+        $merchant_info['evidence_count'] = count($day_evidence);
+        $merchant_info['time_out'] = intval($merchant_info['time_out'] / 60);
+        $merchant_info['quality'] = intval($merchant_info['quality']);
+
+        $pub = new message\publisher();
+        $pub->modify_refill_merchant();
+
+        return self::outsuccess($merchant_info);
+    }
+
+    public function SetQualityTimeOutOp()
+    {
+        $mchid = $this->mchid();
+        $save = [];
+        $quality = intval($_POST['quality']);
+        if($quality > 0) {
+            if(!in_array($quality , [1,2,3])) {
+                return self::outerr(errcode::ErrParamter, "通道质量类型错误");
+            }
+            $save['quality'] = $quality;
+        }
+        $time_out = intval($_POST['time_out']);
+        if($quality > 0) {
+            if($time_out <3) {
+                return self::outerr(errcode::ErrParamter, "超时时间应大于3分钟");
+            }
+            $time_out = intval($time_out * 60);
+            $save['time_out'] = $time_out;
+        }
+        if(empty($save)) {
+            return self::outsuccess([]);
+        }
+        $model_merchant = Model('merchant');
+        $resp = $model_merchant->editMerchant($save, ['mchid' => $mchid]);
+        if($resp) {
+            return self::outsuccess([]);
+        }else{
+            return self::outerr(errcode::ErrOperation, "系统错误.");
+        }
+    }
+
+    public function homeOp()
+    {
+        $mchid = $this->mchid();
+        $model_merchant = Model('merchant');
+        $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid], 'mchid,admin_id,name,company_name');
+        $model_member = Model('member');
+        $member_info = $model_member->getMemberInfo(['member_id' => $merchant_info['admin_id']], 'available_predeposit');
+        if (empty($member_info)) {
+            $merchant_info['available_predeposit'] = 0;
+        } else {
+            $merchant_info['available_predeposit'] = ncPriceFormat($member_info['available_predeposit']);
+        }
+
+        $statistics = $this->statistics();
+        ksort($statistics);
+        $result['merchant_info'] = $merchant_info;
+        $result['todayStatistics'] = $statistics[strtotime(date("Y-m-d",time()))];
+        $result['weeksStatistics'] = $statistics;
+        $max = 0;
+        foreach ($statistics as $key => $val){
+            if($max == 0){
+                $max = $val['successAmounts'];
+
+            }
+            if($max < $val['count']){
+                $max = $val['successAmounts'];
+            }
+        }
+        $result['max'] = ncPriceFormat(ceil($max * 1.1));
+        $week_month_stats = $this->refillStats();
+        $result['month'] = $week_month_stats['month'];
+        $result['week'] = $week_month_stats['week'];
+        return self::outsuccess($result);
+    }
+
+    private function statistics()
+    {
+        $date = date('Y-m-d',time());
+        $today = strtotime("{$date}");
+
+        $times_begin = function ($start) {
+            $times = [];
+            $begin = $start;
+            for($i = 0; $i < 7; $i++) {
+                $times[] = $begin;
+                $begin -= 86400;
+            }
+            return $times;
+        };
+
+        $reader = function ($mchid,$time) {
+            $cond['mchid'] = $mchid;
+            $cond['inner_status'] = 0;
+            $cond['refill_order.order_time'] = ['between', [$time, $time + 86400 -1]];
+
+            $items = Model('')->table('refill_order,vr_order')->join('inner')
+                ->on('refill_order.order_id=vr_order.order_id')
+                ->field('count(*) as order_count, vr_order.order_state, sum(mch_amount) as mch_amounts')
+                ->group('order_state')
+                ->where($cond)->select();
+
+            return $this->refillCountDispose($items);
+        };
+
+        $begins = $times_begin($today);
+
+        $states = rcache($this->mchid() , 'refillstat-');
+
+        if(empty($states)){
+            $states = [];
+        }else{
+            $states = unserialize($states['data']);
+        }
+        $result = [];
+        $cache = [];
+        foreach ($begins as $begin)
+        {
+            if(array_key_exists($begin,$states)) {
+                $item = $states[$begin];
+            }
+            else {
+                $item = $reader($this->mchid(),$begin);
+            }
+            $result[$begin] = $item;
+
+            //判断item 中充值中的状态是否为0,为0且不是今天的情况下放进cache
+            if($item['sendCount'] == 0 && $begin != $today){
+                $cache[$begin] = $item;
+            }
+        }
+        if(!empty($cache) && !$this->isSame($states,$cache)) {
+            wcache($this->mchid() ,['data' => serialize($cache)], 'refillstat-');
+        }
+
+        return $result;
+    }
+
+    private function isSame($arr1, $arr2)
+    {
+        ksort($arr1);
+        ksort($arr2);
+        return $arr1 == $arr2;
+    }
+
+    private function refillCountDispose($stats)
+    {
+        $result['count'] = $result['sendCount'] = $result['errorCount'] = $result['successCount'] = $result['amountCount'] = $result['errorAmounts'] = $result['successAmounts'] = 0;
+        foreach ($stats as $count) {
+            $result['count'] += $count['order_count'];
+            $result['amountCount'] += ncPriceFormat($count['mch_amounts']);
+            if($count['order_state'] == ORDER_STATE_SEND) {
+                $result['sendCount'] = $count['order_count'];
+            }
+            if($count['order_state'] == ORDER_STATE_CANCEL) {
+                $result['errorCount'] = $count['order_count'];
+                $result['errorAmounts'] = ncPriceFormat($count['mch_amounts']);
+            }
+            if($count['order_state'] == ORDER_STATE_SUCCESS) {
+                $result['successCount'] = $count['order_count'];
+                $result['successAmounts'] = ncPriceFormat($count['mch_amounts']);
+            }
+        }
+        $result['amountCount'] = ncPriceFormat($result['amountCount']);
+        $result['errorAmounts'] = ncPriceFormat($result['errorAmounts']);
+        $result['successAmounts'] = ncPriceFormat($result['successAmounts']);
+        return $result;
+    }
+
+    private function refillStats()
+    {
+        $reader = function ($mchid,$time,$end_time) {
+            $cond['mchid'] = $mchid;
+            $cond['inner_status'] = 0;
+            $cond['refill_order.order_time'] = ['between', [$time, $end_time]];
+
+            $items = Model('')->table('refill_order,vr_order')->join('inner')
+                ->on('refill_order.order_id=vr_order.order_id')
+                ->field('count(*) as order_count, vr_order.order_state, sum(mch_amount) as mch_amounts')
+                ->group('order_state')
+                ->where($cond)->select();
+
+            return $this->refillCountDispose($items);
+        };
+        $date = date("Y-m-d");
+        $first = 1;
+        $w = date('w',strtotime($date));
+        $week_start = strtotime(date('Y-m-d',strtotime("$date -".($w ? $w - $first : 6).' days')));
+        $w = 7 - $w + 1;
+        $week_end = strtotime(date('Y-m-d',strtotime("+{$w} days"))) - 1;
+        $week = $reader($this->mchid(), $week_start,$week_end);
+
+        $month_start = strtotime(date("Y-m-1"));
+        $month_end = strtotime(date("Y-m-1",strtotime("+1month")))-1;
+        $month = $reader($this->mchid(), $month_start, $month_end);
+
+        return ['week' => $week , 'month' => $month];
+    }
+
+    public function addipOp()
+    {
+        $mchid = $this->mchid();
+        $ip = $_POST['ip'];
+        if (empty($ip)) {
+            return self::outerr(errcode::ErrParamter, "参数错误");
+        }
+        $ip = trim($ip);
+        if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))
+        {
+            $model_merchant = Model('merchant');
+            $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid]);
+            if (empty($merchant_info['ip_white_list'])) {
+                $ips = [];
+            } else {
+                $ips = unserialize($merchant_info['ip_white_list']);
+            }
+
+            $ips[] = $ip;
+            $ips = array_unique($ips);
+
+            $model_merchant->editMerchant(['ip_white_list' => serialize($ips)], ['mchid' => $merchant_info['mchid']]);
+            return self::outsuccess([]);
+        } else {
+            return self::outerr(errcode::ErrParamter, "ip地址错误");
+        }
+    }
+
+    public function ipdelOp()
+    {
+        $mchid = $this->mchid();
+        $ip = $_POST['ip'];
+        if (empty($ip)) {
+            return self::outerr(errcode::ErrParamter, "参数错误");
+        }
+        $ip = trim($ip);
+        $model_merchant = Model('merchant');
+        $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid]);
+        $ips = unserialize($merchant_info['ip_white_list']);
+        $new_ips = [];
+        foreach ($ips as $value) {
+            if ($value != $ip) {
+                $new_ips[] = $value;
+            }
+        }
+        if (empty($new_ips)) {
+            $new_ips = '';
+        } else {
+            $new_ips = serialize($new_ips);
+        }
+        $model_merchant->editMerchant(['ip_white_list' => $new_ips], ['mchid' => $merchant_info['mchid']]);
+        return self::outsuccess([]);
+    }
+
+    public function setcontactOp(){
+        $mchid = $this->mchid();
+        if(!empty($_POST['contact_name']))
+        {
+            $params['contact_name'] = trim($_POST['contact_name']);
+        }
+        if(!empty($_POST['contact_phone']))
+        {
+            $params['contact_phone'] = trim($_POST['contact_phone']);
+        }
+        if(!empty($_POST['alarm_amount']))
+        {
+            $params['alarm_amount'] = trim($_POST['alarm_amount']);
+        }
+        if(empty($params))
+        {
+            return self::outsuccess([]);
+        }
+        $model_merchant = Model('merchant');
+        $ret = $model_merchant->editMerchant($params, ['mchid' => $mchid]);
+        if ($ret) {
+            return self::outsuccess([]);
+        } else {
+            return self::outerr(errcode::ErrOperation, "系统错误.");
+        }
+    }
+
+    public function addwphoneOp()
+    {
+        $mchid = $this->mchid();
+        $phone = $_POST['phone'];
+        if (empty($phone)) {
+            return self::outerr(errcode::ErrParamter, "参数错误");
+        }
+        $phone = explode(',' ,trim($phone));
+        $model_merchant = Model('merchant');
+        $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid]);
+        if (empty($merchant_info['warning_phone'])) {
+            $phones = [];
+        } else {
+            $phones = unserialize($merchant_info['warning_phone']);
+        }
+        foreach ($phone as $item) {
+            $phones[] = $item;
+        }
+        $phones = array_unique($phones);
+        $model_merchant->editMerchant(['warning_phone' => serialize($phones)], ['mchid' => $merchant_info['mchid']]);
+        return self::outsuccess([]);
+    }
+
+    public function wphonedelOp()
+    {
+        $mchid = $this->mchid();
+        $phone = $_POST['phone'];
+        if (empty($phone)) {
+            return self::outerr(errcode::ErrParamter, "参数错误");
+        }
+        $phone = trim($phone);
+        $model_merchant = Model('merchant');
+        $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid]);
+        $phones = unserialize($merchant_info['warning_phone']);
+        $new_phones = [];
+        foreach ($phones as $value) {
+            if ($value != $phone) {
+                $new_phones[] = $value;
+            }
+        }
+        if (empty($new_phones)) {
+            $new_phones = '';
+        } else {
+            $new_phones = serialize($new_phones);
+        }
+        $model_merchant->editMerchant(['warning_phone' => $new_phones], ['mchid' => $merchant_info['mchid']]);
+        return self::outsuccess([]);
+    }
+
+    public function setkeyOp()
+    {
+        $mchid = $this->mchid();
+        $secure_key = $_POST['secure_key'];
+        if (empty($secure_key)) {
+            return self::outerr(errcode::ErrParamter, "参数错误");
+        }
+        $model_merchant = Model('merchant');
+        $ret = $model_merchant->editMerchant(['secure_key' => $secure_key, 'use_key' => 1], ['mchid' => $mchid]);
+        if ($ret) {
+            return self::outsuccess([]);
+        } else {
+            return self::outerr(errcode::ErrOperation, "系统错误.");
+        }
+    }
+
+    public function modifypwOp()
+    {
+        $mchid = $this->mchid();
+        $new_pw = $_POST['new_pw'];
+        $new_pw2 = $_POST['new_pw2'];
+        if (trim($new_pw) !== trim($new_pw2)) {
+            return self::outerr(errcode::ErrPasswd, "密码错误");
+        }
+        $model_merchant = Model('merchant');
+        $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid]);
+        if (!$merchant_info) {
+            return self::outerr(errcode::ErrMemberNotExist, "用户不存在.");
+        }
+        $pwd = trim($new_pw);
+        if (md5($pwd) == $merchant_info['password']) {
+            return self::outsuccess([]);
+        }
+        $ret = $model_merchant->editMerchant(['password' => md5($pwd), 'org_pwd' => $pwd], ['mchid' => $merchant_info['mchid']]);
+        if ($ret) {
+            return self::outsuccess([]);
+        } else {
+            return self::outerr(errcode::ErrOperation, "系统错误.");
+        }
+    }
+
+    public function pdlogOp()
+    {
+        $mchid = $this->mchid();
+        $model_merchant = Model('merchant');
+        $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid]);
+        if (!$merchant_info) {
+            return self::outerr(errcode::ErrMemberNotExist, "用户不存在.");
+        }
+        $model_pd = Model('merchant');
+        if (empty($merchant_info['admin_id'])) {
+            $result['data'] = [];
+            $result['total'] = 0;
+            return self::outsuccess($result);
+        }
+        $cond['lg_member_id'] = $merchant_info['admin_id'];
+        if (!empty($_GET['lg_type'])) {
+            $cond['lg_type'] = $_GET['lg_type'];
+        }
+        if ($_GET['start_time'] && $_GET['end_time']) {
+            $cond['lg_add_time'] = ['between', [$_GET['start_time'], $_GET['end_time']]];
+        }
+        $list = $model_pd->getPdlog($cond, $this->page, '*', 'lg_id desc');
+        $list = $this->PdLogFormat($list);
+        $result['data'] = $list;
+        $result['total'] = $model_pd->gettotalpage();
+        return self::outsuccess($result);
+    }
+
+    private function PdLogFormat($pdlog)
+    {
+        $data = [];
+        foreach ($pdlog as $key => $value) {
+            if (isset($value['lg_add_time'])) {
+                $value['lg_add_time'] = date('Y-m-d H:i:s', $value['lg_add_time']);
+            }
+            switch ($value['lg_type']) {
+                case 'order_pay':
+                    $value['lg_type_text'] = '下单减款';
+                    break;
+                case 'order_cancel':
+                    $value['lg_type_text'] = '下单失败返回余款';
+                    break;
+                case 'recharge':
+                    $value['lg_type_text'] = '余款充值';
+                    break;
+                case 'sys_add_money':
+                    $value['lg_type_text'] = '管理员调节预存款【增加】';
+                    break;
+                case 'sys_del_money':
+                    $value['lg_type_text'] = '管理员调节预存款【减少】';
+                    break;
+                case 'sys_freeze_money':
+                    $value['lg_type_text'] = '管理员调节预存款【冻结】';
+                    break;
+                case 'sys_unfreeze_money':
+                    $value['lg_type_text'] = '管理员调节预存款【解冻】';
+                    break;
+                default:
+                    $value['lg_type_text'] = 'unknown';
+                    break;
+            }
+            $data[] = $value;
+        }
+        return $data;
+    }
+
+    public function pdlogexportOp()
+    {
+        $mchid = $this->mchid();
+        $model_merchant = Model('merchant');
+        $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid]);
+        if (!$merchant_info) {
+            return self::outerr(errcode::ErrMemberNotExist, "用户不存在.");
+        }
+
+
+        $condition['lg_member_id'] = $merchant_info['admin_id'];
+        if (!empty($_GET['lg_type'])) {
+            $condition['lg_type'] = $_GET['lg_type'];
+        }
+        if ($_GET['start_time'] && $_GET['end_time']) {
+            $condition['lg_add_time'] = ['between', [$_GET['start_time'], $_GET['end_time']]];
+        }
+        $list = Model('')->table('pd_log,refill_order')->join('left')
+            ->on('pd_log.lg_order_sn=refill_order.order_sn')
+            ->field('pd_log.lg_type,pd_log.lg_av_amount,pd_log.lg_add_time,refill_order.card_no,refill_order.mchid,refill_order.card_type,pd_log.lg_available,refill_order.refill_amount')
+            ->where($condition)->select();
+        $result = $this->export_pdlog_exec($list);
+        return self::outsuccess($result);
+    }
+
+    private function export_pdlog_exec($list)
+    {
+        $title = [
+            ['value' => '代理商账号'],
+            ['value' => '金额'],
+            ['value' => '账户余额'],
+            ['value' => '交易日期'],
+            ['value' => '类型'],
+            ['value' => '备注']
+        ];
+        $mchid = $this->mchid();
+        $card_type = ['1'=>'中石油' , '2' =>'中石化' , '4' => '移动' , '5' => '联通' , '6' => '电信'];
+        foreach ($list as $value) {
+            if (isset($value['lg_add_time'])) {
+                $value['lg_add_time'] = date('Y-m-d H:i:s', $value['lg_add_time']);
+            }
+            switch ($value['lg_type']) {
+                case 'order_pay':
+                    $value['lg_type_text'] = '消费';
+                    break;
+                case 'order_cancel':
+                    $value['lg_type_text'] = '退款';
+                    break;
+                case 'recharge':
+                    $value['lg_type_text'] = '充值';
+                    break;
+                case 'sys_add_money':
+                    $value['lg_type_text'] = '管理员充值【增加】';
+                    break;
+                case 'sys_del_money':
+                    $value['lg_type_text'] = '管理员减款';
+                    break;
+                default:
+                    $value['lg_type_text'] = '';
+                    break;
+            }
+            $data = [];
+            $str = "{$value['card_no']}-{$card_type[$value['card_type']]}{$value['refill_amount']}元";
+            if(empty($value['card_no']) || empty($value['card_type']) || empty($value['refill_amount'])) {
+                $str = '';
+            }
+            $data[] = ['value' => $mchid];
+            $data[] = ['value' => $value['lg_av_amount']];
+            $data[] = ['value' => ncPriceFormat($value['lg_available'] + $value['lg_av_amount'])];
+            $data[] = ['value' => $value['lg_add_time']];
+            $data[] = ['value' => $value['lg_type_text']];
+            $data[] = ['value' => $str];
+            $datas[] = $data;
+        }
+        Log::record(json_encode($datas),Log::DEBUG);
+        return ['title' => $title , 'data' => $datas];
+    }
+}

+ 54 - 0
mchsrv/control/merchant_login.php

@@ -0,0 +1,54 @@
+<?php
+
+require_once(BASE_ROOT_PATH . '/mobile/control/merchantweb.php');
+
+//商户后台登录
+class merchant_loginControl extends merchantwebControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    public function loginOp()
+    {
+        $name = $_POST['name'];
+        $pwd = md5($_POST['password']);
+        $model_merchant = Model('merchant');
+
+        $mch_info = $model_merchant->getMerchantInfo(['name' => $name], '*');
+        if (!empty($mch_info)) {
+            if ($mch_info['password'] != $pwd) {
+                return self::outerr(errcode::ErrPasswd, "密码错误");
+            }
+            if ($mch_info['merchant_state'] != 1) {
+                return self::outerr(errcode::ErrAccountStop, "机构已被关闭,无法登录。");
+            }
+
+            $client_ip = $_SERVER['REMOTE_ADDR'];
+            $model_merchant->editMerchant(['last_login_time' => time(), 'last_login_ip' => $client_ip], ['mchid' => $mch_info['mchid']]);
+
+            $model_member = Model('member');
+            $member_info = $model_member->getMemberInfo(['member_id' => $mch_info['admin_id']], 'available_predeposit');
+
+            $mch_info['member'] = $member_info;
+            if (empty($mch_info['ip_white_list'])) {
+                $mch_info['ips'] = [];
+            } else {
+                $mch_info['ips'] = unserialize($mch_info['ip_white_list']);
+            }
+            $_SESSION['mchid'] = $mch_info['mchid'];
+            $_SESSION['member_id'] = $mch_info['admin_id'];
+
+            return self::outsuccess([]);
+        } else {
+            return self::outerr(errcode::ErrMemberNotExist, "用户不存在.");
+        }
+    }
+
+    public function logoutOp()
+    {
+        setNcCookie('MPHPSESSID', 0, -3600);
+        return self::outsuccess([]);
+    }
+}

+ 287 - 0
mchsrv/control/merchant_order.php

@@ -0,0 +1,287 @@
+<?php
+require_once(BASE_ROOT_PATH . '/mobile/control/merchantweb.php');
+
+class merchant_orderControl extends mbMerchantControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    public function listOp()
+    {
+        $model_vr_order = Model('refill_order');
+
+        $cond['mchid'] = $this->mchid();
+        $cond['inner_status'] = 0;
+        if (!empty($_GET['card_type'])) {
+            if(in_array($_GET['card_type'] , ['1' , '2' , '4' , '5' , '6'])) {
+                $cond['refill_order.card_type'] = $_GET['card_type'];
+            }
+            if($_GET['card_type'] == 'oil') {
+                $cond['refill_order.card_type'] = ['in' , ['1' , '2']];
+            }
+            if($_GET['card_type'] == 'phone') {
+                $cond['refill_order.card_type'] = ['in' , ['4' , '5' , '6']];
+            }
+        }
+        if (!empty($_GET['card_no'])) {
+            $cond['refill_order.card_no'] = $_GET['card_no'];
+        }
+        if (!empty($_GET['refill_amount'])) {
+            $cond['refill_order.refill_amount'] = $_GET['refill_amount'];
+        }
+        if (!empty($_GET['mch_order'])) {
+            $cond['refill_order.mch_order'] = $_GET['mch_order'];
+        }
+        if (!empty($_GET['order_sn'])) {
+            $cond['refill_order.order_sn'] = $_GET['order_sn'];
+        }
+        if (in_array($_GET['order_state'], array('0', '30', '40'))) {
+            $cond['vr_order.order_state'] = $_GET['order_state'];
+            if($_GET['order_state'] == 30 && $_GET['time'] == 1){
+                $cond['refill_order.order_time'] = ['lt', (time() - 3600)];
+            }
+        }
+        if ($_GET['start_time'] > 0 && $_GET['end_time'] > 0) {
+            $cond['refill_order.order_time'] = ['between', [$_GET['start_time'], $_GET['end_time']]];
+        }
+        $fields = 'refill_order.*,vr_order.order_state';
+        $order_list = $model_vr_order->getMerchantOrderList($cond, $this->page, $fields, 'refill_order.order_id desc');
+        $order_list = $this->merchant_order_format($order_list);
+        $result['data'] = $order_list;
+        $result['total'] = $model_vr_order->gettotalpage();
+        return self::outsuccess($result);
+    }
+
+    public function OrderStatsOp()
+    {
+        if(empty($_GET['time_type']) || empty($_GET['start_time']) || empty($_GET['end_time'])) {
+            return self::outerr(errcode::ErrInputParam, "参数错误.");
+        }
+        $cond['inner_status'] = 0;
+        $time_type = $_GET['time_type'];
+        if ($time_type == 'order_time') {
+            $cond['order_time'] = ['time', [$_GET['start_time'], $_GET['end_time']]];
+        }
+        if ($time_type == 'notify_time') {
+            $cond['notify_time'] = ['time', [$_GET['start_time'], $_GET['end_time']]];
+        }
+        if(empty($cond)) {
+            return self::outerr(errcode::ErrInputParam, "筛选日期类型错误.");
+        }
+        $cond['mchid'] = $this->mchid();
+        $stats = Model('')->table('refill_order,vr_order')->join('inner')
+            ->on('refill_order.order_id=vr_order.order_id')
+            ->field('count(*) as order_count ,sum(refill_amount) as refill_amounts, sum(mch_amount) as mch_amounts, order_state')
+            ->where($cond)->group('order_state')->select();
+
+        $result['count'] = $result['sendCount'] = $result['errorCount'] = $result['successCount'] = $result['refill_amounts'] = $result['mch_amounts'] = 0;
+        foreach ($stats as $stat) {
+            $result['count'] += $stat['order_count'];
+            if($stat['order_state'] == ORDER_STATE_SEND) {
+                $result['sendCount'] = $stat['order_count'];
+            }
+            if($stat['order_state'] == ORDER_STATE_CANCEL) {
+                $result['errorCount'] = $stat['order_count'];
+            }
+            if($stat['order_state'] == ORDER_STATE_SUCCESS) {
+                $result['successCount'] = $stat['order_count'];
+                $result['mch_amounts'] = $stat['mch_amounts'];
+                $result['refill_amounts'] = $stat['refill_amounts'];
+            }
+        }
+        return self::outsuccess($result);
+    }
+
+    private function merchant_order_format($orders)
+    {
+        $data = [];
+        foreach ($orders as $order) {
+            if($order['notify_time'] > 0)
+            {
+                $order['diff_time_text'] = $this->elapse_time($order['notify_time'] - $order['order_time']);
+                $order['diff_time'] = $order['notify_time'] - $order['order_time'];
+            }
+            else
+            {
+                $order['diff_time_text'] = $this->elapse_time(time() - $order['order_time']);
+                $order['diff_time'] = time() - $order['order_time'];
+            }
+            if (isset($order['order_time'])) {
+                $order['order_time'] = date('Y-m-d H:i:s', $order['order_time']);
+            }
+            if (isset($order['notify_time'])) {
+                $order['notify_time'] = date('Y-m-d H:i:s', $order['notify_time']);
+            }
+            if($order['is_retrying'] == 1) {
+                $order['order_state'] = ORDER_STATE_SEND;
+            }
+            if ($order['order_state'] == ORDER_STATE_NEW || $order['order_state'] == ORDER_STATE_PAY) {
+                $order['order_state'] = ORDER_STATE_SEND;
+            }
+            $order['order_state_text'] = $this->_orderState($order['order_state']);
+            $order['card_type_name'] = $this->scard_type($order['card_type']);
+            $data[] = $order;
+        }
+        return $data;
+    }
+
+    /**
+     * 取得订单状态文字输出形式
+     *
+     * @param int $order_state 订单数组
+     * @return string
+     */
+    private function _orderState($order_state)
+    {
+        switch ($order_state) {
+            case ORDER_STATE_CANCEL:
+                $text = '已取消';
+                break;
+            case ORDER_STATE_NEW:
+                $text = '新订单';
+                break;
+            case ORDER_STATE_SEND:
+                $text = '充值中';
+                break;
+            case ORDER_STATE_PAY:
+                $text = '支付成功';
+                break;
+            case ORDER_STATE_SUCCESS:
+                $text = '充值成功';
+                break;
+            case 'retrying':
+                $text = '重试中';
+                break;
+            default:
+                $text = '未知状态';
+        }
+        return $text;
+    }
+
+    private function scard_type(int $card_type)
+    {
+        if ($card_type == mtopcard\PetroChinaCard) { //中石油
+            return '中石油';
+        } elseif ($card_type == mtopcard\SinopecCard) { //中石化
+            return '中石化';
+        } elseif ($card_type == mtopcard\ChinaMobileCard) { //中国移动
+            return '中国移动';
+        } elseif ($card_type == mtopcard\ChinaUnicomCard) { //中国联通
+            return '中国联通';
+        } elseif ($card_type == mtopcard\ChinaTelecomCard) { //中国电信
+            return '中国电信';
+        } else {
+            return 'unknown';
+        }
+    }
+
+    private function elapse_time($seconds)
+    {
+        $minutes = intval($seconds / 60);
+        $second = intval($seconds % 60);
+        if($minutes >= 60) {
+            $minute = $minutes % 60;
+            $hours = intval($minutes / 60);
+            $result = "{$minute}:{$second}";
+        }
+        else {
+            if($minutes > 0){
+                $result = "{$minutes}:{$second}";
+            }else{
+                $result = "{$second}";
+            }
+        }
+        if(isset($hours))
+        {
+            $result = "{$hours}:" . $result;
+        }
+        return $result;
+    }
+
+    public function OrderExportOp()
+    {
+        $model_vr_order = Model('refill_order');
+
+        $cond['mchid'] = $this->mchid();
+        $cond['inner_status'] = 0;
+        if (!empty($_GET['card_type'])) {
+            if(in_array($_GET['card_type'] , ['1' , '2' , '4' , '5' , '6'])) {
+                $cond['refill_order.card_type'] = $_GET['card_type'];
+            }
+            if($_GET['card_type'] == 'oil') {
+                $cond['refill_order.card_type'] = ['in' , ['1' , '2']];
+            }
+            if($_GET['card_type'] == 'phone') {
+                $cond['refill_order.card_type'] = ['in' , ['4' , '5' , '6']];
+            }
+        }
+        if (!empty($_GET['card_no'])) {
+            $cond['refill_order.card_no'] = $_GET['card_no'];
+        }
+        if (!empty($_GET['refill_amount'])) {
+            $cond['refill_order.refill_amount'] = $_GET['refill_amount'];
+        }
+        if (!empty($_GET['mch_order'])) {
+            $cond['refill_order.mch_order'] = $_GET['mch_order'];
+        }
+        if (!empty($_GET['order_sn'])) {
+            $cond['refill_order.order_sn'] = $_GET['order_sn'];
+        }
+        if (in_array($_GET['order_state'], array('0', '30', '40'))) {
+            $cond['vr_order.order_state'] = $_GET['order_state'];
+            if($_GET['order_state'] == 30 && $_GET['time'] == 1){
+                $cond['refill_order.order_time'] = ['lt', (time() - 3600)];
+            }
+        }
+        if ($_GET['start_time'] > 0 && $_GET['end_time'] > 0) {
+            $cond['refill_order.order_time'] = ['time', [$_GET['start_time'], $_GET['end_time']]];
+        }
+        $fields = 'refill_order.*,vr_order.order_state';
+        $order_list = $model_vr_order->getMerchantOrderList($cond, '10000', $fields, 'refill_order.order_id desc');
+        $order_list = $this->merchant_order_format($order_list);
+
+        $result = $this->export_order_exec($order_list);
+        return self::outsuccess($result);
+    }
+
+    private function export_order_exec($order_list)
+    {
+        $title = [
+            ['value' => '代理商账号'],
+            ['value' => '商品名称'],
+            ['value' => '交易账号'],
+            ['value' => '交易金额'],
+            ['value' => '交易面值'],
+            ['value' => '交易日期'],
+            ['value' => '交易状态'],
+            ['value' => '处理时间'],
+            ['value' => '第三方流水']
+        ];
+        $card_type = ['1'=>'中石油' , '2' =>'中石化' , '4' => '移动' , '5' => '联通' , '6' => '电信'];
+        foreach ($order_list as $order) {
+            $data = [];
+            $official_sn = $order['official_sn'];
+            $notify_time = $order['$notify_time'];
+            if(empty($order['official_sn'])) {
+                $official_sn = '';
+            }
+            if(empty($order['$notify_time'])) {
+                $notify_time = '';
+            }
+            $data[] = ['value' => $order['mchid']];
+            $data[] = ['value' => "{$card_type[$order['card_type']]}{$order['refill_amount']}元"];
+            $data[] = ['value' => $order['card_no']];
+            $data[] = ['value' => $order['mch_amount']];
+            $data[] = ['value' => $order['refill_amount']];
+            $data[] = ['value' => $order['order_time']];
+            $data[] = ['value' => $order['order_state_text']];
+            $data[] = ['value' => $notify_time];
+            $data[] = ['value' => $official_sn];
+            $datas[] = $data;
+        }
+        Log::record(json_encode($datas),Log::DEBUG);
+        return ['title' => $title , 'data' => $datas];
+    }
+}

+ 132 - 0
mchsrv/control/merchant_refill.php

@@ -0,0 +1,132 @@
+<?php
+
+require_once(BASE_ROOT_PATH . '/mobile/control/merchantweb.php');
+require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
+require_once(BASE_HELPER_PATH . '/mtopcard/mtopcard.php');
+
+class merchant_refillControl extends mbMerchantControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    public function goodsOp()
+    {
+        $goods = refill\RefillFactory::instance()->goods();
+
+        $result['oil_amount'] = [];
+        $result['phone_amount'] = [];
+        foreach ($goods as $type => $specs)
+        {
+            if($type == mtopcard\SinopecCard || $type == mtopcard\PetroChinaCard) {
+                foreach ($specs as $spec) {
+                    $result['oil_amount'][] = $spec;
+                }
+            }
+            else {
+                foreach ($specs as $spec) {
+                    $result['phone_amount'][] = $spec;
+                }
+            }
+        }
+
+        $oil_amount = array_unique($result['oil_amount']);
+        sort($oil_amount);
+        $phone_amount = array_unique($result['phone_amount']);
+        sort($phone_amount);
+
+        return self::outsuccess(['oil_amount' => $oil_amount,'phone_amount' => $phone_amount]);
+    }
+
+    private function check_params($params)
+    {
+        if(empty($params['cardno'])) {
+            return [false,'参数没有包含cardno'];
+        }
+        if(empty($params['amount'])) {
+            return [false,'参数没有包含充值金额:amount'];
+        }
+
+        $card_no = $params['cardno'];
+        $card_type = mtopcard\card_type($card_no,$regin_no);
+
+        if($card_type == mtopcard\UnknownCard) {
+            return [false,'卡类型无法识别'];
+        }
+
+        return [true,""];
+    }
+
+    public function addOp()
+    {
+        $params = $_POST;
+
+        $mchid = $this->mchid();
+        $model_merchant = Model('merchant');
+        $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid]);
+        if (empty($merchant_info)) {
+            return self::outerr(errcode::ErrMemberNotExist, "用户不存在.");
+        }
+
+        $amount = intval($params['amount']);
+        $card_nos = trim($params['cardno']);
+        $card_nos = explode(',' , $card_nos);
+        if(empty($card_nos)){
+            return self::outerr(errcode::ErrParamter, "卡号格式错误或未上传");
+        }
+
+        //成功个数、失败个数
+        $success_no = $error_no = 0;
+        $data = [];
+        $all_no = count($card_nos);
+        foreach ($card_nos as $no)
+        {
+            $params['cardno'] = $no;
+            [$success,$error] = $this->check_params($params);
+
+            if($success === false) {
+                $error_no++;
+                $arr['state'] = 201;
+                $arr['err'] = $error;
+            }
+            else
+            {
+                Log::record("no = {$no}",Log::DEBUG);
+                $params = [ 'mchid' => $this->mchid(),
+                    'buyer_id' => intval($merchant_info['admin_id']),
+                    'amount' => $amount,
+                    'card_no' => $no,
+                    'mch_order' => "",
+                    'notify_url' => ""];
+
+                $card_type = mtopcard\simple_card_type($no);
+                [$can_refill, $period] = refill\util::can_commit($no, $card_type);
+                if ($can_refill === false) {
+                    $ret = refill\util::async_add($params, $period);
+                } else {
+                    $ret = refill\util::push_add($params);
+                }
+
+                if($ret) {
+                    $arr['state'] = $ret;
+                    $arr['err'] = '';
+                    $success_no++;
+                }
+                else {
+                    $arr['state'] = 202;
+                    $arr['err'] = '提交失败';
+                    $error_no++;
+                }
+            }
+            $arr['card_no'] = $no;
+            $arr['amount'] = $amount;
+            $data[] = $arr;
+        }
+        $result['success_no'] = $success_no;
+        $result['error_no'] = $error_no;
+        $result['all_no'] = $all_no;
+        $result['data'] = $data;
+        return self::outsuccess($result);
+    }
+}

+ 159 - 0
mchsrv/control/merchantweb.php

@@ -0,0 +1,159 @@
+<?php
+
+require_once(BASE_HELPER_PATH . "/session_helper.php");
+
+class merchantwebControl
+{
+    //列表默认分页数
+    protected $page;
+    protected $cur_page;
+    //任务开始时间
+    private static $startime = 0;
+
+    public function __construct()
+    {
+        $_SESSION['client_type'] = $_GET['client_type'];
+        if (is_numeric($_GET['page']) && intval(trim($_GET['page'])) > 0) {
+            $this->page = intval(trim($_GET['page']));
+        } else {
+            $this->page = 10;
+        }
+
+        if (is_numeric($_GET['curpage']) && intval(trim($_GET['curpage'])) > 0) {
+            $this->cur_page = intval(trim($_GET['curpage']));
+        } else {
+            $this->cur_page = 1;
+        }
+        $this->initpage($this->page, $this->cur_page);
+    }
+
+
+    public static function outerr($code, $msg = '', $page = '', $type = 'ajax')
+    {
+        static $json_clients = ['android', 'ios', 'mini'];
+
+        if (!empty($type)) {
+            $show_type = $type;
+        } else {
+            $show_type = $_SESSION['client_type'];
+        }
+
+        if (in_array($show_type, $json_clients)) {
+            joutput_error($code, $msg);
+        } elseif ($show_type == 'wap') {
+            Tpl::clear();
+            Tpl::output("error", $msg);
+            if (!empty($page)) {
+                Tpl::showpage($page);
+            }
+        } elseif ($show_type == 'ajax') {
+            $callback = $_GET['callback'];
+            if (!isset($callback) || empty($callback)) {
+                joutput_error($code, $msg);
+            } else {
+                echo "{$callback}(";
+                joutput_error($code, $msg);
+                echo ");";
+            }
+        } else {
+            if (empty($msg)) {
+                $msg = errcode::msg($code);
+            }
+            $start = microtime(true);
+            echo joutput_error($code, $msg, 'web') . "<br/>";
+            perfor_period("joutput", $start, "web");
+
+            echo sprintf("eclipse_time = %.6f <br/><br/>", self::eclipse_time());
+            echo "性能关键统计:<br/><br/>";
+            echo perfor_log();
+
+            $sqls = Log::sql_log();
+            echo "sql count = " . count($sqls) . "<br/><br/>";
+            foreach ($sqls as $sql) {
+                echo "{$sql}<br/>";
+            }
+        }
+        return true;
+    }
+
+    public static function outsuccess($data, $page = '', $type = NULL)
+    {
+        static $json_clients = ['android', 'ios', 'mini'];
+
+        if (!empty($type)) {
+            $show_type = $type;
+        } else {
+            $show_type = $_SESSION['client_type'];
+        }
+
+        if (in_array($show_type, $json_clients)) {
+            joutput_data($data);
+        } elseif ($show_type == 'wap') {
+            Tpl::clear();
+            if (is_array($data)) {
+                foreach ($data as $key => $val) {
+                    Tpl::output($key, $val);
+                }
+            }
+            if (!empty($page)) {
+                Tpl::showpage($page);
+            }
+        } elseif ($show_type == 'ajax') {
+            $callback = $_GET['callback'];
+            if (!isset($callback) || empty($callback)) {
+                joutput_data($data);
+            } else {
+                echo "{$callback}(";
+                joutput_data($data);
+                echo ");";
+            }
+        } else {
+            echo 'success: return data=<br/>';
+            $start = microtime(true);
+            joutput_data($data, 'web');
+            perfor_period("joutput", $start, "web");
+
+            echo "<br/><br/>";
+            echo sprintf("eclipse_time = %.6f <br/><br/>", self::eclipse_time());
+            echo "性能关键统计:<br/><br/>";
+            echo perfor_log();
+            $sqls = Log::sql_log();
+            echo "sql count = " . count($sqls) . "<br/><br/>";
+
+            foreach ($sqls as $sql) {
+                echo "{$sql}<br/>";
+            }
+        }
+
+        return true;
+    }
+    private static function eclipse_time()
+    {
+        return (microtime(true) - self::$startime);
+    }
+
+    protected function initpage($page_size, $cur_page)
+    {
+        pagecmd('seteachnum', $page_size);
+        pagecmd('setnowpage', $cur_page);
+    }
+}
+
+class mbMerchantControl extends merchantwebControl
+{
+    public $err_code = errcode::Success;
+
+    public function __construct()
+    {
+        parent::__construct();
+
+        if (empty($_SESSION['mchid'])) {
+            throw new UnloginException();
+        }
+    }
+
+    public function mchid()
+    {
+        return intval($_SESSION['mchid']);
+    }
+}

+ 91 - 0
mchsrv/control/refill_evidence.php

@@ -0,0 +1,91 @@
+<?php
+require_once(BASE_ROOT_PATH . '/mobile/control/merchantweb.php');
+
+class refill_evidenceControl extends mbMerchantControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    public function indexOp()
+    {
+        $mchid = $this->mchid();
+        $model_merchant = Model('merchant');
+        $cond['mchid'] = $mchid;
+        if ($_GET['start_time'] && $_GET['end_time']) {
+            $cond['add_time'] = ['between', [$_GET['start_time'], $_GET['end_time']]];
+        }
+        $list = $model_merchant->getRefillEvidence($cond, $this->page, '*', 'add_time desc', 10);
+        $list = $this->RefillEvidenceFormat($list);
+        $result['data'] = $list;
+        $result['total'] = $model_merchant->gettotalpage();
+        return self::outsuccess($result);
+    }
+
+    public function addOp()
+    {
+        $params = $_POST;
+        if (empty($params['amount'])) {
+            return self::outerr(errcode::ErrParamter, "充值金额错误");
+        }
+        if (empty($params['bank_username'])) {
+            return self::outerr(errcode::ErrParamter, "开户人姓名有误");
+        }
+        if (empty($params['bank_name'])) {
+            return self::outerr(errcode::ErrParamter, "银行名称有误");
+        }
+        if (empty($params['voucher'])) {
+            return self::outerr(errcode::ErrParamter, "凭证名称有误");
+        }
+
+        $mchid = $this->mchid();
+        $model_merchant = Model('merchant');
+        $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid]);
+        if (empty($merchant_info)) {
+            return self::outerr(errcode::ErrMemberNotExist, "用户不存在.");
+        }
+
+
+        $data['amount'] = $params['amount'];
+        $data['bank_username'] = $params['bank_username'];
+        $data['bank_name'] = $params['bank_name'];
+        $data['bz'] = $params['bz'];
+        $data['voucher_name'] = $params['voucher'];
+        $data['mchid'] = $mchid;
+        $data['mch_name'] = $merchant_info['name'];
+        $data['member_id'] = $merchant_info['admin_id'];
+        $data['add_time'] = time();
+
+        $ret = $model_merchant->addRefillEvidence($data);
+        if ($ret) {
+            if(defined('COMPANY_NAME') && COMPANY_NAME === 'XYZ_COMPANY') {
+                global $config;
+                $phones = $config['system_manager_phones'];
+                foreach ($phones as $phone) {
+                    $ret = QueueClient::push('sendSMS', ['mobile'=>$phone,'type'=>'evidence','datas' => [date("m月d日H时") , $merchant_info['company_name'] , $params['amount']]]);
+                    Log::record("phone : {$phone} , result : {$ret}",Log::DEBUG);
+                }
+            }
+            return self::outsuccess([]);
+        } else {
+            return self::outerr(errcode::ErrOperation, "系统错误.");
+        }
+    }
+
+    private function RefillEvidenceFormat($list)
+    {
+        $data = [];
+        $check_status = ['申请中', '已通过', '已驳回'];
+        foreach ($list as $key => $value) {
+            $value['add_time'] = $value['add_time'] > 0 ? date('Y-m-d H:i:s', $value['add_time']) : '/';
+            $value['check_time'] = $value['check_time'] > 0 ? date('Y-m-d H:i:s', $value['check_time']) : '/';
+            $value['status_text'] = $check_status[$value['status'] - 1];
+            if ($value['voucher_name']) {
+                $value['voucher_path'] = UPLOAD_SITE_URL . '/' . ATTACH_UPFILE . DS . $value['voucher_name'];
+            }
+            $data[] = $value;
+        }
+        return $data;
+    }
+}

+ 124 - 0
mchsrv/framework/function/function.php

@@ -0,0 +1,124 @@
+<?php
+/**
+ * mobile公共方法
+ *
+ * 公共方法
+ *
+ */
+defined('InShopNC') or exit('Access Invalid!');
+
+
+require_once(BASE_CORE_PATH . '/framework/libraries/model.php');
+require_once(BASE_DATA_PATH . '/model/member.model.php');
+require_once(BASE_MOBILE_PATH . '/util/errcode.php');
+
+function output_data($datas, $extend_data = array(),$code = 200) 
+{
+    $data = array();
+    $data['code'] = $code;
+
+    if(!empty($extend_data)) {
+        $data = array_merge($data, $extend_data);
+    }
+
+    $data['datas'] = $datas;
+
+    if(!empty($_GET['callback'])) {
+        echo $_GET['callback'].'('.json_encode($data).')';
+    } else {
+        echo json_encode($data);
+    }
+}
+
+function output_error($message, $extend_data = array(),$code = 200) {
+    $datas = array('error' => $message);
+    output_data($datas, $extend_data,$code);
+}
+
+function joutput_data($datas,$type='')
+{
+    $data = [];
+
+    $code = errcode::Success;
+    $data['code'] = $code;
+    $data['message'] = errcode::msg($code);
+
+    $data['datas'] = $datas;
+
+    if($_SESSION['client_type'] != 'ajax')
+    {
+        $contents = ob_get_clean();
+        if(!empty($contents)) {
+            Log::record($contents,Log::ERR);
+        }
+        ob_start();
+    }
+
+    if(!empty($type) && $type == 'web') {
+        echo(json_encode($data,JSON_UNESCAPED_UNICODE));
+    } else {
+        echo(json_encode($data));
+    }
+}
+
+function joutput_error($code,$message = '',$type='')
+{
+    if(empty($message)) {
+        $message = errcode::msg($code);
+    }
+
+    $data = array();
+    $data['code'] = $code;
+    $data['message'] =  $message;
+    $data['datas'] = null;
+
+    if($_SESSION['client_type'] != 'ajax')
+    {
+        $contents = ob_get_clean();
+        if(!empty($contents)) {
+            Log::record($contents,Log::ERR);
+        }
+        ob_start();
+    }
+    Log::record("code = {$code} message = {$message}",Log::ERR);
+
+    if(!empty($type) && $type == 'web') {
+        echo(json_encode($data,JSON_UNESCAPED_UNICODE));
+    } else {
+        echo(json_encode($data));
+    }
+}
+
+function mobile_page($page_count,$totalnum = false)
+{
+    $extend_data = array();
+    $current_page = intval($_GET['curpage']);
+    if($current_page <= 0) {
+        $current_page = 1;
+    }
+    if($current_page >= $page_count) {
+        $extend_data['hasmore'] = false;
+    } else {
+        $extend_data['hasmore'] = true;
+    }
+    $extend_data['page_total'] = $page_count;
+    if($totalnum !== false) {
+        $extend_data['total_num'] = $totalnum;
+    }
+
+    return $extend_data;
+}
+
+/**
+ * 过滤html标签,js代码,css样式标签
+ * @param $str
+ * @return mixed
+ */
+function remove_tags($str) {
+    $str = preg_replace( "@<script(.*?)</script>@is", "", $str );
+    $str = preg_replace( "@<iframe(.*?)</iframe>@is", "", $str );
+    $str = preg_replace( "@<style(.*?)</style>@is", "", $str );
+    $str = preg_replace( "@<(.*?)>@is", "", $str );
+
+    return $str;
+}

+ 1 - 0
mchsrv/framework/index.html

@@ -0,0 +1 @@
+ 

+ 7 - 0
mchsrv/index.php

@@ -0,0 +1,7 @@
+<?php
+/**
+ * 手机接口初始化文件
+ *
+ *
+ */
+require_once(BASE_PATH . '/control/merchant.php');

+ 0 - 0
mchsrv/language/index.html


+ 10 - 0
mchsrv/language/zh_cn/mobile.php

@@ -0,0 +1,10 @@
+<?php
+defined('InShopNC') or exit('Access Invalid!');
+
+$lang['order_state_cancel'] = '已取消';
+$lang['order_state_new'] = '待付款';
+$lang['order_state_pay'] = '待发货';
+$lang['order_state_send'] = '待收货';
+$lang['order_state_success'] = '交易完成';
+$lang['order_state_eval'] = '已评价';
+

+ 73 - 0
mchsrv/mchsrv_run.php

@@ -0,0 +1,73 @@
+<?php
+
+define('APP_ID', 'mchsrv');
+define('MOBILE_SERVER',true);
+define('SUPPORT_PTHREAD',true);
+
+define('BASE_ROOT_PATH', str_replace('/mchsrv', '', dirname(__FILE__)));
+define('BASE_PATH', BASE_ROOT_PATH . '/mchsrv');
+
+require_once(BASE_ROOT_PATH . '/global.php');
+require_once(BASE_ROOT_PATH . '/fooder.php');
+require_once(BASE_PATH . '/index.php');
+
+Log::record(__FILE__,Log::DEBUG);
+
+require_once(BASE_ROOT_PATH . '/helper/session.php');
+require_once(BASE_ROOT_PATH . '/helper/img_helper.php');
+require_once(BASE_ROOT_PATH . '/helper/message/msgstates.php');
+require_once(BASE_ROOT_PATH . '/helper/message/msgutil.php');
+require_once(BASE_ROOT_PATH . '/helper/message/subscriber.php');
+require_once(BASE_ROOT_PATH . '/helper/index_tab.php');
+require_once(BASE_ROOT_PATH . '/helper/bonus_helper.php');
+require_once(BASE_ROOT_PATH . '/helper/session_helper.php');
+require_once(BASE_ROOT_PATH . '/helper/sms_helper.php');
+require_once(BASE_ROOT_PATH . '/helper/model_helper.php');
+require_once(BASE_ROOT_PATH . '/helper/category_helper.php');
+require_once(BASE_ROOT_PATH . '/helper/brand_helper.php');
+require_once(BASE_ROOT_PATH . '/helper/search/tcp_client.php');
+require_once(BASE_ROOT_PATH . '/helper/search/util.php');
+require_once(BASE_ROOT_PATH . '/helper/search_param.php');
+require_once(BASE_ROOT_PATH . '/helper/goods_helper.php');
+require_once(BASE_ROOT_PATH . '/helper/session_helper.php');
+require_once(BASE_ROOT_PATH . '/helper/login_helper.php');
+require_once(BASE_ROOT_PATH . '/helper/third_author/wxauthor.php');
+require_once(BASE_ROOT_PATH . '/helper/fcode/present_manager.php');
+require_once(BASE_ROOT_PATH . '/helper/url_helper.php');
+require_once(BASE_ROOT_PATH . '/helper/activity_helper.php');
+require_once(BASE_HELPER_PATH . '/fcgisrv/MerchantServer.php');
+require_once(BASE_HELPER_PATH . '/refill/util.php');
+
+
+function all_channels() {
+    return ['ch_index','activity','goods','refill'];
+}
+
+Base::mobile_init();
+$trdid = Thread::getCurrentThreadId();
+Log::record("thread id = {$trdid}",Log::INFO);
+
+$gMessageStates = new MsgStates();
+StatesHelper::init();
+$listener = new message\subscriber($gMessageStates);
+$listener->start();
+
+//function sig_handler($signo)
+//{
+//    Log::record("queue quit at sig_handler.",Log::DEBUG);
+//    switch($signo) {
+//        case SIGINT:
+//        case SIGHUP:
+//        case SIGQUIT:
+//        case SIGTERM:
+//        default:
+//            break;
+//    }
+//}
+//
+//pcntl_signal(SIGINT,  'sig_handler');
+//pcntl_signal(SIGHUP,  'sig_handler');
+//pcntl_signal(SIGQUIT, 'sig_handler');
+//pcntl_signal(SIGTERM, 'sig_handler');
+
+fcgisrv\MerchantServer::instance()->run_looper();

+ 1 - 0
mchsrv/templates/index.html

@@ -0,0 +1 @@
+ 

+ 10 - 0
mobile/callback/qianqian.php

@@ -0,0 +1,10 @@
+<?php
+
+$content = $_SERVER['post_content'];
+
+$inputs = json_decode($content,true);
+foreach ($inputs as $input) {
+    refill\util::push_notify('qianqian',$input);
+}
+
+echo ('SUCCESS');

+ 5 - 0
mobile/callback/refill_jumi.php

@@ -0,0 +1,5 @@
+<?php
+$content = $_SERVER['post_content'];
+$input = json_decode($content,true);
+
+refill\util::push_notify('jumi',$input);

+ 4 - 0
mobile/callback/refill_yonghe.php

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

+ 1 - 1
mobile/control/member_order.php

@@ -268,7 +268,7 @@ class member_orderControl extends mbMemberControl
         if (!empty($_POST['order_id'])) {
             $order_id = intval($_POST['order_id']);
             $condition['order_id'] = $order_id;
-        } else if (!empty($_POST['order_sn'])) {
+        } elseif (!empty($_POST['order_sn'])) {
             $condition['order_sn'] = trim($_POST['order_sn']);
         } else {
             return self::outerr(errcode::ErrParamter, "请传入order_sn.");

+ 1 - 1
mobile/control/merchant_info.php

@@ -12,7 +12,7 @@ class merchant_infoControl extends mbMerchantControl
     {
         $mchid = $this->mchid();
         $model_merchant = Model('merchant');
-        $field = 'mchid,admin_id,name,alarm_amount,ip_white_list,use_key,contact_name,contact_phone,warning_phone,company_name,quality,time_out';
+        $field = 'mchid,admin_id,name,alarm_amount,ip_white_list,use_key,contact_name,contact_phone,warning_phone,company_name,quality,time_out,credit_bonus';
         $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid], $field);
         $model_member = Model('member');
         $member_info = $model_member->getMemberInfo(['member_id' => $merchant_info['admin_id']], 'available_predeposit');

+ 2 - 2
mobile/control/refill.php

@@ -207,14 +207,14 @@ class refillControl extends merchantControl
         $refill_info = $mod_refill->getOrderInfo(['mch_order' => $order_sn,'mchid' => $mchid,'inner_status' => 0]);
 
         if(empty($refill_info)) {
-            return self::outerr(201,"无此订单");
+            return self::outerr(202,"无此订单");
         }
 
         $vr_order = Model('vr_order');
         $order_info = $vr_order->getOrderInfo(['order_sn' => $refill_info['order_sn']]);
 
         if(empty($order_info)) {
-            return self::outerr(201,"无此交易号");
+            return self::outerr(203,"无此交易号");
         }
 
         if($order_info['order_state'] == ORDER_STATE_SEND) {

+ 18 - 18
mobile/mobile_run.php

@@ -11,7 +11,7 @@ require_once(BASE_ROOT_PATH . '/global.php');
 require_once(BASE_ROOT_PATH . '/fooder.php');
 require_once(BASE_PATH . '/index.php');
 
-Log::record(__FILE__,LOG::DEBUG);
+Log::record(__FILE__,Log::DEBUG);
 
 require_once(BASE_ROOT_PATH . '/helper/session.php');
 require_once(BASE_ROOT_PATH . '/helper/img_helper.php');
@@ -52,22 +52,22 @@ StatesHelper::init();
 $listener = new message\subscriber($gMessageStates);
 $listener->start();
 
-//function sig_handler($signo)
-//{
-//    Log::record("queue quit at sig_handler.",Log::DEBUG);
-//    switch($signo) {
-//        case SIGINT:
-//        case SIGHUP:
-//        case SIGQUIT:
-//        case SIGTERM:
-//        default:
-//            break;
-//    }
-//}
-//
-//pcntl_signal(SIGINT,  'sig_handler');
-//pcntl_signal(SIGHUP,  'sig_handler');
-//pcntl_signal(SIGQUIT, 'sig_handler');
-//pcntl_signal(SIGTERM, 'sig_handler');
+function sig_handler($signo)
+{
+    Log::record("queue quit at sig_handler.",Log::DEBUG);
+    switch($signo) {
+        case SIGINT:
+        case SIGHUP:
+        case SIGQUIT:
+        case SIGTERM:
+        default:
+            break;
+    }
+}
+
+pcntl_signal(SIGINT,  'sig_handler');
+pcntl_signal(SIGHUP,  'sig_handler');
+pcntl_signal(SIGQUIT, 'sig_handler');
+pcntl_signal(SIGTERM, 'sig_handler');
 
 fcgisrv\MobileServer::instance()->run_looper();

+ 4 - 0
mobile/refill_tiancheng.php

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

+ 0 - 0
mobile/refill_weiyiman.php


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