瀏覽代碼

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

stanley-king 3 年之前
父節點
當前提交
e165b15730

+ 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("操作成功,后台任务已开始重新统计,请稍后查看新数据");
         }
     }
 

+ 25 - 25
admin/control/ordersendlist.php

@@ -121,17 +121,18 @@ class ordersendlistControl extends SystemControl
             $this->RefillOrderExport($orders_cond, '商户超时监控导出', 'time_out_order');
             return;
         }
-        $store_ids = Model('')->table('refill_order,vr_order,merchant')
-            ->join('inner,inner')
-            ->on('refill_order.order_id=vr_order.order_id,refill_order.mchid=merchant.mchid')
-            ->field('DISTINCT vr_order.store_id')
-            ->where($orders_cond)
-            ->group('vr_order.store_id')
-            ->order('store_id asc')
-            ->select();
-        $store_ids = array_column($store_ids, 'store_id');
+//        $store_ids = Model('')->table('refill_order,vr_order,merchant')
+//            ->join('inner,inner')
+//            ->on('refill_order.order_id=vr_order.order_id,refill_order.mchid=merchant.mchid')
+//            ->field('DISTINCT vr_order.store_id')
+//            ->where($orders_cond)
+//            ->group('vr_order.store_id')
+//            ->order('store_id asc')
+//            ->select();
+//        $store_ids = array_column($store_ids, 'store_id');
         $merchant_list = $this->merchants();
-        $provider_list = $this->providers(['store.store_id' => ['in', $store_ids]]);
+//        $provider_list = $this->providers(['store.store_id' => ['in', $store_ids]]);
+        $provider_list = $this->providers();
         [$merchant_stat, $order_stat] = $this->merchant_timeout_stats($orders_cond);
         if (empty($_GET['mchid'])) {
             $order_count = $order_stat['order_count'];
@@ -480,18 +481,18 @@ class ordersendlistControl extends SystemControl
             $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');
@@ -613,18 +614,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);

+ 69 - 0
admin/control/provider.php

@@ -148,6 +148,19 @@ 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];
+        }
+        if (!empty($_GET['export'])) {
+            $this->ProviderAmountExport($condition);
+            return;
+        }
         $provider_list = $this->providers();
         foreach ($provider_list as $provider) {
             $providers[$provider['provider_id']] = $provider;
@@ -158,6 +171,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);
@@ -245,4 +263,55 @@ class providerControl extends SystemControl
         $updater($mod_prov, $phone_updates);
         $updater($mod_prov, $third_updates);
     }
+
+    private function ProviderAmountExport($cond)
+    {
+        $result = Model('provider_amount')->getAllDatas($cond);
+        $this->createExcel($result);
+    }
+
+    private function createExcel($data = [])
+    {
+        if(empty($data)) {
+            showMessage('数据为空');
+        }
+        Language::read('export');
+        import('libraries.excel');
+        $provider_list = $this->providers();
+        $providers = [];
+        foreach ($provider_list as $provider) {
+            $providers[$provider['provider_id']] = $provider;
+        }
+        $excel_obj = new Excel();
+        $excel_data = [];
+        //设置样式
+        $excel_obj->setStyle(['id' => 's_title', 'Font' => ['FontName' => '宋体', 'Size' => '12', 'Bold' => '1']]);
+        //header
+        $excel_data[0][] = ['styleid' => 's_title', 'data' => '序号'];
+        $excel_data[0][] = ['styleid' => 's_title', 'data' => '通道名称'];
+        $excel_data[0][] = ['styleid' => 's_title', 'data' => '调款金额'];
+        $excel_data[0][] = ['styleid' => 's_title', 'data' => '操作日期'];
+        $excel_data[0][] = ['styleid' => 's_title', 'data' => '操作人'];
+        //data
+        foreach ((array)$data as $k => $v) {
+            $tmp = [];
+            $provider_id = intval($v['provider_id']);
+            $provider = $providers[$provider_id];
+            $store_name = "{$provider['name']}({$provider['store_name']})";
+            $tmp[] = ['data' => $k+1];
+            $tmp[] = ['data' => $store_name];
+            $tmp[] = ['data' => $v['amount']];
+            if (empty($v['add_time'])) {
+                $tmp[] = ['data' => ''];
+            } else {
+                $tmp[] = ['data' => date('Y-m-d H:i:s', $v['add_time'])];
+            }
+            $tmp[] = ['data' => $v['operation']];
+            $excel_data[] = $tmp;
+        }
+        $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('通道调款记录导出-' . date('Y-m-d-H', time()));
+    }
 }

+ 67 - 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">
@@ -29,6 +40,7 @@
     <form method="get" name="formSearch" id="formSearch" class="layui-form">
         <input type="hidden" value="provider" name="act">
         <input type="hidden" value="provider_amount" name="op">
+        <input type="hidden" name="export" value=""/>
         <table class="tb-type1 noborder search">
             <tbody>
             <tr>
@@ -41,12 +53,43 @@
                         <?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>
+                </td>
+                <td>
+                    <a href="javascript:void(0);" id="ncexport" class="btns" style="margin: 0 59px;">
+                        <span><i class="icon-edit"></i>导出Excel</span>
+                    </a>
+                </td>
             </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 +140,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();
         });
@@ -108,5 +162,17 @@
                 $(this)[0].style.backgroundColor = '#fff'
             })
         })
+
+        // 导出
+        $('#ncexport').click(function () {
+            $('input[name="export"]').val('1');
+            $('#formSearch').submit();
+            $('input[name="export"]').val('');
+            let ii = layer.load();
+            setTimeout(function(){
+                layer.close(ii);
+            }, 800);
+        })
+
     });
 </script>

+ 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>

+ 17 - 7
admin/templates/default/refill.order.neterr.index.php

@@ -84,11 +84,14 @@
             <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>
@@ -144,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>
@@ -283,9 +293,9 @@
                 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 : ''}`
+                    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=refill_order_manual&op=refill_order_batch_dispose&type=cancel&order_id= ${str ? str : ''}`
+                    window.location.href = `index.php?act=ordersendlist&op=neterr_order_manual&type=cancel&order_ids= ${str ? str : ''}`
                 } else {
                     layer.msg('请还没有任何操作,请先选择');
                 }

+ 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";

+ 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'];
 

+ 24 - 0
data/model/provider_amount.model.php

@@ -20,4 +20,28 @@ class provider_amountModel extends Model
         if (empty($list)) return [];
         return $list;
     }
+
+    public function getAllDatas($condition): array
+    {
+        $len = 1000;
+
+        $i = 0;
+        $datas = [];
+        while (true)
+        {
+            $start = $i * $len;
+            $items = $this
+                ->field('*')
+                ->where($condition)
+                ->order('add_time desc')
+                ->limit("{$start},{$len}")
+                ->select();
+            $datas = array_merge($datas,$items);
+            if (empty($items) || count($items) < $len) {
+                break;
+            }
+            $i++;
+        }
+        return $datas;
+    }
 }

二進制
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

+ 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));
+    }
 }

+ 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
+