stanley-king 3 anni fa
parent
commit
52bef1a318

+ 25 - 588
admin/control/merchant.php

@@ -458,74 +458,6 @@ class merchantControl extends SystemControl
         }
     }
 
-    /**
-     * 充值申请列表
-     */
-    public function refill_evidenceOp()
-    {
-        $model_merchant = Model('merchant');
-        $condition = [];
-        if (trim($_GET['mch_name']) != '') {
-            $condition['mch_name'] = ['like', '%' . $_GET['mch_name'] . '%'];
-            Tpl::output('mch_name', $_GET['mch_name']);
-        }
-        $state_sel = intval($_REQUEST['state_sel']);
-        if ($state_sel == 1) {
-            $condition['check_time'] = 0;
-            $condition['status'] = 1;
-        } elseif ($state_sel == 2) {
-            $condition['check_time'] = ['gt', 0];
-            $condition['status'] = 2;
-        } elseif ($state_sel == 3) {
-            $condition['check_time'] = ['gt', 0];
-            $condition['status'] = 3;
-        } else {
-        }
-
-        $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];
-        }
-
-        //充值申请列表
-        $evidence_list = $model_merchant->getRefillEvidence($condition, 20, '*,member.available_predeposit', 'refill_evidence.add_time desc');
-        $status_text = ['申请中', '已通过', '已驳回'];
-        $operation_text = ['未预存', '已预存'];
-        $add_type_text = ['商户预存','后台手动预存'];
-
-        $counts = Model('')->table('refill_evidence')
-            ->field('sum(amount) as amounts,status')
-            ->where($condition)
-            ->group('status')
-            ->select();
-        $success_amount = $send_amount = $cancel_amount = 0;
-        foreach ($counts as $count) {
-            if($count['status'] == 1) {
-                $send_amount += $count['amounts'];
-            }elseif ($count['status'] == 2) {
-                $success_amount += $count['amounts'];
-            }elseif ($count['status'] == 3) {
-                $cancel_amount += $count['amounts'];
-            }
-        }
-        $stats['send_amount'] = $send_amount;
-        $stats['success_amount'] = $success_amount;
-        $stats['cancel_amount'] = $cancel_amount;
-        Tpl::output('stats', $stats);
-        Tpl::output('evidence_list', $evidence_list);
-        Tpl::output('status_text', $status_text);
-        Tpl::output('operation_text', $operation_text);
-        Tpl::output('add_type_text', $add_type_text);
-        Tpl::output('page', $model_merchant->showpage('2'));
-        Tpl::showpage('merchant.refill.evidence_list');
-    }
-
     public function check_evidenceOp()
     {
         $status = $_GET['status'];
@@ -545,7 +477,7 @@ class merchantControl extends SystemControl
 
             }
         }
-        showMessage(L('nc_common_save_succ'), urlAdmin('merchant', 'refill_evidence'));
+        showMessage(L('nc_common_save_succ'), urlAdmin('refill_evidence', 'index'));
     }
 
     public function rechargeOp()
@@ -561,7 +493,7 @@ class merchantControl extends SystemControl
                 $caches[$mchid] = ['last_time' => 0, 'send_count' => 0];
                 wcache("merchant-notify", ['data' => serialize($caches)], 'refill-');
             }
-            showMessage('操作成功', 'index.php?act=merchant&op=refill_evidence');
+            showMessage('操作成功', 'index.php?act=refill_evidence&op=index');
         } else {
             $apply_id = $_GET['apply_id'];
             if (!empty($apply_id)) {
@@ -647,10 +579,10 @@ class merchantControl extends SystemControl
                     $caches[$mchid] = ['last_time' => 0, 'send_count' => 0];
                     wcache("merchant-notify", ['data' => serialize($caches)], 'refill-');
                 }
-                showMessage('操作成功', 'index.php?act=merchant&op=refill_evidence');
+                showMessage('操作成功', 'index.php?act=refill_evidence&op=index');
             } catch (Exception $e) {
                 $trans->rollback();
-                showMessage('操作失败', 'index.php?act=merchant&op=refill_evidence');
+                showMessage('操作失败', 'index.php?act=refill_evidence&op=index');
             }
         } else {
             $page = "recharge.manual.{$type}";
@@ -742,7 +674,7 @@ class merchantControl extends SystemControl
                 $log_msg = "管理员【" . $admininfo['name'] . "】操作会员【" . $member_info['member_name'] . "】预存款【减少】,金额为" . $money . ",编号为" . $order_sn;
                 break;
             default:
-                showMessage('操作失败', 'index.php?act=merchant&op=refill_evidence');
+                showMessage('操作失败', 'index.php?act=refill_evidence&op=index');
                 break;
         }
         try {
@@ -768,7 +700,7 @@ class merchantControl extends SystemControl
         } catch (Exception $e) {
             $trans->rollback();
             $this->log($log_msg, 0);
-            showMessage($e->getMessage(), 'index.php?act=merchant&op=refill_evidence', 'html', 'error');
+            showMessage($e->getMessage(), 'index.php?act=refill_evidence&op=index', 'html', 'error');
             exit;
         }
     }
@@ -800,7 +732,7 @@ class merchantControl extends SystemControl
                 QueueClient::push("QueryRefillState", ['order_id' => $order_id]);
             }
         }
-        showMessage('操作成功', 'index.php?act=merchant&op=refill_order');
+        showMessage('操作成功', 'index.php?act=refill_order&op=index');
     }
 
     public function mch_notifyOp()
@@ -820,207 +752,9 @@ class merchantControl extends SystemControl
                 }
             }
         }
-        showMessage('操作成功', 'index.php?act=merchant&op=refill_order');
-    }
-
-    public function refill_orderOp()
-    {
-        $fShowStat = $_GET['fShowStat'];
-        $this->refill_order($fShowStat==1);
-    }
-
-    public function refill_order($fShowStat = false)
-    {
-        $model_refill_order = Model('refill_order');
-        $condition['inner_status'] = 0;
-
-        $fSingle = false;
-        if (!empty($_GET['order_sn'])) {
-            $condition['refill_order.order_sn'] = $_GET['order_sn'];
-            $fSingle = true;
-        }
-        if (!empty($_GET['mch_order'])) {
-            $condition['refill_order.mch_order'] = $_GET['mch_order'];
-            $fSingle = true;
-        }
-        if (!empty($_GET['ch_trade_no'])) {
-            $condition['refill_order.ch_trade_no'] = $_GET['ch_trade_no'];
-            $fSingle = true;
-        }
-        if (!empty($_GET['card_no'])) {
-            $condition['refill_order.card_no'] = $_GET['card_no'];
-            $fSingle = true;
-        }
-
-        if (!empty($_GET['mchid'])) {
-            $condition['refill_order.mchid'] = $_GET['mchid'];
-        }
-        if (!empty($_GET['channel_name'])) {
-            $condition['refill_order.channel_name'] = $_GET['channel_name'];
-        }
-        if (!empty($_GET['store_id'])) {
-            $condition['vr_order.store_id'] = $_GET['store_id'];
-        }
-        if (!empty($_GET['refill_amount'])) {
-            $condition['refill_order.refill_amount'] = $_GET['refill_amount'];
-        }
-        if (!empty($_GET['quality'])) {
-            $condition['refill_order.quality'] = $_GET['quality'];
-        }
-
-        if (!empty($_GET['card_type'])) {
-            if (in_array($_GET['card_type'], ['1', '2', '4', '5', '6'])) {
-                $condition['refill_order.card_type'] = intval($_GET['card_type']);
-            }
-            if ($_GET['card_type'] == 'oil') {
-                $condition['refill_order.card_type'] = ['in', [1, 2]];
-            }
-            if ($_GET['card_type'] == 'phone') {
-                $condition['refill_order.card_type'] = ['in', [4, 5, 6]];
-            }
-        }
-
-        $fToday = false;
-        if (!$fSingle)
-        {
-            $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['refill_order.order_time'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
-            } elseif ($start_unixtime > 0) {
-                $condition['refill_order.order_time'] = ['egt', $start_unixtime];
-            } elseif ($end_unixtime > 0) {
-                $condition['refill_order.order_time'] = ['lt', $end_unixtime];
-            } else {
-                $start = strtotime(date('Y-m-d', time()));
-                $condition['refill_order.order_time'] = ['egt', $start];
-                $fToday = true;
-            }
-
-            if (in_array($_GET['order_state'], ['0', '10', '20', '30', '40'])) {
-                $condition['vr_order.order_state'] = $_GET['order_state'];
-                if ($_GET['order_state'] == ORDER_STATE_SEND) {
-                    if ($_GET['time'] == 1) {
-                        $condition['refill_order.order_time'] = ['between', [(time() - 3600), (time() - 1800)]];
-                    }
-                    if ($_GET['time'] == 2) {
-                        $condition['refill_order.order_time'] = ['lt', (time() - 3600)];
-                    }
-                }
-            }
-        }
-        if(!empty($_GET['export'])) {
-            $this->RefillOrderExport($condition);
-        }
-        $merchants = [];
-        $merchant_list = Model('')->table('merchant')->limit(1000)->select();
-        foreach ($merchant_list as $key => $value) {
-            $merchants[$value['mchid']] = $value;
-        }
-        $order_list = $model_refill_order->getMerchantOrderList($condition, 50, 'refill_order.*,vr_order.order_state', 'refill_order.order_time desc');
-
-        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'];
-            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_text'] = $this->elapse_time($diff_time);
-            $order_list[$order_id]['diff_time'] = $diff_time;
-            $order_list[$order_id]['quality_text'] = $this->quality_format($order_info['quality']);
-            $order_list[$order_id]['org_quality_text'] = $this->quality_format($order_info['org_quality']);
-        }
-
-        $provider_list = Model('')->table('refill_provider,store')
-            ->field('refill_provider.*,store.store_name')
-            ->join('inner')
-            ->on('store.store_id=refill_provider.store_id')
-            ->order('opened asc, provider_id desc')
-            ->limit(1000)
-            ->select();
-
-        if ($fShowStat) {
-            $stat = $this->all_order_state_stat($condition);
-            Tpl::output('stat', $stat);
-        }
-
-        Tpl::output('ftoday', $fToday);
-        Tpl::output('order_list', $order_list);
-        Tpl::output('provider_list', $provider_list);
-        Tpl::output('merchant_list', $merchant_list);
-        Tpl::output('show_page', $model_refill_order->showpage());
-        Tpl::showpage('refill.order.index');
+        showMessage('操作成功', 'index.php?act=refill_order&op=index');
     }
 
-    private function RefillOrderExport($condition)
-    {
-        $i = 0;
-        $result = [];
-        while (true)
-        {
-            $start = $i * 1000;
-            $order_list = Model('')->table('refill_order,vr_order')->field('refill_order.*,vr_order.order_state')
-                ->where($condition)->join('inner')->on('refill_order.order_id=vr_order.order_id')->order('refill_order.order_time desc')->limit("{$start},1000")->select();
-            if(empty($order_list)) {
-                break;
-            }
-            $i++;
-            foreach ($order_list as $order) {
-                $result[] = $order;
-            }
-        }
-        $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'=> '订单状态');
-        $excel_data[0][] = array('styleid'=>'s_title','data'=> '扣款金额');
-        //data
-        foreach ((array)$data as $k=>$v){
-            $tmp = array();
-            $tmp[] = array('data'=>$v['mchid']);
-            $tmp[] = array('data'=>$v['mch_order']);
-            $tmp[] = array('data'=>$v['order_sn']);
-            $tmp[] = array('data'=>$v['refill_amount']);
-            $tmp[] = array('data'=>$v['card_no']);
-            $tmp[] = array('data'=>$this->scard_type($v['card_type']));
-            $tmp[] = array('data'=>date('Y-m-d H:i:s',$v['order_time']));
-            if(empty($v['notify_time'])) {
-                $tmp[] = array('data'=>'');
-            }else{
-                $tmp[] = array('data'=>date('Y-m-d H:i:s',$v['notify_time']));
-            }
-
-            $tmp[] = array('data'=>$v['official_sn']);
-            $tmp[] = array('data'=>orderState($v));
-            $tmp[] = array('data'=>$v['mch_amount']);
-            $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 notify_merchantOp()
     {
@@ -1044,7 +778,7 @@ class merchantControl extends SystemControl
         $order_info = $mod_order->getOrderInfo(['order_id' => $order_id]);
 
         if ((time() - $order_info['order_time']) < 3600) {
-            showMessage('订单时间未超过1小时', 'index.php?act=merchant&op=refill_order');
+            showMessage('订单时间未超过1小时', 'index.php?act=refill_order&op=index');
         }
 
         if ($type == 'success') {
@@ -1052,7 +786,7 @@ class merchantControl extends SystemControl
         } elseif ($type == 'cancel') {
             refill\util::manual_cancel($order_id);
         } else {
-            showMessage('手动操作类型错误', 'index.php?act=merchant&op=refill_order');
+            showMessage('手动操作类型错误', 'index.php?act=refill_order&op=index');
         }
 
         showMessage('操作成功', '');
@@ -1072,40 +806,6 @@ class merchantControl extends SystemControl
         Tpl::showpage('provider.stats');
     }
 
-    public function providerOp()
-    {
-        $this->sync_cfgs();
-        $provider_model = Model('refill_provider');
-        $condition = [];
-        if (trim($_GET['name']) != '') {
-            $condition['name'] = ['like', '%' . $_GET['name'] . '%'];
-            Tpl::output('name', $_GET['name']);
-        }
-        if (in_array($_GET['type'], [1, 2])) {
-            $condition['type'] = $_GET['type'];
-        }
-        $store_list = Model('store')->getStoreList(['store_id' => ['gt',0]], '', '', 'store_id,store_name');
-        foreach ($store_list as $store) {
-            $stores[$store['store_id']] = $store['store_name'];
-        }
-        $provider_list = $provider_model->getProviderList($condition, 100);
-        foreach ($provider_list as $key => $provider) {
-            if (!empty($provider['start_period']) && !empty($provider['end_period'])) {
-                $provider_list[$key]['period'] = $provider['start_period'] . '~' . $provider['end_period'];
-            } else {
-                $provider_list[$key]['period'] = '全时间段';
-            }
-            $provider_list[$key]['store_name'] = $stores[$provider['store_id']];
-        }
-        $opened_text = ['使用中', '已禁用'];
-        $type_text = ['油卡', '手机充值卡', '三方增值业务'];
-        Tpl::output('opened_text', $opened_text);
-        Tpl::output('type_text', $type_text);
-        Tpl::output('provider_list', $provider_list);
-        Tpl::output('show_page', $provider_model->showpage());
-        Tpl::showpage('provider.index');
-    }
-
     public function provider_provinceOp()
     {
         $provider_model = Model('refill_provider');
@@ -1128,7 +828,7 @@ class merchantControl extends SystemControl
             }
             $resp = $provider_model->editProvider(['provinces' => serialize($updata)], ['provider_id' => $provider_id]);
             if ($resp) {
-                showMessage('编辑成功', 'index.php?act=merchant&op=provider');
+                showMessage('编辑成功', 'index.php?act=provider&op=index');
             } else {
                 showMessage('编辑失败', "index.php?act=merchant&op=provider_province&id={$provider_id}");
             }
@@ -1152,80 +852,6 @@ class merchantControl extends SystemControl
         }
     }
 
-    public function sync_cfgs()
-    {
-        $name_val = function ($items) {
-            $result = [];
-            foreach ($items as $item) {
-                $name = $item['name'];
-                $result[$name] = $item;
-            }
-            return $result;
-        };
-
-        $match = function ($all, $cur) {
-            $inserts = $updates = [];
-            foreach ($all as $key => $value) {
-                if (!array_key_exists($key, $cur)) {
-                    $insert['name'] = $key;
-                    $insert['store_id'] = $value['cfg']['store_id'];
-                    $insert['qualitys'] = $value['cfg']['qualitys'];
-                    $inserts[] = $insert;
-                } elseif ($value['cfg']['qualitys'] != $cur[$key]['qualitys']) {
-                    $update['provider_id'] = $cur[$key]['provider_id'];
-                    $update['qualitys'] = $value['cfg']['qualitys'];
-                    $updates[] = $update;
-                }
-            }
-            return [$inserts, $updates];
-        };
-
-        $updater = function ($mod, $updates) {
-            if (empty($updates)) return;
-            foreach ($updates as $update) {
-                $provider_id = $update['provider_id'];
-
-                $data = ['qualitys' => $update['qualitys']];
-                $mod->editProvider($data, ['provider_id' => $provider_id]);
-            }
-        };
-        $inserter = function ($mod, $type, $names) {
-            foreach ($names as $name) {
-                $data = ['name' => $name['name'], 'type' => $type, 'store_id' => $name['store_id'], 'qualitys' => $name['qualitys'], 'opened' => 2];
-                $mod->insert($data);
-            }
-        };
-
-        global $config;
-        $oil_configs = $config['oil_providers'];
-        $pho_configs = $config['phone_providers'];
-        $third_configs = $config['third_providers'];
-        $oils = $name_val($oil_configs);
-        $phones = $name_val($pho_configs);
-        $third = $name_val($third_configs);
-
-        $mod_prov = Model('refill_provider');
-
-        $oil_items = $mod_prov->getProviderList(['type' => 1]);
-        $oil_items = $name_val($oil_items);
-        [$oil_inserts, $oil_updates] = $match($oils, $oil_items);
-
-        $phone_items = $mod_prov->getProviderList(['type' => 2]);
-        $phone_items = $name_val($phone_items);
-        [$phone_inserts, $phone_updates] = $match($phones, $phone_items);
-
-        $third_items = $mod_prov->getProviderList(['type' => 3]);
-        $third_items = $name_val($third_items);
-        [$third_inserts, $third_updates] = $match($third, $third_items);
-
-        $inserter($mod_prov, 1, $oil_inserts);
-        $inserter($mod_prov, 2, $phone_inserts);
-        $inserter($mod_prov, 3, $third_inserts);
-        $updater($mod_prov, $oil_updates);
-        $updater($mod_prov, $phone_updates);
-        $updater($mod_prov, $third_updates);
-    }
-
     public function changeProviderStateOp()
     {
         $provider_id = intval($_GET['id']);
@@ -1233,13 +859,13 @@ class merchantControl extends SystemControl
         $provider_model = Model('refill_provider');
         $provider_info = $provider_model->getProviderInfo(['provider_id' => $provider_id]);
         if (empty($provider_info) || !in_array($state, [1, 2])) {
-            showMessage('操作成功', 'index.php?act=merchant&op=provider');
+            showMessage('操作成功', 'index.php?act=provider&op=index');
         }
         $resp = $provider_model->editProvider(['opened' => $state], ['provider_id' => $provider_id]);
         if (!$resp) {
-            showMessage('操作失败', 'index.php?act=merchant&op=provider', 'html', 'error');
+            showMessage('操作失败', 'index.php?act=provider&op=index', 'html', 'error');
         }
-        showMessage('操作成功', 'index.php?act=merchant&op=provider');
+        showMessage('操作成功', 'index.php?act=provider&op=index');
     }
 
     /**
@@ -1255,7 +881,7 @@ class merchantControl extends SystemControl
             if ($result) {
                 $url = [
                     [
-                        'url' => 'index.php?act=merchant&op=provider',
+                        'url' => 'index.php?act=provider&op=index',
                         'msg' => '返回通道列表',
                     ],
                     [
@@ -1284,12 +910,12 @@ class merchantControl extends SystemControl
             $params = $_POST;
             unset($params['form_submit']);
             if (empty($params)) {
-                showMessage('通道编辑成功', 'index.php?act=merchant&op=provider');
+                showMessage('通道编辑成功', 'index.php?act=provider&op=index');
             }
             $result = $provider_model->editProvider($params, ['provider_id' => $provider_id]);
             if ($result) {
                 $this->log('编辑通道:' . '[	' . $provider['name'] . ']', 1);
-                showMessage('通道编辑成功', 'index.php?act=merchant&op=provider');
+                showMessage('通道编辑成功', 'index.php?act=provider&op=index');
             } else {
                 showMessage('通道编辑失败', "index.php?act=merchant&op=provider_edit&id={$provider_id}");
             }
@@ -1316,9 +942,9 @@ class merchantControl extends SystemControl
         $result = $provider_model->delProvider(['provider_id' => $provider_id]);
         if ($result) {
             $this->log('删除通道:' . '[	' . $provider['name'] . ']', 1);
-            showMessage('通道删除成功', 'index.php?act=merchant&op=provider');
+            showMessage('通道删除成功', 'index.php?act=provider&op=index');
         } else {
-            showMessage('通道删除失败', "index.php?act=merchant&op=provider");
+            showMessage('通道删除失败', "index.php?act=provider&op=index");
         }
     }
 
@@ -1354,7 +980,7 @@ class merchantControl extends SystemControl
                 $result[$index][] = $data;
             }
             wcache($rkey, ['data' => serialize($result)], 'provider-');
-            showMessage('编辑成功', 'index.php?act=merchant&op=provider');
+            showMessage('编辑成功', 'index.php?act=provider&op=index');
         } else {
             $speed_limit = rcache($rkey, 'provider-');
             if (empty($speed_limit)) {
@@ -1380,7 +1006,7 @@ class merchantControl extends SystemControl
                 ->order('opened asc , provider_id desc')
                 ->select();
             if (empty($providers)) {
-                showMessage('暂无相关通道', 'index.php?act=merchant&op=provider');
+                showMessage('暂无相关通道', 'index.php?act=provider&op=index');
             }
             $formData = $this->formData($type, $form);
 
@@ -1424,7 +1050,7 @@ class merchantControl extends SystemControl
                 $datas[$pid] = $result;
             }
             if (empty($datas)) {
-                showMessage('暂无相关通道配置', 'index.php?act=merchant&op=provider');
+                showMessage('暂无相关通道配置', 'index.php?act=provider&op=index');
             }
             Tpl::output('form', $formData);
             Tpl::output('datas', $datas);
@@ -1440,7 +1066,7 @@ class merchantControl extends SystemControl
         } elseif ($type == 2) {
             $rkey = "channel-ctl-phone-{$form}-limit";
         } else {
-            showMessage('类型有误', "index.php?act=merchant&op=provider");
+            showMessage('类型有误', "index.php?act=provider&op=index");
         }
         Log::record($rkey, Log::DEBUG);
         return $rkey;
@@ -1546,195 +1172,6 @@ class merchantControl extends SystemControl
         return $result;
     }
 
-    private function refill_stat($condition, $times)
-    {
-        $stat_order = function ($condition) {
-            $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();
-
-            return $stat['order_count'];
-        };
-        $result = [];
-        $condition['order_state'] = ORDER_STATE_SEND;
-        foreach ($times as $time) {
-            $condition['refill_order.order_time'] = $time;
-            $result[] = $stat_order($condition);
-        }
-        return $result;
-    }
-
-    private function all_order_state_stat($condition)
-    {
-        $counts = Model('')->table('refill_order,vr_order')->join('inner')
-            ->on('refill_order.order_id=vr_order.order_id')
-            ->field('count(*) as order_count, sum(refill_amount) as refill_amounts, sum(channel_amount) as channel_amounts, sum(mch_amount) as mch_amounts, order_state')
-            ->where($condition)
-            ->group('order_state')
-            ->select();
-
-        $all = [];
-        $data['order_count'] = $data['refill_amounts'] = $data['channel_amounts'] = $data['mch_amounts'] = 0;
-        $sending = $success = $cancel = $data;
-        foreach ($counts as $count) {
-            if ($count['order_state'] == ORDER_STATE_SEND) {
-                $sending = $count;
-            } elseif ($count['order_state'] == ORDER_STATE_SUCCESS) {
-                $success = $count;
-            } elseif ($count['order_state'] == ORDER_STATE_CANCEL) {
-                $cancel = $count;
-            }
-
-            $all['order_count'] += $count['order_count'];
-            $all['refill_amounts'] += ncPriceFormat($count['refill_amounts']);
-            $all['channel_amounts'] += ncPriceFormat($count['channel_amounts']);
-            $all['mch_amounts'] += ncPriceFormat($count['mch_amounts']);
-        }
-
-        return ['all' => $all, 'sending' => $sending, 'success' => $success, 'cancel' => $cancel];
-    }
-
-
-    public function OrderSendListOp()
-    {
-        $model_refill_order = Model('refill_order');
-        $condition['refill_order.inner_status'] = 0;
-        $condition['vr_order.order_state'] = ORDER_STATE_SEND;
-
-        $condition['refill_order.order_time'] = ['lt', (time() - 1800)];
-        if (!empty($_GET['mchid'])) {
-            $condition['refill_order.mchid'] = $_GET['mchid'];
-        }
-        if (!empty($_GET['store_id'])) {
-            $condition['vr_order.store_id'] = $_GET['store_id'];
-        }
-        $time_cond = [
-            ['between', [(time() - 3600), (time() - 1800)]],
-            ['lt', (time() - 3600)]];
-        if ($_GET['time'] == 1) {
-            $condition['refill_order.order_time'] = ['between', [(time() - 3600), (time() - 1800)]];
-        }
-        if ($_GET['time'] == 2) {
-            $condition['refill_order.order_time'] = ['lt', (time() - 3600)];
-        }
-        $time_out_order = function($time_out, $condition){
-            $mchids = Model('')->table('merchant')->where(['time_out' => ['elt', $time_out]])->field('mchid')->select();
-            $mchids = array_column($mchids, 'mchid');
-            $mchids = implode(',', $mchids);
-
-            $condition['refill_order.order_time'] = ['lt', (time() - $time_out)];
-            $condition['refill_order.mchid'] = ['in',$mchids];
-            return $condition;
-        };
-        if ($_GET['time'] == 3) {
-            $condition = $time_out_order(300, $condition);
-            $time_cond[] = ['lt', (time() - 300)];
-        }
-        if ($_GET['time'] == 4) {
-            $condition = $time_out_order(900, $condition);
-            $time_cond[] = ['lt', (time() - 900)];
-        }
-        if (!empty($_GET['card_type'])) {
-            if (in_array($_GET['card_type'], ['1', '2', '4', '5', '6'])) {
-                $condition['refill_order.card_type'] = $_GET['card_type'];
-            }
-            if ($_GET['card_type'] == 'oil') {
-                $condition['refill_order.card_type'] = ['in', ['1', '2']];
-            }
-            if ($_GET['card_type'] == 'phone') {
-                $condition['refill_order.card_type'] = ['in', ['4', '5', '6']];
-            }
-        }
-        if (!empty($_GET['quality'])) {
-            $condition['refill_order.quality'] = $_GET['quality'];
-        }
-
-        $order_list = $model_refill_order->getMerchantOrderList($condition, 50, 'refill_order.*,vr_order.order_state', 'refill_order.order_time desc');
-
-        $stat = Model('')->table('refill_order,vr_order')->join('inner')
-            ->on('refill_order.order_id=vr_order.order_id')
-            ->field('count(*) as order_count ,sum(refill_amount) as refill_amounts, sum(channel_amount) as channel_amounts, sum(mch_amount) as mch_amounts')
-            ->where($condition)->find();
-        $count = $this->refill_stat($condition,$time_cond);
-
-        $merchant_list = Model('')->table('merchant')->limit(1000)->select();
-        foreach ($merchant_list as $key => $value) {
-            $merchants[$value['mchid']] = $value;
-        }
-        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'];
-            $order_list[$order_id]['quality_text'] = $this->quality_format($order_info['quality']);
-        }
-        $provider_list = Model('')->table('refill_provider,store')
-            ->field('refill_provider.*,store.store_name')
-            ->join('inner')
-            ->on('store.store_id=refill_provider.store_id')
-            ->order('opened asc, provider_id desc')
-            ->limit(1000)
-            ->select();
-        Tpl::output('stat', $stat);
-        Tpl::output('count', $count);
-        Tpl::output('order_list', $order_list);
-        Tpl::output('merchant_list', $merchant_list);
-        Tpl::output('provider_list', $provider_list);
-        Tpl::output('show_page', $model_refill_order->showpage());
-        Tpl::showpage('refill.order.send.index');
-    }
-
-    public function OrderStatsOp()
-    {
-        $type = $_GET['type'] ? $_GET['type'] : 'system';
-        $page = "{$type}.order.stats";
-        $model_refill_order = Model('refill_order');
-        $condition['type'] = $type;
-        if (!empty($_GET['cid'])) {
-            $condition['cid'] = $_GET['cid'];
-        }
-        $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['time_stamp'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
-        } elseif ($start_unixtime > 0) {
-            $condition['time_stamp'] = ['egt', $start_unixtime];
-        } elseif ($end_unixtime > 0) {
-            $condition['time_stamp'] = ['lt', $end_unixtime];
-        }
-
-        $stats_list = $model_refill_order->getOrderStatsList($condition);
-
-        if ($type == 'provider') {
-            $provider_list = Model('')->table('refill_provider,store')->field('refill_provider.store_id,store.store_name')->join('inner')
-                ->on('store.store_id=refill_provider.store_id')->limit(1000)->select();
-            Tpl::output('provider_list', $provider_list);
-        } elseif ($type == 'merchant') {
-            $merchant_list = Model('')->table('merchant')->limit(1000)->select();
-            Tpl::output('merchant_list', $merchant_list);
-        }
-        $success_count_total = $success_refill_amounts_total = $success_mch_amounts_toatl = $success_channel_amounts_total = 0;
-        foreach ($stats_list as $stats) {
-            $success_count_total += $stats['success_count'];
-            $success_refill_amounts_total += $stats['success_refill_amounts'];
-            $success_mch_amounts_toatl += $stats['success_mch_amounts'];
-            $success_channel_amounts_total += $stats['success_channel_amounts'];
-        }
-        $total_stats = [
-            'success_count_total' => $success_count_total,
-            'success_refill_amounts_total' => $success_refill_amounts_total,
-            'success_mch_amounts_toatl' => $success_mch_amounts_toatl,
-            'success_channel_amounts_total' => $success_channel_amounts_total
-        ];
-        $check_text = ['未编辑', '匹配', '不匹配'];
-        Tpl::output('total_stats', $total_stats);
-        Tpl::output('stats_list', $stats_list);
-        Tpl::output('check_text', $check_text);
-        Tpl::output('show_page', $model_refill_order->showpage());
-        Tpl::showpage($page);
-    }
-
     public function OrderStatsCheckOp()
     {
         $stat_id = $_GET['stat_id'] ?? $_POST['stat_id'];
@@ -1756,7 +1193,7 @@ class merchantControl extends SystemControl
                 $gap_order_count = $stats_data['success_count'] - $corder_success_count;
                 $gap_success_amounts = $stats_data['success_channel_amounts'] - $corder_success_amounts;
             }else{
-                showMessage('对账数据类型错误', 'index.php?act=merchant&op=OrderStats');
+                showMessage('对账数据类型错误', 'index.php?act=OrderStats&op=index');
             }
 
             $updata['corder_success_count'] = $corder_success_count;
@@ -1772,7 +1209,7 @@ class merchantControl extends SystemControl
             $res = $mod_stat->edit($stat_id, $updata);
 
             if ($res) {
-                showMessage('操作成功',"index.php?act=merchant&op=OrderStats&type={$type}");
+                showMessage('操作成功',"index.php?act=OrderStats&op=index&type={$type}");
             } else {
                 showMessage('操作失败');
             }

+ 185 - 0
admin/control/ordersendlist.php

@@ -0,0 +1,185 @@
+<?php
+
+
+class ordersendlistControl extends SystemControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    public function indexOp()
+    {
+        $model_refill_order = Model('refill_order');
+        $condition['refill_order.inner_status'] = 0;
+        $condition['vr_order.order_state'] = ORDER_STATE_SEND;
+
+        $condition['refill_order.order_time'] = ['lt', (time() - 1800)];
+        if (!empty($_GET['mchid'])) {
+            $condition['refill_order.mchid'] = $_GET['mchid'];
+        }
+        if (!empty($_GET['store_id'])) {
+            $condition['vr_order.store_id'] = $_GET['store_id'];
+        }
+        $time_cond = [
+            ['between', [(time() - 3600), (time() - 1800)]],
+            ['lt', (time() - 3600)]];
+        if ($_GET['time'] == 1) {
+            $condition['refill_order.order_time'] = ['between', [(time() - 3600), (time() - 1800)]];
+        }
+        if ($_GET['time'] == 2) {
+            $condition['refill_order.order_time'] = ['lt', (time() - 3600)];
+        }
+        $time_out_order = function($time_out, $condition){
+            $mchids = Model('')->table('merchant')->where(['time_out' => ['elt', $time_out]])->field('mchid')->select();
+            $mchids = array_column($mchids, 'mchid');
+            $mchids = implode(',', $mchids);
+
+            $condition['refill_order.order_time'] = ['lt', (time() - $time_out)];
+            $condition['refill_order.mchid'] = ['in',$mchids];
+            return $condition;
+        };
+        if ($_GET['time'] == 3) {
+            $condition = $time_out_order(300, $condition);
+            $time_cond[] = ['lt', (time() - 300)];
+        }
+        if ($_GET['time'] == 4) {
+            $condition = $time_out_order(900, $condition);
+            $time_cond[] = ['lt', (time() - 900)];
+        }
+        if (!empty($_GET['card_type'])) {
+            if (in_array($_GET['card_type'], ['1', '2', '4', '5', '6'])) {
+                $condition['refill_order.card_type'] = $_GET['card_type'];
+            }
+            if ($_GET['card_type'] == 'oil') {
+                $condition['refill_order.card_type'] = ['in', ['1', '2']];
+            }
+            if ($_GET['card_type'] == 'phone') {
+                $condition['refill_order.card_type'] = ['in', ['4', '5', '6']];
+            }
+        }
+        if (!empty($_GET['quality'])) {
+            $condition['refill_order.quality'] = $_GET['quality'];
+        }
+
+        $order_list = $model_refill_order->getMerchantOrderList($condition, 50, 'refill_order.*,vr_order.order_state', 'refill_order.order_time desc');
+
+        $stat = Model('')->table('refill_order,vr_order')->join('inner')
+            ->on('refill_order.order_id=vr_order.order_id')
+            ->field('count(*) as order_count ,sum(refill_amount) as refill_amounts, sum(channel_amount) as channel_amounts, sum(mch_amount) as mch_amounts')
+            ->where($condition)->find();
+        $count = $this->refill_stat($condition,$time_cond);
+
+        $merchant_list = Model('')->table('merchant')->limit(1000)->select();
+        foreach ($merchant_list as $key => $value) {
+            $merchants[$value['mchid']] = $value;
+        }
+        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'];
+            $order_list[$order_id]['quality_text'] = $this->quality_format($order_info['quality']);
+        }
+        $provider_list = Model('')->table('refill_provider,store')
+            ->field('refill_provider.*,store.store_name')
+            ->join('inner')
+            ->on('store.store_id=refill_provider.store_id')
+            ->order('opened asc, provider_id desc')
+            ->limit(1000)
+            ->select();
+        Tpl::output('stat', $stat);
+        Tpl::output('count', $count);
+        Tpl::output('order_list', $order_list);
+        Tpl::output('merchant_list', $merchant_list);
+        Tpl::output('provider_list', $provider_list);
+        Tpl::output('show_page', $model_refill_order->showpage());
+        Tpl::showpage('refill.order.send.index');
+    }
+
+    private function scard_type(int $card_type)
+    {
+        if ($card_type == 1) { //中石油
+            return '中石油';
+        } elseif ($card_type == 2) { //中石化
+            return '中石化';
+        } elseif ($card_type == 4) { //中国移动
+            return '中国移动';
+        } elseif ($card_type == 5) { //中国联通
+            return '中国联通';
+        } elseif ($card_type == 6) { //中国电信
+            return '中国电信';
+        } else {
+            return 'unknown';
+        }
+    }
+
+    private function quality_format($quality) {
+        switch ($quality) {
+            case 1:
+                $text = "普充";
+                break;
+            case 2:
+                $text = "快充";
+                break;
+            case 3:
+                $text = "卡密";
+                break;
+            case 4:
+                $text = "三方";
+                break;
+            case 5:
+                $text = "慢充二十四小时";
+                break;
+            case 6:
+                $text = "慢充六小时";
+                break;
+            case 7:
+                $text = "慢充两小时";
+                break;
+            default:
+                return '其他';
+                break;
+        }
+        return $text;
+    }
+
+    private function elapse_time($seconds)
+    {
+        $minutes = intval($seconds / 60);
+        $second = intval($seconds % 60);
+        if ($minutes >= 60) {
+            $minute = $minutes % 60;
+            $hours = intval($minutes / 60);
+            $result = "{$minute}m{$second}s";
+        } elseif ($minutes > 0) {
+            $result = "{$minutes}m{$second}s";
+        } else {
+            $result = "{$second}s";
+        }
+
+        if (isset($hours)) {
+            $result = "{$hours}h{$minute}m";
+        }
+        return $result;
+    }
+
+    private function refill_stat($condition, $times)
+    {
+        $stat_order = function ($condition) {
+            $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();
+
+            return $stat['order_count'];
+        };
+        $result = [];
+        $condition['order_state'] = ORDER_STATE_SEND;
+        foreach ($times as $time) {
+            $condition['refill_order.order_time'] = $time;
+            $result[] = $stat_order($condition);
+        }
+        return $result;
+    }
+}

+ 60 - 0
admin/control/orderstats.php

@@ -0,0 +1,60 @@
+<?php
+
+
+class orderstatsControl extends SystemControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    public function indexOp()
+    {
+        $type = $_GET['type'] ? $_GET['type'] : 'system';
+        $page = "{$type}.order.stats";
+        $model_refill_order = Model('refill_order');
+        $condition['type'] = $type;
+        if (!empty($_GET['cid'])) {
+            $condition['cid'] = $_GET['cid'];
+        }
+        $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['time_stamp'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
+        } elseif ($start_unixtime > 0) {
+            $condition['time_stamp'] = ['egt', $start_unixtime];
+        } elseif ($end_unixtime > 0) {
+            $condition['time_stamp'] = ['lt', $end_unixtime];
+        }
+
+        $stats_list = $model_refill_order->getOrderStatsList($condition);
+
+        if ($type == 'provider') {
+            $provider_list = Model('')->table('refill_provider,store')->field('refill_provider.store_id,store.store_name')->join('inner')
+                ->on('store.store_id=refill_provider.store_id')->limit(1000)->select();
+            Tpl::output('provider_list', $provider_list);
+        } elseif ($type == 'merchant') {
+            $merchant_list = Model('')->table('merchant')->limit(1000)->select();
+            Tpl::output('merchant_list', $merchant_list);
+        }
+        $success_count_total = $success_refill_amounts_total = $success_mch_amounts_toatl = $success_channel_amounts_total = 0;
+        foreach ($stats_list as $stats) {
+            $success_count_total += $stats['success_count'];
+            $success_refill_amounts_total += $stats['success_refill_amounts'];
+            $success_mch_amounts_toatl += $stats['success_mch_amounts'];
+            $success_channel_amounts_total += $stats['success_channel_amounts'];
+        }
+        $total_stats = [
+            'success_count_total' => $success_count_total,
+            'success_refill_amounts_total' => $success_refill_amounts_total,
+            'success_mch_amounts_toatl' => $success_mch_amounts_toatl,
+            'success_channel_amounts_total' => $success_channel_amounts_total
+        ];
+        $check_text = ['未编辑', '匹配', '不匹配'];
+        Tpl::output('total_stats', $total_stats);
+        Tpl::output('stats_list', $stats_list);
+        Tpl::output('check_text', $check_text);
+        Tpl::output('show_page', $model_refill_order->showpage());
+        Tpl::showpage($page);
+    }
+}

+ 111 - 0
admin/control/provider.php

@@ -0,0 +1,111 @@
+<?php
+
+require_once(BASE_CONFIG_PATH . CONFIG_PREFIX . '/refill.ini.php');
+class providerControl extends SystemControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    public function indexOp()
+    {
+        $this->sync_cfgs();
+        $provider_model = Model('refill_provider');
+        $condition = [];
+        if (trim($_GET['name']) != '') {
+            $condition['name'] = ['like', '%' . $_GET['name'] . '%'];
+            Tpl::output('name', $_GET['name']);
+        }
+        if (in_array($_GET['type'], [1, 2])) {
+            $condition['type'] = $_GET['type'];
+        }
+        $store_list = Model('store')->getStoreList(['store_id' => ['gt',0]], '', '', 'store_id,store_name');
+        foreach ($store_list as $store) {
+            $stores[$store['store_id']] = $store['store_name'];
+        }
+        $provider_list = $provider_model->getProviderList($condition, 100);
+        foreach ($provider_list as $key => $provider) {
+            if (!empty($provider['start_period']) && !empty($provider['end_period'])) {
+                $provider_list[$key]['period'] = $provider['start_period'] . '~' . $provider['end_period'];
+            } else {
+                $provider_list[$key]['period'] = '全时间段';
+            }
+            $provider_list[$key]['store_name'] = $stores[$provider['store_id']];
+        }
+        $opened_text = ['使用中', '已禁用'];
+        $type_text = ['油卡', '手机充值卡'];
+        Tpl::output('opened_text', $opened_text);
+        Tpl::output('type_text', $type_text);
+        Tpl::output('provider_list', $provider_list);
+        Tpl::output('show_page', $provider_model->showpage());
+        Tpl::showpage('provider.index');
+    }
+
+    public function sync_cfgs()
+    {
+        $name_val = function ($items) {
+            $result = [];
+            foreach ($items as $item) {
+                $name = $item['name'];
+                $result[$name] = $item;
+            }
+            return $result;
+        };
+
+        $match = function ($all, $cur) {
+            $inserts = $updates = [];
+            foreach ($all as $key => $value) {
+                if (!array_key_exists($key, $cur)) {
+                    $insert['name'] = $key;
+                    $insert['store_id'] = $value['cfg']['store_id'];
+                    $insert['qualitys'] = $value['cfg']['qualitys'];
+                    $inserts[] = $insert;
+                } elseif ($value['cfg']['qualitys'] != $cur[$key]['qualitys']) {
+                    $update['provider_id'] = $cur[$key]['provider_id'];
+                    $update['qualitys'] = $value['cfg']['qualitys'];
+                    $updates[] = $update;
+                }
+            }
+            return [$inserts, $updates];
+        };
+
+        $updater = function ($mod, $updates) {
+            if (empty($updates)) return;
+            foreach ($updates as $update) {
+                $provider_id = $update['provider_id'];
+
+                $data = ['qualitys' => $update['qualitys']];
+                $mod->editProvider($data, ['provider_id' => $provider_id]);
+            }
+        };
+        $inserter = function ($mod, $type, $names) {
+            foreach ($names as $name) {
+                $data = ['name' => $name['name'], 'type' => $type, 'store_id' => $name['store_id'], 'qualitys' => $name['qualitys'], 'opened' => 2];
+                $mod->insert($data);
+            }
+        };
+
+        global $config;
+        $oil_configs = $config['oil_providers'];
+        $pho_configs = $config['phone_providers'];
+
+        $oils = $name_val($oil_configs);
+        $phones = $name_val($pho_configs);
+
+        $mod_prov = Model('refill_provider');
+
+        $oil_items = $mod_prov->getProviderList(['type' => 1]);
+
+        $oil_items = $name_val($oil_items);
+        [$oil_inserts, $oil_updates] = $match($oils, $oil_items);
+
+        $phone_items = $mod_prov->getProviderList(['type' => 2]);
+        $phone_items = $name_val($phone_items);
+        [$phone_inserts, $phone_updates] = $match($phones, $phone_items);
+        $inserter($mod_prov, 1, $oil_inserts);
+        $inserter($mod_prov, 2, $phone_inserts);
+        $updater($mod_prov, $oil_updates);
+        $updater($mod_prov, $phone_updates);
+    }
+}

+ 78 - 0
admin/control/refill_evidence.php

@@ -0,0 +1,78 @@
+<?php
+
+
+class refill_evidenceControl extends SystemControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * 充值申请列表
+     */
+    public function indexOp()
+    {
+        $model_merchant = Model('merchant');
+        $condition = [];
+        if (trim($_GET['mch_name']) != '') {
+            $condition['mch_name'] = ['like', '%' . $_GET['mch_name'] . '%'];
+            Tpl::output('mch_name', $_GET['mch_name']);
+        }
+        $state_sel = intval($_REQUEST['state_sel']);
+        if ($state_sel == 1) {
+            $condition['check_time'] = 0;
+            $condition['status'] = 1;
+        } elseif ($state_sel == 2) {
+            $condition['check_time'] = ['gt', 0];
+            $condition['status'] = 2;
+        } elseif ($state_sel == 3) {
+            $condition['check_time'] = ['gt', 0];
+            $condition['status'] = 3;
+        } else {
+        }
+
+        $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];
+        }
+
+        //充值申请列表
+        $evidence_list = $model_merchant->getRefillEvidence($condition, 20, '*,member.available_predeposit', 'refill_evidence.add_time desc');
+        $status_text = ['申请中', '已通过', '已驳回'];
+        $operation_text = ['未预存', '已预存'];
+        $add_type_text = ['商户预存','后台手动预存'];
+
+        $counts = Model('')->table('refill_evidence')
+            ->field('sum(amount) as amounts,status')
+            ->where($condition)
+            ->group('status')
+            ->select();
+        $success_amount = $send_amount = $cancel_amount = 0;
+        foreach ($counts as $count) {
+            if($count['status'] == 1) {
+                $send_amount += $count['amounts'];
+            }elseif ($count['status'] == 2) {
+                $success_amount += $count['amounts'];
+            }elseif ($count['status'] == 3) {
+                $cancel_amount += $count['amounts'];
+            }
+        }
+        $stats['send_amount'] = $send_amount;
+        $stats['success_amount'] = $success_amount;
+        $stats['cancel_amount'] = $cancel_amount;
+        Tpl::output('stats', $stats);
+        Tpl::output('evidence_list', $evidence_list);
+        Tpl::output('status_text', $status_text);
+        Tpl::output('operation_text', $operation_text);
+        Tpl::output('add_type_text', $add_type_text);
+        Tpl::output('page', $model_merchant->showpage('2'));
+        Tpl::showpage('merchant.refill.evidence_list');
+    }
+}

+ 307 - 0
admin/control/refill_order.php

@@ -0,0 +1,307 @@
+<?php
+
+
+class refill_orderControl extends SystemControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    public function indexOp()
+    {
+        $fShowStat = $_GET['fShowStat'];
+        $this->refill_order($fShowStat==1);
+    }
+
+    public function refill_order($fShowStat = false)
+    {
+        $model_refill_order = Model('refill_order');
+        $condition['inner_status'] = 0;
+
+        $fSingle = false;
+        if (!empty($_GET['order_sn'])) {
+            $condition['refill_order.order_sn'] = $_GET['order_sn'];
+            $fSingle = true;
+        }
+        if (!empty($_GET['mch_order'])) {
+            $condition['refill_order.mch_order'] = $_GET['mch_order'];
+            $fSingle = true;
+        }
+        if (!empty($_GET['ch_trade_no'])) {
+            $condition['refill_order.ch_trade_no'] = $_GET['ch_trade_no'];
+            $fSingle = true;
+        }
+        if (!empty($_GET['card_no'])) {
+            $condition['refill_order.card_no'] = $_GET['card_no'];
+            $fSingle = true;
+        }
+
+        if (!empty($_GET['mchid'])) {
+            $condition['refill_order.mchid'] = $_GET['mchid'];
+        }
+        if (!empty($_GET['channel_name'])) {
+            $condition['refill_order.channel_name'] = $_GET['channel_name'];
+        }
+        if (!empty($_GET['store_id'])) {
+            $condition['vr_order.store_id'] = $_GET['store_id'];
+        }
+        if (!empty($_GET['refill_amount'])) {
+            $condition['refill_order.refill_amount'] = $_GET['refill_amount'];
+        }
+        if (!empty($_GET['quality'])) {
+            $condition['refill_order.quality'] = $_GET['quality'];
+        }
+
+        if (!empty($_GET['card_type'])) {
+            if (in_array($_GET['card_type'], ['1', '2', '4', '5', '6'])) {
+                $condition['refill_order.card_type'] = intval($_GET['card_type']);
+            }
+            if ($_GET['card_type'] == 'oil') {
+                $condition['refill_order.card_type'] = ['in', [1, 2]];
+            }
+            if ($_GET['card_type'] == 'phone') {
+                $condition['refill_order.card_type'] = ['in', [4, 5, 6]];
+            }
+        }
+
+        $fToday = false;
+        if (!$fSingle)
+        {
+            $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['refill_order.order_time'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
+            } elseif ($start_unixtime > 0) {
+                $condition['refill_order.order_time'] = ['egt', $start_unixtime];
+            } elseif ($end_unixtime > 0) {
+                $condition['refill_order.order_time'] = ['lt', $end_unixtime];
+            } else {
+                $start = strtotime(date('Y-m-d', time()));
+                $condition['refill_order.order_time'] = ['egt', $start];
+                $fToday = true;
+            }
+
+            if (in_array($_GET['order_state'], ['0', '10', '20', '30', '40'])) {
+                $condition['vr_order.order_state'] = $_GET['order_state'];
+                if ($_GET['order_state'] == ORDER_STATE_SEND) {
+                    if ($_GET['time'] == 1) {
+                        $condition['refill_order.order_time'] = ['between', [(time() - 3600), (time() - 1800)]];
+                    }
+                    if ($_GET['time'] == 2) {
+                        $condition['refill_order.order_time'] = ['lt', (time() - 3600)];
+                    }
+                }
+            }
+        }
+        if(!empty($_GET['export'])) {
+            $this->RefillOrderExport($condition);
+        }
+        $merchants = [];
+        $merchant_list = Model('')->table('merchant')->limit(1000)->select();
+        foreach ($merchant_list as $key => $value) {
+            $merchants[$value['mchid']] = $value;
+        }
+        $order_list = $model_refill_order->getMerchantOrderList($condition, 50, 'refill_order.*,vr_order.order_state', 'refill_order.order_time desc');
+
+        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'];
+            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_text'] = $this->elapse_time($diff_time);
+            $order_list[$order_id]['diff_time'] = $diff_time;
+            $order_list[$order_id]['quality_text'] = $this->quality_format($order_info['quality']);
+            $order_list[$order_id]['org_quality_text'] = $this->quality_format($order_info['org_quality']);
+        }
+
+        $provider_list = Model('')->table('refill_provider,store')
+            ->field('refill_provider.*,store.store_name')
+            ->join('inner')
+            ->on('store.store_id=refill_provider.store_id')
+            ->order('opened asc, provider_id desc')
+            ->limit(1000)
+            ->select();
+
+        if ($fShowStat) {
+            $stat = $this->all_order_state_stat($condition);
+            Tpl::output('stat', $stat);
+        }
+
+        Tpl::output('admin_info', $this->getAdminInfo());
+        Tpl::output('ftoday', $fToday);
+        Tpl::output('order_list', $order_list);
+        Tpl::output('provider_list', $provider_list);
+        Tpl::output('merchant_list', $merchant_list);
+        Tpl::output('show_page', $model_refill_order->showpage());
+        Tpl::showpage('refill.order.index');
+    }
+
+    private function RefillOrderExport($condition)
+    {
+        $i = 0;
+        $result = [];
+        while (true)
+        {
+            $start = $i * 1000;
+            $order_list = Model('')->table('refill_order,vr_order')->field('refill_order.*,vr_order.order_state')
+                ->where($condition)->join('inner')->on('refill_order.order_id=vr_order.order_id')->order('refill_order.order_time desc')->limit("{$start},1000")->select();
+            if(empty($order_list)) {
+                break;
+            }
+            $i++;
+            foreach ($order_list as $order) {
+                $result[] = $order;
+            }
+        }
+        $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'=> '订单状态');
+        $excel_data[0][] = array('styleid'=>'s_title','data'=> '扣款金额');
+        //data
+        foreach ((array)$data as $k=>$v){
+            $tmp = array();
+            $tmp[] = array('data'=>$v['mchid']);
+            $tmp[] = array('data'=>$v['mch_order']);
+            $tmp[] = array('data'=>$v['order_sn']);
+            $tmp[] = array('data'=>$v['refill_amount']);
+            $tmp[] = array('data'=>$v['card_no']);
+            $tmp[] = array('data'=>$this->scard_type($v['card_type']));
+            $tmp[] = array('data'=>date('Y-m-d H:i:s',$v['order_time']));
+            if(empty($v['notify_time'])) {
+                $tmp[] = array('data'=>'');
+            }else{
+                $tmp[] = array('data'=>date('Y-m-d H:i:s',$v['notify_time']));
+            }
+
+            $tmp[] = array('data'=>$v['official_sn']);
+            $tmp[] = array('data'=>orderState($v));
+            $tmp[] = array('data'=>$v['mch_amount']);
+            $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;
+    }
+
+    private function scard_type(int $card_type)
+    {
+        if ($card_type == 1) { //中石油
+            return '中石油';
+        } elseif ($card_type == 2) { //中石化
+            return '中石化';
+        } elseif ($card_type == 4) { //中国移动
+            return '中国移动';
+        } elseif ($card_type == 5) { //中国联通
+            return '中国联通';
+        } elseif ($card_type == 6) { //中国电信
+            return '中国电信';
+        } else {
+            return 'unknown';
+        }
+    }
+
+    private function quality_format($quality) {
+        switch ($quality) {
+            case 1:
+                $text = "普充";
+                break;
+            case 2:
+                $text = "快充";
+                break;
+            case 3:
+                $text = "卡密";
+                break;
+            case 4:
+                $text = "三方";
+                break;
+            case 5:
+                $text = "慢充二十四小时";
+                break;
+            case 6:
+                $text = "慢充六小时";
+                break;
+            case 7:
+                $text = "慢充两小时";
+                break;
+            default:
+                return '其他';
+                break;
+        }
+        return $text;
+    }
+
+    private function elapse_time($seconds)
+    {
+        $minutes = intval($seconds / 60);
+        $second = intval($seconds % 60);
+        if ($minutes >= 60) {
+            $minute = $minutes % 60;
+            $hours = intval($minutes / 60);
+            $result = "{$minute}m{$second}s";
+        } elseif ($minutes > 0) {
+            $result = "{$minutes}m{$second}s";
+        } else {
+            $result = "{$second}s";
+        }
+
+        if (isset($hours)) {
+            $result = "{$hours}h{$minute}m";
+        }
+        return $result;
+    }
+
+    private function all_order_state_stat($condition)
+    {
+        $counts = Model('')->table('refill_order,vr_order')->join('inner')
+            ->on('refill_order.order_id=vr_order.order_id')
+            ->field('count(*) as order_count, sum(refill_amount) as refill_amounts, sum(channel_amount) as channel_amounts, sum(mch_amount) as mch_amounts, order_state')
+            ->where($condition)
+            ->group('order_state')
+            ->select();
+
+        $all = [];
+        $data['order_count'] = $data['refill_amounts'] = $data['channel_amounts'] = $data['mch_amounts'] = 0;
+        $sending = $success = $cancel = $data;
+        foreach ($counts as $count) {
+            if ($count['order_state'] == ORDER_STATE_SEND) {
+                $sending = $count;
+            } elseif ($count['order_state'] == ORDER_STATE_SUCCESS) {
+                $success = $count;
+            } elseif ($count['order_state'] == ORDER_STATE_CANCEL) {
+                $cancel = $count;
+            }
+
+            $all['order_count'] += $count['order_count'];
+            $all['refill_amounts'] += ncPriceFormat($count['refill_amounts']);
+            $all['channel_amounts'] += ncPriceFormat($count['channel_amounts']);
+            $all['mch_amounts'] += ncPriceFormat($count['mch_amounts']);
+        }
+
+        return ['all' => $all, 'sending' => $sending, 'success' => $success, 'cancel' => $cancel];
+    }
+}

+ 10 - 1
admin/include/limit.php

@@ -29,8 +29,17 @@ $_limit =  array(
 		array('name'=>$lang['nc_spec_manage'], 'op'=>null, 'act'=>'spec'),
 		array('name'=>$lang['nc_album_manage'], 'op'=>null, 'act'=>'goods_album'),
 		)),
-    array('name'=>$lang['nc_merchant'], 'child'=>array(
+    array('name'=>'充值业务', 'child'=>array(
         array('name'=> '机构管理', 'op'=>null, 'act'=>'merchant'),
+        array('name'=> '充值申请', 'op'=>null, 'act'=>'refill_evidence'),
+        array('name'=> '订单列表', 'op'=>null, 'act'=>'refill_order'),
+        array('name'=> '通道列表', 'op'=>null, 'act'=>'provider'),
+        array('name'=> '通道组管理', 'op'=> null, 'act'=>'provider_group'),
+        array('name'=> '超时订单管理', 'op'=>null, 'act'=>'ordersendlist'),
+        array('name'=> '对账管理', 'op'=>null, 'act'=>'orderstats'),
+        array('name'=> '卡密管理', 'op'=>null, 'act'=>'card_key'),
+        array('name'=> '库存管理', 'op'=>null, 'act'=>'refill_stock'),
+        array('name'=> '成功率监控', 'op'=>null, 'act'=>'refill_successful'),
     )),
 	array('name'=>$lang['nc_store'], 'child'=>array(
 		array('name'=>$lang['nc_store_manage'], 'op'=>null, 'act'=>'store'),

+ 5 - 6
admin/include/menu.php

@@ -94,16 +94,15 @@ $arr = array(
 				'text' => '充值业务',
 				'list' => array(
 					array('args'=>'merchant,merchant,merchant',				'text'=>'机构管理'),
-					array('args'=>'refill_evidence,merchant,merchant',		'text'=>'充值申请'),
-					array('args'=>'refill_order,merchant,merchant',			'text'=>'订单列表'),
-					array('args'=>'provider,merchant,merchant',				'text'=>'通道列表'),
+					array('args'=>'index,refill_evidence,merchant',			'text'=>'充值申请'),
+					array('args'=>'index,refill_order,merchant',			'text'=>'订单列表'),
+					array('args'=>'index,provider,merchant',				'text'=>'通道列表'),
 					array('args'=>'index,provider_group,merchant',			'text'=>'通道组管理'),
-					array('args'=>'OrderSendList,merchant,merchant',		'text'=>'超时订单监控'),
-					array('args'=>'OrderStats,merchant,merchant',			'text'=>'对账管理'),
+					array('args'=>'index,ordersendlist,merchant',			'text'=>'超时订单监控'),
+					array('args'=>'index,orderstats,merchant',				'text'=>'对账管理'),
 					array('args'=>'stats,card_key,merchant',				'text'=>'卡密管理'),
 					array('args'=>'index,refill_stock,merchant',			'text'=>'库存管理'),
 					array('args'=>'provider_successful,refill_successful,merchant',	'text'=>'成功率监控'),
-
 				)
 			),
 			4 => array(

+ 6 - 6
admin/templates/default/merchant.order.stats.php

@@ -7,16 +7,16 @@
             <ul class="tab-base">
                 <li><a href="index.php?act=merchant&op=provider_evidence"><span>上游充值申请记录</span></a></li>
                 <li><a href="index.php?act=merchant&op=provider_evidence_add"><span>新增上游充值申请</span></a></li>
-                <li><a href="index.php?act=merchant&op=OrderStats&type=system"><span>商户对账记录</span></a></li>
-                <li><a href="index.php?act=merchant&op=OrderStats&type=provider"><span>通道对账记录</span></a></li>
+                <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>
             </ul>
         </div>
     </div>
     <div class="fixed-empty"></div>
     <form method="get" name="formSearch" id="formSearch">
-        <input type="hidden" value="merchant" name="act">
-        <input type="hidden" value="OrderStats" name="op">
+        <input type="hidden" value="OrderStats" name="act">
+        <input type="hidden" value="index" name="op">
         <input type="hidden" value="merchant" name="type">
         <table class="tb-type1 noborder search">
             <tbody>
@@ -43,7 +43,7 @@
                 <td><a href="javascript:void(0);" id="ncsubmit" class="btn-search "
                        title="<?php echo $lang['nc_query']; ?>">&nbsp;</a>
                     <?php if ($output['mch_name'] != '') { ?>
-                        <a href="index.php?act=merchant&op=refill_evidence" class="btns "
+                        <a href="index.php?act=OrderStats&op=index" class="btns "
                            title="<?php echo $lang['nc_cancel_search']; ?>"><span><?php echo $lang['nc_cancel_search']; ?></span></a>
                     <?php } ?></td>
             </tr>
@@ -151,7 +151,7 @@
 <script>
     $(function () {
         $('#ncsubmit').click(function () {
-            $('input[name="op"]').val('OrderStats');
+            $('input[name="op"]').val('index');
             $('#formSearch').submit();
         });
         // 日期选择器

+ 3 - 3
admin/templates/default/merchant.provider.evidence_list.php

@@ -7,9 +7,9 @@
             <ul class="tab-base">
                 <li><a href="JavaScript:void(0);" class="current"><span>上游充值申请记录</span></a></li>
                 <li><a href="index.php?act=merchant&op=provider_evidence_add"><span>新增上游充值申请</span></a></li>
-                <li><a href="index.php?act=merchant&op=OrderStats&type=system"><span>平台对账记录</span></a></li>
-                <li><a href="index.php?act=merchant&op=OrderStats&type=provider"><span>通道对账记录</span></a></li>
-                <li><a href="index.php?act=merchant&op=OrderStats&type=merchant"><span>商户对账记录</span></a></li>
+                <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>
             </ul>
         </div>
     </div>

+ 8 - 8
admin/templates/default/merchant.refill.evidence_list.php

@@ -11,8 +11,8 @@
     </div>
     <div class="fixed-empty"></div>
     <form method="get" name="formSearch" id="formSearch">
-        <input type="hidden" value="merchant" name="act">
-        <input type="hidden" value="refill_evidence" name="op">
+        <input type="hidden" value="refill_evidence" name="act">
+        <input type="hidden" value="index" name="op">
         <table class="tb-type1 noborder search">
             <tbody>
             <tr>
@@ -22,10 +22,10 @@
                 <td>
                     <select name="state_sel">
                         <option value="">请选择...</option>
-                        <option value="1">申请中</option>
-                        <option value="2">已通过</option>
-                        <option value="3">已驳回</option>
-                        <option value="4">全部</option>
+                        <option value="1" <?php if($_GET['state_sel'] == '1'){ echo 'selected';}?>>申请中</option>
+                        <option value="2" <?php if($_GET['state_sel'] == '2'){ echo 'selected';}?>>已通过</option>
+                        <option value="3" <?php if($_GET['state_sel'] == '3'){ echo 'selected';}?>>已驳回</option>
+                        <option value="4" <?php if($_GET['state_sel'] == '4'){ echo 'selected';}?>>全部</option>
                     </select>
                 </td>
                 <th><label for="query_start_time">下单时间</label></th>
@@ -39,7 +39,7 @@
                 <td><a href="javascript:void(0);" id="ncsubmit" class="btn-search "
                        title="<?php echo $lang['nc_query']; ?>">&nbsp;</a>
                     <?php if ($output['mch_name'] != '') { ?>
-                        <a href="index.php?act=merchant&op=refill_evidence" class="btns "
+                        <a href="index.php?act=refill_evidence&op=index" class="btns "
                            title="<?php echo $lang['nc_cancel_search']; ?>"><span><?php echo $lang['nc_cancel_search']; ?></span></a>
                     <?php } ?></td>
             </tr>
@@ -191,7 +191,7 @@
             type: 'datetime'
         });
         $('#ncsubmit').click(function () {
-            $('input[name="op"]').val('refill_evidence');
+            $('input[name="op"]').val('index');
             $('#formSearch').submit();
         });
         // 表格hover时背景

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

@@ -5,7 +5,7 @@
         <div class="item-title">
             <h3>通道</h3>
             <ul class="tab-base">
-                <li><a href="index.php?act=merchant&op=provider"><span><?php echo $lang['nc_manage'] ?></span></a></li>
+                <li><a href="index.php?act=provider&op=index"><span><?php echo $lang['nc_manage'] ?></span></a></li>
                 <li><a href="JavaScript:void(0);" class="current"><span><?php echo $lang['nc_new'] ?></span></a></li>
             </ul>
         </div>

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

@@ -79,7 +79,7 @@
         <div class="item-title">
             <h3>通道管理</h3>
             <ul class="tab-base">
-                <li><a href="index.php?act=merchant&op=provider"><span><?php echo $lang['nc_manage'] ?></span></a></li>
+                <li><a href="index.php?act=provider&op=index"><span><?php echo $lang['nc_manage'] ?></span></a></li>
                 <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=common" class="classA" data-type="2-common"><span>普通话费单量控制</span></a></li>
                 <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=fast" class="classA" data-type="2-fast"><span>快充话费单量控制</span></a></li>
                 <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=card" class="classA" data-type="2-card"><span>卡密话费单量控制</span></a></li>

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

@@ -5,7 +5,7 @@
         <div class="item-title">
             <h3>通道</h3>
             <ul class="tab-base">
-                <li><a href="index.php?act=merchant&op=provider"><span><?php echo $lang['nc_manage'] ?></span></a></li>
+                <li><a href="index.php?act=provider&op=index"><span><?php echo $lang['nc_manage'] ?></span></a></li>
                 <li><a href="JavaScript:void(0);" class="current"><span><?php echo $lang['nc_edit'] ?></span></a></li>
             </ul>
         </div>

+ 3 - 3
admin/templates/default/provider.evidence.add.php

@@ -7,9 +7,9 @@
       <ul class="tab-base">
           <li><a href="index.php?act=merchant&op=provider_evidence"><span>上游充值申请记录</span></a></li>
           <li><a href="JavaScript:void(0);" class="current"><span>新增上游充值申请</span></a></li>
-          <li><a href="index.php?act=merchant&op=OrderStats&type=system"><span>平台对账记录</span></a></li>
-          <li><a href="index.php?act=merchant&op=OrderStats&type=provider"><span>通道对账记录</span></a></li>
-          <li><a href="index.php?act=merchant&op=OrderStats&type=merchant"><span>商户对账记录</span></a></li>
+          <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>
       </ul>
     </div>
   </div>

+ 4 - 4
admin/templates/default/provider.index.php

@@ -21,8 +21,8 @@
     </div>
     <div class="fixed-empty"></div>
     <form method="get" name="formSearch" id="formSearch">
-        <input type="hidden" value="merchant" name="act">
-        <input type="hidden" value="provider" name="op">
+        <input type="hidden" value="provider" name="act">
+        <input type="hidden" value="index" name="op">
         <table class="tb-type1 noborder search">
             <tbody>
             <tr>
@@ -40,7 +40,7 @@
                 <td><a href="javascript:void(0);" id="ncsubmit" class="btn-search "
                        title="<?php echo $lang['nc_query']; ?>">&nbsp;</a>
                     <?php if ($output['name'] != '') { ?>
-                        <a href="index.php?act=merchant&op=provider" class="btns "
+                        <a href="index.php?act=provider&op=index" class="btns "
                            title="<?php echo $lang['nc_cancel_search']; ?>"><span><?php echo $lang['nc_cancel_search']; ?></span></a>
                     <?php } ?></td>
             </tr>
@@ -141,7 +141,7 @@
 <script>
     $(function () {
         $('#ncsubmit').click(function () {
-            $('input[name="op"]').val('provider');
+            $('input[name="op"]').val('index');
             $('#formSearch').submit();
         });
         // 表格hover时背景

+ 6 - 6
admin/templates/default/provider.order.stats.php

@@ -7,16 +7,16 @@
             <ul class="tab-base">
                 <li><a href="index.php?act=merchant&op=provider_evidence"><span>上游充值申请记录</span></a></li>
                 <li><a href="index.php?act=merchant&op=provider_evidence_add"><span>新增上游充值申请</span></a></li>
-                <li><a href="index.php?act=merchant&op=OrderStats&type=system"><span>平台对账记录</span></a></li>
+                <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=merchant&op=OrderStats&type=merchant"><span>商户对账记录</span></a></li>
+                <li><a href="index.php?act=OrderStats&op=index&type=merchant"><span>商户对账记录</span></a></li>
             </ul>
         </div>
     </div>
     <div class="fixed-empty"></div>
     <form method="get" name="formSearch" id="formSearch">
-        <input type="hidden" value="merchant" name="act">
-        <input type="hidden" value="OrderStats" name="op">
+        <input type="hidden" value="OrderStats" name="act">
+        <input type="hidden" value="index" name="op">
         <input type="hidden" value="provider" name="type">
         <table class="tb-type1 noborder search">
             <tbody>
@@ -43,7 +43,7 @@
                 <td><a href="javascript:void(0);" id="ncsubmit" class="btn-search "
                        title="<?php echo $lang['nc_query']; ?>">&nbsp;</a>
                     <?php if ($output['mch_name'] != '') { ?>
-                        <a href="index.php?act=merchant&op=refill_evidence" class="btns "
+                        <a href="index.php?act=OrderStats&op=index" class="btns "
                            title="<?php echo $lang['nc_cancel_search']; ?>"><span><?php echo $lang['nc_cancel_search']; ?></span></a>
                     <?php } ?></td>
             </tr>
@@ -151,7 +151,7 @@
 <script>
     $(function () {
         $('#ncsubmit').click(function () {
-            $('input[name="op"]').val('OrderStats');
+            $('input[name="op"]').val('index');
             $('#formSearch').submit();
         });
         // 日期选择器

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

@@ -6,7 +6,7 @@
         <div class="item-title">
             <h3>通道</h3>
             <ul class="tab-base">
-                <li><a href="index.php?act=merchant&op=provider"><span><?php echo $lang['nc_manage'] ?></span></a></li>
+                <li><a href="index.php?act=provider&op=index"><span><?php echo $lang['nc_manage'] ?></span></a></li>
                 <li><a href="JavaScript:void(0);" class="current"><span>通道省份编辑</span></a></li>
             </ul>
         </div>

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

@@ -5,7 +5,7 @@
         <div class="item-title">
             <h3>通道管理</h3>
             <ul class="tab-base">
-                <li><a href="index.php?act=merchant&op=provider"><span><?php echo $lang['nc_manage'] ?></span></a></li>
+                <li><a href="index.php?act=provider&op=index"><span><?php echo $lang['nc_manage'] ?></span></a></li>
                 <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=common"><span>普通话费单量控制</span></a></li>
                 <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=fast"><span>快充话费单量控制</span></a></li>
                 <li><a href="index.php?act=merchant&op=provider_amount_control&type=1&form=common"><span>普通油卡单量控制</span></a></li>

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

@@ -29,8 +29,8 @@
     </div>
     <div class="fixed-empty"></div>
     <form method="get" action="index.php" name="formSearch" id="formSearch">
-        <input type="hidden" name="act" value="merchant"/>
-        <input type="hidden" name="op" value="refill_order"/>
+        <input type="hidden" name="act" value="refill_order"/>
+        <input type="hidden" name="op" value="index"/>
         <input type="hidden" name="export" value=""/>
         <input type="hidden" name="fShowStat" value=""/>
         <table class="tb-type1 noborder search" style="min-width:1400px">
@@ -224,6 +224,7 @@
           <tr>
             <td>
                 <ul>
+                    <?php if($output['admin_info']['id'] == 1){?>
                     <div>
                         <li class="lineLi">总计订单数量:<?php echo $output['stat']['all']['order_count'] ?? 0?></li>
                         <li class="lineLi">总计充值金额:<?php echo $output['stat']['all']['refill_amounts'] ?? 0?></li>
@@ -256,6 +257,7 @@
                         <li class="lineLi">总计充值失败供方扣款金额:<?php echo $output['stat']['cancel']['channel_amounts'] ?? 0?></li>
                         <li class="lineLi">总计充值失败利润:<?php echo ncPriceFormat($output['stat']['cancel']['mch_amounts'] - $output['stat']['cancel']['channel_amounts'])?></li>
                     </div>
+                    <?php }?>
                     <div>
                         <li class="lineLi">成功率:
                             <?php
@@ -376,20 +378,20 @@
         $('#query_start_time').datepicker({dateFormat: 'yy-mm-dd'});
         $('#query_end_time').datepicker({dateFormat: 'yy-mm-dd'});
         $('#ncsubmit').click(function () {
-            $('input[name="op"]').val('refill_order');
+            $('input[name="op"]').val('index');
             $('#formSearch').submit();
         });
         // 导出
         $('#ncexport').click(function () {
             $('input[name="export"]').val('1');
-            $('input[name="op"]').val('refill_order');
+            $('input[name="op"]').val('index');
             $('#formSearch').submit();
             $('input[name="export"]').val('');
         })
         //搜索+统计 
         $('#ncstat').click(function () {
             $('input[name="fShowStat"]').val('1');
-            $('input[name="op"]').val('refill_order');
+            $('input[name="op"]').val('index');
             $('#formSearch').submit();
             $('input[name="fShowStat"]').val('');
         })

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

@@ -19,8 +19,8 @@
     </div>
     <div class="fixed-empty"></div>
     <form method="get" action="index.php" name="formSearch" id="formSearch">
-        <input type="hidden" name="act" value="merchant"/>
-        <input type="hidden" name="op" value="OrderSendList"/>
+        <input type="hidden" name="act" value="OrderSendList"/>
+        <input type="hidden" name="op" value="index"/>
         <table class="tb-type1 noborder search">
             <tr>
                 <th><label>客户名称</label></th>
@@ -107,16 +107,16 @@
                     <a href="#" class="btns" onclick="hCopyCardNo(event)">
                         <span><i class="icon-edit"></i>拷贝充值卡号</span>
                     </a>
-                    <a href="index.php?act=merchant&op=OrderSendList&time=1&card_type=<?php echo $_GET['card_type']?>" class="btns" >
+                    <a href="index.php?act=OrderSendList&op=index&time=1&card_type=<?php echo $_GET['card_type']?>" class="btns" >
                         <span><i class="icon-edit"></i>耗时半小时订单</span>
                     </a>
-                    <a href="index.php?act=merchant&op=OrderSendList&time=2&card_type=<?php echo $_GET['card_type']?>" class="btns" >
+                    <a href="index.php?act=OrderSendList&op=index&time=2&card_type=<?php echo $_GET['card_type']?>" class="btns" >
                         <span><i class="icon-edit"></i>耗时一小时订单</span>
                     </a>
-                    <a href="index.php?act=merchant&op=OrderSendList&time=3&card_type=<?php echo $_GET['card_type']?>" class="btns" >
+                    <a href="index.php?act=OrderSendList&op=index&time=3&card_type=<?php echo $_GET['card_type']?>" class="btns" >
                         <span><i class="icon-edit"></i>特定耗时5分钟订单</span>
                     </a>
-                    <a href="index.php?act=merchant&op=OrderSendList&time=4&card_type=<?php echo $_GET['card_type']?>" class="btns" >
+                    <a href="index.php?act=OrderSendList&op=index&time=4&card_type=<?php echo $_GET['card_type']?>" class="btns" >
                         <span><i class="icon-edit"></i>特定耗时15分钟订单</span>
                     </a>
                 </td>

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

@@ -8,15 +8,15 @@
                 <li><a href="index.php?act=merchant&op=provider_evidence"><span>上游充值申请记录</span></a></li>
                 <li><a href="index.php?act=merchant&op=provider_evidence_add"><span>新增上游充值申请</span></a></li>
                 <li><a href="JavaScript:void(0);" class="current"><span>平台对账记录</span></a></li>
-                <li><a href="index.php?act=merchant&op=OrderStats&type=provider"><span>通道对账记录</span></a></li>
-                <li><a href="index.php?act=merchant&op=OrderStats&type=merchant"><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>
             </ul>
         </div>
     </div>
     <div class="fixed-empty"></div>
     <form method="get" name="formSearch" id="formSearch">
-        <input type="hidden" value="merchant" name="act">
-        <input type="hidden" value="OrderStats" name="op">
+        <input type="hidden" value="OrderStats" name="act">
+        <input type="hidden" value="index" name="op">
         <table class="tb-type1 noborder search">
             <tbody>
             <tr>
@@ -30,7 +30,7 @@
                 <td><a href="javascript:void(0);" id="ncsubmit" class="btn-search "
                        title="<?php echo $lang['nc_query']; ?>">&nbsp;</a>
                     <?php if ($output['mch_name'] != '') { ?>
-                        <a href="index.php?act=merchant&op=orderstats" class="btns "
+                        <a href="index.php?act=OrderStats&op=index" class="btns "
                            title="<?php echo $lang['nc_cancel_search']; ?>"><span><?php echo $lang['nc_cancel_search']; ?></span></a>
                     <?php } ?></td>
             </tr>
@@ -119,7 +119,7 @@
 <script>
     $(function () {
         $('#ncsubmit').click(function () {
-            $('input[name="op"]').val('OrderStats');
+            $('input[name="op"]').val('index');
             $('#formSearch').submit();
         });
         // 日期选择器