From 0fbaccc7f9f2e1b630fd34794c089f59f60a31f2 Mon Sep 17 00:00:00 2001 From: todaywindy Date: Tue, 1 Jul 2025 11:31:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BE=E5=8D=95=E6=97=B6=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/statistics/Item.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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;