|
@@ -257,22 +257,22 @@ class Waste extends Index
|
|
|
$cateTitle[] = $v['title'];
|
|
|
$lists[$k]['title'] = $v['title'];
|
|
|
$aa = [];
|
|
|
- foreach ($arr as $kk=>$vv){
|
|
|
- $record = Db::name('waste_record')
|
|
|
- ->where('org_id',$this->orgId)
|
|
|
- ->where('cateid',$v['id'])
|
|
|
- ->where('del',0)
|
|
|
- ->where('create_yyyymmdd',$vv['ymd'])
|
|
|
- ->sum('weight');
|
|
|
- $aa[$kk] = $record>0? round($record/1000,1):0;
|
|
|
- }
|
|
|
+ $record = Db::name('waste_record')
|
|
|
+ ->where('org_id',$this->orgId)
|
|
|
+ ->where('cateid',$v['id'])
|
|
|
+ ->where('del',0)
|
|
|
+ ->where('create_yyyymmdd', '>=', date('Ymd', $startOfWeek))
|
|
|
+ ->where('create_yyyymmdd', '<=', date('Ymd', $endOfWeek))
|
|
|
+ ->sum('weight');
|
|
|
+ $aa = $record>0? round($record/1000,1):0;
|
|
|
$lists[$k]['list'] = $aa;
|
|
|
}
|
|
|
|
|
|
$data = [
|
|
|
'date' =>array_column($arr,'date'),
|
|
|
+ 'title' =>array_column($lists,'title'),
|
|
|
'cate' =>$cateTitle,
|
|
|
- 'list'=>$lists
|
|
|
+ 'list'=>array_column($lists,'list')
|
|
|
];
|
|
|
|
|
|
HelpHander::success($data);
|