Mike 4 years ago
parent
commit
33164a9b0a
1 changed files with 2 additions and 2 deletions
  1. 2 2
      app/Community/Controllers/ApiController.php

+ 2 - 2
app/Community/Controllers/ApiController.php

xqd xqd
@@ -457,7 +457,7 @@ class ApiController extends Controller
         for($tType = 1; $tType<=3 ; $tType++){
             foreach ($schedule as $id => $date) {
                 $week = intval(date('N', strtotime($date)));
-                $real_id = WeekSchedule::where(['docter_id'=>$docterId,'organization_id'=>$orgId,'week'=>$week,'type'=>$tType])->first();
+                $real_id = WeekSchedule::where(['docter_id'=>$docterId,'organization_id'=>$orgId,'schedule_type'=>$sType,'week'=>$week,'type'=>$tType])->first();
                 if (!empty($real_id)) {
                     foreach ($timePeriods[$tType-1] as $idt) {
                         $s_t= [
@@ -484,7 +484,7 @@ class ApiController extends Controller
 
         //删除 Schedule里面SchedulePeriod 没有的日期
         foreach ($schedule as $date) {
-            $c = SchedulePeriod::where(['docter_id'=>$docterId,'schedule_type'=> $sType])->where('schedule_date',$date)->count();
+            $c = SchedulePeriod::where(['docter_id'=>$docterId,'schedule_date'=> $date,'schedule_type',$sType])->count();
             if($c==0) Schedule::where(['docter_id'=>$docterId,'schedule_date'=>$date,'schedule_type' => $sType])->delete();
         }
         return apiReturn('200','ok');