浏览代码

Merge branch 'raccount' into rchannel

xiaoyu 3 年之前
父节点
当前提交
d721c715d5

+ 13 - 13
admin/control/merchant.php

@@ -9,6 +9,7 @@ defined('InShopNC') or exit('Access Invalid!');
 include(BASE_CONFIG_PATH . CONFIG_PREFIX . '/refill.ini.php');
 require_once(BASE_HELPER_PATH . '/stat_helper.php');
 require_once(BASE_ROOT_PATH . '/helper/refill/functional.php');
+require_once(BASE_HELPER_PATH . '/task/task_helper.php');
 
 class merchantControl extends SystemControl
 {
@@ -1051,20 +1052,19 @@ class merchantControl extends SystemControl
         if (empty($stats_data)) {
             showMessage('对应数据不存在', '');
         }
-        $refill = new statistics\stat_refill();
-        try {
-            $trans = new trans_wapper($mod_stat, __METHOD__);
-            //更新新数据
-            if ($stats_data['type'] == 'merchant') {
-                $refill->merchant_stat($stats_data['time_stamp'], $stats_data['cid'], $stats_data['order_time_type']);
-            } elseif ($stats_data['type'] == 'provider') {
-                $refill->provider_stat($stats_data['time_stamp'], $stats_data['cid'], $stats_data['order_time_type']);
-            }
-            $trans->commit();
+        $cond = [
+            'type' => $stats_data['type'],
+            'time_stamp' => $stats_data['time_stamp'],
+            'cid' => $stats_data['cid'],
+            'order_time_type' => $stats_data['order_time_type']
+        ];
+        $manager = new task\manager();
+
+        $task = $manager->add_task('order_stat_reload',$cond,0,3600);
+        if ($task->completed() && $task->success()) {
             showMessage('操作成功');
-        } catch (Exception $e) {
-            $trans->rollback();
-            showMessage('操作失败');
+        } else {
+            showMessage("操作成功,后台任务已开始重新统计,请稍后查看新数据");
         }
     }
 

+ 39 - 26
admin/control/ordersendlist.php

@@ -118,7 +118,7 @@ class ordersendlistControl extends SystemControl
             return;
         }
         if (!empty($_GET['export'])) {
-            $this->RefillOrderExport($orders_cond, 'time_out_order');
+            $this->RefillOrderExport($orders_cond, '商户超时监控导出', 'time_out_order');
             return;
         }
         $store_ids = Model('')->table('refill_order,vr_order,merchant')
@@ -138,8 +138,8 @@ class ordersendlistControl extends SystemControl
         }else{
             $order_count = $merchant_stat[$_GET['mchid']]['order_count'];
         }
-        $fields = 'refill_order.*,vr_order.order_state';
-        $order_by = "( {$cur_time} - refill_order.commit_time ) desc";
+        $fields = "refill_order.*,vr_order.order_state,( {$cur_time} - refill_order.order_time - merchant.time_out ) as mtime_out";
+        $order_by = "( {$cur_time} - refill_order.order_time - merchant.time_out ) desc";
         $order_list = $model_refill_order->getMerchantTimeOut($orders_cond, 200, $order_count, $fields, $order_by);
 
         $special_stat = $this->extra_stats($base_cond, $timeout_type,$cur_time);
@@ -294,7 +294,7 @@ class ordersendlistControl extends SystemControl
             return;
         }
         if (!empty($_GET['export'])) {
-            $this->RefillOrderExport($orders_cond, 'time_out_order');
+            $this->RefillOrderExport($orders_cond, '渠道回调超时导出', 'time_out_order');
             return;
         }
 
@@ -395,7 +395,7 @@ class ordersendlistControl extends SystemControl
         echo json_encode(['special_stat' => $special_stat, 'order_stat' =>$order_stat]);
     }
 
-    private function RefillOrderExport($cond,$type='order')
+    private function RefillOrderExport($cond, $method_name = '', $type='order')
     {
         $result = [];
         if($type == 'order') {
@@ -404,10 +404,10 @@ class ordersendlistControl extends SystemControl
         }elseif($type == 'time_out_order'){
             $result = Model('refill_order')->getAllTimeOutOrders($cond);
         }
-        $this->createExcel($result);
+        $this->createExcel($result, $method_name);
     }
 
-    private function createExcel($data = array())
+    private function createExcel($data = [], $method_name = '')
     {
         Language::read('export');
         import('libraries.excel');
@@ -428,7 +428,7 @@ class ordersendlistControl extends SystemControl
         $excel_data[0][] = array('styleid' => 's_title', 'data' => '订单状态');
         $excel_data[0][] = array('styleid' => 's_title', 'data' => '扣款金额');
         //data
-        foreach ((array)$data as $k => $v) {
+        foreach ((array)$data as $v) {
             $tmp = array();
             $tmp[] = array('data' => $v['mchid']);
             $tmp[] = array('data' => $v['mch_order']);
@@ -451,8 +451,7 @@ class ordersendlistControl extends SystemControl
         $excel_data = $excel_obj->charset($excel_data, CHARSET);
         $excel_obj->addArray($excel_data);
         $excel_obj->addWorksheet($excel_obj->charset(L('exp_od_order'), CHARSET));
-        $excel_obj->generateXML($excel_obj->charset(L('exp_od_order'), CHARSET) . date('Y-m-d-H', time()));
-        exit;
+        $excel_obj->generateXML($method_name . date('Y-m-d-H', time()));
     }
 
     public function neterr_orderOp()
@@ -465,22 +464,34 @@ class ordersendlistControl extends SystemControl
         $condition['refill_order.neterr'] = 1;
         $condition['vr_order.order_state'] = ORDER_STATE_PAY;
 
+        $cur_time = time();
+        $start_day = strtotime("-5 days",$cur_time);
+        $condition['vr_order.add_time&vr_order.add_time'] = ['_multi' => true,
+            ['egt', $start_day],
+            ['lt', $cur_time]];
+        $condition['refill_order.order_time&refill_order.order_time'] = ['_multi' => true,
+            ['egt', $start_day],
+            ['lt', $cur_time]];
+        if (!empty($_GET['order_query'])) {
+            $this->updateOrderSend($condition);
+            return;
+        }
         if (!empty($_GET['export'])) {
-            $this->RefillOrderExport($condition);
+            $this->RefillOrderExport($condition, '网络错误订单导出');
             return;
         }
-        $order_stat = Model('')->table('refill_order,vr_order')
-            ->join('inner')
-            ->on('refill_order.order_id=vr_order.order_id')
-            ->field('count(*) as order_count')
-            ->where($condition)->find();
-        $order_list = $model_refill_order->getMerchantOrderList($condition, 200, $order_stat['order_count'],'refill_order.*,vr_order.order_state', 'refill_order.order_time asc');
-        $merchant_list = Model('')->table('merchant')->limit(1000)->order('name asc')->select();
-        $order_list = $this->orderFormat($order_list, $merchant_list);
 
+        $merchant_list = $this->merchants();
         $provider_list = $this->providers();
+        //耗时
+        $fields = "refill_order.*,vr_order.order_state";
+        $order_by = "refill_order.commit_time asc";
+        [$special_stat, $order_stat] = $this->provider_timeout_stats($condition, $provider_list);
+        $order_list = $model_refill_order->getMerchantOrderList($condition, 200, $order_stat['order_count'],$fields, $order_by);
+        $order_list = $this->orderFormat($order_list, $merchant_list);
+
         Tpl::output('stat', $order_stat);
-        Tpl::output('provider_list', $provider_list);
+        Tpl::output('special_stat', $special_stat);
         Tpl::output('order_list', $order_list);
         Tpl::output('show_page', $model_refill_order->showpage());
         Tpl::showpage('refill.order.neterr.index');
@@ -545,6 +556,9 @@ class ordersendlistControl extends SystemControl
                 $total_diff_time = $cur_time - $order_info['order_time'];
                 $diff_time = $cur_time - $order_info['commit_time'];
             }
+            if($order_info['mtime_out'] > 0) {
+                $order_list[$order_id]['mtime_out_text'] = $this->elapse_time($order_info['mtime_out']);
+            }
 
             $order_list[$order_id]['diff_time'] = $diff_time;
             $order_list[$order_id]['diff_time_text'] = $this->elapse_time($diff_time);
@@ -599,18 +613,17 @@ class ordersendlistControl extends SystemControl
         }
         $cur_time = time();
         $time = $_GET['time'] * 3600;
-        $condition['refill_order.order_time'] = [['gt', ($cur_time - $time)], ['lt', $cur_time], 'and'];
-        $condition['vr_order.add_time'] = [['gt', ($cur_time - $time)], ['lt', $cur_time], 'and'];
+        $condition['refill_order.order_time'] = [['egt', ($cur_time - $time)], ['lt', $cur_time], 'and'];
+        $condition['vr_order.add_time'] = [['egt', ($cur_time - $time)], ['lt', $cur_time], 'and'];
 
         $notify_time = $_GET['notify_time'];
         if($notify_time > 0) {
             $start_day = strtotime("-5 days",$cur_time);
-            $condition['refill_order.notify_time'] = ['lt', ($cur_time - $notify_time)];
-            $condition['refill_order.notify_time'] = [['gt', $start_day], ['lt', ($cur_time - $notify_time)], 'and'];
+            $condition['refill_order.notify_time'] = [['egt', $start_day], ['lt', ($cur_time - $notify_time)], 'and'];
         }
 
-        $order_list = $model_refill_order->getMerchantOrderList($condition, 200, 0,'refill_order.*,vr_order.order_state', 'refill_order.notify_time asc', 1000);
-        $merchant_list = Model('')->table('merchant')->limit(1000)->order('name asc')->select();
+        $order_list = $model_refill_order->getMerchantOrderList($condition, 200, 1000,'refill_order.*,vr_order.order_state', '', 1000);
+        $merchant_list = $this->merchants();
         $order_list = $this->orderFormat($order_list, $merchant_list);
 
         Tpl::output('order_list', $order_list);

+ 14 - 0
admin/control/provider.php

@@ -148,6 +148,15 @@ class providerControl extends SystemControl
         if(!empty($_GET['provider_id'])) {
             $condition['provider_id'] = $_GET['provider_id'];
         }
+        $start_unixtime = intval(strtotime($_GET['query_start_time']));
+        $end_unixtime = intval(strtotime($_GET['query_end_time']));
+        if ($start_unixtime > 0 && $end_unixtime > $start_unixtime) {
+            $condition['add_time'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
+        } elseif ($start_unixtime > 0) {
+            $condition['add_time'] = ['egt', $start_unixtime];
+        } elseif ($end_unixtime > 0) {
+            $condition['add_time'] = ['lt', $end_unixtime];
+        }
         $provider_list = $this->providers();
         foreach ($provider_list as $provider) {
             $providers[$provider['provider_id']] = $provider;
@@ -158,6 +167,11 @@ class providerControl extends SystemControl
             $list[$key]['provider_name'] = $providers[$value['provider_id']]['name'];
             $list[$key]['store_name'] = $providers[$value['provider_id']]['store_name'];
         }
+        $stat = Model()->table('provider_amount')
+            ->where($condition)
+            ->field('sum(amount) as amounts')
+            ->find();
+        Tpl::output('stat', $stat);
         Tpl::output('provider_list', $providers);
         Tpl::output('show_page', $mod->showpage());
         Tpl::output('info_list', $list);

+ 7 - 0
admin/templates/default/merchant.ctl.php

@@ -122,6 +122,13 @@
                             <option value="3600" <?php if ($output['retry_times']['lower_ratio']['period'] == 3600) {
                                 echo 'selected';
                             } ?>>3600
+                            <option value="86400" <?php if ($output['retry_times']['lower_ratio']['period'] == 86400) {
+                                echo 'selected';
+                            } ?>>当天
+                            </option>
+                            <option value="7200" <?php if ($output['retry_times']['lower_ratio']['period'] == 7200) {
+                                echo 'selected';
+                            } ?>>7200
                             </option>
                             <option value="1800" <?php if ($output['retry_times']['lower_ratio']['period'] == 1800) {
                                 echo 'selected';

+ 3 - 12
admin/templates/default/merchant.ratios.php

@@ -16,7 +16,7 @@
     }
     #tablee tbody {
         display:block;
-        height: 600px;
+        height: 1000px;
         overflow-y:scroll;
     }
     #tablee thead,
@@ -39,7 +39,7 @@
         top: 115px!important;
     }
     .tbodyd tr:last-child   {
-        margin-bottom: 550px;
+        margin-bottom: 950px;
     }
 </style>
 <div class="page">
@@ -80,7 +80,7 @@
     </form>
     <form method="post" id="merchant_name_form" class="scrollTable">
         <input type="hidden" name="form_submit" value="ok"/>
-        <div id='scrollTable' class="fixed-bar">
+        <div id='scrollTable' class="fixed-bar"  style="background: transparent">
             <table class="table tb-type2" id="tablee">
                 <thead>
                 <tr class="thead">
@@ -147,15 +147,6 @@
                         <td colspan="8"><?php echo $lang['nc_no_record']; ?></td>
                     </tr>
                 <?php } ?>
-                </tbody>
-                <tfoot>
-                <tr class="tfoot">
-                    <td></td>
-                    <td colspan="8">
-                        <div class="pagination"><?php echo $output['show_page']; ?></div>
-                    </td>
-                </tr>
-                </tfoot>
             </table>
         </div>
         <!-- <span style="color: red;font-size: 16px;">移 | 联 | 电</span> -->

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

@@ -14,6 +14,17 @@
     input::placeholder{ 
         color:#333; 
     }
+    .layui-input {
+        width: 160px!important;
+    }
+    .layui-edge {
+        right: 202px!important;
+    }
+    .layui-form-select dl {
+        left: 3px!important;
+        top: 26px!important;
+        min-width: 45%!important;
+    }
 </style>
 <div class="page">
     <div class="fixed-bar">
@@ -41,12 +52,36 @@
                         <?php }?>
                     </select>
                 </td>
-                <td><a href="javascript:void(0);" id="ncsubmit" class="btn-search "
+                <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:130px" />
+                    <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:130px" />
+                </td>
+                <td><a href="javascript:void(0);" id="ncsubmit" class="btn-search"
                        title="<?php echo $lang['nc_query']; ?>">&nbsp;</a>
             </tr>
             </tbody>
         </table>
     </form>
+    <table class="table tb-type2" id="prompt">
+        <tbody>
+        <tr class="space odd">
+            <th><div class="title">
+                    <h5>金额统计:</h5>
+                    <span class="arrow"></span></div></th>
+        </tr>
+        <tr>
+            <td>
+                <ul>
+                    <li>总金额:<?php echo ncPriceFormat($output['stat']['amounts']);?></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">
@@ -97,6 +132,17 @@
 <link rel="stylesheet" type="text/css" href="<?php echo ADMIN_TEMPLATES_URL; ?>/layui/css/layui.css"/>
 <script>
     $(function () {
+        // 日期选择器
+        laydate.render({
+            elem: '#startTime',
+            type: 'datetime',
+            trigger: 'click'
+        });
+        laydate.render({
+            elem: '#endTime',
+            type: 'datetime',
+            trigger: 'click'
+        });
         $('#ncsubmit').click(function () {
             $('#formSearch').submit();
         });

+ 7 - 4
admin/templates/default/provider.price.php

@@ -18,7 +18,7 @@
     }
     #tablee tbody {
         display:block;
-        height: 600px;
+        height: 1200px;
         overflow-y:scroll;
     }
     #tablee thead,
@@ -34,7 +34,7 @@
         top: 115px!important;
     }
     .tbodyd tr:last-child {
-        margin-bottom: 552px;
+        margin-bottom: 1152px;
     }
     .tbodyd tr:hover { background-color : #cbe9f3!important;}
     .tbodyd tr:hover td { background : none!important;}
@@ -56,6 +56,9 @@
     .hover:hover {
         background-color : #cbe9f3!important;
     }
+    tr td {
+        border-color :none!important;
+    }
 </style>
 <div class="page">
     <div class="fixed-bar">
@@ -129,8 +132,8 @@
     </form>
     <form method="post" id="merchant_name_form" class="scrollTable">
         <input type="hidden" name="form_submit" value="ok"/>
-        <div id='scrollTable' class="fixed-bar">
-        <table style="width: 100%" class="table tb-type2" id="tablee">
+        <div id='scrollTable' class="fixed-bar" style="background: transparent">
+        <table style="width: 100%" class="table tb-type2" id="tablee" >
             <thead id="tbody">
             <tr class="thead">
                 <th rowspan="2" class="align-center">通道ID</th>

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

@@ -38,7 +38,7 @@
                         <option value="add">增加</option>
                         <option value="del">减少</option>
                     </select>
-                    <input type="text" id="pointsnum" name="pointsnum" class="txt">
+                    <input type="text" autocomplete="off" id="pointsnum" name="pointsnum" class="txt">
                     <div id="money" style="color:red; display: inline-block"></div>
                 </td>
                 <td class="vatop tips"></td>

+ 1 - 1
admin/templates/default/recharge.manual.add.php

@@ -58,7 +58,7 @@
                         <option value="add">增加</option>
                         <option value="del">减少</option>
                     </select>
-                    <input type="text" id="pointsnum" name="pointsnum" class="txt">
+                    <input type="text" autocomplete="off" id="pointsnum" name="pointsnum" class="txt">
                     <div id="money" style="color:red; display: inline-block"></div>
                 </td>
                 <td class="vatop tips"></td>

+ 1 - 1
admin/templates/default/recharge.manual.edit.php

@@ -50,7 +50,7 @@
                         <option value="add">增加</option>
                         <option value="del">减少</option>
                     </select>
-                    <input type="text" id="pointsnum" name="pointsnum" class="txt">
+                    <input type="text" autocomplete="off" id="pointsnum" name="pointsnum" class="txt">
                     <div id="money" style="color:red; display: inline-block"></div>
                 </td>
                 <td class="vatop tips"></td>

+ 165 - 132
admin/templates/default/refill.order.neterr.index.php

@@ -79,37 +79,54 @@
         <input type="hidden" name="act" value="OrderSendList"/>
         <input type="hidden" name="op" value="neterr_order"/>
         <input type="hidden" name="export" value=""/>
+        <input type="hidden" name="order_query" value=""/>
         <table class="tb-type1 noborder search">
             <tr>
                 <th><label class="lefto">供方名称</label></th>
                 <td  class="layui-form">
-                    <select name="store_id" class="querySelect" lay-verify="" lay-search>
-                        <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 } ?>data-color="<?php echo $provider['opened'] ?>" class="textColor"><?php echo $provider['store_name'] ?></option>
-                        <?php } ?>
+                    <select name="store_id" class="">
+                        <option data-color="<?php echo $provider['opened']?>" value=""><?php echo $lang['nc_please_choose']; ?> </option>
+                        <?php if(!empty($output['special_stat'])){?>
+                            <?php foreach($output['special_stat'] as $provider){?>
+                                <option value="<?php echo $provider['store_id']?>"
+                                        <?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>
                 </td>
                 <td>
                     <a href="javascript:void(0);" id="ncsubmit" class="btn-search "
                        title="<?php echo $lang['nc_query']; ?>">&nbsp;
                     </a>
-                    <a href="javascript:void(0);" id="ncexport" class="btns" >
-                        <span><i class="icon-edit"></i>导出</span>
-                    </a>
                 </td>
             </tr>
         </table>
         <table class="tb-type1 noborder search">
             <tr>
                 <td>
+                    <a href="javascript:void(0);" id="order_query" class="btns" style="margin-right: 59px;">
+                        <span><i class="icon-edit"></i>更新待收货订单状态</span>
+                    </a>
+                    <a href="#" class="btns" onclick="hCopyOrder(event)">
+                        <span><i class="icon-edit"></i>拷贝我方订单号</span>
+                    </a>
+                    <a href="#" class="btns" onclick="hCopyMchOrder(event)">
+                        <span><i class="icon-edit"></i>拷贝商家单号</span>
+                    </a>
                     <a href="#" class="btns" onclick="hCopyChannel(event)">
-                        <span><i class="icon-edit"></i>拷贝订单号</span>
+                        <span><i class="icon-edit"></i>拷贝渠道单号</span>
                     </a>
                     <a href="#" class="btns" onclick="hCopyCardNo(event)">
                         <span><i class="icon-edit"></i>拷贝充值卡号</span>
                     </a>
-                    <a href="#" class="btns"  id="hFail">
+                    <a href="javascript:void(0);" id="ncexport" class="btns" style="margin: 0 59px;">
+                        <span><i class="icon-edit"></i>导出Excel</span>
+                    </a>
+                </td>
+            </tr>
+            <tr>
+                <td>
+                    <a href="#" class="btns fail">
                         <span><i class="icon-edit"></i>批量失败</span>
                     </a>
                 </td>
@@ -121,7 +138,8 @@
         <tr class="space odd" id="autoClick">
             <th colspan="12">
                 <div class="title"><h5>
-                        数据统计</h5><span class="arrow"></span></div>
+                        数据统计</h5><span class="arrow"></span>
+                </div>
             </th>
         </tr>
         <tr>
@@ -129,6 +147,13 @@
                 <ul>
                     <li class="lineLi" style="color:#000;">总计订单数量:<?php echo $output['stat']['order_count'] ?? 0 ?></li>
                 </ul>
+                <ul id="special_stat">
+                        <?php if(!empty($output['special_stat'])) {
+                            foreach ($output['special_stat'] as $stat){
+                                ?>
+                                <li class="lineLi" style="color:#000;"><?php echo "{$stat['store_name']} :{$stat['order_count']}" ?></li>
+                            <?php }}?>
+                    </ul>
             </td>
         </tr>
         </tbody>
@@ -136,7 +161,7 @@
     <table class="table tb-type2 nobdb">
         <thead>
         <tr class="thead">
-            <th class="align-center" id="selectAll">全选</th>
+            <th class="align-center" id="selectAll"><input type="checkbox" name="chbox" value=""></th>
             <th class="align-center">编号</th>
             <th class="align-center">订单号</th>
             <th class="align-center">机构编号</th>
@@ -162,9 +187,7 @@
             <?php
             foreach ($output['order_list'] as $key => $order) { ?>
                 <tr class="hover trFlex">
-                    <td class="align-center">
-                        <input type="checkbox" id="checkBoxList" name="checkbox" value="<?php echo $order['order_id'];?>">
-                    </td>
+                    <td class="align-center"><input type="checkbox" id="checkBoxList" name="checkbox" value="<?php echo $order['order_id'];?>"></td>
                     <td class="align-center"><?php echo $key + 1; ?></td>
                     <td class="align-left"><?php echo $order['order_sn']; ?></td>
                     <td class="align-center"><?php echo $order['mchid']; ?></td>
@@ -243,121 +266,95 @@
         });
         $('#query_start_time').datepicker({dateFormat: 'yy-mm-dd'});
         $('#query_end_time').datepicker({dateFormat: 'yy-mm-dd'});
-                  //全选
-         $('#selectAll' ).click ( function () {
-          if ($(this).text() == '全选') {
-              $("input[name='checkbox']").each(function() {
-                  this.checked = true;
-              })
-              $(this).text("取消全选")
-          } else {
-              $("input[name='checkbox']").each(function() {
-                  this.checked = false;
-              })
-              $(this).text("全选")
-
-          }
-     
-
-            })
-            //批量
-             $('#hFail').click(function () {
-                layer.confirm('您确定要批量失败', {
-                btn: ['确定','取消'],
-                title:'批量失败'
-                }, function(){
-
-
-                let arr = [];
-                $("input:checkbox:checked").each(function (i) {
-                arr[i] = $(this).val();
-            })
-            let str = arr.join(",");
-            // console.log(str);
-            if (str != '') {
-            window.location.href =`index.php?act=ordersendlist&op=neterr_order_manual&order_ids= ${str ? str : ''}&type=cancel`
-            console.log(str);
-            // layer.msg('批量成功', {icon: 1});
-
+        //全选
+        $('#selectAll').click(function () {
+            if ($("input[name='chbox']").is(':checked')) {
+                $("input[name='checkbox']").each(function () {
+                    this.checked = true;
+                })
             } else {
-                layer.msg('请还没有任何操作,请先选择');
+                $("input[name='checkbox']").each(function () {
+                    this.checked = false;
+                })
             }
-
-		
-
-            }, function(){
-            });
-            })
-            //手动成功
-            $('.hsuccess').click(function() {
-                let succid = $(this).attr('data_id');
-                layer.prompt({
-
-                    // formType:  1 ,
-                    title:  '请输入运营商流水号' ,
-                    // area: [ '500px' ,  '150px' ],
-                    // btnAlign:  'c' ,
-                    yes: function(index, layero){
-                        // 获取文本框输入的值
-                        var value = layero.find( ".layui-layer-input" ).val();
-                        console.log(value);
-                        if  (value) {
-                            window.location.href =`index.php?act=ordersendlist&op=neterr_order_manual&order_ids= ${succid}&type=success&official_sn= ${value}`
-                            // layer.close(index);
-                        }  else  {
-                            window.location.href =`index.php?act=ordersendlist&op=neterr_order_manual&order_ids= ${succid}&type=success`
-                        }
+        })
+        //批量失败
+        $('.fail').click(function() {
+            layer.confirm('您确定要批量失败', {
+                btn: ['确定', '取消'],
+                title: '批量失败'
+            }, function () {
+                let arr = [];
+                $("input:checkbox:checked").each(function (i) {
+                    arr[i] = $(this).val();
+                })
+                let str = arr.join(",");
+                let strr = str.substring(0, 1);
+                let number = Number(strr);
+                if (isNaN(number)) {
+                    let strrr = str.substring(1, str.length);
+                    window.location.href = `index.php?act=ordersendlist&op=neterr_order_manual&type=cancel&order_ids= ${strrr ? strrr : ''}`
+                } else if(!isNaN(number) && str !== '') {
+                    window.location.href = `index.php?act=ordersendlist&op=neterr_order_manual&type=cancel&order_ids= ${str ? str : ''}`
+                } else {
+                    layer.msg('请还没有任何操作,请先选择');
+                }
+            }, function () {layer.msg('取消成功');});
+        })
+         //手动成功
+        $('.hsuccess').click(function () {
+            let succid = $(this).attr('data_id');
+            layer.prompt({
+                title: '请输入运营商流水号',
+                yes: function (index, layero) {
+                    var value = layero.find(".layui-layer-input").val();
+                    if (value) {
+                        window.location.href = `index.php?act=ordersendlist&op=neterr_order_manual&order_ids= ${succid}&type=success&official_sn= ${value}`
+                    } else {
+                        window.location.href = `index.php?act=ordersendlist&op=neterr_order_manual&order_ids= ${succid}&type=success`
                     }
-                    });
-            })
-            //手动失败
-            $('.hcancel').click(function() {
-                let succid = $(this).attr('data_id');
-                layer.confirm('确定要手动失败 ?', {
-                  btn: ['确定','失败'] //按钮
-                }, function(){
-                    window.location.href =`index.php?act=ordersendlist&op=neterr_order_manual&order_ids= ${succid}&type=cancel`
-                }, function(){
-               
-                  });
-                });
-           
-
-
-                        //双击
-             $('.doubleclick').dblclick(function() {
+                }
+            });
+        })
+        //手动失败
+        $('.hcancel').click(function () {
+            let succid = $(this).attr('data_id');
+            layer.confirm('确定要手动失败 ?', {
+                btn: ['确定', '失败'] //按钮
+            }, function () {
+                window.location.href = `index.php?act=ordersendlist&op=neterr_order_manual&order_ids= ${succid}&type=cancel`
+            }, function () {
+            });
+        });
+        //双击
+        $('.doubleclick').dblclick(function () {
             let db_click = $(this).attr('data-order')
             $.get('index.php?act=refill_order&op=showOrders', {
-                order_sn:db_click
-            }, function(data) {
+                order_sn: db_click
+            }, function (data) {
                 data = JSON.parse(data)
-           
                 if (data.state == 1) {
-                    
-                var dbclick = data.data
-                let ConentArr = [];
-                let html = ''; 
-                for (let i = 0; i < dbclick.length; i++) {
-                    var item = dbclick[i];
-                    html += `
-                    <tr>
-                                        <td class="db-center">${item.order_sn}</td>
-                                         <td class="db-center">${item.commit_time_text}</td>
-                                         <td class="db-center">${item.notify_time_text}</td>
-                                         <td class="db-center">${item.diff_time_text}</td>
-                                         <td class="db-center">${item.order_state_text}</td>
-                                         <td class="db-center">${item.channel_name}</td>
-                                         <td class="db-center">${item.err_msg}</td>
-                                        <td class="db-center">${item.close_reason}</td>
-                             <tr>
-                    `
-                }
-
-
+                    var dbclick = data.data
+                    let ConentArr = [];
+                    let html = '';
+                    for (let i = 0; i < dbclick.length; i++) {
+                        var item = dbclick[i];
+                        html += `
+                            <tr>
+                                <td class="db-center">${item.order_sn}</td>
+                                <td class="db-center">${item.commit_time_text}</td>
+                                <td class="db-center">${item.notify_time_text}</td>
+                                <td class="db-center">${item.diff_time_text}</td>
+                                <td class="db-center">${item.order_state_text}</td>
+                                <td class="db-center">${item.channel_name}</td>
+                                <td class="db-center">${item.err_msg}</td>
+                                <td class="db-center">${item.close_reason}</td>
+                             <tr>`
+                    }
                     layer.open({
-                   title: `<span>共${data.count}单</span> <span class="db-top">回调状态:${data.mch_notify_state}</span> <span>回调次数:${data.mch_notify_times}</span>`,
-                   content: `<table>
-                   <thead>
+                        title: `<span>共${data.count}单</span> <span class="db-top">回调状态:${data.mch_notify_state}</span> <span>回调次数:${data.mch_notify_times}</span>`,
+                        content: `<table>
+                    <thead>
                              <tr>
                                  <th class="db-right">订单号</th>
                                  <th class="db-right">下单日期</th>
@@ -373,16 +370,11 @@
                              ${html}
                              </tbody>
                             </table>`,
-                            
-
-                        });
+                    });
                 } else {
                     alert("没有此订单");
-
                 }
-                
             })
-
         })
         // 日期选择器
         laydate.render({
@@ -425,8 +417,8 @@
                 $(this).css('color', 'red')
             }
         })
-                    // 导出
-    $('#ncexport').click(function () {
+        // 导出
+        $('#ncexport').click(function () {
         $('input[name="export"]').val('1');
         $('#formSearch').submit();
         $('input[name="export"]').val('');
@@ -437,7 +429,18 @@
     })
     });
 
-    function hCopyChannel(e) {
+        // 更新待收货状态
+        $('#order_query').click(function () {
+            $('input[name="order_query"]').val('1');
+            $('#formSearch').submit();
+            $('input[name="order_query"]').val('');
+            var ii = layer.load();
+            setTimeout(function(){
+                layer.close(ii);
+            }, 800);
+        });
+
+        function hCopyOrder(e) {
         let str = ''
         $('#tbody tr').each(function () {
             let res = $(this).find('td').eq(2).text()
@@ -453,7 +456,7 @@
         oInput.parentNode.removeChild(oInput)
     }
 
-    function hCopyCardNo(e) {
+     function hCopyCardNo(e) {
         let str = ''
         $('#tbody tr').each(function () {
             let res = $(this).find('td').eq(5).text()
@@ -468,4 +471,34 @@
         document.execCommand("Copy"); // 执行浏览器复制命令
         oInput.parentNode.removeChild(oInput)
     }
+    function hCopyMchOrder(e) {
+        let str = ''
+        $('#tbody tr').each(function () {
+            let res = $(this).find('td').eq(14).text()
+            str += res + '\n'
+        })
+        let oInput = document.createElement("textarea");
+        oInput.style.border = "0 none";
+        oInput.style.color = "transparent";
+        oInput.value = str;
+        document.body.appendChild(oInput);
+        oInput.select(); // 选择对象
+        document.execCommand("Copy"); // 执行浏览器复制命令
+        oInput.parentNode.removeChild(oInput)
+    }
+    function hCopyChannel(e) {
+        let str = ''
+        $('#tbody tr').each(function () {
+            let res = $(this).find('td').eq(16).text()
+            str += res + '\n'
+        })
+        let oInput = document.createElement("textarea");
+        oInput.style.border = "0 none";
+        oInput.style.color = "transparent";
+        oInput.value = str;
+        document.body.appendChild(oInput);
+        oInput.select(); // 选择对象
+        document.execCommand("Copy"); // 执行浏览器复制命令
+        oInput.parentNode.removeChild(oInput)
+    }
 </script> 

+ 2 - 1
admin/templates/default/refill.order.notify.err.index.php

@@ -46,6 +46,7 @@
     }
     .lefto {
         margin-left: 6px;
+        width: 127px;
     }
     .db-right {
         padding-right: 134px!important;
@@ -89,7 +90,7 @@
                         <?php } ?>
                     </select>
                 </td>
-                <th>回调时间</th>
+                <th style="padding-left: 15px;">回调时间</th>
                 <td>
                     <select name="notify_time" class="querySelect" id="arrangeClass">
                         <option value=""><?php echo $lang['nc_please_choose']; ?></option>

+ 2 - 3
admin/templates/default/refill.order.search.php

@@ -248,7 +248,7 @@
                 <td></td>
                 <td>
                     <a href="#" class="btns" onclick="hCopyCardNo(event)">
-                        <span><i class="icon-edit"></i>拷贝充值卡号+渠道单号</span>
+                        <span><i class="icon-edit"></i>拷贝充值卡号</span>
                     </a>
                     <a href="#" class="btns" onclick="hCopyOrder(event)">
                         <span><i class="icon-edit"></i>拷贝订单号</span>
@@ -455,8 +455,7 @@
         let str = ''
         $('#tbody tr').each(function () {
             let card_no = $(this).find('td').eq(4).text()
-            let channel_no = $(this).find('td').eq(15).text()
-            str += card_no + ' ' + channel_no + '\n'
+            str += card_no + '\n'
         })
         let oInput = document.createElement("textarea");
         oInput.style.border = "0 none";

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

@@ -235,22 +235,25 @@
                     </a>
                 </td>
             </tr>
+            <tr>
+                <td>
+                    <a href="#" class="btns fail">
+                        <span><i class="icon-edit"></i>批量失败</span>
+                    </a>
+                </td>
+            </tr>
         </table>
     </form>
     <table class="table tb-type2" id="prompt">
         <tbody>
         <tr class="space odd" id="autoClick">
             <th colspan="12">
-                <div class="title"><h5>
-                        金额统计</h5><span class="arrow"></span></div>
-            </th>
-        </tr>
-        <tr>
-            <td>
+                <div class="title" style="margin-top: 4px;"><h5>
+                        金额统计</h5><span class="arrow"></span>
+                </div>
                 <ul>
-                    <li class="lineLi" style="color:#000;">
-                        总计充值金额:<?php echo $output['stat']['refill_amounts'] ?? 0 ?></li>
                     <li class="lineLi" style="color:#000;">总计订单数量:<?php echo $output['stat']['order_count'] ?? 0 ?></li>
+                    <li class="lineLi" style="color:#000;">总计充值金额:<?php echo $output['stat']['refill_amounts'] ?? 0 ?></li>
                     <li class="lineLi" style="color:#000;">超过30分钟订单数量:<?php echo $output['count'][0] ?? 0 ?></li>
                     <li class="lineLi" style="color:#000;">超过1小时订单数量:<?php echo $output['count'][1] ?? 0 ?></li>
                     <?php if ($_GET['time'] == 3) { ?>
@@ -265,6 +268,10 @@
                         <li class="lineLi" style="color:#000;">超过两小时订单数量:<?php echo $output['count'][2] ?? 0 ?></li>
                     <?php } ?>
                 </ul>
+            </th>
+        </tr>
+        <tr>
+            <td>
                 <ul id="merchant_stat">
                     <?php if(!empty($output['merchant_stat'])) {
                         foreach ($output['merchant_stat'] as $stat){
@@ -281,7 +288,8 @@
     </table>
     <table class="table tb-type2 nobdb">
         <thead>
-        <tr class="thead">
+            <tr class="thead">
+            <th class="align-center" id="selectAll"><input type="checkbox" name="chbox" value=""></th>
             <th class="align-center">编号</th>
             <th class="align-center">订单号</th>
             <th class="align-center">机构编号</th>
@@ -290,6 +298,7 @@
             <th class="align-center">充值卡类型</th>
             <th class="align-center">充值额度</th>
             <th class="align-right">下单日期</th>
+            <th class="align-right">超时</th>
             <th class="align-right">当前耗时</th>
             <th class="align-right">总耗时</th>
             <th class="align-center">订单状态</th>
@@ -307,6 +316,7 @@
             <?php
             foreach ($output['order_list'] as $key => $order) { ?>
                 <tr class="hover trFlex" id="dataColor" data-timeout_State="<?php echo $order['time_out_state'];?>">
+                    <td class="align-center"><input type="checkbox" id="checkBoxList" name="checkbox" value="<?php echo $order['order_id'];?>"></td>
                     <td class="align-center"><?php echo $key + 1; ?></td>
                     <td class="align-left"><?php echo $order['order_sn']; ?></td>
                     <td class="align-center"><?php echo $order['mchid']; ?></td>
@@ -321,6 +331,19 @@
                     </td>
                     <td class="align-right">
                         <?php if (empty($order['notify_time'])) {
+                            if ($order['mtime_out'] > 180) {
+                                ?>
+                                <span style="color: #f30707"><?php echo $order['mtime_out_text'] ?></span>
+
+                            <?php } else { ?>
+                                <?php echo $order['mtime_out_text'] ?>
+                            <?php } ?>
+                        <?php } else { ?>
+                            <?php echo $order['mtime_out_text'] ?>
+                        <?php } ?>
+                    </td>
+                    <td class="align-right">
+                        <?php if (empty($order['notify_time'])) {
                             if ($order['diff_time'] > 180) {
                                 ?>
                                 <span style="color: #f30707"><?php echo $order['diff_time_text'] ?></span>
@@ -451,6 +474,41 @@
                 }
             })
         })
+         //全选
+        $('#selectAll').click(function () {
+            if ($("input[name='chbox']").is(':checked')) {
+                $("input[name='checkbox']").each(function () {
+                    this.checked = true;
+                })
+            } else {
+                $("input[name='checkbox']").each(function () {
+                    this.checked = false;
+                })
+            }
+        })
+        //批量失败
+        $('.fail').click(function() {
+            layer.confirm('您确定要批量失败', {
+                btn: ['确定', '取消'],
+                title: '批量失败'
+            }, function () {
+                let arr = [];
+                $("input:checkbox:checked").each(function (i) {
+                    arr[i] = $(this).val();
+                })
+                let str = arr.join(",");
+                let strr = str.substring(0, 1);
+                let number = Number(strr);
+                if (isNaN(number)) {
+                    let strrr = str.substring(1, str.length);
+                    window.location.href = `index.php?act=refill_order_manual&op=refill_order_batch_dispose&type=cancel&order_id= ${strrr ? strrr : ''}`
+                } else if(!isNaN(number) && str !== '') {
+                    window.location.href = `index.php?act=refill_order_manual&op=refill_order_batch_dispose&type=cancel&order_id= ${str ? str : ''}`
+                } else {
+                    layer.msg('请还没有任何操作,请先选择');
+                }
+            }, function () {layer.msg('取消成功');});
+        })
 
         // 获取不包含客户
         let selest_nc
@@ -571,7 +629,7 @@
     function hCopyOrder(e) {
         let str = ''
         $('#tbody tr').each(function () {
-            let res = $(this).find('td').eq(1).text()
+            let res = $(this).find('td').eq(2).text()
             str += res + '\n'
         })
         let oInput = document.createElement("textarea");
@@ -587,7 +645,7 @@
     function hCopyChannel(e) {
         let str = ''
         $('#tbody tr').each(function () {
-            let res = $(this).find('td').eq(15).text()
+            let res = $(this).find('td').eq(17).text()
             str += res + '\n'
         })
         let oInput = document.createElement("textarea");
@@ -603,7 +661,7 @@
     function hCopyCardNo(e) {
         let str = ''
         $('#tbody tr').each(function () {
-            let res = $(this).find('td').eq(4).text()
+            let res = $(this).find('td').eq(5).text()
             str += res + '\n'
         })
         let oInput = document.createElement("textarea");
@@ -619,7 +677,7 @@
     function hCopyMchOrder(e) {
         let str = ''
         $('#tbody tr').each(function () {
-            let res = $(this).find('td').eq(13).text()
+            let res = $(this).find('td').eq(15).text()
             str += res + '\n'
         })
         let oInput = document.createElement("textarea");

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

@@ -2079,42 +2079,42 @@ $guochuang_phone = ['name' => 'guochuang', 'store_id' => 106, 'qualitys' => '2',
 $xianghongrui_phone = ['name' => 'xianghongrui', 'store_id' => 107,'qualitys' => '1',
     'amount' => [
         10 => [
-            ['goods_id' => 6949, 'price' => 9.55, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6949, 'price' => 9.57, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6949, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6949, 'price' => 9.52, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         20 => [
-            ['goods_id' => 6950, 'price' => 19.1, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6950, 'price' => 19.14, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6950, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6950, 'price' => 19.04, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         30 => [
-            ['goods_id' => 6951, 'price' => 28.65, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6951, 'price' => 28.71, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6951, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6951, 'price' => 28.56, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         50 => [
-            ['goods_id' => 6952, 'price' => 47.75, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6952, 'price' => 47.85, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6952, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6952, 'price' => 47.6, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
-            ['goods_id' => 6953, 'price' => 95.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6953, 'price' => 95.7, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6953, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6953, 'price' => 95.2, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 6954, 'price' => 191, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6954, 'price' => 191.4, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6954, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6954, 'price' => 190.4, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         300 => [
-            ['goods_id' => 6955, 'price' => 286.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6955, 'price' => 287.1, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6955, 'price' => 285, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6955, 'price' => 285.6, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         500 => [
-            ['goods_id' => 6956, 'price' => 477.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6956, 'price' => 478.5, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6956, 'price' => 475, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6956, 'price' => 476, 'quality' => 1, 'card_type' => 'chinatelecom']
         ]
@@ -3099,12 +3099,12 @@ $lexianglt_phone = ['name' => 'lexianglt', 'store_id' => 154, 'qualitys' => '1',
     'amount' => [
 //        10 => [['goods_id' => 7308, 'price' => 9.48, 'quality' => 1, 'card_type' => 'chinaunicom']],
 //        20 => [['goods_id' => 7309, 'price' => 18.96, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        30 => [['goods_id' => 7310, 'price' => 28.44, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        50 => [['goods_id' => 7311, 'price' => 47.4, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        100 => [['goods_id' => 7312, 'price' => 94.8, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        200 => [['goods_id' => 7313, 'price' => 189.6, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        300 => [['goods_id' => 7314, 'price' => 284.4, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        500 => [['goods_id' => 7315, 'price' => 474, 'quality' => 1, 'card_type' => 'chinaunicom']]
+        30 => [['goods_id' => 7310, 'price' => 28.65, 'quality' => 1, 'card_type' => 'chinaunicom']],
+        50 => [['goods_id' => 7311, 'price' => 47.75, 'quality' => 1, 'card_type' => 'chinaunicom']],
+        100 => [['goods_id' => 7312, 'price' => 95.5, 'quality' => 1, 'card_type' => 'chinaunicom']],
+        200 => [['goods_id' => 7313, 'price' => 191, 'quality' => 1, 'card_type' => 'chinaunicom']],
+        300 => [['goods_id' => 7314, 'price' => 286.5, 'quality' => 1, 'card_type' => 'chinaunicom']],
+        500 => [['goods_id' => 7315, 'price' => 477.5, 'quality' => 1, 'card_type' => 'chinaunicom']]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 

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

@@ -2079,42 +2079,42 @@ $guochuang_phone = ['name' => 'guochuang', 'store_id' => 106, 'qualitys' => '2',
 $xianghongrui_phone = ['name' => 'xianghongrui', 'store_id' => 107,'qualitys' => '1',
     'amount' => [
         10 => [
-            ['goods_id' => 6949, 'price' => 9.55, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6949, 'price' => 9.57, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6949, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6949, 'price' => 9.52, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         20 => [
-            ['goods_id' => 6950, 'price' => 19.1, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6950, 'price' => 19.14, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6950, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6950, 'price' => 19.04, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         30 => [
-            ['goods_id' => 6951, 'price' => 28.65, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6951, 'price' => 28.71, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6951, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6951, 'price' => 28.56, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         50 => [
-            ['goods_id' => 6952, 'price' => 47.75, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6952, 'price' => 47.85, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6952, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6952, 'price' => 47.6, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
-            ['goods_id' => 6953, 'price' => 95.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6953, 'price' => 95.7, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6953, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6953, 'price' => 95.2, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 6954, 'price' => 191, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6954, 'price' => 191.4, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6954, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6954, 'price' => 190.4, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         300 => [
-            ['goods_id' => 6955, 'price' => 286.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6955, 'price' => 287.1, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6955, 'price' => 285, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6955, 'price' => 285.6, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         500 => [
-            ['goods_id' => 6956, 'price' => 477.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6956, 'price' => 478.5, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6956, 'price' => 475, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6956, 'price' => 476, 'quality' => 1, 'card_type' => 'chinatelecom']
         ]
@@ -3099,12 +3099,12 @@ $lexianglt_phone = ['name' => 'lexianglt', 'store_id' => 154, 'qualitys' => '1',
     'amount' => [
 //        10 => [['goods_id' => 7308, 'price' => 9.48, 'quality' => 1, 'card_type' => 'chinaunicom']],
 //        20 => [['goods_id' => 7309, 'price' => 18.96, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        30 => [['goods_id' => 7310, 'price' => 28.44, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        50 => [['goods_id' => 7311, 'price' => 47.4, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        100 => [['goods_id' => 7312, 'price' => 94.8, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        200 => [['goods_id' => 7313, 'price' => 189.6, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        300 => [['goods_id' => 7314, 'price' => 284.4, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        500 => [['goods_id' => 7315, 'price' => 474, 'quality' => 1, 'card_type' => 'chinaunicom']]
+        30 => [['goods_id' => 7310, 'price' => 28.65, 'quality' => 1, 'card_type' => 'chinaunicom']],
+        50 => [['goods_id' => 7311, 'price' => 47.75, 'quality' => 1, 'card_type' => 'chinaunicom']],
+        100 => [['goods_id' => 7312, 'price' => 95.5, 'quality' => 1, 'card_type' => 'chinaunicom']],
+        200 => [['goods_id' => 7313, 'price' => 191, 'quality' => 1, 'card_type' => 'chinaunicom']],
+        300 => [['goods_id' => 7314, 'price' => 286.5, 'quality' => 1, 'card_type' => 'chinaunicom']],
+        500 => [['goods_id' => 7315, 'price' => 477.5, 'quality' => 1, 'card_type' => 'chinaunicom']]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 

+ 14 - 14
data/config/xyzadm/refill.ini.php

@@ -2079,42 +2079,42 @@ $guochuang_phone = ['name' => 'guochuang', 'store_id' => 106, 'qualitys' => '2',
 $xianghongrui_phone = ['name' => 'xianghongrui', 'store_id' => 107,'qualitys' => '1',
     'amount' => [
         10 => [
-            ['goods_id' => 6949, 'price' => 9.55, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6949, 'price' => 9.57, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6949, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6949, 'price' => 9.52, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         20 => [
-            ['goods_id' => 6950, 'price' => 19.1, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6950, 'price' => 19.14, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6950, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6950, 'price' => 19.04, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         30 => [
-            ['goods_id' => 6951, 'price' => 28.65, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6951, 'price' => 28.71, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6951, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6951, 'price' => 28.56, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         50 => [
-            ['goods_id' => 6952, 'price' => 47.75, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6952, 'price' => 47.85, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6952, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6952, 'price' => 47.6, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
-            ['goods_id' => 6953, 'price' => 95.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6953, 'price' => 95.7, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6953, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6953, 'price' => 95.2, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 6954, 'price' => 191, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6954, 'price' => 191.4, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6954, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6954, 'price' => 190.4, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         300 => [
-            ['goods_id' => 6955, 'price' => 286.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6955, 'price' => 287.1, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6955, 'price' => 285, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6955, 'price' => 285.6, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         500 => [
-            ['goods_id' => 6956, 'price' => 477.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6956, 'price' => 478.5, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6956, 'price' => 475, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 6956, 'price' => 476, 'quality' => 1, 'card_type' => 'chinatelecom']
         ]
@@ -3099,12 +3099,12 @@ $lexianglt_phone = ['name' => 'lexianglt', 'store_id' => 154, 'qualitys' => '1',
     'amount' => [
 //        10 => [['goods_id' => 7308, 'price' => 9.48, 'quality' => 1, 'card_type' => 'chinaunicom']],
 //        20 => [['goods_id' => 7309, 'price' => 18.96, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        30 => [['goods_id' => 7310, 'price' => 28.44, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        50 => [['goods_id' => 7311, 'price' => 47.4, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        100 => [['goods_id' => 7312, 'price' => 94.8, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        200 => [['goods_id' => 7313, 'price' => 189.6, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        300 => [['goods_id' => 7314, 'price' => 284.4, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        500 => [['goods_id' => 7315, 'price' => 474, 'quality' => 1, 'card_type' => 'chinaunicom']]
+        30 => [['goods_id' => 7310, 'price' => 28.65, 'quality' => 1, 'card_type' => 'chinaunicom']],
+        50 => [['goods_id' => 7311, 'price' => 47.75, 'quality' => 1, 'card_type' => 'chinaunicom']],
+        100 => [['goods_id' => 7312, 'price' => 95.5, 'quality' => 1, 'card_type' => 'chinaunicom']],
+        200 => [['goods_id' => 7313, 'price' => 191, 'quality' => 1, 'card_type' => 'chinaunicom']],
+        300 => [['goods_id' => 7314, 'price' => 286.5, 'quality' => 1, 'card_type' => 'chinaunicom']],
+        500 => [['goods_id' => 7315, 'price' => 477.5, 'quality' => 1, 'card_type' => 'chinaunicom']]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 

二进制
helper/refill/api/xyz/guochuang/20211204陕西电信调价函.jpg


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

@@ -88,7 +88,7 @@ class config
         "5-10-22" => 10.04, "5-20-22" => 20.08, "5-30-22" => 30.12, "5-50-22" => 50.2, "5-100-22" => 100.4, "5-200-22" => 200.8, "5-300-22" => 301.2, "5-500-22" => 502,//重庆 22
         "5-10-14" => 10.04, "5-20-14" => 20.08, "5-30-14" => 30.12, "5-50-14" => 50.2, "5-100-14" => 100.1, "5-200-14" => 200.2, "5-300-14" => 300.3, "5-500-14" => 500.5,//江西 14
         //电信
-        "6-10-27" => 9.935, "6-20-27" => 19.87, "6-30-27" => 29.805, "6-50-27" => 49.675, "6-100-27" => 99.35, "6-200-27" => 198.7, "6-300-27" => 297.84, "6-500-27" => 496.4,//陕西 27
+        "6-10-27" => 9.95, "6-20-27" => 19.9, "6-30-27" => 29.85, "6-50-27" => 49.75, "6-100-27" => 99.5, "6-200-27" => 199, "6-300-27" => 298.5, "6-500-27" => 497.5,//陕西 27
         "6-10-4" => 9.935, "6-20-4" => 19.87, "6-30-4" => 29.805, "6-50-4" => 49.675, "6-100-4" => 99.35, "6-200-4" => 198.7, "6-300-4" => 298.05, "6-500-4" => 496.75,//山西 4
         "6-10-18" => 10.21, "6-20-18" => 20.22, "6-30-18" => 30.231, "6-50-18" => 50.25, "6-100-18" => 100.3, "6-200-18" => 200.3, "6-300-18" => 300.45, "6-500-18" => 500.75,//湖南 18
         "6-10-15" => 10.21, "6-20-15" => 20.22, "6-30-15" => 30.231, "6-50-15" => 50.25, "6-100-15" => 100.3, "6-200-15" => 200.3, "6-300-15" => 300.45, "6-500-15" => 500.75,//山东 15

+ 7 - 1
helper/refill/policy/xyz/policy.php

@@ -489,6 +489,12 @@ class policy extends ProviderManager implements IPolicy
 
     private function body($state, $refill_info, $mch_info)
     {
+        if($state == 'SUCCESS') {
+            $err_msg = '';
+        } else {
+            $err_msg = 'fail';
+        }
+
         $params = [
             "mchid" => $refill_info['mchid'],
             "order_sn" => $refill_info['mch_order'],
@@ -498,7 +504,7 @@ class policy extends ProviderManager implements IPolicy
             "idcard" => $refill_info['idcard'] ?? "",
             "card_name" => $refill_info['card_name'] ?? "",
             'official_sn' => $refill_info['official_sn'] ?? "",
-            'message' => $refill_info['err_msg'] ?? "",
+            'message' => $err_msg,
             "state" => $state];
 
         [$has_sms,$sms] = $this->sms($refill_info);

+ 14 - 1
helper/statistics/stat_refill.php

@@ -124,7 +124,6 @@ class stat_refill
                 $params['success_channel_amounts'] = $item['channel_amounts'];
                 $params['success_mch_amounts'] = $item['mch_amounts'];
                 $params['profit_amounts'] = $item['mch_amounts'] - $item['channel_amounts'];
-
             }
             elseif($order_state == ORDER_STATE_CANCEL) {
                 $params['cancel_count'] = $item['order_count'];
@@ -200,6 +199,8 @@ class stat_refill
             $params['order_time_type'] = $order_time_type;
             $params['cid'] = $mchid;
             $params['cname'] = $cname;
+
+            $params = $this->init_count($params);
             foreach ($items as $item)
             {
                 $order_state = $item['order_state'];
@@ -266,6 +267,7 @@ class stat_refill
             $params['cid'] = $store_id;
             $params['cname'] = $cname;
 
+            $params = $this->init_count($params);
             foreach ($items as $item)
             {
                 $order_state = $item['order_state'];
@@ -290,4 +292,15 @@ class stat_refill
             }
         }
     }
+    private function init_count($params)
+    {
+        $params['success_count'] = 0;
+        $params['success_refill_amounts'] = 0;
+        $params['success_channel_amounts'] = 0;
+        $params['success_mch_amounts'] = 0;
+        $params['profit_amounts'] = 0;
+        $params['cancel_count'] = 0;
+        $params['send_count'] = 0;
+        return $params;
+    }
 }

+ 22 - 0
helper/task/handler.php

@@ -1,10 +1,12 @@
 <?php
 namespace task;
+require_once(BASE_HELPER_PATH . '/stat_helper.php');
 
 use Exception;
 use mtopcard;
 use PHPExcel;
 use PHPExcel_IOFactory;
+use statistics\stat_refill;
 
 class handler
 {
@@ -119,4 +121,24 @@ class handler
     {
         return md5("refill_order_export-".serialize($condition));
     }
+
+    public function order_stat_reload($condition)
+    {
+        $refill = new stat_refill();
+        $type = $condition['type'];
+        $time_stamp = $condition['time_stamp'];
+        $cid = $condition['cid'];
+        $order_time_type = $condition['order_time_type'];
+        if ($type == 'merchant') {
+            $refill->merchant_stat($time_stamp, $cid, $order_time_type);
+        } elseif ($type == 'provider') {
+            $refill->provider_stat($time_stamp, $cid, $order_time_type);
+        }
+        return [true, 'success'];
+    }
+
+    public function order_stat_reload_title($condition)
+    {
+        return md5("order_stat_reload-".serialize($condition));
+    }
 }

+ 1 - 1
helper/task/task_helper.php

@@ -4,4 +4,4 @@ namespace task;
 
 require_once(BASE_HELPER_PATH . '/task/manager.php');
 require_once(BASE_HELPER_PATH . '/task/handler.php');
-require_once(BASE_HELPER_PATH . '/task/task_wrapper.php');
+require_once(BASE_HELPER_PATH . '/task/task_wrapper.php');

+ 48 - 30
test/TestRefillStats.php

@@ -1,30 +1,48 @@
-<?php
-
-
-use PHPUnit\Framework\TestCase;
-
-define('APP_ID', 'test');
-define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
-
-require_once(BASE_ROOT_PATH . '/global.php');
-require_once(BASE_CORE_PATH . '/lrlz.php');
-require_once(BASE_ROOT_PATH . '/fooder.php');
-
-require_once(BASE_HELPER_PATH . '/stat_helper.php');
-
-class TestRefillStats extends TestCase
-{
-    public static function setUpBeforeClass(): void
-    {
-        Base::run_util();
-    }
-
-    public function  testLatestDay()
-    {
-        $refill = new statistics\stat_refill();
-        $refill->run();
-    }
-}
-
-//docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillStats::testLatestDay)( .*)?$/" --test-suffix TestRefillStats.php /var/www/html/test
-
+<?php
+
+
+use PHPUnit\Framework\TestCase;
+
+define('APP_ID', 'test');
+define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
+
+require_once(BASE_ROOT_PATH . '/global.php');
+require_once(BASE_CORE_PATH . '/lrlz.php');
+require_once(BASE_ROOT_PATH . '/fooder.php');
+
+require_once(BASE_HELPER_PATH . '/stat_helper.php');
+
+class TestRefillStats extends TestCase
+{
+    public static function setUpBeforeClass(): void
+    {
+        Base::run_util();
+    }
+
+    public function  testLatestDay()
+    {
+        $refill = new statistics\stat_refill();
+        $refill->run();
+    }
+
+    public function testReload()
+    {
+        $refill = new statistics\stat_refill();
+        $task_id = 8;
+        $mod_task = Model('task');
+        $item = $mod_task->where(['task_id' => $task_id])->find();
+        $condition = unserialize($item['params']);
+        $type = $condition['type'];
+        $time_stamp = $condition['time_stamp'];
+        $cid = $condition['cid'];
+        $order_time_type = $condition['order_time_type'];
+        if ($type == 'merchant') {
+            $refill->merchant_stat($time_stamp, $cid, $order_time_type);
+        } elseif ($type == 'provider') {
+            $refill->provider_stat($time_stamp, $cid, $order_time_type);
+        }
+    }
+}
+
+//docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillStats::testLatestDay)( .*)?$/" --test-suffix TestRefillStats.php /var/www/html/test
+