|
@@ -66,15 +66,18 @@ class Decision extends Api
|
|
|
if(!empty($param['sist'])){
|
|
if(!empty($param['sist'])){
|
|
|
$where['设备编组'] = $param['sist'];
|
|
$where['设备编组'] = $param['sist'];
|
|
|
}
|
|
}
|
|
|
- $mouth = date('Y-m',strtotime($param['mouth']));
|
|
|
|
|
|
|
+ //将参数装换成标准日期格式
|
|
|
|
|
+ $mouth = date_create_from_format('Ym', $param['mouth'])->format('Y-m');
|
|
|
$machine = \db('设备_基本资料')
|
|
$machine = \db('设备_基本资料')
|
|
|
->where($where)
|
|
->where($where)
|
|
|
->field('设备编号')
|
|
->field('设备编号')
|
|
|
->select();
|
|
->select();
|
|
|
$day = \db('设备_产量计酬')
|
|
$day = \db('设备_产量计酬')
|
|
|
- ->field('DATE(sczl_rq) as day')
|
|
|
|
|
- ->whereTime('sczl_rq',$mouth)
|
|
|
|
|
- ->group('day')
|
|
|
|
|
|
|
+ ->distinct(true)
|
|
|
|
|
+ ->field('DATE_FORMAT(sczl_rq,"%Y-%m-%d") as day')
|
|
|
|
|
+ ->whereRaw("DATE_FORMAT(sczl_rq, '%Y-%m') = '$mouth'")
|
|
|
|
|
+// ->whereTime('sczl_rq',$mouth)
|
|
|
|
|
+// ->group('day')
|
|
|
->order('day')
|
|
->order('day')
|
|
|
->select();
|
|
->select();
|
|
|
$day = array_reduce($day, function($carry, $item) {
|
|
$day = array_reduce($day, function($carry, $item) {
|