Swdz-WangHaiJun 4 лет назад
Родитель
Сommit
8659a1e00c
1 измененных файлов с 11 добавлено и 1 удалено
  1. 11 1
      app/Community/Controllers/ApiController.php

+ 11 - 1
app/Community/Controllers/ApiController.php

xqd xqd xqd
@@ -138,6 +138,7 @@ class ApiController extends Controller
         $first_day = strtotime($all_time[0]);
 //        DB::enableQueryLog();
         $sche_dule = Schedule::whereBetween('schedule_day',[$start_time,$end_time])
+            ->where(['docter_id'=>$docter_id])
             ->pluck('id')
             ->toArray();
 //        echo '<pre>';
@@ -197,9 +198,17 @@ class ApiController extends Controller
             for ($i = 0; $i<6; $i++){
                 $str_time =  date('Y-m-d',($first_day + $i * 86400));
                 for($j=0;$j<3;$j++){
+
+                    //dd($sche_dule);
+                 DB::enableQueryLog();
+
                     //检测上午
                     $is_mo_have = SchedulePeriod::whereIn('schedule_id',$sche_dule)->where('schedule_date',$str_time)->whereIn('time_period_id',$times[$j])
                         ->where('docter_id','!=',$docter_id)->count();
+                    echo '<pre>';
+                    print_r(DB::getQueryLog());
+                    echo '</pre>';
+                    dd($is_mo_have);
                     $is_self = SchedulePeriod::whereIn('schedule_id',$sche_dule)->where('schedule_date',$str_time)->whereIn('time_period_id',$times[$j])
                         ->where('docter_id',$docter_id)->count();
                     if($is_self){
@@ -218,11 +227,12 @@ class ApiController extends Controller
             for ($i=0; $i<=6; $i++){
                 $str_time =  date('Y-m-d',($first_day + $i * 86400));
                 for($j=0;$j<=2;$j++){
-                    //检测上午
+
                     $is_mo_have = SchedulePeriod::whereIn('schedule_id',$sche_dule)->where('schedule_date',$str_time)->whereIn('time_period_id',$times[$j])
                         ->where('organization_id','!=',$org_id)->where('docter_id','=',$docter_id)->count();
                     $is_mo_self = SchedulePeriod::whereIn('schedule_id',$sche_dule)->where('schedule_date',$str_time)->whereIn('time_period_id',$times[$j])
                         ->where('organization_id',$org_id)->where('docter_id',$docter_id)->count();
+
                     if($is_mo_self){
                         $sche_dule_arr[$j][$week_arr[$i]] = true;
                     }