sunhao 5 years ago
parent
commit
2c2881cb9d
1 changed files with 1 additions and 5 deletions
  1. 1 5
      app/Http/Controllers/Admin/StatisticsController.php

+ 1 - 5
app/Http/Controllers/Admin/StatisticsController.php

@@ -1764,11 +1764,7 @@ class StatisticsController extends Controller
1764 1764
         $teams = DB::table('teams')->lists('name', 'id');
1765 1765
 
1766 1766
         foreach($_data['data'] as $k=>&$v){
1767
-            $order_result = Order::select(DB::raw('team_id, count(1) as order_count, sum(receivedAmount) as receivedAmount, sum(if(payment_type=1,receivedAmount,null)) as wx_money'))->where(function($query) use($team_id, $stime, $etime){
1768
-                if($team_id) $query->where('team_id', $team_id);
1769
-                if($stime) $query->where('createTime', '>=', $stime);
1770
-                if($etime) $query->where('createTime', '<=', $etime.' 23:59:59');
1771
-            })->where('is_del', 0)->whereRaw('left(createTime, 10)='.$v['date'])->where('team_id', $v['team_id'])->first();
1767
+            $order_result = Order::select(DB::raw('team_id, count(1) as order_count, sum(receivedAmount) as receivedAmount, sum(if(payment_type=1,receivedAmount,null)) as wx_money'))->where('is_del', 0)->where('createTime','>=', $v['date'])->where('createTime','<=', $v['date'].' 23:59:59')->where('team_id', $v['team_id'])->first();
1772 1768
 
1773 1769
             $v['order_count'] = isset($order_result->order_count) ? $order_result->order_count : '';
1774 1770
             $v['receivedAmount'] = isset($order_result->receivedAmount) ? $order_result->receivedAmount : '';