xiaoyu vor 3 Jahren
Ursprung
Commit
ec5c362569

+ 1 - 1
admin/control/control.php

@@ -363,7 +363,7 @@ class SystemControl
     protected function elapse_time($seconds)
     {
         $minutes = intval($seconds / 60);
-        $second = intval($seconds % 60);
+        $second = $seconds % 60;
         if ($minutes >= 60) {
             $minute = $minutes % 60;
             $hours = intval($minutes / 60);

+ 96 - 2
admin/control/orderstats.php

@@ -3,6 +3,24 @@
 
 class orderstatsControl extends SystemControl
 {
+    private $task_type = [
+        'order_export' => '订单导出'
+    ];
+    private $type = [
+        'merchant' => '机构',
+        'provider' => '通道'
+    ];
+    private $order_time_type = [
+        'notify_time' => '回调时间',
+        'order_time' => '下单时间'
+    ];
+    private $task_state = [
+        1   => '待处理',
+        2   => '处理中',
+        3   => '已处理',
+        4   => '处理错误'
+    ];
+
     public function __construct()
     {
         parent::__construct();
@@ -42,10 +60,9 @@ class orderstatsControl extends SystemControl
         }
         
         $total_stats = $this->stats($condition);
-        $order_time_type_text = ['notify_time' => '回调时间', 'order_time' => '下单时间'];
         Tpl::output('total_stats', $total_stats);
         Tpl::output('stats_list', $stats_list);
-        Tpl::output('order_time_type_text', $order_time_type_text);
+        Tpl::output('order_time_type_text', $this->order_time_type);
         Tpl::output('show_page', $model_refill_order->showpage());
         Tpl::showpage($page);
     }
@@ -121,4 +138,81 @@ class orderstatsControl extends SystemControl
         }
         return $result;
     }
+
+    public function refill_taskOp()
+    {
+        $model = Model('refill_task');
+        $condition = [];
+        $task_list = $model->getRefillTaskList($condition, 50);
+        foreach ($task_list as $key => $value) {
+            $task_list[$key]['condition'] = unserialize($value['task_condition']);
+        }
+
+        Tpl::output('list', $task_list);
+        Tpl::output('provider_list', $this->providers());
+        Tpl::output('merchant_list', $this->merchants());
+        Tpl::output('task_type', $this->task_type);
+        Tpl::output('type', $this->type);
+        Tpl::output('task_state', $this->task_state);
+        Tpl::showpage('refill.task');
+    }
+
+    public function task_addOp()
+    {
+        if(chksubmit())
+        {
+            $insert['task_type'] = $_POST['task_type'];
+            $insert['type'] = $_POST['type'];
+            $insert['cid'] = $_POST['cid'];
+            $insert['add_time'] = time();
+
+            $condition['order_time_type'] = $_POST['order_time_type'];
+            $start_unixtime = intval(strtotime($_POST['query_start_time']));
+            $end_unixtime = intval(strtotime($_POST['query_end_time']));
+            if ($start_unixtime > 0 && $end_unixtime > $start_unixtime) {
+                $condition['refill_order.order_time'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
+                $condition['vr_order.add_time'] = ['egt', $start_unixtime-1];
+            } elseif ($start_unixtime > 0) {
+                $condition['refill_order.order_time'] = ['egt', $start_unixtime];
+                $condition['vr_order.add_time'] = ['egt', $start_unixtime-1];
+            }
+            if(!empty($_POST['order_state'])) {
+                $condition['order_state'] = $_POST['order_state'];
+            }
+
+            $hash = $this->task_hash_check($condition, $insert['task_type'], $insert['type']);
+            if($hash === false) {
+                showMessage('此任务已存在,如需重新执行,请删除已存在的任务');
+            }
+            $insert['task_hash'] = $hash;
+            $insert['task_condition'] = serialize($condition);
+
+            $model = Model('refill_task');
+            $resp = $model->TaskInsert($insert);
+            if($resp) {
+                showMessage('录入成功', 'index.php?act=OrderStats&&op=refill_task');
+            }else{
+                showMessage('任务添加失败');
+            }
+        }
+        else
+        {
+            Tpl::output('task_type', $this->task_type);
+            Tpl::output('type', $this->type);
+            Tpl::output('order_time_type', $this->order_time_type);
+            Tpl::showpage('refill.task.add');
+        }
+    }
+
+    private function task_hash_check($condition, $task_type, $type)
+    {
+        $model = Model('refill_task');
+        $hash = md5(serialize($condition) . $task_type . $type);
+        $check = $model->TaskHashCheck($hash);
+        if($check) {
+            return $hash;
+        }else{
+            return false;
+        }
+    }
 }

+ 1 - 18
admin/control/refill_successful.php

@@ -117,8 +117,7 @@ class refill_successfulControl extends SystemControl
         //0:成功单,1:失败单,2:成功率
         $ins = Cache::getInstance('cacheredis');
         $json = $ins->get_org('merchant_card_type_ratios');
-        $data = json_decode($json);
-        $data = $this->object_array($data);
+        $data = json_decode($json, true);
         $result = [];
         $stats = [];
         $card_types = ['YD', 'LT', 'DX'];
@@ -147,20 +146,4 @@ class refill_successfulControl extends SystemControl
         Tpl::output('list', $result);
         Tpl::showpage('merchant.ratios');
     }
-
-    private function object_array($array)
-    {
-        if(is_object($array))
-        {
-            $array = (array)$array;
-        }
-        if(is_array($array))
-        {
-            foreach($array as $key=>$value)
-            {
-                $array[$key] = $this->object_array($value);
-            }
-        }
-        return $array;
-    }
 }

+ 11 - 12
admin/templates/default/merchant.order.stats.php

@@ -31,6 +31,8 @@
                 <li><a href="index.php?act=OrderStats&op=index&type=system"><span>平台对账记录</span></a></li>
                 <li><a href="index.php?act=OrderStats&op=index&type=provider"><span>上游对账记录</span></a></li>
                 <li><a href="JavaScript:void(0);" class="current"><span>下游对账记录</span></a></li>
+                <li><a href="index.php?act=OrderStats&op=refill_task"><span>任务列表</span></a></li>
+                <li><a href="index.php?act=OrderStats&op=task_add"><span>任务录入</span></a></li>
             </ul>
         </div>
     </div>
@@ -47,30 +49,25 @@
             <tr>
                 <th><label for="query_start_time">统计时间</label></th>
                 <td>
+                    <label for="startTime"></label>
                     <input class="txt date" type="text" value="<?php echo $_GET['query_start_time']; ?>"
-                           id="startTime" name="query_start_time" autocomplete="off" style="width:120px" />
+                           id="startTime" name="query_start_time" autocomplete="off" style="width:120px"/>
                     <label for="query_start_time">~</label>
+                    <label for="endTime"></label>
                     <input class="txt date" type="text" value="<?php echo $_GET['query_end_time']; ?>"
-                           id="endTime" name="query_end_time" autocomplete="off" style="width:120px" />
+                           id="endTime" name="query_end_time" autocomplete="off" style="width:120px"/>
                 </td>
                 <th><label>统计日期类型</label></th>
                 <td>
                     <select name="order_time_type" id="order_time_type">
                         <option value="">请选择...</option>
-                        <option value="notify_time" <?php if($_GET['order_time_type'] == 'notify_time'){ echo 'selected';}?>>回调日期</option>
-                        <option value="order_time" <?php if($_GET['order_time_type'] == 'order_time'){ echo 'selected';}?>>下单日期</option>
+                        <?php foreach ($output['order_time_type_text'] as $key => $value) { ?>
+                            <option value="<?php echo $key; ?>" <?php if($_GET['order_time_type'] == $value){ echo 'selected';}?>><?php echo $value; ?></option>
+                        <?php } ?>
                     </select>
                 </td>
                 <th><label>商户名称</label></th>
                 <td>
-                    <!-- <select name="cid" id="cid" class="querySelect" lay-verify="" lay-search>
-                        <option value=""><?php echo $lang['nc_please_choose']; ?></option>
-                        <?php foreach($output['merchant_list'] as $merchant){?>
-                            <option value="<?php echo $merchant['mchid']?>"
-                                    <?php if ($_GET['cid'] == $merchant['mchid']){ ?>selected<?php } ?>><?php echo $merchant['company_name'] == '' ? $merchant['name'] : $merchant['company_name'];?>
-                            </option>
-                        <?php }?>
-                    </select> -->
                     <div id="selest_nc"></div>
                 </td>
                 <td><a href="javascript:void(0);" id="ncsubmit" class="btn-search "
@@ -132,6 +129,7 @@
 <!--                <th class="align-center">失败订单数量</th>-->
 <!--                <th class="align-center">成功占比</th>-->
                 <th class="align-center">当日结余</th>
+                <th class="align-center">充值中数量</th>
                 <th class="align-center">下游成功单量</th>
                 <th class="align-center">下游成功面值</th>
                 <th class="align-center">下游成功扣款金额</th>
@@ -161,6 +159,7 @@
 <!--                        <td class="align-center">--><?php //echo $v['order_count']; ?><!--</td>-->
 <!--                        <td class="align-center">--><?php //echo $v['cancel_count']; ?><!--</td>-->
 <!--                        <td class="align-center">--><?php //echo $v['success_ratio']; ?><!--</td>-->
+                        <td class="align-center"><?php echo $v['send_count']; ?></td>
                         <td class="align-center"><?php echo $v['corder_success_count']; ?></td>
                         <td class="align-center"><?php echo $v['corder_success_refill_amounts']; ?></td>
                         <td class="align-center"><?php echo $v['corder_success_amounts']; ?></td>

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

@@ -26,7 +26,11 @@
         table-layout:fixed;
     }
     .w1pre {
-        width: 10%!important;
+        width: 6%!important;
+    }
+    .w1p {
+        width: 3.5%!important;
+
     }
     #tablee thead {
         width: calc( 100% - 1em )
@@ -77,10 +81,10 @@
         <table class="table tb-type2" id="tablee">
             <thead>
             <tr class="thead">
-                <th class="align-center w1pre">机构编码</th>
-                <th class="align-center w1pre">机构名称</th>
-                <th class="align-center w1pre">超时时间(秒)</th>
-                <th class="align-center w1pre">15分钟: 总(成功,失败,总订单数) <br> 移 | 联 | 电 (成功单量)</th>
+                <th class="align-center w1p">机构编码</th>
+                <th class="align-center w1p">机构名称</th>
+                <th class="align-center w1p">超时时间(秒)</th>
+                <th class="align-center w10pre">15分钟: 总(成功,失败,总订单数) <br> 移 | 联 | 电 (成功单量)</th>
                 <th class="align-center w10pre">30分钟</th>
                 <th class="align-center w10pre">1小时</th>
                 <th class="align-center w10pre">2小时</th>
@@ -90,9 +94,9 @@
             <?php if (!empty($output['list']) && is_array($output['list'])) { ?>
                 <?php foreach ($output['list'] as $k => $v) { ?>
                     <tr class="trFlex">
-                        <td class="align-center"><?php echo $k;?></td>
-                        <td class="align-center"><?php echo $v['company_name'];?></td>
-                        <td class="align-center"><?php echo $v['time_out'];?></td>
+                        <td class="align-center w1pre"><?php echo $k;?></td>
+                        <td class="align-center w1pre"><?php echo $v['company_name'];?></td>
+                        <td class="align-center w1pre"><?php echo $v['time_out'];?></td>
                         <td class="align-center">
                             <?php if(($v['ratio']['ALL'][900][0] + $v['ratio']['ALL'][900][1]) > 0){?>
                                 <?php echo ($v['ratio']['ALL'][900][2] * 100) ?? 0;?>%(<span style="color: #2d7255; display: inline-block; padding-bottom: 4px;"><?php echo ($v['ratio']['ALL'][900][0]) ?? 0;?></span>,<span style="color: red;"><?php echo ($v['ratio']['ALL'][900][1]) ?? 0;?></span> ,<?php echo ($v['ratio']['ALL'][900][0] + $v['ratio']['ALL'][900][1]) ?? 0;?>) <br>

+ 18 - 7
admin/templates/default/provider.order.stats.php

@@ -31,6 +31,8 @@
                 <li><a href="index.php?act=OrderStats&op=index&type=system"><span>平台对账记录</span></a></li>
                 <li><a href="JavaScript:void(0);" class="current"><span>上游对账记录</span></a></li>
                 <li><a href="index.php?act=OrderStats&op=index&type=merchant"><span>下游对账记录</span></a></li>
+                <li><a href="index.php?act=OrderStats&op=refill_task"><span>任务列表</span></a></li>
+                <li><a href="index.php?act=OrderStats&op=task_add"><span>任务录入</span></a></li>
             </ul>
         </div>
     </div>
@@ -46,18 +48,25 @@
             <tr>
                 <th><label for="query_start_time">统计时间</label></th>
                 <td>
-                    <input class="txt date" type="text" value="<?php echo $_GET['query_start_time']; ?>"
-                           id="startTime" name="query_start_time" autocomplete="off" style="width:120px" />
+                    <label for="startTime"></label
+                    ><input class="txt date" type="text"
+                            value="<?php echo $_GET['query_start_time']; ?>"
+                            id="startTime" name="query_start_time" autocomplete="off"
+                            style="width:120px"/>
                     <label for="query_start_time">~</label>
-                    <input class="txt date" type="text" value="<?php echo $_GET['query_end_time']; ?>"
-                           id="endTime" name="query_end_time" autocomplete="off" style="width:120px" />
+                    <label for="endTime"></label>
+                    <input class="txt date" type="text"
+                           value="<?php echo $_GET['query_end_time']; ?>"
+                           id="endTime" name="query_end_time" autocomplete="off"
+                           style="width:120px"/>
                 </td>
                 <th><label>统计日期类型</label></th>
                 <td>
-                    <select name="order_time_type" id="order_time_type">
+                    <label for="order_time_type"></label><select name="order_time_type" id="order_time_type">
                         <option value="">请选择...</option>
-                        <option value="notify_time" <?php if($_GET['order_time_type'] == 'notify_time'){ echo 'selected';}?>>回调日期</option>
-                        <option value="order_time" <?php if($_GET['order_time_type'] == 'order_time'){ echo 'selected';}?>>下单日期</option>
+                        <?php foreach ($output['order_time_type_text'] as $key => $value) { ?>
+                            <option value="<?php echo $key; ?>" <?php if($_GET['order_time_type'] == $value){ echo 'selected';}?>><?php echo $value; ?></option>
+                        <?php } ?>
                     </select>
                 </td>
                 <th><label>通道名称</label></th>
@@ -122,6 +131,7 @@
 <!--                <th class="align-center">订单总量</th>-->
 <!--                <th class="align-center">失败订单数量</th>-->
 <!--                <th class="align-center">成功占比</th>-->
+                <th class="align-center">充值中数量</th>
                 <th class="align-center">上游成功单量</th>
                 <th class="align-center">上游成功面值</th>
                 <th class="align-center">上游成功扣款金额</th>
@@ -150,6 +160,7 @@
 <!--                        <td class="align-center">--><?php //echo $v['order_count']; ?><!--</td>-->
 <!--                        <td class="align-center">--><?php //echo $v['cancel_count']; ?><!--</td>-->
 <!--                        <td class="align-center">--><?php //echo $v['success_ratio']; ?><!--</td>-->
+                        <td class="align-center"><?php echo $v['send_count']; ?></td>
                         <td class="align-center"><?php echo $v['corder_success_count']; ?></td>
                         <td class="align-center"><?php echo $v['corder_success_refill_amounts']; ?></td>
                         <td class="align-center"><?php echo $v['corder_success_amounts']; ?></td>

+ 280 - 0
admin/templates/default/refill.task.add.php

@@ -0,0 +1,280 @@
+<?php defined('InShopNC') or exit('Access Invalid!'); ?>
+<!--//zmr>v20-->
+<style>
+    .layui-form-select .layui-input {
+        padding: 13px 5px;
+    }
+
+    .layui-form-select dl {
+        top: 29px !important;
+        min-width: 40%!important;
+    }
+    .layui-form-select .layui-edge {
+        right: 204px!important;
+    }
+
+    .layui-input {
+        width: 41%!important;
+    }
+    .layui-form-select {
+        width: 85%;
+    }
+
+    .layui-select-title {
+        width: 100%;
+    }
+    .page .fixed-bar .item-title h3 {
+        margin-top: 18px !important;
+        margin-bottom: 10px !important;
+        font-weight: 700 !important;
+    }
+
+    .tab-base li span {
+        font-size: 12px !important;
+    }
+</style>
+<div class="page">
+    <div class="fixed-bar">
+        <div class="item-title">
+            <h3>对账管理</h3>
+            <ul class="tab-base">
+                <li><a href="index.php?act=OrderStats&op=index&type=system"><span>上游对账记录</span></a></li>
+                <li><a href="index.php?act=OrderStats&op=index&type=provider"><span>上游对账记录</span></a></li>
+                <li><a href="index.php?act=OrderStats&op=index&type=merchant"><span>下游对账记录</span></a></li>
+                <li><a href="index.php?act=OrderStats&op=refill_task"><span>任务列表</span></a></li>
+                <li><a href="JavaScript:void(0);" class="current"><span>任务录入</span></a></li>
+            </ul>
+        </div>
+    </div>
+    <div class="fixed-empty"></div>
+    <form id="points_form" method="post" name="form1" enctype="multipart/form-data" >
+        <input type="hidden" name="form_submit" value="ok"/>
+
+        <table class="table tb-type2 nobdb">
+            <tbody>
+            <tr class="noborder">
+                <td colspan="2" class="required"><label class="validation">任务类型:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="layui-form">
+                    <select name="task_type" class="layui_in" id="task_type" lay-verify="" lay-search>
+                        <option value="">请选择</option>
+                        <?php foreach ($output['task_type'] as $key => $value){?>
+                            <option value="<?php echo $key;?>"><?php echo $value;?></option>
+                        <?php }?>
+                    </select>
+                    <td class="vatop tips"></td>
+                </td>
+            </tr>
+            <tr>
+                <td colspan="2" class="required"><label class="validation">主体类型:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="layui-form">
+                    <select name="type" class="layui_in subject" id="type" lay-verify="" lay-search lay-filter="type">
+                        <option value="">请选择</option>
+                        <?php foreach ($output['type'] as $key => $value){?>
+                        <option value="<?php echo $key;?>"><?php echo $value;?></option>
+                        <?php }?>
+                    </select>
+                </td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr>
+                <td colspan="2" class="required"><label class="validation">主体选择:</label></td>
+            </tr>
+            <tr class="noborder" >
+                <td class="layui-form">
+                    <label for="selection"></label>
+                    <select name="cid" id="selection" lay-search></select>
+                </td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr>
+                <td colspan="2" class="required"><label class="validation">任务统计条件:</label></td>
+            </tr>
+            <tr class="noborder" >
+                <td style="width: 380px;" >
+                    <label for="startTime">日期区间:</label>
+                    <input style="margin-left:10px;width:120px" class="txt date" type="text"
+                           value=""
+                           id="startTime" name="query_start_time" autocomplete="off"/>
+                    <label for="endTime">~</label>
+                    <input class="txt date" type="text" value="" id="endTime"
+                           name="query_end_time" autocomplete="off" style="width:120px"/>
+                </td>
+                <td class="vatop tips"></td>
+            </tr>  
+            <tr class="noborder" >
+                <td colspan="2" class="vatop rowform">
+                    <label for="order_time_type" >日期类型:</label>
+                </td>
+            </tr>
+            <tr class="noborder">
+                <td class="layui-form">
+                    <select name="order_time_type" class="querySelect" id="order_time_type">
+                        <option value="">请选择</option>
+                        <?php foreach ($output['order_time_type'] as $key => $value) { ?>
+                            <option value="<?php echo $key; ?>"><?php echo $value; ?></option>
+                        <?php } ?>
+                    </select>
+                </td>
+                <td class="vatop tips"></td>
+            </tr>  
+            <tr class="noborder">
+                <td colspan="2" class="vatop rowform">
+                    <label for="order_state" >订单状态:</label>
+                </td>
+            </tr>
+            <tr class="noborder">
+                <td class="layui-form">
+                    <select name="order_state" class="querySelect" id="order_state">
+                        <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+                        <option value="10"><?php echo $lang['order_state_new']; ?></option>
+                        <option value="20"><?php echo $lang['order_state_pay']; ?></option>
+                        <option value="30"><?php echo $lang['order_state_send']; ?></option>
+                        <option value="40"><?php echo $lang['order_state_success']; ?></option>
+                        <option value="0"><?php echo $lang['order_state_cancel']; ?></option>
+                    </select>
+                </td>
+                <td class="vatop tips"></td>
+            </tr> 
+            </tbody>
+            <tfoot>
+            <tr class="tfoot">
+                <td>
+                    <a href="JavaScript:void(0);" class="btn" id="submitBtn"><span><?php echo $lang['nc_submit']; ?></span></a>
+                </td>
+            </tr>
+            </tfoot>
+        </table>
+    </form>
+</div>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/laydate/laydate.js"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/jquery.ui.js"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/i18n/zh-CN.js"
+        charset="utf-8"></script>
+<link rel="stylesheet" type="text/css"
+      href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/themes/ui-lightness/jquery.ui.css"/>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/refill/layer.js"></script>
+<script type="text/javascript" src="<?php echo ADMIN_TEMPLATES_URL; ?>/layui/layui.js"></script>
+<link rel="stylesheet" type="text/css" href="<?php echo ADMIN_TEMPLATES_URL; ?>/layui/css/layui.css"/>
+
+<script type="text/javascript">
+    var ji = null;
+    $(function () {
+        $("#voucher").change(function () {
+            $("#textfield1").val($(this).val());
+        });
+        $("#submitBtn").click(function () {
+            if ($("#points_form").valid()) {
+                $("#points_form").submit();
+            }
+        });
+        //主体选择
+        layui.use(['form'], function () {
+            let form = layui.form;
+            form.on('select(type)', function (data) {
+                let form_type = data.value;
+                    form.render('select')
+                    if (form_type === 'merchant') {
+                    $.get('index.php?act=refill_order&op=merchant_data', function(res) {
+                        res = JSON.parse(res) 
+                        let html = '';
+                        res.forEach(item => {
+                        html += `<option value="${item.value}">${item.name}</option>`;
+                        })
+                        let select_type = `<select>${html}</select>`
+                        $('#selection').html(select_type);
+                        form.render('select')
+                    })
+                } else if (form_type === 'provider'){
+                    $.get('index.php?act=refill_order&op=provider_data', function(res) {
+                        res = JSON.parse(res) 
+                        let html = '';
+                        res.forEach(item => {
+                        html += `<option value="${item.value}">${item.name}</option>`;
+                        })
+                        let select_type = `<select>${html}</select>`
+                        $('#selection').html(select_type);
+                        form.render('select')
+                    })
+                } else {
+                        $('#selection').html('');
+                        form.render('select')
+                }
+            })
+        })
+        $('#points_form').validate({
+            errorPlacement: function (error, element) {
+                error.appendTo(element.parent().parent().prev().find('td:first'));
+            },
+            rules: {
+                type: {
+                    required: true
+                },
+                order_time_type: {
+                    required: true
+                },
+                cid: {
+                    required: true
+                },
+                task_type: {
+                    required: true
+                },
+                query_start_time: {
+                    required: true
+                }
+            },
+            messages: {
+                type: {
+                    required: '未选择主体类型'
+                },
+                order_time_type: {
+                    required: '日期类型未选择'
+                },
+                cid: {
+                    required: '未选择统计主体'
+                },
+                task_type: {
+                    required: '未选择任务类型'
+                },
+                query_start_time: {
+                    required: '未选择日期区间'
+                }
+            }
+        });
+            // 日期选择器
+        $('#query_start_time').datepicker({dateFormat: 'yy-mm-dd'});
+        $('#query_end_time').datepicker({dateFormat: 'yy-mm-dd'});
+        let start_a = laydate.render({
+            elem: '#startTime',
+            type: 'datetime',
+            trigger: 'click',
+            done: function (value, date, endDate) {
+                end.config.min = {
+                    year: date.year,
+                    month: date.month - 1,
+                    date: date.date,
+                }; 
+                end.config.value = {
+                    year: date.year,
+                    month: date.month - 1,
+                    date: date.date,
+                }; 
+            }
+        });
+        let end = laydate.render({
+            elem: '#endTime',
+            type: 'datetime',
+            trigger: 'click',
+            done: function (value, date, endDate) {
+                start_a.config.max = {
+                    year: date.year,
+                    month: date.month - 1,
+                    date: date.date,
+                }; 
+            }
+        });
+    })
+</script>

+ 306 - 0
admin/templates/default/refill.task.php

@@ -0,0 +1,306 @@
+<style>
+    th label {
+        display: inline-block;
+        width: 60px;
+        margin-left: 10px;
+    }
+    .page .fixed-bar .item-title h3 {
+        margin-top: 18px !important;
+        margin-bottom: 10px !important;
+        font-weight: 700 !important;
+    }
+    .tab-base li span {
+        font-size: 12px !important;
+    }
+    .query_ors {
+        width: 125px;
+    }
+    th label {
+        display: inline-block;
+        width: 60px;
+    }
+    .lineLi {
+        min-width: 150px;
+        font-size: 12px;
+        color: #000;
+    }
+    #prompt ul .noLineLi {
+        background: none;
+    }
+    #prompt div {
+        display: inline-block;
+        background: none
+    }
+    #prompt ul .lineLi {
+        color: #000;
+    }
+    #selest_nc {
+        width: 220px
+    }
+    tbody {
+        font-size: 12px;
+    }
+    .layui-form-select .layui-input {
+        padding: 13px 5px;
+    }
+    .selection .layui-form-selected dl {
+        display: flex !important;
+        flex-wrap: wrap !important;
+    }
+    .selection .layui-form-select dl {
+
+        top: 29px !important;
+        min-width: 883% !important;
+        max-height: 280px !important;
+        padding: 14px 0 !important;
+        left: -599px !important;
+    }
+    .layui-form-select {
+        width: 45%;
+    }
+    .layui-select-title {
+        width: 104%;
+    }
+    .selection .layui-form-select .layui-input {
+        padding-left: 11px;
+    }
+    .page .fixed-bar .item-title h3 {
+        margin-top: 18px !important;
+        margin-bottom: 10px !important;
+        font-weight: 700 !important;
+    }
+    .tab-base li span {
+        font-size: 12px !important;
+    }
+    .layui-form-select .layui-input {
+        height: 26px;
+    }
+    input::placeholder {
+        color: #333;
+    }
+    .xm-tips {
+        color: #333 !important;
+        font-size: 12px;
+    }
+    .layui-form-select dl dd.layui-this {
+        display: none;
+    }
+    .layui-form-select dl dd {
+        cursor: pointer;
+        width: 130px;
+    }
+    .tb-type1 td select {
+        width: 201px;
+    }
+    .tb-type1 td input[type="text"],
+    .tb-type1 td select {
+        margin-right: 4px;
+        margin-left: 0;
+        width: 195px;
+    }
+    .layui-form-select .layui-edge {
+        right: -91px !important;
+    }
+    .type .layui-form-select dl {
+        top: 29px !important;
+        width: 214% !important;
+    }
+</style>
+
+<?php defined('InShopNC') or exit('Access Invalid!'); ?>
+<div class="page">
+    <div class="fixed-bar">
+        <div class="item-title">
+            <h3>对账管理</h3>
+            <ul class="tab-base">
+                <li><a href="index.php?act=OrderStats&op=index&type=system"><span>上游对账记录</span></a></li>
+                <li><a href="index.php?act=OrderStats&op=index&type=provider"><span>上游对账记录</span></a></li>
+                <li><a href="index.php?act=OrderStats&op=index&type=merchant"><span>下游对账记录</span></a></li>
+                <li><a href="JavaScript:void(0);" class="current"><span>任务列表</span></a></li>
+                <li><a href="index.php?act=OrderStats&op=task_add"><span>任务录入</span></a></li>
+            </ul>
+        </div>
+    </div>
+    <div class="fixed-empty"></div>
+    <form method="get" action="index.php" name="formSearch" id="formSearch">
+        <input type="hidden" name="act" value="order_search"/>
+        <input type="hidden" name="op" value="index"/>
+        <table class="tb-type1 noborder search">
+            <tr>
+                <th><label for="query_start_time">下单时间</label></th>
+                <td style="width: 327px">
+                    <input class="txt date" type="text" value="<?php echo $_GET['query_start_time']; ?>"
+                           id="startTime" name="query_start_time" autocomplete="off" style="width:120px" />
+                    <label for="query_start_time">~</label>
+                    <input class="txt date" type="text" value="<?php echo $_GET['query_end_time']; ?>"
+                           id="endTime" name="query_end_time" autocomplete="off" style="width:120px" />
+                </td>
+                <th><label>订单状态</label></th>
+                <td class="layui-form type">
+                    <select name="order_state" class="querySelect">
+                        <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+                        <option value="10"
+                                <?php if ($_GET['order_state'] == '10'){ ?>selected<?php } ?>><?php echo $lang['order_state_new']; ?></option>
+                        <option value="20"
+                                <?php if ($_GET['order_state'] == '20'){ ?>selected<?php } ?>><?php echo $lang['order_state_pay']; ?></option>
+                        <option value="30"
+                                <?php if ($_GET['order_state'] == '30'){ ?>selected<?php } ?>><?php echo $lang['order_state_send']; ?></option>
+                        <option value="40"
+                                <?php if ($_GET['order_state'] == '40'){ ?>selected<?php } ?>><?php echo $lang['order_state_success']; ?></option>
+                        <option value="0"
+                                <?php if ($_GET['order_state'] == '0'){ ?>selected<?php } ?>><?php echo $lang['order_state_cancel']; ?></option>
+                    </select>
+                </td>
+                <th><label>主体类型</label></th>
+                <td class="layui-form type">
+                    <select name="type" id="type" lay-filter="type">
+                        <option value="">请选择</option>
+                        <?php foreach ($output['type'] as $key => $value){?>
+                        <option value="<?php echo $key;?>"><?php echo $value;?></option>
+                        <?php }?>
+                    </select>
+                </td>
+                <th><label>主体选择</label></th>
+                <td class="layui-form selection">
+                    <select name="cid" id="selection" lay-search></select>
+                </td>
+                <!-- <td>
+                    <a href="javascript:void(0);" id="ncsubmit" class="btn-search "
+                       title="<?php echo $lang['nc_query']; ?>">&nbsp;
+                    </a>
+                </td> -->
+            </tr>
+        </table>
+    </form>
+
+    <table class="table tb-type2 nobdb">
+        <thead>
+        <tr class="thead">
+            <th class="align-center">编号</th>
+            <th class="align-center">任务ID</th>
+            <th class="align-center">任务类型</th>
+            <th class="align-center">主体类型</th>
+            <th class="align-center">主体ID</th>
+            <th class="align-center">任务条件</th>
+            <th class="align-center">任务状态</th>
+            <th class="align-center">生成日期</th>
+            <th class="align-center">处理日期</th>
+            <th class="align-center">完成日期</th>
+            <th class="align-center">处理结果</th>
+        </tr>
+        </thead>
+        <tbody id="tbody">
+        <?php if (count($output['list']) > 0) { ?>
+            <?php
+            foreach ($output['list'] as $key => $value) { ?>
+                <tr class="hover trFlex">
+                    <td class="align-center"><?php echo $key + 1; ?></td>
+                    <td class="align-center"><?php echo $value['task_id']; ?></td>
+                    <td class="align-center"><?php echo $output['task_type'][$value['task_type']]; ?></td>
+                    <td class="align-center"><?php echo $output['type'][$value['type']]; ?></td>
+                    <td class="align-center"><?php echo $value['cid']; ?></td>
+                    <td class="align-center">
+
+                    </td>
+                    <td class="align-center"><?php echo $output['task_state'][$value['task_state']]; ?></td>
+                    <td class="align-center"><?php echo $value['add_time'] ? date('Y-m-d H:i:s', $value['add_time']) : '/'; ?></td>
+                    <td class="align-center"><?php echo $value['dispose_time'] ? date('Y-m-d H:i:s', $value['dispose_time']) : '/'; ?></td>
+                    <td class="align-center"><?php echo $value['finish_time'] ? date('Y-m-d H:i:s', $value['finish_time']) : '/'; ?></td>
+                    <td class="align-center"></td>
+                </tr>
+            <?php } ?>
+        <?php } else { ?>
+            <tr class="no_data">
+                <td colspan="11"><?php echo $lang['nc_no_record']; ?></td>
+            </tr>
+        <?php } ?>
+        </tbody>
+        <tfoot>
+        <tr class="tfoot">
+            <td colspan="11" id="dataFuncs">
+                <div class="pagination"> <?php echo $output['show_page']; ?> </div>
+            </td>
+        </tr>
+        </tfoot>
+    </table>
+    <!-- 预警提示 -->
+    <audio id="auto" src="<?php echo RESOURCE_SITE_URL; ?>/warning.mp3"></audio>
+</div>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/laydate/laydate.js"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/jquery.ui.js"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/i18n/zh-CN.js"
+        charset="utf-8"></script>
+<link rel="stylesheet" type="text/css"
+      href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/themes/ui-lightness/jquery.ui.css"/>
+      <script type="text/javascript" src="<?php echo ADMIN_TEMPLATES_URL;?>/layui/layui.js"></script>
+<link rel="stylesheet" type="text/css" href="<?php echo ADMIN_TEMPLATES_URL; ?>/layui/css/layui.css"/>
+<script type="text/javascript">
+    $(function () {
+        $('#ncsubmit').click(function () {
+            $('#formSearch').submit();
+        });
+        $('#query_start_time').datepicker({dateFormat: 'yy-mm-dd'});
+        $('#query_end_time').datepicker({dateFormat: 'yy-mm-dd'});
+        // 日期选择器
+        laydate.render({
+            elem: '#startTime',
+            type: 'datetime'
+        });
+        laydate.render({
+            elem: '#endTime',
+            type: 'datetime'
+        });
+
+        // 表格hover时背景
+        $('.trFlex').each(function () {
+            $(this).hover(function () {
+                $(this)[0].style.backgroundColor = '#cbe9f3'
+            }, function () {
+                $(this)[0].style.backgroundColor = '#fff'
+            })
+        })
+        // 供方名称颜色
+        $('.textColor').each(function () {
+            let color = $(this).attr('data-color')
+            if (color == '1') {
+                $(this).css('color', 'green')
+            } else {
+                $(this).css('color', 'red')
+            }
+        })
+            //主体选择
+        layui.use(['form'], function () {
+            let form = layui.form;
+            form.on('select(type)', function (data) {
+            let form_type = data.value;
+            form.render('select')
+                if (form_type === 'merchant') {
+                $.get('index.php?act=refill_order&op=merchant_data', function(res) {
+                    res = JSON.parse(res) 
+                    let html = '';
+                    res.forEach(item => {
+                    html += `<option value="${item.value}">${item.name}</option>`;
+                    })
+                    let select_type = `<select>${html}</select>`
+                    $('#selection').html(select_type);
+                    form.render('select')
+                })
+            } else if (form_type === 'provider'){
+                $.get('index.php?act=refill_order&op=provider_data', function(res) {
+                    res = JSON.parse(res) 
+                    let html = '';
+                    res.forEach(item => {
+                    html += `<option value="${item.value}">${item.name}</option>`;
+                    })
+                    let select_type = `<select>${html}</select>`
+                    $('#selection').html(select_type);
+                    form.render('select')
+                })
+            } else {
+                    $('#selection').html('');
+                    form.render('select')
+                }
+            })
+        })
+    });
+</script> 

+ 15 - 6
admin/templates/default/system.order.stats.php

@@ -17,6 +17,8 @@
                 <li><a href="JavaScript:void(0);" class="current"><span>平台对账记录</span></a></li>
                 <li><a href="index.php?act=OrderStats&op=index&type=provider"><span>上游对账记录</span></a></li>
                 <li><a href="index.php?act=OrderStats&op=index&type=merchant"><span>下游对账记录</span></a></li>
+                <li><a href="index.php?act=OrderStats&op=refill_task"><span>任务列表</span></a></li>
+                <li><a href="index.php?act=OrderStats&op=task_add"><span>任务录入</span></a></li>
             </ul>
         </div>
     </div>
@@ -29,18 +31,25 @@
             <tr>
                 <th><label for="query_start_time">统计时间</label></th>
                 <td>
-                    <input class="txt date" type="text" value="<?php echo $_GET['query_start_time']; ?>"
-                           id="startTime" name="query_start_time" autocomplete="off" style="width:120px" />
+                    <label for="startTime"></label>
+                    <input class="txt date" type="text"
+                           value="<?php echo $_GET['query_start_time']; ?>"
+                           id="startTime" name="query_start_time" autocomplete="off"
+                           style="width:120px"/>
                     <label for="query_start_time">~</label>
-                    <input class="txt date" type="text" value="<?php echo $_GET['query_end_time']; ?>"
-                           id="endTime" name="query_end_time" autocomplete="off" style="width:120px" /></td>
+                    <label for="endTime"></label>
+                    <input class="txt date" type="text"
+                           value="<?php echo $_GET['query_end_time']; ?>"
+                           id="endTime" name="query_end_time" autocomplete="off"
+                           style="width:120px"/></td>
                 <td>
                 <th><label>统计日期类型</label></th>
                 <td>
                     <select name="order_time_type" id="order_time_type">
                         <option value="">请选择...</option>
-                        <option value="notify_time" <?php if($_GET['order_time_type'] == 'notify_time'){ echo 'selected';}?>>回调日期</option>
-                        <option value="order_time" <?php if($_GET['order_time_type'] == 'order_time'){ echo 'selected';}?>>下单日期</option>
+                        <?php foreach ($output['order_time_type_text'] as $key => $value) { ?>
+                            <option value="<?php echo $key; ?>" <?php if($_GET['order_time_type'] == $value){ echo 'selected';}?>><?php echo $value; ?></option>
+                        <?php } ?>
                     </select>
                 </td>
                 </td>

+ 61 - 0
data/model/refill_task.model.php

@@ -0,0 +1,61 @@
+<?php
+
+defined('InShopNC') or exit('Access Invalid!');
+
+class refill_taskModel extends Model
+{
+    const DisposeState = 2;
+    const FinishState = 3;
+    const ErrState = 4;
+
+    public function __construct()
+    {
+        parent::__construct('refill_task');
+    }
+
+    public function getRefillTaskList($condition, $pagesize = '', $field = '*', $order = 'add_time desc', $limit = '', $master = false)
+    {
+        $condition['is_del'] = 0;
+        $list = $this->field($field)->where($condition)->page($pagesize)->order($order)->limit($limit)->master($master)->select();
+        if (empty($list)) return [];
+        return $list;
+    }
+
+    public function TaskInsert($data)
+    {
+        return $this->insert($data);
+    }
+
+    public function TaskHashCheck($hash): bool
+    {
+        $condition['is_del'] = 0;
+        $condition['task_hash'] = $hash;
+        return empty($this->where($condition)->find());
+    }
+
+    public function TaskUnDisposeList($task_type)
+    {
+        $condition['is_del'] = 0;
+        $condition['task_state'] = 1;
+        $condition['task_type'] = $task_type;
+        $list = $this->where($condition)->page(1000)->order('add_time asc')->select();
+        if (empty($list)) return [];
+        return $list;
+    }
+
+    public function TaskDispose($condition)
+    {
+        $condition['is_del'] = 0;
+        return $this->where($condition)->update(
+            ['task_state' => self::DisposeState]
+        );
+    }
+
+    public function TaskDisposeErr($condition, $err_msg)
+    {
+        $condition['is_del'] = 0;
+        return $this->where($condition)->update(
+            ['task_state' => self::ErrState, 'task_result' => $err_msg]
+        );
+    }
+}

+ 63 - 49
helper/statistics/stat_refill.php

@@ -153,40 +153,47 @@ class stat_refill
     {
         $cond = [
             'refill_order.inner_status' => 0,
-            'vr_order.order_state' => ORDER_STATE_SUCCESS,
             "refill_order.{$order_time_type}&refill_order.{$order_time_type}" => ['_multi' => true, ['egt', $day_time], ['lt', $day_time + stat_refill::DaySecs]],
         ];
 
-        $items = Model('')->table('refill_order,vr_order')
-            ->field('mchid, count(*) as order_count, sum(refill_amount) as refill_amounts, sum(channel_amount) as channel_amounts, sum(mch_amount) as mch_amounts')
-            ->join('inner')
-            ->on('refill_order.order_id=vr_order.order_id')
-            ->where($cond)
-            ->group('mchid')
-            ->select();
-
-        foreach ($items as $item)
+        foreach ($this->mMerchantNames as $mchid => $cname)
         {
+            $mchid = intval($mchid);
+            if($mchid <= 0) continue;
+            if($cur_mchid != 0 && $cur_mchid != $mchid) continue;
+            $cond['refill_order.mchid'] = $mchid;
+            $items = Model('')->table('refill_order,vr_order')
+                ->field('mchid, count(*) as order_count, sum(refill_amount) as refill_amounts, sum(channel_amount) as channel_amounts, sum(mch_amount) as mch_amounts, order_state')
+                ->join('inner')
+                ->on('refill_order.order_id=vr_order.order_id')
+                ->where($cond)
+                ->group('order_state')
+                ->select();
+            if(empty($items)) continue;
+
             $params = [];
+
             $params['time_text'] = date("Y-m-d" , $day_time);
             $params['time_stamp'] = $day_time;
             $params['type'] = 'merchant';
             $params['order_time_type'] = $order_time_type;
-
-            $mchid = intval($item['mchid']);
-            if($mchid <= 0) continue;
-            if($cur_mchid != 0 && $cur_mchid != $mchid) continue;
-
             $params['cid'] = $mchid;
-            if(!array_key_exists($mchid,$this->mMerchantNames)) continue;
-            $params['cname'] = $this->mMerchantNames[$mchid];
-
-            $params['success_count'] = $item['order_count'];
-            $params['success_refill_amounts'] = $item['refill_amounts'];
-            $params['success_channel_amounts'] = $item['channel_amounts'];
-            $params['success_mch_amounts'] = $item['mch_amounts'];
-            $params['profit_amounts'] = $item['mch_amounts'] - $item['channel_amounts'];
-
+            $params['cname'] = $cname;
+            foreach ($items as $item)
+            {
+                $order_state = $item['order_state'];
+                if ($order_state == ORDER_STATE_SUCCESS) {
+                    $params['success_count'] = $item['order_count'];
+                    $params['success_refill_amounts'] = $item['refill_amounts'];
+                    $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'];
+                } else {
+                    $params['send_count'] = $item['order_count'];
+                }
+            }
             if($cur_mchid != 0 && $cur_mchid == $mchid) {
                 Model('')->table('refill_stats')->where(['time_stamp' => $day_time, 'cid' => $cur_mchid, 'type' => 'merchant', 'order_time_type' => $order_time_type])->update($params);
             }else{
@@ -199,41 +206,48 @@ class stat_refill
     {
         $cond = [
             'refill_order.inner_status' => 0,
-            'vr_order.order_state' => ORDER_STATE_SUCCESS,
             "refill_order.{$order_time_type}&refill_order.{$order_time_type}" => ['_multi' => true, ['egt', $day_time], ['lt', $day_time + stat_refill::DaySecs]],
         ];
 
-        $items = Model('')->table('refill_order,vr_order')
-            ->field('vr_order.store_id, count(*) as order_count, sum(refill_amount) as refill_amounts, sum(channel_amount) as channel_amounts, sum(mch_amount) as mch_amounts')
-            ->join('inner')
-            ->on('refill_order.order_id=vr_order.order_id')
-            ->where($cond)
-            ->group('vr_order.store_id')
-            ->select();
-
-        foreach ($items as $item)
+        foreach ($this->mProviderNames as $store_id => $cname)
         {
+            $store_id = intval($store_id);
+            if($store_id <= 0) continue;
+            if($cur_storeid != 0 && $cur_storeid != $store_id) continue;
+
+            $cond['vr_order.store_id'] = $store_id;
+            $items = Model('')->table('refill_order,vr_order')
+                ->field('vr_order.store_id, count(*) as order_count, sum(refill_amount) as refill_amounts, sum(channel_amount) as channel_amounts, sum(mch_amount) as mch_amounts, order_state')
+                ->join('inner')
+                ->on('refill_order.order_id=vr_order.order_id')
+                ->where($cond)
+                ->group('order_state')
+                ->select();
+            if(empty($items)) continue;
+
             $params = [];
             $params['time_text'] = date("Y-m-d" , $day_time);
             $params['time_stamp'] = $day_time;
             $params['type'] = 'provider';
             $params['order_time_type'] = $order_time_type;
-
-            $store_id = intval($item['store_id']);
-            if($store_id <= 0) continue;
-            if($cur_storeid != 0 && $cur_storeid != $store_id) continue;
-
             $params['cid'] = $store_id;
-            if(!array_key_exists($store_id,$this->mProviderNames)) continue;
-            $params['cname'] = $this->mProviderNames[$store_id];
-
-
-            $params['success_count'] = $item['order_count'];
-            $params['success_refill_amounts'] = $item['refill_amounts'];
-            $params['success_channel_amounts'] = $item['channel_amounts'];
-            $params['success_mch_amounts'] = $item['mch_amounts'];
-            $params['profit_amounts'] = $item['mch_amounts'] - $item['channel_amounts'];
-
+            $params['cname'] = $cname;
+
+            foreach ($items as $item)
+            {
+                $order_state = $item['order_state'];
+                if ($order_state == ORDER_STATE_SUCCESS) {
+                    $params['success_count'] = $item['order_count'];
+                    $params['success_refill_amounts'] = $item['refill_amounts'];
+                    $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'];
+                } else {
+                    $params['send_count'] = $item['order_count'];
+                }
+            }
             if($cur_storeid != 0 && $cur_storeid == $store_id) {
                 Model('')->table('refill_stats')->where(['time_stamp' => $day_time, 'cid' => $cur_storeid, 'type' => 'provider', 'order_time_type' => $order_time_type])->update($params);
             }else{

+ 44 - 0
test/TestExportOrder.php

@@ -73,6 +73,50 @@ class TestExportOrder extends TestCase
 
         fclose($fp);
     }
+
+    public function testRefillTask()
+    {
+        $model_refill_task = Model('refill_task');
+
+        $condition['task_type'] = 'order_export';
+        $task_list = $model_refill_task->getRefillTaskList($condition, 1000);
+        foreach ($task_list as $task)
+        {
+            $type = $task['type'];
+            $task_condition = unserialize($task['task_condition']);
+            if(empty($task_condition)) continue;
+            if($type === 'merchant') {
+
+            }
+        }
+
+    }
+
+    private function getAllOrders($condition): array
+    {
+        $len = 1000;
+
+        $i = 0;
+        $orders = [];
+        while (true)
+        {
+            $start = $i * $len;
+            $items = Model('')->table('refill_order,vr_order')
+                ->field('refill_order.*,vr_order.order_state')
+                ->join('inner')
+                ->on('refill_order.order_id=vr_order.order_id')
+                ->where($condition)
+                ->order('refill_order.order_time desc')
+                ->limit("{$start},{$len}")
+                ->select();
+            $orders = array_merge($orders,$items);
+            if (empty($items) || count($items) < $len) {
+                break;
+            }
+            $i++;
+        }
+        return $orders;
+    }
 }
 
 

+ 9 - 8
test/TestRefill.php

@@ -938,16 +938,17 @@ class TestRefill extends TestCase
 
     public function testGuochuang_nation()
     {
-//        $providers = $this->getProvider('guochuang_nation');
+        $providers = $this->getProvider('guochuang_nation');
 //        $resp = $providers->add(18500608333, 5, 1, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
+        $resp = $providers->query(['order_sn' => '4372390688043259849812']);
 
-        $body = '{"account":"18500608333","evidence":"N/A","evidenceType":"","id":"D2021090718185107657","inTime":"2021/09/07 18:19:05","money":"1","outerId":"65261631009929751933","status":"SUCCESS"}';
-        $params['ts'] = 1631009945;
-        $params['sign'] = 'C53F921EB5573EF4D0C757C5B5D4185D';
-        $params['body'] = $body;
-        $providers = $this->getProvider('guochuang_nation','RefillCallBack');
-        $ret = $providers->verify($params);
-        $resp = $providers->notify($params);
+//        $body = '{"account":"19982440060","evidence":"1000000083421102010443856304","evidenceType":"","id":"D2021102010210473815","inTime":"2021/10/20 10:31:14","money":"100","outerId":"1659990688040464576756","status":"SUCCESS"}';
+//        $params['ts'] = 1634697074;
+//        $params['sign'] = 'C93583DEF43208A26983BC5427CFFF12';
+//        $params['body'] = $body;
+//        $providers = $this->getProvider('guochuang_nation','RefillCallBack');
+//        $ret = $providers->verify($params);
+//        $resp = $providers->notify($params);
     }
 
     public function testTianyanman()

+ 6 - 0
test/TestRefillStats.php

@@ -24,6 +24,12 @@ class TestRefillStats extends TestCase
         $refill = new statistics\stat_refill();
         $refill->run();
     }
+
+    public function testMerchantStats()
+    {
+        $refill = new statistics\stat_refill();
+        $refill->merchant_stat(1617465600);
+    }
 }
 
 //docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillStats::testLatestDay)( .*)?$/" --test-suffix TestRefillStats.php /var/www/html/test