qiuenguang 1 rok pred
rodič
commit
e299786412
1 zmenil súbory, kde vykonal 7 pridanie a 4 odobranie
  1. 7 4
      application/api/controller/Decision.php

+ 7 - 4
application/api/controller/Decision.php

@@ -66,15 +66,18 @@ class Decision extends Api
         if(!empty($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('设备_基本资料')
             ->where($where)
             ->field('设备编号')
             ->select();
         $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')
             ->select();
         $day = array_reduce($day, function($carry, $item) {