|
@@ -122,24 +122,26 @@ class ordersendlistControl extends SystemControl
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ $merchant_list = $this->merchants();
|
|
|
+ $provider_list = $this->providers();
|
|
|
+ [$merchant_stat, $order_stat] = $this->merchant_timeout_stats($orders_cond);
|
|
|
+ if (empty($_GET['mchid'])) {
|
|
|
+ $order_count = $order_stat['order_count'];
|
|
|
+ }else{
|
|
|
+ $order_count = $merchant_stat[$_GET['mchid']]['order_count'];
|
|
|
+ }
|
|
|
$fields = 'refill_order.*,vr_order.order_state';
|
|
|
$order_by = "( {$cur_time} - refill_order.commit_time ) desc";
|
|
|
- $order_stat = Model('')->table('refill_order,vr_order,merchant')
|
|
|
- ->join('inner,inner')
|
|
|
- ->on('refill_order.order_id=vr_order.order_id,refill_order.mchid=merchant.mchid')
|
|
|
- ->field('count(*) as order_count ,sum(refill_amount) as refill_amounts, sum(channel_amount) as channel_amounts, sum(mch_amount) as mch_amounts')
|
|
|
- ->where($orders_cond)->find();
|
|
|
- $order_list = $model_refill_order->getMerchantTimeOut($orders_cond, 200, $order_stat['order_count'], $fields, $order_by);
|
|
|
+ $order_list = $model_refill_order->getMerchantTimeOut($orders_cond, 200, $order_count, $fields, $order_by);
|
|
|
|
|
|
$special_stat = $this->extra_stats($base_cond, $timeout_type,$cur_time);
|
|
|
- $merchant_list = $this->merchants();
|
|
|
|
|
|
if(!empty($order_list)) {
|
|
|
$order_list = $this->orderFormat($order_list, $merchant_list);
|
|
|
}
|
|
|
- $provider_list = $this->providers();
|
|
|
Tpl::output('stat', $order_stat);
|
|
|
Tpl::output('count', $special_stat);
|
|
|
+ Tpl::output('merchant_stat', $merchant_stat);
|
|
|
Tpl::output('order_list', $order_list);
|
|
|
Tpl::output('merchant_list', $merchant_list);
|
|
|
Tpl::output('provider_list', $provider_list);
|
|
@@ -190,6 +192,33 @@ class ordersendlistControl extends SystemControl
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
+ private function merchant_timeout_stats($cond)
|
|
|
+ {
|
|
|
+ unset($cond['refill_order.mchid']);
|
|
|
+ $stats = Model('')->table('refill_order,vr_order,merchant')
|
|
|
+ ->join('inner,inner')
|
|
|
+ ->on('refill_order.order_id=vr_order.order_id,refill_order.mchid=merchant.mchid')
|
|
|
+ ->field('count(*) as order_count, sum(refill_amount) as refill_amounts, merchant.mchid, merchant.company_name, merchant.name')
|
|
|
+ ->where($cond)
|
|
|
+ ->group('refill_order.mchid')
|
|
|
+ ->order('order_count desc')
|
|
|
+ ->select();
|
|
|
+ $special_stat = [];
|
|
|
+ $order_stat = ['order_count' => 0, 'refill_amounts' => 0];
|
|
|
+ if(empty($stats)) return [$special_stat, $order_stat];
|
|
|
+
|
|
|
+ foreach ($stats as $stat) {
|
|
|
+ $mchid = intval($stat['mchid']);
|
|
|
+ $special_stat[$mchid] = [
|
|
|
+ 'mchid' => $mchid, 'order_count' => $stat['order_count'], 'refill_amounts' => $stat['refill_amounts'],
|
|
|
+ 'company_name' => $stat['company_name'], 'name' => $stat['name']
|
|
|
+ ];
|
|
|
+ $order_stat['order_count'] += $stat['order_count'];
|
|
|
+ $order_stat['refill_amounts'] += $stat['refill_amounts'];
|
|
|
+ }
|
|
|
+ return [$special_stat, $order_stat];
|
|
|
+ }
|
|
|
+
|
|
|
private function notify_time($cur_time,$period)
|
|
|
{
|
|
|
$start_day = strtotime("-5 days",$cur_time);
|
|
@@ -231,11 +260,6 @@ class ordersendlistControl extends SystemControl
|
|
|
|
|
|
if (!empty($_GET['mchid'])) {
|
|
|
$base_cond['refill_order.mchid'] = $_GET['mchid'];
|
|
|
- } elseif(!empty($_GET['no_mchid'])) {
|
|
|
- $no_mchid = explode(',', $_GET['no_mchid']);
|
|
|
- $base_cond['refill_order.mchid'] = ['not in', $no_mchid];
|
|
|
- } elseif(!empty($mch_cond)) {
|
|
|
- $base_cond = array_merge($base_cond,$mch_cond);
|
|
|
}
|
|
|
|
|
|
if (!empty($card_type))
|