diff --git a/application/admin/controller/statistics/Item.php b/application/admin/controller/statistics/Item.php index f6dd031..ec424fa 100644 --- a/application/admin/controller/statistics/Item.php +++ b/application/admin/controller/statistics/Item.php @@ -81,6 +81,8 @@ class Item extends Backend 'sum(material_cost) material_cost', // 收益 'sum(refund_amount) refund_amount', // 公司退款 'sum(worker_refund_amount) worker_refund_amount', // 工人退款 + "IFNULL(AVG(CASE WHEN status > 10 THEN UNIX_TIMESTAMP(dispatch_time) - UNIX_TIMESTAMP(create_time) END), 0) AS avg_time_diff", //派单时效 + ])->group('item_title') ->order('count_num', 'desc'); // dd($total); @@ -100,7 +102,7 @@ class Item extends Backend $re['cash_value'] = $this->mydiv($re['performance'],$re['count_num'],2,false); $re['total_avg'] = $this->mydiv($re['total'],$re['count_num'],2,false); $re['performance_avg'] = $this->mydiv($re['performance'],$re['finish_num'],2,false); - + $re['avg_time_diff'] = $this->mydiv($re['avg_time_diff'],3600,2,false); $re['cost_total'] = $cost_total; // $re['id'] = $re['item_id']; $data [] = $re;