Pārlūkot izejas kodu

task export add export_type

xiaoyu 3 gadi atpakaļ
vecāks
revīzija
71b25bfe57

+ 1 - 1
admin/control/refill_order.php

@@ -275,7 +275,7 @@ class refill_orderControl extends SystemControl
         $title = $input['task_title'] ?? '';
         $manager = new task\manager();
 
-        $cond = ['normal' => $normal_cond,'time_scope' => $time_scope];
+        $cond = ['normal' => $normal_cond,'time_scope' => $time_scope,'export_type'=> $input['export_type']];
 
         $task = $manager->add_task('refill_order_export',$cond,1,-1,$title);
         if ($task->completed() && $task->success()) {

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

@@ -204,6 +204,13 @@
                     <option value="notify_time"
                             <?php if ($_GET['time_type'] == 'notify_time'){ ?>selected<?php } ?>>回调时间</option>
                 </select>
+                    <label>导出对象</label>
+                    <select name="export_type" class="export_type">
+                        <option value="merchant"
+                                <?php if ($_GET['export_type'] == 'merchant'){ ?>selected<?php } ?>>机构</option>
+                        <option value="provider"
+                                <?php if ($_GET['export_type'] == 'provider'){ ?>selected<?php } ?>>上游</option>
+                    </select>
                 </td>
             </tr>
             <tr>

+ 11 - 3
helper/task/handler.php

@@ -82,6 +82,7 @@ class handler
 
         $normal_cond = $cond['normal'];
         $time_scope = $cond['time_scope'];
+        $export_type = $cond['export_type'];
 
         $order_reader = function ($normal_cond,$time_scope) use ($tmcond_gen)
         {
@@ -112,7 +113,7 @@ class handler
                 {
                     $start = $i * $len;
                     $items = $mod->table('refill_order,vr_order')
-                        ->field('refill_order.*,vr_order.order_state')
+                        ->field('refill_order.*,vr_order.order_state,vr_order.store_name')
                         ->join('inner')
                         ->on('refill_order.order_id=vr_order.order_id')
                         ->where($cond)
@@ -130,8 +131,15 @@ class handler
         };
 
         $merchants = [];
-        $column_values = ['商户号', '商户订单号', '平台单号','面额', '充值卡号', '充值卡类型', '是否转网', '下单日期', '完成日期', '订单状态', '扣款金额'];
-        $data_keys = ['mchid', 'mch_order', 'order_sn', 'refill_amount', 'card_no', 'card_type_text', 'is_transfer_text', 'order_time_text', 'notify_time_text','order_state_text', 'mch_amount'];
+        $column_values = ['平台单号','面额', '充值卡号', '充值卡类型', '是否转网', '下单日期', '完成日期', '订单状态'];
+        $data_keys = ['order_sn', 'refill_amount', 'card_no', 'card_type_text', 'is_transfer_text', 'order_time_text', 'notify_time_text','order_state_text'];
+        if($export_type === 'merchant') {
+            $column_values = array_merge(['商户号', '商户订单号'], $column_values, ['扣款金额']);
+            $data_keys = array_merge(['mchid', 'mch_order'], $data_keys, ['mch_amount']);
+        }elseif ($export_type === 'provider') {
+            $column_values = array_merge(['上游名称', '上游订单号'], $column_values, ['折扣金额']);
+            $data_keys = array_merge(['store_name', 'ch_trade_no'], $data_keys, ['channel_amount']);
+        }
         $merchant_list = Model('')->table('merchant')->limit(1000)->order('company_name asc')->select();
         foreach ($merchant_list as $value) {
             $merchants[$value['mchid']] = $value;