finish
This commit is contained in:
parent
c74807d4d1
commit
8831588cdf
|
|
@ -131,24 +131,24 @@ class Dispatcher extends Backend
|
||||||
|
|
||||||
$orderValid = implode(',',$this->model->tabStatus(Order::TAB_VALID));
|
$orderValid = implode(',',$this->model->tabStatus(Order::TAB_VALID));
|
||||||
|
|
||||||
//"COUNT(CASE WHEN status IN (".$orderValid.") THEN 1 END) AS ing_num",
|
|
||||||
$fields = [
|
$fields = [
|
||||||
'dispatch_admin_id',
|
'dispatch_admin_id',
|
||||||
// 使用 IFNULL 确保结果为 null 时返回 0
|
// 只要是 COUNT(...) 不用 IFNULL
|
||||||
"IFNULL(COUNT(CASE WHEN status = 60 THEN 1 END), 0) AS finish_num", //完成数
|
"COUNT(CASE WHEN status = 60 THEN 1 END) AS finish_num", // 完成数
|
||||||
"IFNULL(COUNT(CASE WHEN status IN (".$orderValid.") THEN 1 END), 0) AS count_num", //总订单数 (排除取消 和草稿)
|
"COUNT(CASE WHEN status IN (".$orderValid.") THEN 1 END) AS count_num", // 总订单数(排除取消和草稿)
|
||||||
"IFNULL(COUNT(CASE WHEN status IN (".$orderValid.") AND is_overtime = 1 THEN 1 END), 0) AS overtime_num", //超时数
|
"COUNT(CASE WHEN status IN (".$orderValid.") AND is_overtime = 1 THEN 1 END) AS overtime_num", // 超时数
|
||||||
|
|
||||||
"IFNULL(SUM(CASE WHEN status = 60 THEN total END), 0) AS total", //成效额
|
// SUM 可能为 NULL,使用 IFNULL 保证 0
|
||||||
"IFNULL(SUM(CASE WHEN status = 60 THEN performance END), 0) AS performance", //业绩
|
"IFNULL(SUM(CASE WHEN status = 60 THEN total END), 0) AS total", // 成效额
|
||||||
"IFNULL(SUM(CASE WHEN status = 60 THEN (cost + material_cost) END), 0) AS cost_total", //总成本
|
"IFNULL(SUM(CASE WHEN status = 60 THEN performance END), 0) AS performance", // 业绩
|
||||||
//"IFNULL(SUM(CASE WHEN status = 60 THEN (refund_amount + worker_refund_amount) END), 0) AS refund_total", //退款总数
|
"IFNULL(SUM(CASE WHEN status = 60 THEN (cost + material_cost) END), 0) AS cost_total", // 总成本
|
||||||
"SUM(
|
|
||||||
CASE WHEN status = 60 THEN (refund_amount + worker_refund_amount) ELSE 0 END
|
// refund_total 计算改成 IFNULL(SUM(...), 0)
|
||||||
) AS refund_total",
|
"IFNULL(SUM(CASE WHEN status = 60 THEN (refund_amount + worker_refund_amount) ELSE 0 END), 0) AS refund_total",
|
||||||
"IFNULL(COUNT(CASE WHEN status = 60 AND (refund_amount > 0 OR worker_refund_amount > 0) THEN 1 END), 0) AS refund_count", //退款订单数量
|
|
||||||
"IFNULL(AVG(CASE WHEN status = 60 THEN UNIX_TIMESTAMP(dispatch_time) - UNIX_TIMESTAMP(create_time) END), 0) AS avg_time_diff", //派单时效
|
"COUNT(CASE WHEN status = 60 AND (refund_amount > 0 OR worker_refund_amount > 0) THEN 1 END) AS refund_count", // 退款订单数量
|
||||||
// "SUM(CASE WHEN status = 60 THEN (field1 + field2) END) AS performance",
|
|
||||||
|
"IFNULL(AVG(CASE WHEN status = 60 THEN UNIX_TIMESTAMP(dispatch_time) - UNIX_TIMESTAMP(create_time) END), 0) AS avg_time_diff", // 派单时效
|
||||||
];
|
];
|
||||||
|
|
||||||
$builder = $this->model
|
$builder = $this->model
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user