首页统计

This commit is contained in:
xman 2025-07-07 14:42:30 +08:00
parent 15e80a39ea
commit 5fdc8c2000

View File

@ -300,17 +300,26 @@ class Orderplan extends Backend
$start = now()->format('Y-m-d 00:00:00');
$end_at = now()->format('Y-m-d 23:59:59');
$build = new \app\admin\model\Order();
$build->whereBetween('audit_time', [$start, $end_at])
->where('status',\app\admin\model\Order::STATUS_FINISHED);
$data1 = $build->field([
'sum(total) total',
'count(*) count',
])->select();
$build = new \app\admin\model\Order();
$build->whereBetween('create_time', [$start, $end_at]);
$data = $build->field([
'sum(total) total',
'count(id) count',
/* 'sum(total) total',
'count(id) count',*/
'count(if(status=-10,1,null)) cancel'
])->select();
$today = [
'total' => $data[0]->total ?? 0,
'count' => $data[0]->count ?? 0,
'total' => $data1[0]->total ?? 0,
'count' => $data1[0]->count ?? 0,
'cancel' => $data[0]->cancel ?? 0,
];