601,'msg'=>'缺少必要参数','data'=>'']); } else{ echo 'what happend'; } $all_time = explode('至',$set_time); if(count($all_time) <2){ return json_encode(['status'=>601,'msg'=>'缺少必要参数','data'=>'']); } $sche_dule = Schedule::where('organization_id','!=','') ->where(['docter_id'=>$docter_id,'schedule_date'=>$all_time[0]]) ->pluck('id'); $sche_dule_arr = [ [ 'date'=>"上午", 'mondy'=>true, 'tuesday'=>true, 'wednesday'=>true, 'thursday'=>true, 'friday'=>true, 'saturday'=>true, 'sunday'=>true, ], [ 'date'=>"下午", 'mondy'=>true, 'tuesday'=>true, 'wednesday'=>true, 'thursday'=>true, 'friday'=>true, 'saturday'=>true, 'sunday'=>true, ], [ 'date'=>"晚上", 'mondy'=>true, 'tuesday'=>true, 'wednesday'=>true, 'thursday'=>true, 'friday'=>true, 'saturday'=>true, 'sunday'=>true, ] ]; if(empty($sche_dule)){ return ['status'=>200,'msg'=>'ok','data'=>['schedule'=>$sche_dule_arr,'org_id'=>$org_id,'docter_id'=>$docter_id]]; } foreach ($sche_dule as ){ $org_schdule = SchedulePeriod::where(['schedule_id'=>$org_id,''])->get()->GroupBy('organization_id'); } $schedule_config = SystemConfig::get('docter_config'); dd($schedule_config); $community = CommunitySchedule::where('org_id',$org_id)->orderBy('day_type')->pluck('times_id','day_type'); $time_array = [[],[],[],[],[],[],[]]; foreach ($community as $key => $ids){ $time = TimePeriod::whereIn('id',$ids)->get(['id','start_time_period','end_time_period']); $time_info = []; foreach ($time as $val){ if(!in_array(intval($val->id),$arrays)){ $time_info[] = ['id'=>$val->id,'time'=>$val->start_time_period.'-'.$val->end_time_period]; } } $time_array[$key-1] = $time_info; } $data['community'] = $time_array; $firstday = date('Y-m-d', strtotime("this week")); $scd_id = Schedule::where(['schedule_date'=>$firstday,'docter_id'=>$docter_id,'organization_id'=>$org_id])->value('id'); $docter_schedule = $time_array; if(!empty($scd_id)){ $sche_dule = SchedulePeriod::where('schedule_id',$scd_id)->get(['time_period_id','schedule_date'])->GroupBy('schedule_date')->toArray(); foreach ($sche_dule as $val){ if($val){ $i = 0; $new_sche_dule[$i] = array_column($val,'time_period_id'); $i++; } } } $data['docter'] = $docter_schedule; $data['role'] = 1; return (json_encode(['code'=>200,'msg'=>'ok','data'=>$data])); } public function setDocChedule() { } }