Accept Merge Request #231: (feature/hant -> master)

Merge Request: 统计

Created By: @todayswind
Accepted By: @todayswind
URL: https://g-bcrc3009.coding.net/p/allocatr/d/allocatr/git/merge/231?initial=true
This commit is contained in:
todayswind 2025-08-03 20:46:46 +08:00 committed by Coding
commit 0e2f9409a6

View File

@ -96,7 +96,7 @@ class Item extends Backend
if (!empty($filter)){
$arr = explode(' - ', $filter);
if (trim($arr[0])) {
$start = trim($arr[0]);
$start = trim($arr[0]). ' 00:00:00';
}
if (trim($arr[1])) {
$end_at = trim($arr[1]) . ' 23:29:59';
@ -113,10 +113,6 @@ class Item extends Backend
if(!empty(request()->get('source',null))){
$build->where('source',request()->get('source'));
}
//城市
/* if(!empty(request()->post('area_id',null))){
$build->where('area_id','LIKE',request()->post('source').'%');
}*/
if(!empty(request()->get('item_id',null))){
$item_id =request()->get('item_id');
@ -125,7 +121,8 @@ class Item extends Backend
$build->whereIn('item_id', $item_ids);
}
$build->whereBetween('create_time', [$start, $end_at])
$build->whereBetween('audit_time', [$start, $end_at])
->where('status',Order::STATUS_FINISHED)
->field([
'item_title name', // 类型
'sum(total) total', // 营业额
@ -141,6 +138,7 @@ class Item extends Backend
])->group('item_title')
->order('count_num', 'desc');
// dd($total);
$res = $build->paginate($limit);
$total = $res->total();
$ress = $res->items();