소스 검색

预约时间排序

whj 4 년 전
부모
커밋
321a6a06d7
1개의 변경된 파일12개의 추가작업 그리고 8개의 파일을 삭제
  1. 12 8
      app/Community/Controllers/OrderVaccinesController.php

+ 12 - 8
app/Community/Controllers/OrderVaccinesController.php

xqd
@@ -48,20 +48,24 @@ class OrderVaccinesController extends AdminController
         });
 //        $grid->model()->orderByDesc('orders.id');
 
-//        if(!empty($res['orderPatient']['appoint_start_time']['start']) || !empty($res['orderPatient']['appoint_start_time']['start']) ){
-//
+        if(!empty($res['orderPatient']['appoint_start_time']['start']) || !empty($res['orderPatient']['appoint_start_time']['start']) ){
+
 //            $grid->model()->leftJoin('order_patients','order_patients.order_id','=','orders.id')->orderByDesc('order_patients.appoint_start_time');
-//
+
 //            $grid->model()->whereHas('orderPatient',function($query){
 //                $query->orderBy( OrderPatient::select('appoint_start_time')
 //                    ->whereColumn('order_id', 'orders.id')
 //                    ->orderBy('appoint_start_time', 'asc'));
 //            });
-//        } else {
-//            $grid->model()->whereHas('orderPatient',function($query){
-//                return $query->orderBy('appoint_start_time','desc')->groupBy('appoint_start_time');
-//            });
-//        }
+
+            $grid->model()->whereHas('orderPatient',function($query){
+                $query->orderBy( 'appoint_start_time','asc');
+            });
+        } else {
+            $grid->model()->whereHas('orderPatient',function($query){
+                return $query->orderBy('appoint_start_time','desc')->groupBy('appoint_start_time');
+            });
+        }
         DB::enableQueryLog();
 
 //        select bm_orders.*,bm_order_patients.appoint_end_time,bm_order_patients.appoint_start_time,bm_order_patients.name from `bm_orders`