|
@@ -275,11 +275,16 @@ class ordersendlistControl extends SystemControl
|
|
|
->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($orders_cond)->find();
|
|
|
- $order_list = $model_refill_order->getMerchantTimeOut($orders_cond, 200, $order_stat['order_count'],$fields, $order_by);
|
|
|
+ [$special_stat, $order_stat] = $this->provider_timeout_stats($orders_cond, $provider_list);
|
|
|
+ if (empty($_GET['store_id'])) {
|
|
|
+ $order_count = $order_stat['order_count'];
|
|
|
+ }else{
|
|
|
+ $order_count = $special_stat[$_GET['store_id']]['order_count'];
|
|
|
+ }
|
|
|
+ $order_list = $model_refill_order->getMerchantTimeOut($orders_cond, 200, $order_count,$fields, $order_by);
|
|
|
if(!empty($order_list)) {
|
|
|
$order_list = $this->orderFormat($order_list, $merchant_list);
|
|
|
}
|
|
|
- $special_stat = $this->provider_timeout_stats($orders_cond, $provider_list);
|
|
|
|
|
|
Tpl::output('stat', $order_stat);
|
|
|
Tpl::output('special_stat', $special_stat);
|
|
@@ -293,26 +298,32 @@ class ordersendlistControl extends SystemControl
|
|
|
private function provider_timeout_stats($cond, $provider_list)
|
|
|
{
|
|
|
unset($cond['vr_order.store_id']);
|
|
|
- $order_stat = Model('')->table('refill_order,vr_order')
|
|
|
+ $stats = Model('')->table('refill_order,vr_order')
|
|
|
->join('inner')
|
|
|
->on('refill_order.order_id=vr_order.order_id')
|
|
|
- ->field('count(*) as order_count, store_id')
|
|
|
+ ->field('count(*) as order_count, store_id, sum(refill_amount) as refill_amounts')
|
|
|
->where($cond)
|
|
|
->group('vr_order.store_id')
|
|
|
->order('order_count desc')
|
|
|
->select();
|
|
|
- if(empty($order_stat)) return [];
|
|
|
+ if(empty($stats)) return [];
|
|
|
|
|
|
foreach ($provider_list as $provider) {
|
|
|
- $providers[$provider['provider_id']] = $provider;
|
|
|
+ $providers[$provider['store_id']] = $provider;
|
|
|
}
|
|
|
ksort($providers);
|
|
|
- foreach ($order_stat as $key => $stat) {
|
|
|
+ $special_stat = [];
|
|
|
+ $order_stat = ['order_count' => 0, 'refill_amounts' => 0];
|
|
|
+ foreach ($stats as $stat) {
|
|
|
$store_id = intval($stat['store_id']);
|
|
|
- $order_stat[$key]['store_name'] = $providers[$store_id]['store_name'];
|
|
|
- $order_stat[$key]['opened'] = $providers[$store_id]['opened'];
|
|
|
- }
|
|
|
- return $order_stat;
|
|
|
+ $special_stat[$store_id] = [
|
|
|
+ 'store_id' => $store_id, 'order_count' => $stat['order_count'], 'refill_amounts' => $stat['refill_amounts'],
|
|
|
+ 'store_name' => $providers[$store_id]['store_name'], 'opened' =>$providers[$store_id]['opened']
|
|
|
+ ];
|
|
|
+ $order_stat['order_count'] += $stat['order_count'];
|
|
|
+ $order_stat['refill_amounts'] += $stat['refill_amounts'];
|
|
|
+ }
|
|
|
+ return [$special_stat, $order_stat];
|
|
|
}
|
|
|
|
|
|
private function RefillOrderExport($cond,$type='order')
|