Selaa lähdekoodia

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

stanley-king 3 vuotta sitten
vanhempi
commit
9630e7af06

+ 42 - 6
admin/control/ordersendlist.php

@@ -156,8 +156,15 @@ class ordersendlistControl extends SystemControl
         foreach ($order_list as $order_id => $order_info) {
             $order_list[$order_id]['card_type_text'] = $this->scard_type($order_info['card_type']);
             $order_list[$order_id]['mch_name'] = $merchants[$order_info['mchid']]['company_name'];
-            $order_list[$order_id]['diff_time_text'] = $this->elapse_time(time() - $order_info['order_time']);
-            $order_list[$order_id]['diff_time'] = time() - $order_info['order_time'];
+            if ($order_info['notify_time'] > 0) {
+                $diff_time = $order_info['notify_time'] - $order_info['order_time'];
+            } else {
+                $diff_time = time() - $order_info['order_time'];
+            }
+
+            $order_list[$order_id]['diff_time'] = $diff_time;
+            $order_list[$order_id]['diff_time_text'] = $this->elapse_time($diff_time);
+
             $order_list[$order_id]['quality_text'] = $this->quality_format($order_info['quality'],$order_info['card_type']);
         }
 
@@ -176,12 +183,15 @@ class ordersendlistControl extends SystemControl
         if(empty($_GET['time'])) {
             $_GET['time'] = 1;
         }
+        if(empty($_GET['notify_time'])) {
+            $_GET['notify_time'] = 180;
+        }
         $time = $_GET['time'] * 3600;
         $condition['refill_order.order_time'] = ['gt', (time() - $time)];
-        if(!empty($_GET['notify_time'])) {
-            $notify_time = $_GET['notify_time'];
-            $condition['refill_order.notify_time'] = ['lt', (time() - $notify_time)];
-        }
+
+        $notify_time = $_GET['notify_time'];
+        $condition['refill_order.notify_time'] = ['lt', (time() - $notify_time)];
+
 
         $order_list = $model_refill_order->getMerchantOrderList($condition, '', 'refill_order.*,vr_order.order_state', 'refill_order.notify_time asc', 1000);
         $merchant_list = Model('')->table('merchant')->limit(1000)->order('name asc')->select();
@@ -199,4 +209,30 @@ class ordersendlistControl extends SystemControl
         Tpl::output('show_page', $model_refill_order->showpage());
         Tpl::showpage('refill.order.notify.err.index');
     }
+
+    public function notifyerr_all_notifyOp()
+    {
+        if(empty($_GET['time']) || empty($_GET['notify_time'])) {
+            showMessage('日期条件错误');
+        }
+        $model_refill_order = Model('refill_order');
+
+        $order_state_cancel = ORDER_STATE_CANCEL;
+        $order_state_success = ORDER_STATE_SUCCESS;
+        $condition['refill_order.inner_status'] = 0;
+        $condition['vr_order.order_state'] = ['in',"{$order_state_cancel},{$order_state_success}"];
+        $condition['refill_order.mch_notify_state'] = 0;
+
+        $time = $_GET['time'] * 3600;
+        $condition['refill_order.order_time'] = ['gt', (time() - $time)];
+        $notify_time = $_GET['notify_time'];
+        $condition['refill_order.notify_time'] = ['lt', (time() - $notify_time)];
+
+        $order_list = $model_refill_order->getMerchantOrderList($condition, '', 'refill_order.*,vr_order.order_state', 'refill_order.notify_time asc', 1000);
+
+        foreach ($order_list as $order) {
+            QueueClient::push("NotifyMerchantComplete", ['order_id' => $order['order_id'], 'manual' => true]);
+        }
+        showMessage('操作成功');
+    }
 }

+ 79 - 5
admin/control/refill_refund.php

@@ -40,7 +40,21 @@ class refill_refundControl extends SystemControl
             $merchants[$value['mchid']] = $value;
         }
 
-        $refund_list = $mod->getRefillRefundList($condition,50);
+        if($_GET['export'] == 1) {
+            $this->RefillRefundExport($condition,$providers,$merchants);
+        }else{
+            $refund_list = $mod->getRefillRefundList($condition,50);
+            $refund_list = $this->DataFormat($refund_list,$providers,$merchants);
+        }
+
+        Tpl::output('provider_list', $providers);
+        Tpl::output('merchants', $merchants);
+        Tpl::output('info_list', $refund_list);
+        Tpl::showpage('refill.refund');
+    }
+
+    private function DataFormat($refund_list,$providers,$merchants)
+    {
         foreach ($refund_list as $key => $value) {
             $refund_list[$key]['provider_name'] = $providers[$value['provider_id']]['name'];
             $refund_list[$key]['store_name'] = $providers[$value['provider_id']]['store_name'];
@@ -50,10 +64,70 @@ class refill_refundControl extends SystemControl
 
             $refund_list[$key]['card_type_text'] = $this->scard_type($value['card_type']);
         }
-        Tpl::output('provider_list', $providers);
-        Tpl::output('merchants', $merchants);
-        Tpl::output('info_list', $refund_list);
-        Tpl::showpage('refill.refund');
+        return $refund_list;
+    }
+
+    private function RefillRefundExport($condition,$providers,$merchants)
+    {
+        $i = 0;
+        $result = [];
+        while (true) {
+            $start = $i * 1000;
+            $list = Model('')->table('refill_refund')->where($condition)->order('refund_time desc')->limit("{$start},1000")->select();
+
+            if (empty($list)) {
+                break;
+            }
+            $i++;
+            foreach ($list as $value) {
+                $result[] = $value;
+            }
+        }
+        $result = $this->DataFormat($result,$providers,$merchants);
+        $this->createExcel($result);
+    }
+
+    private function createExcel($data = array())
+    {
+        Language::read('export');
+        import('libraries.excel');
+        $excel_obj = new Excel();
+        $excel_data = array();
+        //设置样式
+        $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
+        //header
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '通道名称');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '通道退款金额');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '机构编码');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '机构名称');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '机构退款金额');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '退款卡号');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '退款卡类型');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '退款面值');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '退款日期');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '备注');
+        //data
+        foreach ((array)$data as $v) {
+            $mch_name = $v['company_name'] ?? $v['name'];
+            $tmp = array();
+            $tmp[] = array('data' => "{$v['provider_name']}({$v['store_name']})");
+            $tmp[] = array('data' => $v['channel_amount']);
+            $tmp[] = array('data' => $v['mchid']);
+            $tmp[] = array('data' => $mch_name);
+            $tmp[] = array('data' => $v['mch_amount']);
+            $tmp[] = array('data' => $v['card_no']);
+            $tmp[] = array('data' => $v['card_type_text']);
+            $tmp[] = array('data' => $v['refill_amount']);
+            $tmp[] = array('data' => date('Y-m-d H:i:s', $v['refund_time']));
+            $tmp[] = array('data' => $v['bz']);
+
+            $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($excel_obj->charset(L('exp_od_order'), CHARSET) . date('Y-m-d-H', time()));
+        exit;
     }
 
     public function addOp()

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

@@ -307,6 +307,19 @@
             </tbody>
         </table>
     </form>
+    <table class="table tb-type2" style="min-width:1400px">
+        <tbody>
+        <tr>
+            <td>
+                <ul>
+                    <li>
+                        队列任务个数:
+                    </li>
+                </ul>
+            </td>
+        </tr>
+        </tbody>
+    </table>
     <?php if($_GET['fShowStat'] == 1){?>
         <table class="table tb-type2" id="prompt" style="min-width:1400px">
             <tbody>

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

@@ -69,7 +69,7 @@
             <tr>
                 <th><label class="lefto">近期时间(小时内)</label></th>
                 <td  class="layui-form">
-                    <select name="time" class="querySelect" lay-verify="" lay-search>
+                    <select name="time" class="querySelect" id="time_id"  lay-verify="" lay-search lay-filter="time_id">
                         <option value=""><?php echo $lang['nc_please_choose']; ?></option>
                         <?php for ($i = 1; $i<=12; $i++) { ?>
                             <option value="<?php echo $i; ?>" <?php if ($_GET['time'] == $i){ ?>selected<?php } ?>><?php echo $i;?>小时
@@ -79,7 +79,7 @@
                 </td>
                 <th>回调时间</th>
                 <td>
-                    <select name="notify_time" class="querySelect">
+                    <select name="notify_time" class="querySelect" id="arrangeClass">
                         <option value=""><?php echo $lang['nc_please_choose']; ?></option>
                         <option value="1"
                                 <?php if ($_GET['notify_time'] == '1'){ ?>selected<?php } ?>>1秒</option>
@@ -111,6 +111,9 @@
                     <a href="#" class="btns" onclick="hCopyCardNo(event)">
                         <span><i class="icon-edit"></i>拷贝充值卡号</span>
                     </a>
+                    <a href="#" id="btn_time" class="btns">
+                        <span><i class="icon-edit"></i>批量回调</span>
+                    </a>
                 </td>
             </tr>
         </table>
@@ -227,6 +230,36 @@
             elem: '#endTime',
             type: 'datetime'
         });
+     
+        //批量回调
+        $('#btn_time').click(() => {
+            let time1 = $("#time_id option:selected").val()
+            let time2 = $("#arrangeClass option:selected").val()
+          console.log(time1, time2);
+          window.location.href =`index.php?act=OrderSendList&op=notifyerr_all_notify&time= ${time1 ? time1 : ''} &notify_time= ${time2 ? time2 : ''}`
+         
+        })
+        layui.use(['form'], function(){
+            var form = layui.form;
+            form.on('select(time_id)', function (data) {
+                const time3 = data.value;
+                console.log(time3);
+                form.render('select')
+
+                $("select[name='notify_time']").blur(function(){
+                const time4 = $(this).val()
+				console.log(time4)
+                $('#btn_time').click(() =>{
+                console.log(time3, time4);
+                window.location.href = `index.php?act=OrderSendList&op=notifyerr_all_notify&time= ${time3} &notify_time= ${time4}`
+
+
+                })
+			});
+            })
+        })
+    
+      
         let isWring = '<?php echo $output['count'][1];?>';
         // console.log('isWring', Number(isWring));
         let setTimer

+ 19 - 0
admin/templates/default/refill.refund.php

@@ -29,6 +29,7 @@
     <form method="get" name="formSearch" id="formSearch" class="layui-form">
         <input type="hidden" value="refill_refund" name="act">
         <input type="hidden" value="index" name="op">
+        <input type="hidden" name="export" value=""/>
         <table class="tb-type1 noborder search">
             <tbody>
             <tr>
@@ -66,6 +67,11 @@
                 </td>
                 <td><a href="javascript:void(0);" id="ncsubmit" class="btn-search "
                        title="<?php echo $lang['nc_query']; ?>">&nbsp;</a>
+                <td>
+                    <a href="javascript:void(0);" id="ncexport" class="btns" >
+                        <span><i class="icon-edit"></i>搜索导出</span>
+                    </a>
+                </td>
             </tr>
             </tbody>
         </table>
@@ -157,5 +163,18 @@
                 $(this)[0].style.backgroundColor = '#fff'
             })
         })
+        // 导出
+        $('#ncexport').click(function () {
+
+            $('input[name="export"]').val('1');
+            $('input[name="op"]').val('index');
+
+            $('#formSearch').submit();
+            $('input[name="export"]').val('');
+            var ii = layer.load();
+            setTimeout(function(){
+                layer.close(ii);
+            }, 800);
+        })
     });
 </script>

+ 7 - 6
test/TestRefill.php

@@ -1268,12 +1268,13 @@ class TestRefill extends TestCase
     public function testcreateSign()
     {
         $params['act'] = 'refill';
-        $params['amount'] = '100';
-        $params['cardno'] = '11100';
-        $params['mchid'] = '10152';
-        $params['notifyurl'] = 'http://122.114.168.35/gateway/api.notify/call?s_order=D20210623163820797539530&s_type=1';
+        $params['amount'] = '30';
+        $params['cardno'] = '18500972879';
+        $params['mchid'] = '10175';
+        $params['notifyurl'] = 'https://su.emgot.com/union/coco/rechargeNotify';
         $params['op'] = 'add';
-        $params['order_sn'] = 'D20210623163820797539530';
+        $params['order_sn'] = '20210706125001412243513';
+        $params['quality'] = 7;
         $sign = $this->md5_sign($params);
     }
 
@@ -1327,7 +1328,7 @@ class TestRefill extends TestCase
             }
         }
 
-        $body .= "&key=NNLUOn14tNBeG7JJRGoPDKEO6Ocdt89G";
+        $body .= "&key=BcuXVAbW3KstGRWh6EdMMoFIfq9XKUW0";
 
         return md5($body);
     }