stanley-king 4 лет назад
Родитель
Сommit
1133e03c84
76 измененных файлов с 1674 добавлено и 509 удалено
  1. 93 0
      admin/control/card_key.php
  2. 75 14
      admin/control/merchant.php
  3. 2 1
      admin/include/menu.php
  4. 154 0
      admin/templates/default/card_key.stats.php
  5. 2 2
      admin/templates/default/css/login.css
  6. 1 1
      admin/templates/default/css/skin_0.css
  7. 1 0
      admin/templates/default/merchant.add.php
  8. 1 0
      admin/templates/default/merchant.edit.php
  9. 1 0
      admin/templates/default/merchant.index.php
  10. 10 1
      admin/templates/default/merchant.orderlimit.php
  11. 1 1
      admin/templates/default/merchant.provider.evidence_list.php
  12. 218 0
      admin/templates/default/oil.amount.lock.php
  13. 1 1
      admin/templates/default/provider.evidence.add.php
  14. 19 5
      admin/templates/default/refill.order.index.php
  15. 13 3
      admin/templates/default/refill.order.send.index.php
  16. 1 1
      crontab/control/minutes.php
  17. 1 1
      data/config/win/refill.ini.php
  18. 1 1
      data/config/xyz/refill.ini.php
  19. 1 1
      helper/fcgisrv/MobileServer.php
  20. 13 5
      helper/refill/RefillBase.php
  21. 10 7
      helper/refill/api/lingzh/aming/RefillPhone.php
  22. 18 10
      helper/refill/api/lingzh/amingjd/RefillPhone.php
  23. 22 12
      helper/refill/api/lingzh/amingyd/RefillPhone.php
  24. 27 14
      helper/refill/api/lingzh/baizeyd/RefillPhone.php
  25. 19 11
      helper/refill/api/lingzh/binghc/RefillPhone.php
  26. 24 12
      helper/refill/api/lingzh/chuka/RefillPhone.php
  27. 12 11
      helper/refill/api/lingzh/feiniao/RefillPhone.php
  28. 8 10
      helper/refill/api/lingzh/fensheng/RefillPhone.php
  29. 4 4
      helper/refill/api/lingzh/legou/RefillPhone.php
  30. 24 13
      helper/refill/api/lingzh/ruishun/RefillPhone.php
  31. 20 11
      helper/refill/api/lingzh/weisyd/RefillPhone.php
  32. 30 15
      helper/refill/api/lingzh/wuchen/RefillPhone.php
  33. 21 12
      helper/refill/api/lingzh/yibao/RefillPhone.php
  34. 19 10
      helper/refill/api/xyz/afand/RefillPhone.php
  35. 12 15
      helper/refill/api/xyz/afandeng/RefillPhone.php
  36. 11 15
      helper/refill/api/xyz/afandnew/RefillPhone.php
  37. 8 6
      helper/refill/api/xyz/bdt/RefillOil.php
  38. 27 9
      helper/refill/api/xyz/beixt/RefillPhone.php
  39. 17 18
      helper/refill/api/xyz/bjb/RefillPhone.php
  40. 17 12
      helper/refill/api/xyz/bjbnew/RefillPhone.php
  41. 15 18
      helper/refill/api/xyz/bjbyd/RefillPhone.php
  42. 26 7
      helper/refill/api/xyz/bxtwt/RefillPhone.php
  43. 32 7
      helper/refill/api/xyz/jiec/RefillPhone.php
  44. 13 18
      helper/refill/api/xyz/lingzh/RefillPhone.php
  45. 14 18
      helper/refill/api/xyz/lingzhdl/RefillPhone.php
  46. 20 11
      helper/refill/api/xyz/qiucheng/RefillPhone.php
  47. 13 9
      helper/refill/api/xyz/saihu/RefillOil.php
  48. 78 0
      helper/refill/api/xyz/shengchuang/RefillCallBack.php
  49. 117 0
      helper/refill/api/xyz/shengchuang/RefillOil.php
  50. 24 0
      helper/refill/api/xyz/shengchuang/RefillPhone.php
  51. 19 0
      helper/refill/api/xyz/shengchuang/config.php
  52. 14 11
      helper/refill/api/xyz/suhcpdd/RefillOil.php
  53. 17 11
      helper/refill/api/xyz/suhctm/RefillOil.php
  54. 14 11
      helper/refill/api/xyz/tianjt/RefillOil.php
  55. 19 10
      helper/refill/api/xyz/tonglu/RefillPhone.php
  56. 23 11
      helper/refill/api/xyz/tongy/RefillPhone.php
  57. 1 1
      helper/refill/api/xyz/wantong/RefillCallBack.php
  58. 24 14
      helper/refill/api/xyz/wantong/RefillPhone.php
  59. 1 1
      helper/refill/api/xyz/wantong/api.txt
  60. 4 4
      helper/refill/api/xyz/wantong/config.php
  61. 18 9
      helper/refill/api/xyz/weit/RefillPhone.php
  62. 21 11
      helper/refill/api/xyz/weiyi/RefillPhone.php
  63. 16 14
      helper/refill/api/xyz/xc/RefillPhone.php
  64. 18 10
      helper/refill/api/xyz/xunyin/RefillPhone.php
  65. 8 6
      helper/refill/api/xyz/yifa/RefillPhone.php
  66. 9 4
      helper/refill/api/xyz/yunling/RefillPhone.php
  67. 18 14
      helper/refill/api/xyz/zzx/RefillOil.php
  68. 2 2
      helper/refill/policy/quaility.php
  69. 46 2
      helper/refill/policy/xyz/policy.php
  70. 36 2
      helper/refill/util.php
  71. 6 2
      helper/refill_proxy.php
  72. 1 0
      mobile/control/refill.php
  73. 4 0
      mobile/refill_wantong.php
  74. 2 1
      shop/control/card_keylist.php
  75. 13 0
      test/TestRedis.php
  76. 9 5
      test/TestRefill.php

+ 93 - 0
admin/control/card_key.php

@@ -0,0 +1,93 @@
+<?php
+
+require_once(BASE_HELPER_PATH . '/mtopcard/mtopcard.php');
+class card_keyControl extends SystemControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    public function statsOp()
+    {
+        $condition = ['card_id' => ['gt', 0]];
+        $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['assigned_time'] = [ ['egt', $start_unixtime] , ['lt', $end_unixtime] , 'and'];
+        }
+        elseif ($start_unixtime > 0) {
+            $condition['assigned_time'] = ['egt', $start_unixtime];
+        }
+        elseif ($end_unixtime > 0) {
+            $condition['assigned_time'] = ['lt', $end_unixtime];
+        }
+        if(!empty($_GET['store_id'])) {
+            $condition['store_id'] = $_GET['store_id'];
+        }
+        $items = Model('')->table('card_key')
+            ->field('card_type, amount, card_state, count(*) as card_count, sum(amount) as card_amounts')
+            ->where($condition)
+            ->group('card_type,amount,card_state')
+            ->order('card_type asc, amount asc, card_state asc')
+            ->select();
+
+        $card_count = 0;
+        $card_type_texts = [1 => '中石油', 2 => '中石化', 4 => '中国移动', 5 => '中国联通', 6 => '中国电信'];
+        $stats = [];
+        foreach ($items as $item) {
+            $card_count += $item['card_count'];
+            $card_type = $item['card_type'];
+            $item['amount'] = intval($item['amount']);
+            $item['card_amounts'] = intval($item['card_amounts']);
+            $key = "{$card_type_texts[$card_type]}-{$item['amount']}元";
+            $stats[$key][] = $item;
+        }
+        $card_state_stats = function($stats) {
+            $data = [];
+            foreach ($stats as $key => $value) {
+                foreach ($value as $stat) {
+                    if (empty($data[$key]['UnusedCardCount'])) {
+                        $data[$key]['UnusedCardCount'] = $stat['card_state'] == mtopcard\UnusedCard ? $stat['card_count'] : 0;
+                        $data[$key]['UnusedCardAmounts'] = $stat['card_state'] == mtopcard\UnusedCard ? $stat['card_amounts'] : 0;
+                    }
+                    if (empty($data[$key]['ReserveCardCount'])) {
+                        $data[$key]['ReserveCardCount'] = $stat['card_state'] == mtopcard\ReserveCard ? $stat['card_count'] : 0;
+                        $data[$key]['ReserveCardAmounts'] = $stat['card_state'] == mtopcard\ReserveCard ? $stat['card_amounts'] : 0;
+                    }
+                    if (empty($data[$key]['AssignedCardCount'])) {
+                        $data[$key]['AssignedCardCount'] = $stat['card_state'] == mtopcard\AssignedCard ? $stat['card_count'] : 0;
+                        $data[$key]['AssignedCardAmounts'] = $stat['card_state'] == mtopcard\AssignedCard ? $stat['card_amounts'] : 0;
+                    }
+                    if (empty($data[$key]['FreezedCardCount'])) {
+                        $data[$key]['FreezedCardCount'] = $stat['card_state'] == mtopcard\FreezedCard ? $stat['card_count'] : 0;
+                        $data[$key]['FreezedCardAmounts'] = $stat['card_state'] == mtopcard\FreezedCard ? $stat['card_amounts'] : 0;
+                    }
+                }
+            }
+            return $data;
+        };
+        $data = $card_state_stats($stats);
+        $totals = [];
+        $items = Model('')->table('card_key')
+            ->field('card_type, card_state, count(*) as card_count, sum(amount) as card_amounts')
+            ->where($condition)
+            ->group('card_type,card_state')
+            ->order('card_type asc, card_state asc')
+            ->select();
+        foreach ($items as $item) {
+            $card_type = $item['card_type'];
+            $key = "{$card_type_texts[$card_type]}-总计:";
+            $totals[$key][] = $item;
+        }
+        $total = $card_state_stats($totals);
+        $provider_list = Model('')->table('refill_provider,store')->field('refill_provider.store_id,store.store_name')->join('inner')
+            ->on('store.store_id=refill_provider.store_id')->limit(1000)->select();
+        Tpl::output('provider_list', $provider_list);
+        Tpl::output('card_count', $card_count);
+        Tpl::output('stats', $data);
+        Tpl::output('totals', $total);
+        Tpl::showpage('card_key.stats');
+    }
+}

+ 75 - 14
admin/control/merchant.php

@@ -9,7 +9,6 @@ defined('InShopNC') or exit('Access Invalid!');
 require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
 require_once(BASE_CONFIG_PATH . CONFIG_PREFIX . '/refill.ini.php');
 
-
 class merchantControl extends SystemControl
 {
     const EXPORT_SIZE = 1000;
@@ -207,6 +206,62 @@ class merchantControl extends SystemControl
         return [true, 'success'];
     }
 
+    public function oilAmountLockOp()
+    {
+        $turn_name = 'oil_amount_lock_turn';
+
+        if(chksubmit())
+        {
+            $lock_opened = $_POST['lock_opened'];
+            if(!in_array($lock_opened, [0,1])) {
+                showMessage('开启状态有误', '');
+            }
+            if($lock_opened == 1) {
+                wkcache($turn_name, true);
+            } elseif ($lock_opened == 0) {
+                wkcache($turn_name, false);
+            }
+
+            $mchids = $_POST['mchid'];
+            $change_amounts = $_POST['change'];
+            foreach ($mchids as $key => $mchid)
+            {
+                $mchid = intval($mchid);
+                $amount = $change_amounts[$key];
+                if(!empty($amount)){
+                    refill\util::set_amount_lock($mchid, $amount);
+                }
+            }
+            showMessage('编辑成功', 'index.php?act=merchant&op=merchant');
+        }
+        else
+        {
+            $lock_opened = rkcache($turn_name);
+
+            $model_merchant = Model('merchant');
+            $merchant_list = $model_merchant->getMerchantList([], 1000, 'mchid asc', 'mchid,company_name');
+            $result = $data = [];
+            foreach ($merchant_list as $merchant)
+            {
+                $mchid = intval($merchant['mchid']);
+                $amount_lock = \refill\util::get_amount_lock($mchid);
+                Log::record("mchid: {$mchid}, amount_lock: {$amount_lock}", Log::DEBUG);
+                $result['mchid'] = $mchid;
+                if (!empty($amount_lock)) {
+                    $result['amount'] = $amount_lock;
+                } else {
+                    $result['amount'] = 0;
+                }
+                $result['company_name'] = $merchant['company_name'];
+                $data[] = $result;
+            }
+
+            Tpl::output('data', $data);
+            Tpl::output('lock_opened', $lock_opened);
+            Tpl::showpage('oil.amount.lock');
+        }
+    }
+
     public function orderStorgeOp()
     {
         if (chksubmit()) {
@@ -897,7 +952,7 @@ class merchantControl extends SystemControl
             ->field('refill_provider.*,store.store_name')
             ->join('inner')
             ->on('store.store_id=refill_provider.store_id')
-            ->where(['refill_provider.opened' => 1])
+            ->order('opened asc, provider_id desc')
             ->limit(1000)
             ->select();
 
@@ -1406,12 +1461,19 @@ class merchantControl extends SystemControl
         foreach ($merchant_list as $key => $value) {
             $merchants[$value['mchid']] = $value;
         }
+        $_GET['card_type'] = $_GET['card_type'] ?? 'phone';
         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']];
+        }
+        if ($_GET['card_type'] == 'phone') {
+            $condition['refill_order.card_type'] = ['in', ['4', '5', '6']];
+        }
 
         $order_list = $model_refill_order->getMerchantOrderList($condition, 100, 'refill_order.*,vr_order.order_state', 'refill_order.order_time desc');
 
@@ -1570,17 +1632,17 @@ class merchantControl extends SystemControl
             if ($money == 0) {
                 showMessage('申请金额错误');
             }
-            if(empty($_FILES['voucher']['name'])) {
-                showMessage('未上传充值申请凭证');
-            }
-            $upload = new UploadFile();
-            $upload->set('default_dir',ATTACH_UPFILE.'/provider');
-
-            $result = $upload->upfile('voucher');
-            if ($result){
-                $_POST['voucher'] = $upload->file_name;
-            }else {
-                showMessage($upload->error);
+            if(!empty($_FILES['voucher']['name'])) {
+                $upload = new UploadFile();
+                $upload->set('default_dir',ATTACH_UPFILE.'/provider');
+
+                $result = $upload->upfile('voucher');
+                if ($result){
+                    $_POST['voucher'] = $upload->file_name;
+                    $input['voucher_name'] = $_POST['voucher'];
+                }else {
+                    showMessage($upload->error);
+                }
             }
 
             $input['store_name'] = $provider_info['store_name'];
@@ -1590,7 +1652,6 @@ class merchantControl extends SystemControl
             $input['bank_name'] = $_POST['bank_name'];
             $input['to_bank_username'] = $_POST['to_bank_username'];
             $input['to_bank_name'] = $_POST['to_bank_name'];
-            $input['voucher_name'] = $_POST['voucher'];
             $input['add_time'] = time();
             $mod = Model('provider_evidence');
             $res = $mod->addProviderEvidence($input);

+ 2 - 1
admin/include/menu.php

@@ -98,7 +98,8 @@ $arr = array(
 					array('args'=>'refill_order,merchant,merchant',			'text'=>'订单列表'),
 					array('args'=>'provider,merchant,merchant',				'text'=>'通道列表'),
 					array('args'=>'OrderSendList,merchant,merchant',		'text'=>'超时订单监控'),
-					array('args'=>'OrderStats,merchant,merchant',		'text'=>'对账管理')
+					array('args'=>'OrderStats,merchant,merchant',			'text'=>'对账管理'),
+					array('args'=>'stats,card_key,merchant',				'text'=>'卡密管理')
 				)
 			),
 			4 => array(

+ 154 - 0
admin/templates/default/card_key.stats.php

@@ -0,0 +1,154 @@
+<?php defined('InShopNC') or exit('Access Invalid!'); ?>
+<style>
+    #tdBottom td {
+        border-bottom: 1px dotted #CBE9F3;
+    }
+</style>
+<div class="page">
+    <div class="fixed-bar">
+        <div class="item-title">
+            <h3>卡密管理</h3>
+            <ul class="tab-base">
+                <li><a href="JavaScript:void(0);" class="current"><span>卡密统计</span></a></li>
+            </ul>
+        </div>
+    </div>
+    <div class="fixed-empty"></div>
+    <form method="get" name="formSearch" id="formSearch">
+        <input type="hidden" value="card_key" name="act">
+        <input type="hidden" value="stats" name="op">
+        <table class="tb-type1 noborder search">
+            <tbody>
+            <tr>
+                <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>
+                <th><label>通道名称</label></th>
+                <td>
+                    <select name="store_id" class="querySelect">
+                        <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+                        <?php foreach($output['provider_list'] as $provider){?>
+                            <option value="<?php echo $provider['store_id']?>"
+                                    <?php if ($_GET['cid'] == $provider['store_id']){ ?>selected<?php } ?>><?php echo $provider['store_name']?>
+                            </option>
+                        <?php }?>
+                    </select>
+                </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'] != '') { ?>
+                        <a href="index.php?act=merchant&op=refill_evidence" class="btns "
+                           title="<?php echo $lang['nc_cancel_search']; ?>"><span><?php echo $lang['nc_cancel_search']; ?></span></a>
+                    <?php } ?></td>
+            </tr>
+            </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>-->
+    <form method="post" id="merchant_name_form">
+        <input type="hidden" name="form_submit" value="ok"/>
+        <table class="table tb-type2">
+            <thead>
+            <tr class="thead">
+                <th>卡密</th>
+                <th>未使用数量</th>
+                <th>金额</th>
+                <th>充值中数量</th>
+                <th>金额</th>
+                <th>已使用数量</th>
+                <th>金额</th>
+                <th>冻结中数量</th>
+                <th>金额</th>
+            </tr>
+            </thead>
+            <tbody>
+            <?php if (!empty($output['stats']) && is_array($output['stats'])) { ?>
+                <?php foreach ($output['stats'] as $key => $stats) { ?>
+                    <tr class="trFlex" id="tdBottom">
+                        <td><?php echo $key;?></td>
+                        <td><?php echo $stats['UnusedCardCount'];?></td>
+                        <td><?php echo $stats['UnusedCardAmounts'];?></td>
+                        <td><?php echo $stats['ReserveCardCount'];?></td>
+                        <td><?php echo $stats['ReserveCardAmounts'];?></td>
+                        <td><?php echo $stats['AssignedCardCount'];?></td>
+                        <td><?php echo $stats['AssignedCardAmounts'];?></td>
+                        <td><?php echo $stats['FreezedCardCount'];?></td>
+                        <td><?php echo $stats['FreezedCardAmounts'];?></td>
+                    </tr>
+                <?php } ?>
+                    <tr style="height:30px;"></tr>
+                <?php foreach ($output['totals'] as $key => $total) { ?>
+                    <tr class="trFlex">
+                        <td><?php echo $key;?></td>
+                        <td><?php echo $total['UnusedCardCount'];?></td>
+                        <td><?php echo $total['UnusedCardAmounts'];?></td>
+                        <td><?php echo $total['ReserveCardCount'];?></td>
+                        <td><?php echo $total['ReserveCardAmounts'];?></td>
+                        <td><?php echo $total['AssignedCardCount'];?></td>
+                        <td><?php echo $total['AssignedCardAmounts'];?></td>
+                        <td><?php echo $total['FreezedCardCount'];?></td>
+                        <td><?php echo $total['FreezedCardAmounts'];?></td>
+                    </tr>
+                <?php } ?>
+            <?php } else { ?>
+                <tr class="no_data">
+                    <td colspan="15"><?php echo $lang['nc_no_record']; ?></td>
+                </tr>
+            <?php } ?>
+            </tbody>
+            <tfoot>
+            <tr class="tfoot">
+                <td></td>
+                <td colspan="16">
+                    <div class="pagination"><?php echo $output['page']; ?></div>
+                </td>
+            </tr>
+            </tfoot>
+        </table>
+    </form>
+</div>
+<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; ?>/laydate/laydate.js"></script>
+<script>
+    $(function () {
+        $('#ncsubmit').click(function () {
+            $('input[name="op"]').val('stats');
+            $('#formSearch').submit();
+        });
+        // 日期选择器
+        laydate.render({
+            elem: '#startTime',
+            type: 'datetime'
+        });
+        laydate.render({
+            elem: '#endTime',
+            type: 'datetime'
+        });
+        // 表格hover时背景
+        $('.trFlex').each(function () {
+            $(this).hover(function () {
+                $(this)[0].style.backgroundColor = '#cbe9f3'
+            },function() {
+                $(this)[0].style.backgroundColor = '#fff'
+            })
+        })
+    });
+</script>

+ 2 - 2
admin/templates/default/css/login.css

@@ -73,7 +73,7 @@ box-shadow: 0 2px 3px 0 rgba(0,0,0,.1) inset;
 input:-moz-placeholder { color: #fff; }
 input:-ms-input-placeholder { color: #fff; }
 input::-webkit-input-placeholder { color: #fff; }
-input:focus { filter:progid:DXImageTransform.Microsoft.gradient(enabled='true',startColorstr='#3F000000', endColorstr='#3F000000');background:rgba(0,0,0,0.25);
+input:focus { filter:progid:DXImageTransform.Microsoft.gradient(enabled=true,startColorstr='#3F000000', endColorstr='#3F000000');background:rgba(0,0,0,0.25);
     outline: none; border-color: rgba(255,255,255,0.5);
     -moz-box-shadow:
         0 2px 3px 0 rgba(0,0,0,.1) inset,
@@ -187,7 +187,7 @@ input:focus { filter:progid:DXImageTransform.Microsoft.gradient(enabled='true',s
 }
 
 .progress-bar-success {
-  filter:progid:DXImageTransform.Microsoft.gradient(enabled='true',startColorstr='#E5FFFFFF', endColorstr='#E5FFFFFF');background:rgba(255,255,255,0.9);
+  filter:progid:DXImageTransform.Microsoft.gradient(enabled=true,startColorstr='#E5FFFFFF', endColorstr='#E5FFFFFF');background:rgba(255,255,255,0.9);
 }
 
 .progress-striped .progress-bar-success {

+ 1 - 1
admin/templates/default/css/skin_0.css

@@ -1227,7 +1227,7 @@ span.module-assembly-html { background-position: -490px -1040px;}
 .special-goods-list dd.taobao-item-delete { font-size: 0; line-height: 0; background: url(../images/sky/bg_position.gif) no-repeat -250px -640px; display: none; width: 9px; height: 9px; position: absolute; z-index: 9; top: 0; right: 0; cursor: pointer;}
 .special-goods-list dl:hover dd.taobao-item-delete { display: block}
 .special-hot-point { position: relative; z-index: 1;}
-.special-hot-point div { font-size: 16px; font-weight: 600; font-style: italic; line-height: 24px; color: #000000; text-shadow: 1px 1px 0 rgba(255,255,255,0.75); text-indent: 10px; filter:progid:DXImageTransform.Microsoft.gradient(enabled='true',startColorstr='#5900FF00', endColorstr='#5900FF00'); background:rgba(0,255,0,0.35); border-color: #F00;}
+.special-hot-point div { font-size: 16px; font-weight: 600; font-style: italic; line-height: 24px; color: #000000; text-shadow: 1px 1px 0 rgba(255,255,255,0.75); text-indent: 10px; filter:progid:DXImageTransform.Microsoft.gradient(enabled=true,startColorstr='#5900FF00', endColorstr='#5900FF00'); background:rgba(0,255,0,0.35); border-color: #F00;}
 .hot-point-list li { display: block; padding: 5px; clear: both; position: relative; z-index: 1; border: solid 2px #FFF; margin-bottom: 5px;}
 .hot-point-list li:hover { border-color: #F30;}
 .hot-point-list li i { background: url(../images/select.gif) no-repeat 0 0; vertical-align: middle; display: inline-block; width: 16px; height: 16px; margin-right: 6px;}

+ 1 - 0
admin/templates/default/merchant.add.php

@@ -8,6 +8,7 @@
                 <li><a href="index.php?act=merchant&op=merchant"><span><?php echo $lang['nc_manage'] ?></span></a></li>
                 <li><a href="JavaScript:void(0);" class="current"><span><?php echo $lang['nc_new'] ?></span></a></li>
                 <li><a href="index.php?act=merchant&op=orderStorge"><span>机构库存锁定</span></a></li>
+                <li><a href="index.php?act=merchant&op=oilAmountLock"><span>机构油卡金额锁定</span></a></li>
             </ul>
         </div>
     </div>

+ 1 - 0
admin/templates/default/merchant.edit.php

@@ -8,6 +8,7 @@
                 <li><a href="index.php?act=merchant&op=merchant"><span><?php echo $lang['nc_manage'] ?></span></a></li>
                 <li><a href="JavaScript:void(0);" class="current"><span>编辑</span></a></li>
                 <li><a href="index.php?act=merchant&op=orderStorge"><span>机构库存锁定</span></a></li>
+                <li><a href="index.php?act=merchant&op=oilAmountLock"><span>机构油卡金额锁定</span></a></li>
             </ul>
         </div>
     </div>

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

@@ -10,6 +10,7 @@ defined('InShopNC') or exit('Access Invalid!'); ?>
                 <li><a href="JavaScript:void(0);" class="current"><span><?php echo $lang['nc_manage'] ?></span></a></li>
                 <li><a href="index.php?act=merchant&op=merchant_add"><span><?php echo $lang['nc_new'] ?></span></a></li>
                 <li><a href="index.php?act=merchant&op=orderStorge"><span>机构库存锁定</span></a></li>
+                <li><a href="index.php?act=merchant&op=oilAmountLock"><span>机构油卡金额锁定</span></a></li>
             </ul>
         </div>
     </div>

+ 10 - 1
admin/templates/default/merchant.orderlimit.php

@@ -88,6 +88,7 @@
                 <li><a href="index.php?act=merchant&op=merchant"><span><?php echo $lang['nc_manage'] ?></span></a></li>
                 <li><a href="index.php?act=merchant&op=merchant_add"><span><?php echo $lang['nc_new'] ?></span></a></li>
                 <li><a href="JavaScript:void(0);"  class="current"><span>机构库存锁定</span></a></li>
+                <li><a href="index.php?act=merchant&op=oilAmountLock"><span>机构油卡金额锁定</span></a></li>
             </ul>
         </div>
     </div>
@@ -129,7 +130,7 @@
                     <tbody class="tbody" style="display: block;padding-top: 95px;">
                     <?php if (!empty($output['data']) && is_array($output['data'])) { ?>
                     <?php foreach ($output['data'] as $k => $v) { ?>
-                        <tr class="w500">
+                        <tr class="w500 trFlex">
                             <td class="w50 align-center" style="width: 100px">
                                 <?php echo $v['mchid'];?>
                                 <input type="hidden" name="mchid[]" value="<?php echo $v['mchid'];?>">
@@ -179,5 +180,13 @@
         $("#submitBtn").click(function () {
             $("#price_form").submit();
         })
+        // 表格hover时背景
+        $('.trFlex').each(function () {
+            $(this).hover(function () {
+                $(this)[0].style.backgroundColor = '#cbe9f3'
+            },function() {
+                $(this)[0].style.backgroundColor = '#fff'
+            })
+        })
     });
 </script>

+ 1 - 1
admin/templates/default/merchant.provider.evidence_list.php

@@ -76,7 +76,7 @@
                         <td class="align-center"><?php echo $v['to_bank_name']; ?></td>
                         <td class="nowarp align-center"><?php echo $v['add_time'] ? date('Y-m-d H:i', $v['add_time']) : $lang['no_limit']; ?></td>
                         <td class="align-center w200">
-                            <?php if($v['voucher_name'] != '/') {?>
+                            <?php if(!empty($v['voucher_name'])) {?>
                             <a target="_blank"
                                href="<?php echo UPLOAD_SITE_URL . '/' . ATTACH_UPFILE . DS . 'provider/' .$v['voucher_name']; ?>">预览</a>
                             <?php }?>

+ 218 - 0
admin/templates/default/oil.amount.lock.php

@@ -0,0 +1,218 @@
+<?php defined('InShopNC') or exit('Access Invalid!'); ?>
+<!--<link rel="stylesheet" type="text/css" href="--><?php //echo RESOURCE_SITE_URL;?><!--/js/jquery-ui/themes/ui-lightness/jquery.ui.css"  />-->
+<!--<link href="--><?php //echo SHOP_SITE_URL;?><!--/templates/default/css/seller_center.css" rel="stylesheet" type="text/css"/>-->
+<style>
+    .spec_table .batch {
+        vertical-align: middle;
+        display: inline-block;
+        *display: inline /*IE7*/;
+        margin-left: 4px;
+        position: relative;
+        z-index: 1;
+        *zoom: 1 /*IE7*/;
+    }
+
+    .spec_table .batch i {
+        cursor: pointer;
+    }
+
+    .spec_table .batch-input {
+        background-color: #FFF;
+        white-space: nowrap;
+        padding: 4px 9px;
+        border: solid 1px #BCE8F1;
+        position: absolute;
+        z-index: 1;
+        top: -70px;
+        left: -75px;
+        box-shadow: 3px 3px 0 rgba(153, 153, 153, 0.25);
+    }
+
+    .spec_table .batch-input h6 {
+        font-size: 12px;
+        color: #555;
+    }
+
+    .spec_table .batch-input .text {
+        vertical-align: middle;
+        clear: both;
+        padding: 0 4px;
+        vertical-align: middle;
+        margin-right: 4px;
+    }
+
+    .spec_table .batch-input .arrow {
+        background: url(<?php echo SHOP_SITE_URL;?>/templates/default/images/seller/ncsc_bg_img.png) no-repeat -240px -20px;
+        display: block;
+        width: 10px;
+        height: 5px;
+        margin-left: -5px;
+        bottom: -5px;
+        left: 50%;
+        position: absolute;
+        z-index: 2;
+    }
+
+    .spec_table .batch-input a.close {
+        font-size: 11px;
+        line-height: 12px;
+        color: #BCE8F1;
+        text-decoration: none;
+        background-color: #FFF;
+        text-align: center;
+        display: block;
+        width: 12px;
+        height: 12px;
+        border-radius: 7px;
+        border: solid 1px #BCE8F1;
+        top: -7px;
+        right: -7px;
+        position: absolute;
+        z-index: 2;
+    }
+
+    .spec_table .text.price {
+        width: 40px;
+    }
+    .tableFixed {
+        position: fixed;
+        top: 54px;
+        background-color: #fff;
+    }
+</style>
+<div class="page">
+    <div class="fixed-bar">
+        <div class="item-title">
+            <h3><?php echo $lang['nc_merchant'] ?></h3>
+            <ul class="tab-base">
+                <li><a href="index.php?act=merchant&op=merchant"><span><?php echo $lang['nc_manage'] ?></span></a></li>
+                <li><a href="index.php?act=merchant&op=merchant_add"><span><?php echo $lang['nc_new'] ?></span></a></li>
+                <li><a href="index.php?act=merchant&op=orderStorge"><span>机构库存锁定</span></a></li>
+                <li><a href="JavaScript:void(0);" class="current"><span>机构油卡金额锁定</span></a></li>
+            </ul>
+        </div>
+    </div>
+
+    <div class="fixed-empty"></div>
+
+    <form id="price_form" enctype="multipart/form-data" method="post">
+        <input type="hidden" name="form_submit" value="ok"/>
+        <table class="table tb-type2 tableFixed">
+            <tbody class="">
+                <tr>
+                    <td colspan="2" class="required"><label>机构油卡金额锁定设置:</label></td>
+                </tr>
+                <tr>
+                    <td style="border-top: 0;color: #e60d0d;font-size:13px">
+                        变动金额:请输入数字
+                    </td>
+                </tr>
+                <tr class="noborder">
+                    <table class="spec_table tb-type2" style="width: 800px;">
+                        <tbody style="position: fixed;top:135px;background-color: #fff;display: block;width: 100%;">
+                            <tr style="margin-left: 10px;display: block;margin-bottom: 10px;">
+                                <td colspan="4" style="border-top: none;">
+                                    机构油卡金额状态:
+                                    <label style="margin-right: 10px;">
+                                        <input name="lock_opened" type="radio" value="1" <?php if($output['lock_opened'] === true){ echo 'checked'; }?>/>
+                                        开启
+                                    </label>
+                                    <label>
+                                        <input name="lock_opened" type="radio" value="0" <?php if($output['lock_opened'] === false){ echo 'checked'; }?>/>
+                                        关闭
+                                    </label>
+                                </td>
+                            </tr>
+                            <tr class="w800">
+                                <th class="w100 align-left">机构号</th>
+                                <th class="w120 align-left">机构名称</th>
+                                <th class="w100 align-left">锁定金额</th>
+                                <th class="w100 align-left">变动金额</th>
+                            </tr>
+                        </tbody>
+                        <tbody class="tbody tableContent" style="display: block;padding-top: 142px;">
+                            <?php if (!empty($output['data']) && is_array($output['data'])) { ?>
+                                <?php foreach ($output['data'] as $k => $v) { ?>
+                                    <tr class="w500 trFlex">
+                                        <td class="w100 align-left">
+                                            <?php echo $v['mchid'];?>
+                                            <input type="hidden" name="mchid[]" value="<?php echo $v['mchid'];?>">
+                                        </td>
+                                        <td class="w120 align-left">
+                                            <?php echo $v['company_name'];?>
+                                        </td>
+                                        <td class="w100 align-left">
+                                            <input type="text" readonly value="<?php echo $v['amount'];?>" style="display:block;width:100px;background-color: #eaeaea;">
+                                        </td>
+                                        <td class="w100 align-left">
+                                            <input type="text" name="change[]" value="0" style="display:block;width:100px" class="w50 amountInput">
+                                        </td>
+                                    </tr>
+                                <?php } ?>
+                            <?php } ?>
+                        </tbody>
+                    </table>
+                </tr>
+            </tbody>
+            <tfoot>
+            <tr class="tfoot">
+                <td colspan="15"><a href="JavaScript:void(0);" class="btn"
+                                    id="submitBtn"><span><?php echo $lang['nc_submit']; ?></span></a></td>
+            </tr>
+            </tfoot>
+        </table>
+    </form>
+</div>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/dialog/dialog.js" id="dialog_js"
+        charset="utf-8"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/jquery.ui.js"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/ajaxfileupload/ajaxfileupload.js"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.Jcrop/jquery.Jcrop.js"></script>
+<link href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.Jcrop/jquery.Jcrop.min.css" rel="stylesheet" type="text/css"
+      id="cssfile2"/>
+<script type="text/javascript">
+    $(function () {
+        let isSubmit = true
+        $('.amountInput').blur(function () {
+            // console.log('$(this).value', ($(this)));
+            let value = $(this)[0].value
+            // console.log('value.substr(1,1)', !Number(value));
+            if (value != 0 && !Number(value)) {
+                isSubmit = false
+                $(this)[0].style['borderColor'] = '#e64444'
+                return
+            }
+            if (value.substr(0,1) == '-' || parseFloat(value.substr(0,1)) >= 0) {
+                isSubmit = true;
+                $(this)[0].style['borderColor'] = ''
+            } else if(!value.substr(1,1) && parseFloat(value.substr(1,1)) >= 0) {
+                isSubmit = true;
+                $(this)[0].style['borderColor'] = ''
+            } else {
+                isSubmit = false
+                $(this)[0].style['borderColor'] = '#e64444'
+            }
+            if (value.substr(0,1) === '0' && value.substr(1,1) === '0') {
+                isSubmit = false
+                $(this)[0].style['borderColor'] = '#e64444'
+            }
+            if (value.substr(0,1) == '-' && value.substr(1,1) === '0') {
+                isSubmit = false
+                $(this)[0].style['borderColor'] = '#e64444'
+            }
+        })
+        $("#submitBtn").click(function () {
+            if (isSubmit) {
+                $("#price_form").submit();
+            }
+        })
+        // 表格hover时背景
+        $('.trFlex').each(function () {
+            $(this).hover(function () {
+                $(this)[0].style.backgroundColor = '#cbe9f3'
+            },function() {
+                $(this)[0].style.backgroundColor = '#fff'
+            })
+        })
+    });
+</script>

+ 1 - 1
admin/templates/default/provider.evidence.add.php

@@ -73,7 +73,7 @@
             <td class="vatop tips"></td>
         </tr>
         <tr>
-            <td colspan="2" class="required"><label class="validation">充值申请凭证:</label></td>
+            <td colspan="2"><label>充值申请凭证:</label></td>
         </tr>
         <tr class="noborder">
             <td class="vatop rowform">

+ 19 - 5
admin/templates/default/refill.order.index.php

@@ -4,6 +4,9 @@
         min-width: 150px;
         font-size: 12px;
     }
+    #prompt ul .noLineLi {
+        background:none; 
+    }
 </style>
 
 <?php defined('InShopNC') or exit('Access Invalid!'); ?>
@@ -49,7 +52,9 @@
                         <option value=""><?php echo $lang['nc_please_choose']; ?></option>
                         <?php foreach($output['provider_list'] as $provider){?>
                             <option value="<?php echo $provider['store_id']?>"
-                                    <?php if ($_GET['store_id'] == $provider['store_id']){ ?>selected<?php } ?>><?php echo $provider['store_name']?>
+                                    <?php if ($_GET['store_id'] == $provider['store_id']){ ?>selected<?php } ?> data-color="<?php echo $provider['opened']?>" class="textColor">
+                                        <?php echo $provider['store_name']?>
+                                
                             </option>
                         <?php }?>
                     </select>
@@ -175,7 +180,7 @@
                         <li class="lineLi" style="color:#000;">总计订单数量:<?php echo $output['stat']['all']['order_count'] ?? 0?></li>
                         <li class="lineLi" style="color:#000;">总计充值金额:<?php echo $output['stat']['all']['refill_amounts'] ?? 0?></li>
                         <li class="lineLi" style="color:#000;">总计客户扣款金额:<?php echo $output['stat']['all']['mch_amounts'] ?? 0?></li>
-                        <li class="lineLi" style="color:#000;">&nbsp;</li>
+                        <li class="lineLi noLineLi" style="color:#000;">&nbsp;</li>
                         <li class="lineLi" style="color:#000;">总计供方扣款金额:<?php echo $output['stat']['all']['channel_amounts'] ?? 0?></li>
                         <li class="lineLi" style="color:#000;">总计利润:<?php echo ncPriceFormat($output['stat']['all']['mch_amounts'] - $output['stat']['all']['channel_amounts'])?></li>
                     </div>
@@ -183,7 +188,7 @@
                         <li class="lineLi" style="color:#000;">总计充值中订单数量:<?php echo $output['stat']['sending']['order_count'] ?? 0?></li>
                         <li class="lineLi" style="color:#000;">总计充值中订单金额:<?php echo $output['stat']['sending']['refill_amounts'] ?? 0?></li>
                         <li class="lineLi" style="color:#000;">总计充值中客户扣款金额:<?php echo $output['stat']['sending']['mch_amounts'] ?? 0?></li>
-                        <li class="lineLi" style="color:#000;">&nbsp;</li>
+                        <li class="lineLi noLineLi" style="color:#000;">&nbsp;</li>
                         <li class="lineLi" style="color:#000;">总计充值中供方扣款金额:<?php echo $output['stat']['sending']['channel_amounts'] ?? 0?></li>
                         <li class="lineLi" style="color:#000;">总计充值中利润:<?php echo ncPriceFormat($output['stat']['sending']['mch_amounts'] - $output['stat']['sending']['channel_amounts'])?></li>
                     </div>
@@ -191,7 +196,7 @@
                         <li class="lineLi" style="color:#000;">总计充值成功订单数量:<?php echo $output['stat']['success']['order_count'] ?? 0?></li>
                         <li class="lineLi" style="color:#000;">总计充值成功订单金额:<?php echo $output['stat']['success']['refill_amounts'] ?? 0?></li>
                         <li class="lineLi" style="color:#000;">总计充值成功客户扣款金额:<?php echo $output['stat']['success']['mch_amounts'] ?? 0?></li>
-                        <li class="lineLi" style="color:#000;">&nbsp;</li>
+                        <li class="lineLi noLineLi" style="color:#000;">&nbsp;</li>
                         <li class="lineLi" style="color:#000;">总计充值成功供方扣款金额:<?php echo $output['stat']['success']['channel_amounts'] ?? 0?></li>
                         <li class="lineLi" style="color:#000;">总计充值成功利润:<?php echo ncPriceFormat($output['stat']['success']['mch_amounts'] - $output['stat']['success']['channel_amounts'])?></li>
                     </div>
@@ -199,7 +204,7 @@
                         <li class="lineLi" style="color:#000;">总计充值失败订单数量:<?php echo $output['stat']['cancel']['order_count'] ?? 0?></li>
                         <li class="lineLi" style="color:#000;">总计充值失败订单金额:<?php echo $output['stat']['cancel']['refill_amounts'] ?? 0?></li>
                         <li class="lineLi" style="color:#000;">总计充值失败客户扣款金额:<?php echo $output['stat']['cancel']['mch_amounts'] ?? 0?></li>
-                        <li class="lineLi" style="color:#000;">&nbsp;</li>
+                        <li class="lineLi noLineLi" style="color:#000;">&nbsp;</li>
                         <li class="lineLi" style="color:#000;">总计充值失败供方扣款金额:<?php echo $output['stat']['cancel']['channel_amounts'] ?? 0?></li>
                         <li class="lineLi" style="color:#000;">总计充值失败利润:<?php echo ncPriceFormat($output['stat']['cancel']['mch_amounts'] - $output['stat']['cancel']['channel_amounts'])?></li>
                     </div>
@@ -329,6 +334,15 @@
                 $(this)[0].style.backgroundColor = '#fff'
             })
         })
+        // 供方名称颜色
+        $('.textColor').each(function () {
+            let color = $(this).attr('data-color')
+            if (color == '1') {
+                $(this).css('color', 'green')
+            } else {
+                $(this).css('color', 'red')
+            }
+        })
     });
     function hCopyChannel(e) {
         let str = ''

+ 13 - 3
admin/templates/default/refill.order.send.index.php

@@ -13,7 +13,8 @@
         <div class="item-title">
             <h3>订单监控列表</h3>
             <ul class="tab-base">
-                <li><a href="JavaScript:void(0);" class="current"><span>管理</span></a></li>
+                <li><a href="index.php?act=merchant&op=OrderSendList&card_type=phone" class="classA" data-type="phone"><span>话费超时订单</span></a></li>
+                <li><a href="index.php?act=merchant&op=OrderSendList&card_type=oil" class="classA" data-type="oil"><span>油卡超时订单</span></a></li>
             </ul>
         </div>
     </div>
@@ -31,10 +32,10 @@
                 <a href="#" class="btns" onclick="hCopyCardNo(event)">
                     <span><i class="icon-edit"></i>拷贝充值卡号</span>
                 </a>
-                <a href="index.php?act=merchant&op=OrderSendList&time=1" class="btns" >
+                <a href="index.php?act=merchant&op=OrderSendList&time=1&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=2" class="btns" >
+                <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>
             </td>
@@ -149,6 +150,15 @@
       href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/themes/ui-lightness/jquery.ui.css"/>
 <script type="text/javascript">
     $(function () {
+        let type = '<?php echo $_GET['card_type'];?>';
+        $(".classA").each(function () {
+            if (type == $(this).attr("data-type")) {
+                $(this).addClass('current')
+                $(this).attr('href','JavaScript:void(0);')
+                $(this).siblings('.classA').removeClass('current')
+            }
+        })
+
         $('#query_start_time').datepicker({dateFormat: 'yy-mm-dd'});
         $('#query_end_time').datepicker({dateFormat: 'yy-mm-dd'});
         $('#ncsubmit').click(function () {

+ 1 - 1
crontab/control/minutes.php

@@ -51,7 +51,7 @@ class minutesControl extends BaseCronControl
             if($available_pd < $alarm_pd || $available_pd < 10000)
             {
                 $counts =  $mch_cache['send_count'];
-                if(($mch_cache['last_time'] + 300 < time()) && $counts < 5) {
+                if(($mch_cache['last_time'] + 300 < time()) && $counts < 2) {
                     $mch_cache = ['last_time' => time(), 'send_count' => $counts + 1];
                     foreach ($phones as $phone) {
                         if(!empty($phone)){

+ 1 - 1
data/config/win/refill.ini.php

@@ -437,7 +437,7 @@ $phone_providers = [
     ['name' => 'tonglu', 'cfg' => $tonglu_phone],
     ['name' => 'xc', 'cfg' => $xc_phone],
     ['name' => 'xunyin', 'cfg' => $xunyin_phone],
-//    ['name' => 'wantong', 'cfg' => $wantong_phone],
+    ['name' => 'wantong', 'cfg' => $wantong_phone],
     ['name' => 'yunling', 'cfg' => $yunling_phone],
 ];
 $config['phone_providers'] = $phone_providers;

+ 1 - 1
data/config/xyz/refill.ini.php

@@ -437,7 +437,7 @@ $phone_providers = [
     ['name' => 'tonglu', 'cfg' => $tonglu_phone],
     ['name' => 'xc', 'cfg' => $xc_phone],
     ['name' => 'xunyin', 'cfg' => $xunyin_phone],
-//    ['name' => 'wantong', 'cfg' => $wantong_phone],
+    ['name' => 'wantong', 'cfg' => $wantong_phone],
     ['name' => 'yunling', 'cfg' => $yunling_phone],
 ];
 $config['phone_providers'] = $phone_providers;

+ 1 - 1
helper/fcgisrv/MobileServer.php

@@ -57,7 +57,7 @@ class MobileServer extends BaseServer
             'bridge_shr.php','refill_weit.php','refill_afand.php','refill_afandeng.php',
             '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_yunling.php','refill_wantong.php'
         ];
 
         $this->setExFiles($exfiles);

+ 13 - 5
helper/refill/RefillBase.php

@@ -112,23 +112,29 @@ class RefillBase
                 if(!empty($refill_info))
                 {
                     util::incr_notify($chname, $card_type, $spec, $quality, false);
+                    util::incr_amount_lock($refill_info['mchid'],$card_type,$refill_info['refill_amount']);
+
                     $logic_vr_order->changeOrderStateCancel($order_info, '', "{$chname}接口回调通知失败,正在重试");
+
                     [$can_retry,$params] = $this->retry($refill_info, $order_info);
-                    if ($can_retry) {
+                    if ($can_retry)
+                    {
                         $mod_refill->edit($order_id, ['is_retrying' => 1]);
                         $tran->commit();
 
-                        if(defined('USE_COROUTINE') && USE_COROUTINE) {
-                            \Swoole\Coroutine::sleep(1);
-                        }
-                        util::push_add($params);
+//                        if(defined('USE_COROUTINE') && USE_COROUTINE) {
+//                            \Swoole\Coroutine::sleep(1);
+//                        }
 
+                        util::push_add($params);
                         return true;
                     }
                 }
             }
             else {
                 util::incr_notify($chname, $card_type, $spec, $quality, false);
+                util::incr_amount_lock($refill_info['mchid'],$card_type,$refill_info['refill_amount']);
+
                 $logic_vr_order->changeOrderStateCancel($order_info, '', "{$chname}接口回调通知失败,不可重试.");
             }
             $tran->commit();
@@ -346,6 +352,7 @@ class RefillBase
             {
                 //提交成功
                 util::incr_commit($channel_name,$card_type,$amount,$quality,true);
+                util::decr_amount_lock($mchid,$card_type,$amount);
                 $trade_no = $errmsg;
                 if ($provider->refill_type() == 'api') {
                     $logic_vr_order = Logic("vr_order");
@@ -366,6 +373,7 @@ class RefillBase
             else {
                 //提交失败
                 util::incr_commit($channel_name,$card_type,$amount,$quality,false);
+
                 Log::record("channel:{$channel_name} err:{$errmsg}");
                 $logic_vr_order = Logic("vr_order");
                 $order_info = Model('vr_order')->getOrderInfo(['order_id' => $order_id]);

+ 10 - 7
helper/refill/api/lingzh/aming/RefillPhone.php

@@ -33,11 +33,14 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误', true];
         } else {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp ,true);
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            }
             if($resp['result'] == 'SUCCESS') {
                 return [true, $resp['orderNo'], false];
             }
@@ -53,17 +56,18 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = strtoupper(md5($content));
 
         $resp = http_request(config::QUERY_URL, $params , 'POST' , false);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误'];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-
-            if ($resp['result'] == 'SUCCESS')
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['result'] == 'SUCCESS')
             {
-                $order_state = -1;
                 $data = $resp['data'];
                 if ($data['status'] == '充值成功') {
                     $order_state = ORDER_STATE_SUCCESS;
@@ -73,8 +77,7 @@ class RefillPhone extends refill\IRefillPhone
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif ($data['status'] == '充值中') {
                     $order_state = ORDER_STATE_SEND;
-                }
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['msg']];
                 }
                 return [true, $order_state];

+ 18 - 10
helper/refill/api/lingzh/amingjd/RefillPhone.php

@@ -37,12 +37,18 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误', true];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['code'] == 0) {
+
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            }
+            elseif ($resp['code'] == 0) {
                 return [true, $resp['order_id'], false];
             } else {
                 return [false, $resp['msg'], false];
@@ -58,16 +64,18 @@ class RefillPhone extends refill\IRefillPhone
         $content = $params['mchid'] . $params['orderid'] . config::KEY;
         $params['sign'] = md5($content);
         $resp = http_request(config::QUERY_URL, $params , 'POST' , false);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误'];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['code'] == 100)
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['code'] == 100)
             {
-                $order_state = -1;
                 if ($resp['status'] == 3) {
                     $order_state = ORDER_STATE_SUCCESS;
                     $save['official_sn'] = strtolower($resp['out_order_id']) == 'null' ? '' : $resp['out_order_id'];
@@ -76,13 +84,13 @@ class RefillPhone extends refill\IRefillPhone
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif (in_array($resp['status'] , [1 , 2])) {
                     $order_state = ORDER_STATE_SEND;
-                }
-
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['msg']];
                 }
+
                 return [true, $order_state];
-            } else {
+            }
+            else {
                 return [false, $resp['msg']];
             }
         }

+ 22 - 12
helper/refill/api/lingzh/amingyd/RefillPhone.php

@@ -30,17 +30,24 @@ class RefillPhone extends refill\IRefillPhone
         $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 ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误', true];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
-            $resp = json_decode($resp ,true);
-            if($resp['code'] == 'success') {
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['code'] == 'success') {
                 return [true, $resp['data'], false];
+            } else {
+                return [false, $resp['message'], false];
             }
-            return [false , $resp['message'], false];
         }
     }
 
@@ -52,14 +59,18 @@ class RefillPhone extends refill\IRefillPhone
 
         $params = json_encode($params);
         $resp = http_post_data(config::QUERY_URL, $params , config::ExtHeaders);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-
-            if ($resp['code'] == 'success') {
-                $order_state = -1;
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['code'] == 'success')
+            {
                 $data = $resp['data'];
                 if ($data['status'] == 3) {
                     $order_state = ORDER_STATE_SUCCESS;
@@ -69,8 +80,7 @@ class RefillPhone extends refill\IRefillPhone
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif (in_array($data['status'] , [0,1,4])) {
                     $order_state = ORDER_STATE_SEND;
-                }
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['message']];
                 }
                 return [true, $order_state];

+ 27 - 14
helper/refill/api/lingzh/baizeyd/RefillPhone.php

@@ -32,15 +32,23 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false , config::ExtHeaders);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误', true];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp ,true);
-            if($resp['state'] == 'success' && $resp['code'] == 000) {
+
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            }
+            elseif($resp['state'] == 'success' && $resp['code'] == 000) {
                 return [true, $resp['data']['id'], false];
             }
-            return [false , $resp['message'], false];
+            else {
+                return [false , $resp['message'], false];
+            }
         }
     }
 
@@ -51,15 +59,19 @@ class RefillPhone extends refill\IRefillPhone
         $content = $params['appKey'] . config::APP_SECRET;
         $params['sign'] = strtolower(md5($content));
 
-        $resp = http_request(config::QUERY_URL, $params , 'POST' , false , config::ExtHeaders);
-        if ($resp === false) {
+        $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
+        if (empty($resp)) {
             return [false, '系统错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-
-            if ($resp['state'] == 'success' && $resp['code'] == 000) {
-                $order_state = -1;
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['state'] == 'success' && $resp['code'] == 000)
+            {
                 $data = $resp['data'];
                 if ($data['status'] == 6) {
                     $order_state = ORDER_STATE_SUCCESS;
@@ -67,14 +79,15 @@ class RefillPhone extends refill\IRefillPhone
                     Model('refill_order')->edit($refill_info['order_id'], $save);
                 } elseif ($data['status'] == 7) {
                     $order_state = ORDER_STATE_CANCEL;
-                } elseif (in_array($data['status'] , [0,2,4])) {
+                } elseif (in_array($data['status'], [0, 2, 4])) {
                     $order_state = ORDER_STATE_SEND;
-                }
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['msg']];
                 }
+
                 return [true, $order_state];
-            } else {
+            }
+            else {
                 return [false, $resp['message']];
             }
         }

+ 19 - 11
helper/refill/api/lingzh/binghc/RefillPhone.php

@@ -33,13 +33,17 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误', true];
         }
-        else {
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp ,true);
-            if ($resp['result'] == 'SUCCESS') {
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['result'] == 'SUCCESS') {
                 return [true, $resp['orderNo'], false];
             } else {
                 return [false, $resp['msg'], false];
@@ -55,14 +59,18 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = strtoupper(md5($content));
 
         $resp = http_request(config::QUERY_URL, $params , 'POST' , false);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-
-            if ($resp['result'] == 'SUCCESS') {
-                $order_state = -1;
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            }
+            elseif ($resp['result'] == 'SUCCESS')
+            {
                 $data = $resp['data'];
                 if ($data['status'] == '充值成功') {
                     $order_state = ORDER_STATE_SUCCESS;
@@ -72,12 +80,12 @@ class RefillPhone extends refill\IRefillPhone
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif ($data['status'] == '充值中') {
                     $order_state = ORDER_STATE_SEND;
-                }
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['msg']];
                 }
                 return [true, $order_state];
-            } else {
+            }
+            else {
                 return [false, $resp['code']['desc']];
             }
         }

+ 24 - 12
helper/refill/api/lingzh/chuka/RefillPhone.php

@@ -40,15 +40,23 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false , config::ExtHeaders);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误', true];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = $this->xmlToArray($resp);
-            if($resp['code'] == 1) {
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            }
+            elseif($resp['code'] == 1) {
                 return [true, $resp['data']['tradeNo'], false];
             }
-            return [false , $resp['message'], false];
+            else {
+                return [false , $resp['message'], false];
+            }
         }
     }
 
@@ -61,14 +69,18 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::QUERY_URL, $params , 'POST' , false , config::ExtHeaders);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = $this->xmlToArray($resp);
-
-            if ($resp['code'] == 1) {
-                $order_state = -1;
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            }
+            elseif ($resp['code'] == 1)
+            {
                 $data = $resp['data'];
                 if ($data['status'] == 'success') {
                     $order_state = ORDER_STATE_SUCCESS;
@@ -76,12 +88,12 @@ class RefillPhone extends refill\IRefillPhone
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif ($data['status'] == 'wait') {
                     $order_state = ORDER_STATE_SEND;
-                }
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['msg']];
                 }
                 return [true, $order_state];
-            } else {
+            }
+            else {
                 return [false, $resp['message']];
             }
         }

+ 12 - 11
helper/refill/api/lingzh/feiniao/RefillPhone.php

@@ -32,14 +32,17 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误', true];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['result'] == 'SUCCESS') {
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['result'] == 'SUCCESS') {
                 return [true, $resp['data'], false];
             } else {
                 return [false, $resp['msg'], false];
@@ -55,15 +58,17 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = strtoupper(md5($content));
 
         $resp = http_request(config::QUERY_URL, $params);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误'];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-
-            if ($resp['result'] == 'SUCCESS')
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['result'] == 'SUCCESS')
             {
                 $status = $resp['msg'];
                 if ($status == '充值成功') {
@@ -75,14 +80,10 @@ class RefillPhone extends refill\IRefillPhone
                 } elseif ($status == '充值中') {
                     $order_state = ORDER_STATE_SEND;
                 } else {
-                    $order_state = -1;
-                }
-
-                if ($order_state == -1) {
                     return [false, $resp['msg']];
-                } else {
-                    return [true, $order_state];
                 }
+
+                return [true, $order_state];
             }
             else {
                 return [false, $resp['code']['desc']];

+ 8 - 10
helper/refill/api/lingzh/fensheng/RefillPhone.php

@@ -36,7 +36,8 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误', true];
         }
         else
@@ -44,15 +45,12 @@ class RefillPhone extends refill\IRefillPhone
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp ,true);
 
-            if($resp === false) {
+            if (empty($resp)) {
                 return [false, '系统错误', true];
-            }
-
-            if($resp['status'] === '001') {
+            } elseif ($resp['status'] === '001') {
                 return [true, $resp['orderNo'], false];
-            }
-            else {
-                return [false , $resp['status'], false];
+            } else {
+                return [false, $resp['status'], false];
             }
         }
     }
@@ -65,14 +63,14 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $this->sign($params);
 
         $resp = http_request(config::QUERY_URL, $params);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误'];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp === false) {
+            if (empty($resp)) {
                 return [false, '系统错误'];
             }
 

+ 4 - 4
helper/refill/api/lingzh/legou/RefillPhone.php

@@ -50,7 +50,7 @@ class RefillPhone extends refill\IRefillPhone
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false , config::ExtHeaders);
 
         $order_id = $params['order_id'];
-        if ($resp === false) {
+        if (empty($resp)) {
             cards_helper::reuse($order_id);
             return [false, '网络错误', true];
         }
@@ -59,7 +59,7 @@ class RefillPhone extends refill\IRefillPhone
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp ,true);
 
-            if($resp == false) {
+            if (empty($resp)) {
                 cards_helper::reuse($order_id);
                 return [false, '网络错误', true];
             }
@@ -83,7 +83,7 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = md5($content);
 
         $resp = http_request(config::QUERY_URL, $params , 'POST' , false , config::ExtHeaders);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '网络错误'];
         }
         else
@@ -91,7 +91,7 @@ class RefillPhone extends refill\IRefillPhone
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
 
-            if($resp == false) {
+            if (empty($resp)) {
                 return [false, '网络错误'];
             }
 

+ 24 - 13
helper/refill/api/lingzh/ruishun/RefillPhone.php

@@ -33,15 +33,21 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误', true];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
-            $resp = json_decode($resp ,true);
-            if($resp['result'] == 'SUCCESS') {
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['result'] == 'SUCCESS') {
                 return [true, $resp['orderNo'], false];
+            } else {
+                return [false, $resp['msg'], false];
             }
-            return [false , $resp['msg'], false];
         }
     }
 
@@ -53,14 +59,18 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = strtoupper(md5($content));
 
         $resp = http_request(config::QUERY_URL, $params , 'POST' , false);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-
-            if ($resp['result'] == 'SUCCESS') {
-                $order_state = -1;
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['result'] == 'SUCCESS')
+            {
                 $data = $resp['data'];
                 if ($data['status'] == '充值成功') {
                     $order_state = ORDER_STATE_SUCCESS;
@@ -70,12 +80,13 @@ class RefillPhone extends refill\IRefillPhone
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif ($data['status'] == '充值中') {
                     $order_state = ORDER_STATE_SEND;
-                }
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['msg']];
                 }
+
                 return [true, $order_state];
-            } else {
+            }
+            else {
                 return [false, $resp['code']['desc']];
             }
         }

+ 20 - 11
helper/refill/api/lingzh/weisyd/RefillPhone.php

@@ -32,15 +32,21 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false , config::ExtHeaders);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误', true];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp ,true);
-            if($resp['state'] == 'success' && $resp['code'] == 000) {
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['state'] == 'success' && $resp['code'] == 000) {
                 return [true, $resp['data']['id'], false];
+            } else {
+                return [false, $resp['message'], false];
             }
-            return [false , $resp['message'], false];
         }
     }
 
@@ -51,14 +57,18 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $this->sign($params);
 
         $resp = http_request(config::QUERY_URL, $params , 'POST' , false , config::ExtHeaders);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-
-            if ($resp['code'] == 'SUCCESS') {
-                $order_state = '';
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['code'] == 'SUCCESS')
+            {
                 $data = $resp['data'];
                 if ($data['status'] == 3) {
                     $order_state = ORDER_STATE_SUCCESS;
@@ -66,8 +76,7 @@ class RefillPhone extends refill\IRefillPhone
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif ($data['status'] == 2) {
                     $order_state = ORDER_STATE_SEND;
-                }
-                if (empty($order_state)) {
+                } else {
                     return [false, $resp['msg']];
                 }
                 return [true, $order_state];

+ 30 - 15
helper/refill/api/lingzh/wuchen/RefillPhone.php

@@ -47,21 +47,31 @@ class RefillPhone extends refill\IRefillPhone
             "ExpiredTime: 10",
             "Authorization: {$sign}",
         ];
+
         $params = json_encode($params);
         $resp = http_post_data(config::ORDER_URL, $params , $header);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误', true];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp ,true);
-            if($resp['code'] == 10000) {
-                if($resp['data']['orders_success'][0]['state'] == 'success') {
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            }
+            elseif ($resp['code'] == 10000)
+            {
+                if ($resp['data']['orders_success'][0]['state'] == 'success') {
                     return [true, $resp['orders_success'][0]['sys_sn'], false];
-                }else{
-                    return [false , $resp['orders_failure'][0]['message'], false];
+                } else {
+                    return [false, $resp['orders_failure'][0]['message'], false];
                 }
-            }else{
-                return [false , $resp['message'], false];
+            }
+            else
+            {
+                return [false, $resp['message'], false];
             }
         }
     }
@@ -87,13 +97,18 @@ class RefillPhone extends refill\IRefillPhone
         ];
         $params = json_encode($params);
         $resp = http_post_data(config::QUERY_URL, $params , $header);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp ,true);
-            if($resp['code'] == 10000) {
-                $order_state = -1;
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif($resp['code'] == 10000)
+            {
                 $data = $resp['data'];
                 if ($data['orders'][0]['state'] == '支付成功') {
                     $order_state = ORDER_STATE_SUCCESS;
@@ -103,12 +118,12 @@ class RefillPhone extends refill\IRefillPhone
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif (in_array($data['orders'][0]['state'] , ['待分配' , '待获取' , '处理中'])) {
                     $order_state = ORDER_STATE_SEND;
-                }
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['message']];
                 }
                 return [true, $order_state];
-            }else{
+            }
+            else {
                 return [false , $resp['message']];
             }
         }

+ 21 - 12
helper/refill/api/lingzh/yibao/RefillPhone.php

@@ -37,15 +37,20 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false , config::ExtHeaders);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误', true];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp ,true);
-            if($resp['code'] == 200) {
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['code'] == 200) {
                 return [true, $resp['data']['tradeNo'], false];
+            } else {
+                return [false, $resp['msg'], false];
             }
-            return [false , $resp['msg'], false];
         }
     }
 
@@ -56,14 +61,18 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $this->sign($params);
 
         $resp = http_request(config::QUERY_URL, $params , 'POST' , false , config::ExtHeaders);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-
-            if ($resp['code'] == 200) {
-                $order_state = -1;
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['code'] == 200)
+            {
                 $data = $resp['data'];
                 if ($data['orderStatus'] == 2) {
                     $order_state = ORDER_STATE_SUCCESS;
@@ -73,12 +82,12 @@ class RefillPhone extends refill\IRefillPhone
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif ($data['orderStatus'] == 1) {
                     $order_state = ORDER_STATE_SEND;
-                }
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['msg']];
                 }
                 return [true, $order_state];
-            } else {
+            }
+            else {
                 return [false, $resp['msg']];
             }
         }

+ 19 - 10
helper/refill/api/xyz/afand/RefillPhone.php

@@ -38,16 +38,19 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误', true];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp === false) {
+            if (empty($resp)) {
                 return [false, '系统错误', true];
-            } elseif ($resp['code'] == 0) {
+            }
+            $code = intval($resp['code']);
+            if ($code === 0) {
                 return [true, $resp['pt_order_id'], false];
             } else {
                 return [false, $resp['msg'], false];
@@ -68,23 +71,29 @@ class RefillPhone extends refill\IRefillPhone
         $content = $params['mchid'] . $params['pt_order_id'] . $params['mch_order_id'] . $params['op_order_id'] . $params['tel'] . $params['time'] . $params['rand'] . config::KEY;
         $params['sign'] = md5($content);
         $resp = http_request(config::QUERY_URL, $params , 'POST' , false);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['code'] == 0) {
-                $order_state = -1;
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            $code = intval($resp['code']);
+            if ($code === 0)
+            {
                 if ($resp['data']['status'] == '已支付') {
                     $order_state = ORDER_STATE_SUCCESS;
                 } elseif ($resp['data']['status'] == '支付失败') {
                     $order_state = ORDER_STATE_CANCEL;
-                }
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['data']];
                 }
                 return [true, $order_state];
-            } else {
+            }
+            else {
                 return [false, $resp['msg']];
             }
         }

+ 12 - 15
helper/refill/api/xyz/afandeng/RefillPhone.php

@@ -34,8 +34,10 @@ class RefillPhone extends refill\IRefillPhone
         $params = $this->req_params($card_no,$amount,$order_sn);
         $sign = $this->sign($params);
         $params['sgn'] = $sign;
+
         $resp = http_request(config::PAY_PHONE_URL,$params,'GET');
-        if($resp === false) {
+
+        if (empty($resp)) {
             return [false,'系统错误',true];
         }
         else
@@ -44,14 +46,12 @@ class RefillPhone extends refill\IRefillPhone
             $resp = ltrim($resp , '|');
 
             $resp = explode('|' , $resp);
-            if(count($resp) != 3) {
-                return [false,'返回值错误', false];
-            }
-            elseif($resp[0] == 0) {
-                return [true,'', false];
-            }
-            else {
-                return [false,$resp[1], false];
+            if (count($resp) != 3) {
+                return [false, '返回值错误', false];
+            } elseif ($resp[0] == 0) {
+                return [true, '', false];
+            } else {
+                return [false, $resp[1], false];
             }
         }
     }
@@ -63,7 +63,7 @@ class RefillPhone extends refill\IRefillPhone
         $content = $params['usr'] . $params['ord'] . config::KEY;
         $params['sgn'] = strtoupper(md5($content));
         $resp = http_request(config::QUERY_URL,$params);
-        if($resp === false) {
+        if (empty($resp)) {
             return [false,'系统错误'];
         }
         else
@@ -73,16 +73,13 @@ class RefillPhone extends refill\IRefillPhone
             $resp = explode('|' , $resp);
             if(count($resp) != 3) {
                 return [false,'返回值错误'];
-            }
-            $order_state = -1;
-            if ($resp[0] == 1) {
+            } elseif ($resp[0] == 1) {
                 $order_state = ORDER_STATE_SUCCESS;
             } elseif ($resp[0] == 2) {
                 $order_state = ORDER_STATE_CANCEL;
             } elseif ($resp[0] == 0){
                 $order_state = ORDER_STATE_SEND;
-            }
-            if ($order_state == -1) {
+            } else {
                 return [false, $resp[0]];
             }
             return [true, $order_state];

+ 11 - 15
helper/refill/api/xyz/afandnew/RefillPhone.php

@@ -35,14 +35,17 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误', true];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['code'] == 200) {
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['code'] == 200) {
                 return [true, $resp['data']['tradeNo'], false];
             } else {
                 return [false, $resp['msg'], false];
@@ -56,19 +59,19 @@ class RefillPhone extends refill\IRefillPhone
         $params['appId'] = config::APP_ID;
         $sign = $this->sign($params);
         $params['sign'] = $sign;
+
         $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误'];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp == false) {
+            if (empty($resp)) {
                 return [false, '系统错误'];
             }
-
-            if ($resp['code'] == 200)
+            elseif ($resp['code'] == 200)
             {
                 $data = $resp['data'];
                 if ($data['orderStatus'] == 2) {
@@ -79,17 +82,10 @@ class RefillPhone extends refill\IRefillPhone
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif ($data['orderStatus'] == 1) {
                     $order_state = ORDER_STATE_SEND;
-                }
-                else {
-                    $order_state = -1;
-                }
-
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['msg']];
                 }
-                else {
-                    return [true, $order_state];
-                }
+                return [true, $order_state];
             }
             else {
                 return [false, $resp['msg']];

+ 8 - 6
helper/refill/api/xyz/bdt/RefillOil.php

@@ -60,18 +60,20 @@ class RefillOil extends refill\IRefillOil
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL,$params,'POST',false, config::ExtHeaders);
-        if($resp === false) {
+
+        if (empty($resp)) {
             return [false,'系统错误',true];
         }
         else
         {
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
-            if($resp['code'] == 200) {
-                return [true,$resp['msg'], false];
-            }
-            else {
-                return [false,$resp['msg'], false];
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['code'] == 200) {
+                return [true, $resp['msg'], false];
+            } else {
+                return [false, $resp['msg'], false];
             }
         }
     }

+ 27 - 9
helper/refill/api/xyz/beixt/RefillPhone.php

@@ -39,18 +39,20 @@ class RefillPhone extends refill\IRefillPhone
             "API-SIGNATURE: {$sign}",
         ];
         $resp = http_post_data(config::REQUEST_URL,$params,$header);
-        if($resp === false) {
+
+        if (empty($resp)) {
             return [false,'系统错误',true];
         }
         else
         {
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
-            if($resp['ack'] == 'success') {
-                return [true,$resp['message']['order_number'], false];
-            }
-            else {
-                return [false,$resp['message'], false];
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['ack'] == 'success') {
+                return [true, $resp['message']['order_number'], false];
+            } else {
+                return [false, $resp['message'], false];
             }
         }
     }
@@ -71,16 +73,32 @@ class RefillPhone extends refill\IRefillPhone
             "API-TIMESTAMP: {$time}",
             "API-SIGNATURE: {$sign}",
         ];
+
         $resp = http_post_data(config::REQUEST_URL,json_encode($params),$header);
-        if($resp === false) {
+
+        if (empty($resp)) {
             return [false,'系统错误'];
         }
         else
         {
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
-            if($resp['ack'] == 'success') {
-                return [true,$resp['message']];
+            if (empty($resp)) {
+                return [false,'系统错误'];
+            }
+            elseif($resp['ack'] == 'success')
+            {
+                $data = $resp['order'];
+                if ($data['shipping_status'] == 1) {
+                    $order_state = ORDER_STATE_SUCCESS;
+                } elseif (in_array($data['shipping_status'], [0,3,4])) {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif (in_array($data['shipping_status'], [2,5])) {
+                    $order_state = ORDER_STATE_SEND;
+                } else {
+                    return [false, $resp['message']];
+                }
+                return [true, $order_state];
             }
             else {
                 return [false,$resp['message']];

+ 17 - 18
helper/refill/api/xyz/bjb/RefillPhone.php

@@ -31,8 +31,10 @@ class RefillPhone extends refill\IRefillPhone
         $params = $this->req_params($card_no,$amount,$order_sn);
         $sign = $this->sign($params);
         $params['sgn'] = $sign;
+
         $resp = http_request(config::PAY_PHONE_URL,$params,'GET');
-        if($resp === false) {
+
+        if (empty($resp)) {
             return [false,'系统错误',true];
         }
         else
@@ -41,14 +43,12 @@ class RefillPhone extends refill\IRefillPhone
             $resp = ltrim($resp , '|');
 
             $resp = explode('|' , $resp);
-            if(count($resp) != 3) {
-                return [false,'返回值错误', false];
-            }
-            elseif($resp[0] == 0) {
-                return [true,'', false];
-            }
-            else {
-                return [false,$resp[1], false];
+            if (count($resp) != 3) {
+                return [false, '返回值错误', false];
+            } elseif ($resp[0] == 0) {
+                return [true, '', false];
+            } else {
+                return [false, $resp[1], false];
             }
         }
     }
@@ -58,8 +58,10 @@ class RefillPhone extends refill\IRefillPhone
         $params['usr'] = config::USR;
         $content = $params['usr'] . $params['ord'] . config::KEY;
         $params['sgn'] = strtoupper(md5($content));
+
         $resp = http_request(config::QUERY_URL,$params);
-        if($resp === false) {
+
+        if (empty($resp)) {
             return [false,'系统错误'];
         }
         else
@@ -67,18 +69,15 @@ class RefillPhone extends refill\IRefillPhone
             Log::record($resp,Log::DEBUG);
             $resp = ltrim($resp , '|');
             $resp = explode('|' , $resp);
-            if(count($resp) != 3) {
-                return [false,'返回值错误'];
-            }
-            $order_state = -1;
-            if ($resp[0] == 1) {
+            if (count($resp) != 3) {
+                return [false, '返回值错误'];
+            } elseif ($resp[0] == 1) {
                 $order_state = ORDER_STATE_SUCCESS;
             } elseif ($resp[0] == 2) {
                 $order_state = ORDER_STATE_CANCEL;
-            } elseif ($resp[0] == 0){
+            } elseif ($resp[0] == 0) {
                 $order_state = ORDER_STATE_SEND;
-            }
-            if ($order_state == -1) {
+            } else {
                 return [false, $resp[0]];
             }
             return [true, $order_state];

+ 17 - 12
helper/refill/api/xyz/bjbnew/RefillPhone.php

@@ -31,19 +31,22 @@ class RefillPhone extends refill\IRefillPhone
         $params = $this->req_params($card_no,$amount,$order_sn);
         $sign = $this->sign($params);
         $params['verifystring'] = $sign;
+
         $resp = http_request(config::PAY_PHONE_URL,$params,'GET');
-        if($resp === false) {
+
+        if (empty($resp)) {
             return [false,'系统错误',true];
         }
         else
         {
             Log::record($resp,Log::DEBUG);
             $resp = $this->xmlToArray($resp);
-            if($resp['resultno'] == 0000) {
-                return [true,$resp['orderno'], false];
-            }
-            else {
-                return [false,$resp['resultmessage'], false];
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['resultno'] === '0000') {
+                return [true, $resp['orderno'], false];
+            } else {
+                return [false, $resp['resultmessage'], false];
             }
         }
     }
@@ -55,23 +58,25 @@ class RefillPhone extends refill\IRefillPhone
         $key = config::MerchantKey;
         $content = "agentid={$params['agentid']}&returntype={$params['returntype']}&orderid={$params['orderid']}&merchantKey={$key}";
         $params['verifystring'] = md5($content);
+
         $resp = http_request(config::QUERY_URL,$params);
-        if($resp === false) {
+
+        if (empty($resp)) {
             return [false,'系统错误'];
         }
         else
         {
             Log::record($resp,Log::DEBUG);
             $resp = $this->xmlToArray($resp);
-            $order_state = -1;
-            if ($resp['resultno'] == 0014) {
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            } elseif ($resp['resultno'] == 0014) {
                 $order_state = ORDER_STATE_SUCCESS;
             } elseif ($resp['resultno'] == 0015) {
                 $order_state = ORDER_STATE_CANCEL;
-            } elseif ($resp['resultno'] == 0016){
+            } elseif ($resp['resultno'] == 0016) {
                 $order_state = ORDER_STATE_SEND;
-            }
-            if ($order_state == -1) {
+            } else {
                 return [false, $resp['resultmessage']];
             }
             return [true, $order_state];

+ 15 - 18
helper/refill/api/xyz/bjbyd/RefillPhone.php

@@ -32,22 +32,22 @@ class RefillPhone extends refill\IRefillPhone
         $params = $this->req_params($card_no,$amount,$order_sn);
         $sign = $this->sign($params);
         $params['sgn'] = $sign;
+
         $resp = http_request(config::PAY_PHONE_URL,$params,'GET');
-        if($resp === false) {
+
+        if (empty($resp)) {
             return [false,'系统错误',true];
         }
         else
         {
             Log::record($resp,Log::DEBUG);
             $resp = explode('|' , $resp);
-            if(count($resp) != 3) {
-                return [false,'返回值错误', false];
-            }
-            elseif($resp[0] == 0) {
-                return [true,'', false];
-            }
-            else {
-                return [false,$resp[1], false];
+            if (count($resp) != 3) {
+                return [false, '返回值错误', false];
+            } elseif ($resp[0] == 0) {
+                return [true, '', false];
+            } else {
+                return [false, $resp[1], false];
             }
         }
     }
@@ -59,7 +59,7 @@ class RefillPhone extends refill\IRefillPhone
         $content = $params['usr'] . $params['ord'] . config::KEY;
         $params['sgn'] = strtoupper(md5($content));
         $resp = http_request(config::QUERY_URL,$params);
-        if($resp === false) {
+        if (empty($resp)) {
             return [false,'系统错误'];
         }
         else
@@ -67,18 +67,15 @@ class RefillPhone extends refill\IRefillPhone
             Log::record($resp,Log::DEBUG);
             $resp = ltrim($resp , '|');
             $resp = explode('|' , $resp);
-            if(count($resp) != 3) {
-                return [false,'返回值错误'];
-            }
-            $order_state = -1;
-            if ($resp[0] == 1) {
+            if (count($resp) != 3) {
+                return [false, '返回值错误'];
+            } elseif ($resp[0] == 1) {
                 $order_state = ORDER_STATE_SUCCESS;
             } elseif ($resp[0] == 2) {
                 $order_state = ORDER_STATE_CANCEL;
-            } elseif ($resp[0] == 0){
+            } elseif ($resp[0] == 0) {
                 $order_state = ORDER_STATE_SEND;
-            }
-            if ($order_state == -1) {
+            } else {
                 return [false, $resp[0]];
             }
             return [true, $order_state];

+ 26 - 7
helper/refill/api/xyz/bxtwt/RefillPhone.php

@@ -39,18 +39,21 @@ class RefillPhone extends refill\IRefillPhone
             "API-TIMESTAMP: {$time}",
             "API-SIGNATURE: {$sign}",
         ];
+
         $resp = http_post_data(config::REQUEST_URL, $params, $header);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误',true];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['ack'] == 'success') {
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['ack'] == 'success') {
                 return [true, $resp['message']['order_number'], false];
-            }
-            else {
+            } else {
                 return [false, $resp['message'], false];
             }
         }
@@ -72,16 +75,32 @@ class RefillPhone extends refill\IRefillPhone
             "API-TIMESTAMP: {$time}",
             "API-SIGNATURE: {$sign}",
         ];
+
         $resp = http_post_data(config::REQUEST_URL, json_encode($params), $header);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误'];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['ack'] == 'success') {
-                return [true, $resp['message']];
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['ack'] == 'success')
+            {
+                $data = $resp['order'];
+                if ($data['shipping_status'] == 1) {
+                    $order_state = ORDER_STATE_SUCCESS;
+                } elseif (in_array($data['shipping_status'], [0,3,4])) {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif (in_array($data['shipping_status'], [2,5])) {
+                    $order_state = ORDER_STATE_SEND;
+                } else {
+                    return [false, $resp['message']];
+                }
+                return [true, $order_state];
             }
             else {
                 return [false, $resp['message']];

+ 32 - 7
helper/refill/api/xyz/jiec/RefillPhone.php

@@ -33,12 +33,16 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false , config::ExtHeaders);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误',true];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['code'] == 1) {
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['code'] == 1) {
                 return [true, $resp['data'], false];
             } else {
                 return [false, $resp['msg'], false];
@@ -53,14 +57,35 @@ class RefillPhone extends refill\IRefillPhone
         $content = $params['partner_id'] . $params['partner_order_no'] . config::KEY;
         $params['sign'] = md5($content);
         $resp = http_post_data(config::QUERY_URL, json_encode($params));
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if (in_array($resp['code'] , [0,1,2])) {
 
-            } else {
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['code'] == 1)
+            {
+                $status = $resp['data']['code'];
+                if ($status === 1) {
+                    $order_state = ORDER_STATE_SUCCESS;
+                    $save['official_sn'] = $resp['data']['official_order_id'];
+                    Model('refill_order')->edit($refill_info['order_id'], $save);
+                } elseif ($status === 0) {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif ($status === 2) {
+                    $order_state = ORDER_STATE_SEND;
+                } else {
+                    return [false, $resp['msg']];
+                }
+
+                return [true, $order_state];
+            }
+            else {
                 return [false, $resp['msg']];
             }
         }

+ 13 - 18
helper/refill/api/xyz/lingzh/RefillPhone.php

@@ -37,7 +37,7 @@ class RefillPhone extends refill\IRefillPhone
         $sign = $this->sign($params);
         $params['sgn'] = $sign;
         $resp = http_request(config::PAY_PHONE_URL,$params,'GET');
-        if($resp === false) {
+        if (empty($resp)) {
             return [false,'系统错误',true];
         }
         else
@@ -46,14 +46,12 @@ class RefillPhone extends refill\IRefillPhone
             $resp = ltrim($resp , '|');
 
             $resp = explode('|' , $resp);
-            if(count($resp) != 3) {
-                return [false,'返回值错误', false];
-            }
-            elseif($resp[0] == 0) {
-                return [true,'', false];
-            }
-            else {
-                return [false,$resp[1], false];
+            if (count($resp) != 3) {
+                return [false, '返回值错误', false];
+            } elseif ($resp[0] == 0) {
+                return [true, '', false];
+            } else {
+                return [false, $resp[1], false];
             }
         }
     }
@@ -66,7 +64,7 @@ class RefillPhone extends refill\IRefillPhone
         $content = $params['usr'] . $params['ord'] . config::KEY;
         $params['sgn'] = strtoupper(md5($content));
         $resp = http_request(config::QUERY_URL,$params);
-        if($resp === false) {
+        if (empty($resp)) {
             return [false,'系统错误'];
         }
         else
@@ -74,20 +72,17 @@ class RefillPhone extends refill\IRefillPhone
             Log::record($resp,Log::DEBUG);
             $resp = ltrim($resp , '|');
             $resp = explode('|' , $resp);
-            if(count($resp) != 3) {
-                return [false,'返回值错误'];
-            }
-            $order_state = -1;
-            if ($resp[0] == 1) {
+            if (count($resp) != 3) {
+                return [false, '返回值错误'];
+            } elseif ($resp[0] == 1) {
                 $order_state = ORDER_STATE_SUCCESS;
                 $save['official_sn'] = $resp[2];
                 Model('refill_order')->edit($refill_info['order_id'], $save);
             } elseif ($resp[0] == 2) {
                 $order_state = ORDER_STATE_CANCEL;
-            } elseif ($resp[0] == 0){
+            } elseif ($resp[0] == 0) {
                 $order_state = ORDER_STATE_SEND;
-            }
-            if ($order_state == -1) {
+            } else {
                 return [false, $resp[0]];
             }
             return [true, $order_state];

+ 14 - 18
helper/refill/api/xyz/lingzhdl/RefillPhone.php

@@ -36,8 +36,9 @@ class RefillPhone extends refill\IRefillPhone
         $params = $this->req_params($card_no,$amount,$order_sn);
         $sign = $this->sign($params);
         $params['sgn'] = $sign;
+
         $resp = http_request(config::PAY_PHONE_URL,$params,'GET');
-        if($resp === false) {
+        if (empty($resp)) {
             return [false,'系统错误',true];
         }
         else
@@ -46,14 +47,12 @@ class RefillPhone extends refill\IRefillPhone
             $resp = ltrim($resp , '|');
 
             $resp = explode('|' , $resp);
-            if(count($resp) != 3) {
-                return [false,'返回值错误', false];
-            }
-            elseif($resp[0] == 0) {
-                return [true,'', false];
-            }
-            else {
-                return [false,$resp[1], false];
+            if (count($resp) != 3) {
+                return [false, '返回值错误', false];
+            } elseif ($resp[0] == 0) {
+                return [true, '', false];
+            } else {
+                return [false, $resp[1], false];
             }
         }
     }
@@ -66,7 +65,7 @@ class RefillPhone extends refill\IRefillPhone
         $content = $params['usr'] . $params['ord'] . config::KEY;
         $params['sgn'] = strtoupper(md5($content));
         $resp = http_request(config::QUERY_URL,$params);
-        if($resp === false) {
+        if (empty($resp)) {
             return [false,'系统错误'];
         }
         else
@@ -74,20 +73,17 @@ class RefillPhone extends refill\IRefillPhone
             Log::record($resp,Log::DEBUG);
             $resp = ltrim($resp , '|');
             $resp = explode('|' , $resp);
-            if(count($resp) != 3) {
-                return [false,'返回值错误'];
-            }
-            $order_state = -1;
-            if ($resp[0] == 1) {
+            if (count($resp) != 3) {
+                return [false, '返回值错误'];
+            } elseif ($resp[0] == 1) {
                 $order_state = ORDER_STATE_SUCCESS;
                 $save['official_sn'] = $resp[2];
                 Model('refill_order')->edit($refill_info['order_id'], $save);
             } elseif ($resp[0] == 2) {
                 $order_state = ORDER_STATE_CANCEL;
-            } elseif ($resp[0] == 0){
+            } elseif ($resp[0] == 0) {
                 $order_state = ORDER_STATE_SEND;
-            }
-            if ($order_state == -1) {
+            } else {
                 return [false, $resp[0]];
             }
             return [true, $order_state];

+ 20 - 11
helper/refill/api/xyz/qiucheng/RefillPhone.php

@@ -32,13 +32,17 @@ class RefillPhone extends refill\IRefillPhone
         $sign = $this->sign($params);
         $params['sign'] = $sign;
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误', true];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['code'] == 000) {
-                return [true, $resp['orderno'] , false];
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['code'] === '000') {
+                return [true, $resp['orderno'], false];
             } else {
                 return [false, $resp['msg'], false];
             }
@@ -53,13 +57,18 @@ class RefillPhone extends refill\IRefillPhone
         $content = $params['merid'] . $params['merchantorderId'] . $params['ts'] . config::KEY;
         $params['sign'] = md5($content);
         $resp = http_request(config::QUERY_URL, $params , 'POST' , false);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if($resp['code'] == 000) {
-                $order_state = -1;
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif($resp['code'] === '000')
+            {
                 if ($resp['rechargestate'] == 99) {
                     $order_state = ORDER_STATE_SUCCESS;
                     $save['official_sn'] = $resp['orderid'];
@@ -68,12 +77,12 @@ class RefillPhone extends refill\IRefillPhone
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif (in_array($resp['rechargestate'] , [98,2])) {
                     $order_state = ORDER_STATE_SEND;
-                }
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['msg']];
                 }
                 return [true, $order_state];
-            }else{
+            }
+            else {
                 return [false, $resp['msg']];
             }
         }

+ 13 - 9
helper/refill/api/xyz/saihu/RefillOil.php

@@ -42,12 +42,16 @@ class RefillOil extends refill\IRefillOil
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误',true];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['code'] == 0) {
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['code'] == 0) {
                 return [true, $resp['result'], false];
             } else {
                 return [false, $resp['msg'], false];
@@ -62,25 +66,25 @@ class RefillOil extends refill\IRefillOil
         $params['sign'] = md5(config::APP_ID . config::APP_KEY . $refill_info['order_sn']);
 
         $resp = http_request(config::QUERY_URL, $params);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误'];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['code'] == 0)
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['code'] == 0)
             {
-                $order_state = -1;
                 if ($resp['result']['order_state'] == 1) {
                     $order_state = ORDER_STATE_SUCCESS;
                 } elseif ($resp['result']['order_state'] == 9) {
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif ($resp['result']['order_state'] == 0){
                     $order_state = ORDER_STATE_SEND;
-                }
-
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['result']];
                 }
 

+ 78 - 0
helper/refill/api/xyz/shengchuang/RefillCallBack.php

@@ -0,0 +1,78 @@
+<?php
+
+
+namespace refill\shengchuang;
+
+require_once(BASE_HELPER_RAPI_PATH . '/shengchuang/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;
+        }
+    }
+
+    private 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)
+    {
+        ksort($params);
+
+        $body = "";
+        $key = config::APP_KEY;
+        $i = 0;
+        foreach ($params as $k => $v)
+        {
+            if (false === $this->check_empty($v) && "@" != substr($v, 0, 1)) {
+                if ($i == 0) {
+                    $body .= "{$k}" . "=" . urldecode($v);
+                } else {
+                    $body .= "&" . "{$k}" . "=" . urldecode($v);
+                }
+                $i++;
+            }
+        }
+
+        $body .= md5($key);
+        return md5($body);
+    }
+
+    public function notify($params)
+    {
+        $status = intval($params['status']);
+        $order_sn = $params['orderId'];
+
+        $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) {
+            return [$order_id, true, false, true];
+        } elseif ($status === 0) {
+            return [$order_id, false, false, true];
+        } else {
+            return [$order_id, false, false, false];
+        }
+    }
+}

+ 117 - 0
helper/refill/api/xyz/shengchuang/RefillOil.php

@@ -0,0 +1,117 @@
+<?php
+
+
+namespace refill\shengchuang;
+
+require_once(BASE_HELPER_RAPI_PATH . '/shengchuang/config.php');
+
+
+use refill;
+use Log;
+
+class RefillOil extends refill\IRefillOil
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    private function req_params(string $card_no, int $amount, array $other)
+    {
+        $params['userId'] = config::userId;
+        $params['commoditySellId'] = config::commoditySellId;
+        $params['buyNum'] = $amount;
+        $params['shopOrderId'] = $other['order_sn'];
+        $params['json'] =json_encode(['sOilId'=>$card_no]);
+        $params['notifyUrl'] = config::NOTIFY_URL;
+        return $params;
+    }
+
+
+    private function sign($params)
+    {
+        $content = '';
+        $key = config::APP_KEY;
+        ksort($params);
+        $i = 0;
+        foreach ($params as $k => $v)
+        {
+            if (false === $this->check_empty($v) && "@" != substr($v, 0, 1))
+            {
+                if ($i == 0) {
+                    $content .= "{$k}" . "=" . $v;
+                } else {
+                    $content .= "&" . "{$k}" . "=" . $v;
+                }
+
+                $i++;
+            }
+        }
+        $content .= md5($key);
+
+        return md5($content);
+    }
+
+    public function add($card_no, $card_type, $amount, $input)
+    {
+        $params = $this->req_params($card_no, $amount, $input);
+        $sign = $this->sign($params);
+        $params['sign'] = $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['code'] == 0) {
+                return [true, $resp['data']['platformId'], false];
+            } else {
+                return [false, $resp['message'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['orderId'] = $refill_info['order_sn'];
+        $params['userId'] = config::userId;
+        $params['sign'] = $this->sign($params);
+
+        $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, '系统错误'];
+            }
+            elseif ($resp['state'] == 0)
+            {
+                $status = $resp['data']['status'];
+                if (in_array($status, [12,16])) {
+                    $order_state = ORDER_STATE_SUCCESS;
+                } elseif ($status == 13) {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif ($resp['data']['status'] == 0){
+                    $order_state = ORDER_STATE_SEND;
+                } else {
+                    return [false, $resp['statusDesc']];
+                }
+
+                return [true, $order_state];
+            }
+            else {
+                return [false, $resp['message']];
+            }
+        }
+    }
+}

+ 24 - 0
helper/refill/api/xyz/shengchuang/RefillPhone.php

@@ -0,0 +1,24 @@
+<?php
+
+
+namespace refill\shengchuang;
+
+
+use refill\IRefillPhone;
+
+class RefillPhone extends IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    public function add($card_no,$card_type,$amount,$input)
+    {
+        return [false,'No Implement', false];
+    }
+    public function query($refill_info)
+    {
+        return [false,'No Implement'];
+    }
+}

+ 19 - 0
helper/refill/api/xyz/shengchuang/config.php

@@ -0,0 +1,19 @@
+<?php
+
+
+namespace refill\shengchuang;
+
+
+class config
+{
+    const ORDER_URL = 'http://www.hkswif.com/orderApi/orderPay.html';
+    const QUERY_URL = 'http://www.hkswif.com/orderApi/orderQuery.html';
+
+    const userId = '010001617934663602';
+    const APP_KEY = 'ZTDtdrAk3VzXp0kIMW0161';
+
+//    const NOTIFY_URL = BASE_SITE_URL . "/mobile/refill_saihu.php";
+    const NOTIFY_URL = "https://www.xyzshops.cn/mobile/signature.php";
+    const ExtHeaders = ['Content-Type: application/x-www-form-urlencoded'];
+    const commoditySellId = 202101281526122703;
+}

+ 14 - 11
helper/refill/api/xyz/suhcpdd/RefillOil.php

@@ -57,18 +57,19 @@ class RefillOil extends refill\IRefillOil
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL,$params,'POST',false, config::ExtHeaders);
-        if($resp === false) {
+        if (empty($resp)) {
             return [false,'系统错误',true];
         }
         else
         {
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
-            if($resp['state'] == 0) {
-                return [true,$resp['data'], false];
-            }
-            else {
-                return [false,$resp['msg'], false];
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['state'] == 0) {
+                return [true, $resp['data'], false];
+            } else {
+                return [false, $resp['msg'], false];
             }
         }
     }
@@ -84,23 +85,25 @@ class RefillOil extends refill\IRefillOil
 
         Log::record(json_encode($params),Log::DEBUG);
         $resp = http_request(config::ORDER_QUERY_URL,$params,'POST',false,config::ExtHeaders);
-        if($resp === false) {
+        if (empty($resp)) {
             return [false,'系统错误'];
         }
         else
         {
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
-            if($resp['state'] == 0) {
-                $order_state = -1;
+            if (empty($resp)) {
+                return [false,'系统错误'];
+            }
+            elseif($resp['state'] == 0)
+            {
                 if ($resp['status'] == 2) {
                     $order_state = ORDER_STATE_SUCCESS;
                 } elseif ($resp['status'] == 3) {
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif ($resp['status'] == 0){
                     $order_state = ORDER_STATE_SEND;
-                }
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['data']];
                 }
                 return [true, $order_state];

+ 17 - 11
helper/refill/api/xyz/suhctm/RefillOil.php

@@ -57,18 +57,20 @@ class RefillOil extends refill\IRefillOil
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL,$params,'POST',false, config::ExtHeaders);
-        if($resp === false) {
+
+        if (empty($resp)) {
             return [false,'系统错误',true];
         }
         else
         {
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
-            if($resp['state'] == 0) {
-                return [true,$resp['data'], false];
-            }
-            else {
-                return [false,$resp['msg'], false];
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['state'] == 0) {
+                return [true, $resp['data'], false];
+            } else {
+                return [false, $resp['msg'], false];
             }
         }
     }
@@ -83,24 +85,28 @@ class RefillOil extends refill\IRefillOil
         $params['sign'] = $sign;
 
         Log::record(json_encode($params),Log::DEBUG);
+
         $resp = http_request(config::ORDER_QUERY_URL,$params,'POST',false,config::ExtHeaders);
-        if($resp === false) {
+
+        if (empty($resp)) {
             return [false,'系统错误'];
         }
         else
         {
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
-            if($resp['state'] == 0) {
-                $order_state = -1;
+            if (empty($resp)) {
+                return [false,'系统错误'];
+            }
+            elseif($resp['state'] == 0)
+            {
                 if ($resp['status'] == 2) {
                     $order_state = ORDER_STATE_SUCCESS;
                 } elseif ($resp['status'] == 3) {
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif ($resp['status'] == 0){
                     $order_state = ORDER_STATE_SEND;
-                }
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['data']];
                 }
                 return [true, $order_state];

+ 14 - 11
helper/refill/api/xyz/tianjt/RefillOil.php

@@ -60,18 +60,19 @@ class RefillOil extends refill\IRefillOil
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL,$params,'POST',false, config::ExtHeaders);
-        if($resp === false) {
+        if (empty($resp)) {
             return [false,'系统错误',true];
         }
         else
         {
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
-            if($resp['state'] == 0) {
-                return [true,$resp['data'], false];
-            }
-            else {
-                return [false,$resp['msg'], false];
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['state'] == 0) {
+                return [true, $resp['data'], false];
+            } else {
+                return [false, $resp['msg'], false];
             }
         }
     }
@@ -84,23 +85,25 @@ class RefillOil extends refill\IRefillOil
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_QUERY_URL,$params,'POST',false,config::ExtHeaders);
-        if($resp === false) {
+        if (empty($resp)) {
             return [false,'系统错误'];
         }
         else
         {
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
-            if($resp['state'] == 0) {
-                $order_state = -1;
+            if (empty($resp)) {
+                return [false,'系统错误'];
+            }
+            elseif($resp['state'] == 0)
+            {
                 if ($resp['data']['status'] == 2) {
                     $order_state = ORDER_STATE_SUCCESS;
                 } elseif ($resp['data']['status'] == 3) {
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif ($resp['data']['status'] == 0){
                     $order_state = ORDER_STATE_SEND;
-                }
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['data']];
                 }
                 return [true, $order_state];

+ 19 - 10
helper/refill/api/xyz/tonglu/RefillPhone.php

@@ -36,12 +36,16 @@ class RefillPhone extends refill\IRefillPhone
         ];
         $params = json_encode($params);
         $resp = http_post_data(config::ORDER_URL, $params , $header);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误', true];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['state'] == 'ok') {
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['state'] == 'ok') {
                 return [true, '', false];
             } else {
                 return [false, $resp['msg'], false];
@@ -61,13 +65,18 @@ class RefillPhone extends refill\IRefillPhone
         ];
         $params = json_encode($params);
         $resp = http_post_data(config::QUERY_URL, $params , $header);
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '系统错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if($resp['state'] == 'ok') {
-                $order_state = -1;
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif($resp['state'] == 'ok')
+            {
                 $data = $resp['data'];
                 if ($data['order_status'] == 3) {
                     $order_state = ORDER_STATE_SUCCESS;
@@ -77,12 +86,12 @@ class RefillPhone extends refill\IRefillPhone
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif (in_array($data['order_status'] , [-1,0,1,2])) {
                     $order_state = ORDER_STATE_SEND;
-                }
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['msg']];
                 }
                 return [true, $order_state];
-            }else{
+            }
+            else {
                 return [false, $resp['msg']];
             }
         }

+ 23 - 11
helper/refill/api/xyz/tongy/RefillPhone.php

@@ -37,12 +37,17 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误', true];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['Code'] == 10012) {
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['Code'] == 10012) {
                 return [true, $resp['SysOrderId'], false];
             } else {
                 return [false, $resp['Message'], false];
@@ -58,26 +63,33 @@ class RefillPhone extends refill\IRefillPhone
         $params['Timestamp'] = $this->getMillisecond();
         $content = $params['ShopId'] . $params['UserId'] . $params['OrderId'] . $params['Timestamp'] . config::KEY;
         $params['sign'] = md5($content);
+
         $resp = http_request(config::QUERY_URL, $params , 'POST' , false);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['Code'] == 10023) {
-                $order_state = -1;
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['Code'] == 10023)
+            {
                 if ($resp['State'] == 4) {
                     $order_state = ORDER_STATE_SUCCESS;
                 } elseif ($resp['State'] == 5) {
                     $order_state = ORDER_STATE_CANCEL;
-                }elseif ($resp['State'] == 0) {
+                } elseif ($resp['State'] == 0) {
                     $order_state = ORDER_STATE_SEND;
-                }
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['Message']];
                 }
                 return [true, $order_state];
-            } else {
+            }
+            else {
                 return [false, $resp['Message']];
             }
         }

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

@@ -36,8 +36,8 @@ class RefillCallBack implements refill\IRefillCallBack
         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) {

+ 24 - 14
helper/refill/api/xyz/wantong/RefillPhone.php

@@ -22,7 +22,7 @@ class RefillPhone extends refill\IRefillPhone
         $params['orderid'] = $order_sn;
         $params['price'] = $amount;
         $params['teltype'] = $this->phone_type($phone);
-        $params['timeout'] = 300;
+        $params['timeout'] = config::NotifyTimeout;
         $params['notify'] = config::NOTIFY_URL;
         $params['time'] = time();
         $params['rand'] = rand(100000, 999999);
@@ -37,15 +37,17 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params, 'POST', false);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误', true];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp == false) {
+            if (empty($resp)) {
                 return [false, '系统错误', true];
-            }
-            if ($resp['code'] == 0) {
+            } elseif ($resp['code'] == 0) {
                 return [true, $resp['order_id'], false];
             } else {
                 return [false, $resp['msg'], false];
@@ -60,13 +62,22 @@ class RefillPhone extends refill\IRefillPhone
 
         $content = $params['mchid'] . $params['orderid'] . config::KEY;
         $params['sign'] = md5($content);
+
         $resp = http_request(config::QUERY_URL, $params, 'POST', false);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['code'] == 100) {
+
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['code'] == 100)
+            {
                 $status = $resp['status'];
                 if ($status == 3) {
                     $order_state = ORDER_STATE_SUCCESS;
@@ -77,13 +88,12 @@ class RefillPhone extends refill\IRefillPhone
                 } elseif (in_array($status, [1, 2])) {
                     $order_state = ORDER_STATE_SEND;
                 } else {
-                    $order_state = -1;
-                }
-                if ($order_state == -1) {
                     return [false, $resp['data']];
                 }
+
                 return [true, $order_state];
-            } else {
+            }
+            else {
                 return [false, $resp['msg']];
             }
         }
@@ -105,7 +115,7 @@ class RefillPhone extends refill\IRefillPhone
             return 0;
         } elseif ($card_type == mtopcard\ChinaUnicomCard) {
             return 1;
-        } elseif ($card_type == mtopcard\ChinaTelecomCard) {
+        } else { // ($card_type == mtopcard\ChinaTelecomCard)
             return 2;
         }
     }

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

@@ -1,5 +1,5 @@
 http://mm.jm618.cn/account/profile
-商户id  10016
+商户id  10037
 密码123456
 
 话费充值接口文档

+ 4 - 4
helper/refill/api/xyz/wantong/config.php

@@ -9,8 +9,8 @@ class config
     const ORDER_URL = 'https://mm.jm618.cn/api/telpay';
     const QUERY_URL = 'https://mm.jm618.cn/api/telpay/query';
 
-    const MCHID = 10016;
-    const KEY = '06be014a9c14b12d893663bff36372ba';
-//    const NOTIFY_URL = BASE_SITE_URL . "/mobile/refill_wantong.php";
-    const NOTIFY_URL = "https://www.xyzshops.cn/mobile/signature.php";
+    const MCHID = 10037;
+    const KEY = '7ad5f64b90f7f02a30fbd26641195f58';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/refill_wantong.php";
+    const NotifyTimeout = 7200;
 }

+ 18 - 9
helper/refill/api/xyz/weit/RefillPhone.php

@@ -36,13 +36,17 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params , 'POST');
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误', true];
         }
-        else {
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['code'] == 0) {
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['code'] == 0) {
                 return [true, $resp['pt_order_id'], false];
             } else {
                 return [false, $resp['msg'], false];
@@ -61,28 +65,33 @@ class RefillPhone extends refill\IRefillPhone
         $params['rand'] = rand(100000,999999);
         $content = $params['mchid'] . $params['pt_order_id'] . $params['mch_order_id'] . $params['op_order_id'] . $params['tel'] . $params['time'] . $params['rand'] . config::KEY;
         $params['sign'] = md5($content);
+
         $resp = http_request(config::QUERY_URL, $params , 'POST');
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误'];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['code'] == 0) {
-                $order_state = -1;
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['code'] == 0)
+            {
                 if ($resp['data']['status'] == 1) {
                     $order_state = ORDER_STATE_SUCCESS;
                 } elseif ($resp['data']['status'] == 0) {
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif ($resp['data']['status'] == 2){
                     $order_state = ORDER_STATE_SEND;
-                }
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['data']];
                 }
                 return [true, $order_state];
-            } else {
+            }
+            else {
                 return [false, $resp['msg']];
             }
         }

+ 21 - 11
helper/refill/api/xyz/weiyi/RefillPhone.php

@@ -35,13 +35,19 @@ class RefillPhone extends refill\IRefillPhone
         $params['chargeSign'] = $sign;
 
         $params = json_encode($params);
+
         $resp = http_post_data(config::ORDER_URL, $params , config::ExtHeaders);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误', true];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if ($resp['code'] == 0000) {
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['code'] === '0000') {
                 return [true, '', false];
             } else {
                 return [false, $resp['desc'], false];
@@ -57,21 +63,25 @@ class RefillPhone extends refill\IRefillPhone
         $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 ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            $order_state = -1;
-            if ($resp['code'] == 0000) {
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            } elseif ($resp['code'] === '0000') {
                 $order_state = ORDER_STATE_SUCCESS;
-            } elseif ($resp['code'] == 0004) {
+            } elseif ($resp['code'] === '0004') {
                 $order_state = ORDER_STATE_CANCEL;
-            } elseif ($resp['code'] == 0002 || $resp['code'] == 0003) {
+            } elseif ($resp['code'] === '0002' || $resp['code'] === '0003') {
                 $order_state = ORDER_STATE_SEND;
-            }
-            if ($order_state == -1) {
+            } else {
                 return [false, $resp['desc']];
             }
             return [true, $order_state];

+ 16 - 14
helper/refill/api/xyz/xc/RefillPhone.php

@@ -30,18 +30,20 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $this->sign($params);
 
         $resp = http_request(config::ORDER_URL,$params,'POST');
-        if($resp === false) {
+
+        if (empty($resp)) {
             return [false,'系统错误',true];
         }
         else
         {
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
-            if($resp['code'] == 200 && $resp['result'] == 'success') {
-                return [true,'', false];
-            }
-            else {
-                return [false,$resp['info'], false];
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['code'] == 200 && $resp['result'] == 'success') {
+                return [true, '', false];
+            } else {
+                return [false, $resp['info'], false];
             }
         }
     }
@@ -54,15 +56,17 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::QUERY_ORDER_URL, $params, 'POST');
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '系统错误'];
         } 
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-
-            $order_state = -1;
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
             $status = $resp['data']['status'];
             if ($status == 1) {
                 $order_state = ORDER_STATE_SUCCESS;
@@ -72,13 +76,11 @@ class RefillPhone extends refill\IRefillPhone
                 $order_state = ORDER_STATE_CANCEL;
             } elseif ($status == 2) {
                 $order_state = ORDER_STATE_SEND;
-            }
-
-            if ($order_state == -1) {
-                return [false, $resp['info']];
             } else {
-                return [true, $order_state];
+                return [false, $resp['info']];
             }
+
+            return [true, $order_state];
         }
     }
 

+ 18 - 10
helper/refill/api/xyz/xunyin/RefillPhone.php

@@ -34,13 +34,19 @@ class RefillPhone extends refill\IRefillPhone
         $params = $this->req_params($card_no, $amount, $order_sn);
         $sign = $this->sign($params);
         $params['sign'] = $sign;
+
         $resp = http_request(config::PAY_PHONE_URL, $params);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '网络错误', true];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = $this->xmlToArray($resp);
-            if ($resp['Code'] === '0000') {
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            } elseif ($resp['Code'] === '0000') {
                 return [true, $resp['order_no'], false];
             } else {
                 return [false, $resp['msg'], false];
@@ -54,14 +60,19 @@ class RefillPhone extends refill\IRefillPhone
         $params['cpid'] = config::CP_ID;
         $content = $params['cpid'] . $params['OrderID'] . config::KEY;
         $params['sign'] = md5($content);
+
         $resp = http_request(config::QUERY_URL, $params);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '网络错误'];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = $this->xmlToArray($resp);
-
-            if ($resp['state'] === '8888') {
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            } elseif ($resp['state'] === '8888') {
                 $order_state = ORDER_STATE_SUCCESS;
                 $updata['official_sn'] = $resp['operatorid'];
                 Model('refill_order')->edit($refill_info['order_id'], $updata);
@@ -70,9 +81,6 @@ class RefillPhone extends refill\IRefillPhone
             } elseif ($resp['state'] === '0000') {
                 $order_state = ORDER_STATE_SEND;
             } else {
-                $order_state = -1;
-            }
-            if ($order_state == -1) {
                 return [false, $resp['msg']];
             }
             return [true, $order_state];

+ 8 - 6
helper/refill/api/xyz/yifa/RefillPhone.php

@@ -34,17 +34,19 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL,$params,'POST',false,config::ExtHeaders);
-        if($resp === false) {
+
+        if (empty($resp)) {
             return [false,'系统错误',true];
         }
 
         $resp = json_decode($resp,true);
-        if($resp['code'] == 10000 && $resp['message'] == 'success') {
+        if (empty($resp)) {
+            return [false, '系统错误', true];
+        } elseif ($resp['code'] == 10000 && $resp['message'] == 'success') {
             $result = $resp['result'];
-            return [true,$result['order_sn'], false];
-        }
-        else {
-            return [false,$resp['message'], false];
+            return [true, $result['order_sn'], false];
+        } else {
+            return [false, $resp['message'], false];
         }
     }
 

+ 9 - 4
helper/refill/api/xyz/yunling/RefillPhone.php

@@ -44,14 +44,16 @@ class RefillPhone extends refill\IRefillPhone
 
         $resp = http_request(config::ORDER_URL, $params);
 
-        if ($resp === false) {
+        if (empty($resp)) {
             return [false, '网络错误', true];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = $this->xmlToArray($resp);
-
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            }
             $resultno = intval($resp['resultno']);
             if (in_array($resultno, [0,1,2])) {
                 return [true, $resp['orderid'], false];
@@ -67,14 +69,17 @@ class RefillPhone extends refill\IRefillPhone
         $params['userid'] = config::USER_ID;
 
         $resp = http_request(config::QUERY_URL, $params);
-        if ($resp === false) {
+
+        if (empty($resp)) {
             return [false, '网络错误'];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = $this->xmlToArray($resp);
-
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            }
             $resultno = intval($resp['resultno']);
             if ($resultno === 1) {
                 $order_state = ORDER_STATE_SUCCESS;

+ 18 - 14
helper/refill/api/xyz/zzx/RefillOil.php

@@ -52,18 +52,20 @@ class RefillOil extends refill\IRefillOil
         $params['sign'] = $sign;
 
         $resp = http_post_data(config::ORDER_URL,json_encode($params),config::ExtHeaders);
-        if($resp === false) {
+
+        if (empty($resp)) {
             return [false,'系统错误',true];
         }
         else
         {
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
-            if($resp['code'] == 0000 && $resp['respCode'] == 1111) {
-                return [true,$resp['msg'], false];
-            }
-            else {
-                return [false,$resp['msg'], false];
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['code'] === '0000' && $resp['respCode'] === '1111') {
+                return [true, $resp['msg'], false];
+            } else {
+                return [false, $resp['msg'], false];
             }
         }
     }
@@ -75,21 +77,23 @@ class RefillOil extends refill\IRefillOil
         $params['sign'] = $this->sign($params);
 
         $resp = http_post_data(config::QUERY_URL,json_encode($params),config::ExtHeaders);
-        if($resp === false) {
+
+        if (empty($resp)) {
             return [false,'系统错误'];
         }
-        else {
+        else
+        {
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
-            $order_state = -1;
-            if ($resp['code'] == 0000) {
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            } elseif ($resp['code'] === '0000') {
                 $order_state = ORDER_STATE_SUCCESS;
-            } elseif ($resp['code'] == 0004) {
+            } elseif ($resp['code'] === '0004') {
                 $order_state = ORDER_STATE_CANCEL;
-            } elseif ($resp['code'] == 0005){
+            } elseif ($resp['code'] === '0005') {
                 $order_state = ORDER_STATE_SEND;
-            }
-            if ($order_state == -1) {
+            } else {
                 return [false, $resp['msg']];
             }
             return [true, $order_state];

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

@@ -38,7 +38,7 @@ class Quality
     public function find_quality($mchid,$card_type,$quality,$times,$used_time): array
     {
         if($card_type == mtopcard\ChinaMobileCard || $card_type == mtopcard\ChinaUnicomCard || $card_type == mtopcard\ChinaTelecomCard) {
-            return $this->mobile_quality($mchid,$quality,$times,$used_time);
+            return $this->mobile_quality($mchid, $quality, $times, $used_time);
         }
         elseif($card_type == mtopcard\PetroChinaCard || $card_type == mtopcard\SinopecCard) {
             return [1, [1]];
@@ -73,7 +73,7 @@ class Quality
         elseif(array_key_exists($quality,$this->mQualities)) {
             $org = $quality;
             $qualities = $this->mQualities[$quality];
-            [$sucdess,$setting_quality,$time_out] = $this->mMchctl->getCtls($mchid);
+            [$sucdess, $setting_quality, $time_out] = $this->mMchctl->getCtls($mchid);
         }
         else {
             Log::record("find_quality: cannot find any quality",Log::DEBUG);

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

@@ -6,6 +6,7 @@ namespace refill;
 use Log;
 use rbridge\RBridgeFactory;
 use StatesHelper;
+use mtopcard;
 
 class policy extends ProviderManager implements IPolicy
 {
@@ -13,6 +14,7 @@ class policy extends ProviderManager implements IPolicy
     protected $mMchctl;
     protected $mQuality;
     protected $mPrices;
+    protected $mAmountLockTurn;
 
     public function __construct()
     {
@@ -31,8 +33,13 @@ class policy extends ProviderManager implements IPolicy
         $this->mMchctl->load();
         $this->mQuality->load();
         $this->mPrices->load();
+
+        $turn_name = 'oil_amount_lock_turn';
+        $this->mAmountLockTurn = rkcache($turn_name);
+        Log::record("AmountLockTurn = {$this->mAmountLockTurn}",Log::DEBUG);
     }
 
+
     public function find_providers(int $spec, int $card_type,int $quality): array
     {
         $providers = parent::find_providers($spec,$card_type,$quality);
@@ -114,7 +121,18 @@ class policy extends ProviderManager implements IPolicy
 
     public function allow($mchid,$card_type,$amount,$quality) : bool
     {
-        $reader = function () {
+        if(empty($this->mAmountLockTurn)) {
+            return true;
+        }
+        else {
+            return util::get_amount_lock($mchid) > 0;
+        }
+    }
+
+    private function allow_storge($mchid,$card_type,$amount,$quality)
+    {
+        $reader = function ()
+        {
             $cache = rcache("refill_able",'merchant-');
             if(!empty($cache)) {
                 $result = unserialize($cache['data']);
@@ -159,7 +177,6 @@ class policy extends ProviderManager implements IPolicy
         $mchid = $refill_info['mchid'];
         $mch_info = Model('merchant')->getMerchantInfo(['mchid' => $mchid]);
 
-
         [$params, $sign] = $this->body($state, $refill_info, $mch_info);
         $params['sign'] = $sign;
 
@@ -188,12 +205,39 @@ class policy extends ProviderManager implements IPolicy
             'message' => $refill_info['err_msg'] ?? "",
             "state" => $state];
 
+        [$has_sms,$sms] = $this->sms($refill_info);
+        if($has_sms) {
+            $params['sms'] = $sms;
+        }
+
         $secure_key = $mch_info['secure_key'];
         $sign = $this->sign($params, $secure_key);
 
         return [$params, $sign];
     }
 
+    private function sms($refill_info)
+    {
+        $mchids = [10116];
+        $mchid = $refill_info['mchid'];
+        $official_sn = $refill_info['official_sn'] ?? "";
+        $card_type = $refill_info['card_type'];
+        $card_no = $refill_info['card_no'];
+        $amount = intval($refill_info['refill_amount']);
+
+        if(in_array($mchid,$mchids) && !empty($official_sn) && $card_type == mtopcard\SinopecCard && !empty($card_no))
+        {
+            $short_no = substr($card_no,-6);
+            $ret = preg_match('/\d{4}(?P<month>\d{2})(?P<day>\d{2})(?P<hour>\d{2})(?P<min>\d{2})\d{4}/u', $official_sn, $matches);
+            if($ret > 0) {
+                $sms = "【中国石化】您尾号为{$short_no}的加油卡于{$matches['month']}月{$matches['day']}日 {$matches['hour']}时{$matches['min']}分充值成功,金额{$amount}元,订单号:{$official_sn}";
+                return [true,$sms];
+            }
+        }
+
+        return [false,''];
+    }
+
     private function sign($params, $key)
     {
         ksort($params);

+ 36 - 2
helper/refill/util.php

@@ -37,13 +37,13 @@ class util
             } else {
                 $latest = current($result);
                 $cur = time();
-                $success = ($cur - $latest) > 120;
+                $success = ($cur - $latest) > 2;
 
                 if ($success) {
                     wcache("card_expired", [$card_no => time()], '');
                 }
 
-                return [$success, $latest + 120 - $cur];
+                return [$success, $latest + 2 - $cur];
             }
         } else {
             return [true, 0];
@@ -366,4 +366,38 @@ class util
 
         return intval($value);
     }
+
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    public static function incr_amount_lock($mchid, $card_type, $spec)
+    {
+        if ($card_type == mtopcard\SinopecCard || $card_type == mtopcard\PetroChinaCard) {
+            $ins = Cache::getInstance('cacheredis');
+            $name = 'mechant_amount_lock';
+            return $ins->hIncrBy($name, "{$mchid}", intval($spec));
+        }
+    }
+
+    public static function decr_amount_lock($mchid, $card_type, $spec)
+    {
+        if ($card_type == mtopcard\SinopecCard || $card_type == mtopcard\PetroChinaCard) {
+            $ins = Cache::getInstance('cacheredis');
+            $name = 'mechant_amount_lock';
+            return $ins->hIncrBy($name, "{$mchid}", -1 * intval($spec));
+        }
+    }
+
+    public static function set_amount_lock($mchid, $spec)
+    {
+        $ins = Cache::getInstance('cacheredis');
+        $name = 'mechant_amount_lock';
+        return $ins->hIncrBy($name, "{$mchid}", intval($spec));
+    }
+
+    public static function get_amount_lock($mchid)
+    {
+        $ins = Cache::getInstance('cacheredis');
+        $name = 'mechant_amount_lock';
+        return $ins->hget($name, '', "{$mchid}");
+    }
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 }

+ 6 - 2
helper/refill_proxy.php

@@ -17,13 +17,17 @@ class refill_proxy
         $params['sign'] = md5($body);
 
         $resp = $this->http_request($url,$params,'POST');
-        if($resp === false) {
+        if(empty($resp)) {
             return [false,'网络错误'];
         }
 
         $resp = json_decode($resp,true);
         $code = $resp['code'];
-        if($resp['code'] == 200) {
+
+        if(empty($resp)) {
+            return [false,'网络错误'];
+        }
+        elseif($code == 200) {
             return [$code,'success'];
         }
         else {

+ 1 - 0
mobile/control/refill.php

@@ -190,6 +190,7 @@ class refillControl extends merchantControl
         $result['order_time'] = $refill_info['order_time'];
         $result['success_time'] = $refill_info['notify_time'];
         $result['order_state'] = $order_info['order_state'];
+        $result['official_sn'] = $refill_info['official_sn'] ?? "";
 
         return $result;
     }

+ 4 - 0
mobile/refill_wantong.php

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

+ 2 - 1
shop/control/card_keylist.php

@@ -13,6 +13,7 @@ class card_keylistcontrol extends BaseSellerControl
     public function listOp()
     {
         $mod_card = Model('card_key');
+        $condition['store_id'] = $_SESSION['store_id'];
         if (!empty($_GET['card_type'])) {
             $condition['card_type'] = $_GET['card_type'];
         }
@@ -41,7 +42,7 @@ class card_keylistcontrol extends BaseSellerControl
 
     public function statsOp()
     {
-        $condition = ['card_id' => ['gt', 0]];
+        $condition['store_id'] = $_SESSION['store_id'];
         $start_unixtime = intval(strtotime($_GET['query_start_time']));
         $end_unixtime   = intval(strtotime($_GET['query_end_time']));
 

+ 13 - 0
test/TestRedis.php

@@ -191,6 +191,19 @@ class TestRedis extends TestCase
         $resp = json_decode('',true);
     }
 
+    public function testFormat()
+    {
+        $body = 'a2421040915130540';
+        $ret = preg_match('/^\d{4}(?P<month>\d{2})(?P<day>\d{2})(?P<hour>\d{2})(?P<min>\d{2})\d{4}/u', $body, $matches);
+
+        $short_no = substr('1000115100002086143',-6);
+
+        $x = 'http://www.sina.com.cn';
+        $y = urlencode($x);
+
+
+    }
+
     public static function tearDownAfterClass() : void
     {
 

+ 9 - 5
test/TestRefill.php

@@ -387,7 +387,11 @@ class TestRefill extends TestCase
     {
         $providers = new refill\wantong\RefillPhone([]);
         $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
-//        $resp = $providers->query(['order_sn' => '50261617199864602428']);
+        $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
+//        $resp = $providers->query(['order_sn' => '62851617873564694325']);
+//        $data = '{"order_id":"48751617849306859783","mchid":"10037","tel":"13699279618","price":"30.00","sign":"fbe70d8366736ccb0e2467f7130fc4b2","status":"0","out_order_id":"0"}';
+//        $input = json_decode($data, true);
+//        refill\RefillFactory::instance()->notify('wantong',$input);
     }
 
     public function testXunyinPhone()
@@ -428,11 +432,11 @@ class TestRefill extends TestCase
     public function testYunlingPhone()
     {
         $providers = new refill\yunling\RefillPhone([]);
-//        $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
+        $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
 //        $resp = $providers->query(['order_sn' => '40241617777847227476']);
-        $data = '{"userid":"10073505","sporderid":"40241617777847227476","orderid":"0F45757A7306D35973505","resultno":"9","merchantsubmittime":"20210407144751","ordermoney":"47.8","verifystring":"f42ac17164d5b0105b0a2f4a720892fc","sign":"4cd75d9f0c796eb1694ded9531ce5de1"}';
-        $input = json_decode($data, true);
-        refill\RefillFactory::instance()->notify('yunling',$input);
+//        $data = '{"userid":"10073505","sporderid":"7761230671186470456129","orderid":"8BE7B813A399AD2173505","resultno":"1","merchantsubmittime":"20210408084145","ordermoney":"28.68","verifystring":"28711bba302fadf95387b1d863d47a98","sign":"2e49e034ead64880f4fd605e378dd42b","supnumber":"510568880044465061"}';
+//        $input = json_decode($data, true);
+//        refill\RefillFactory::instance()->notify('yunling',$input);
     }
 
     public function testLingzhPhone()