You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB
PHP

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
namespace App\Services;
use App\Http\Controllers\API\AspNetZhuanController;
use DateTime;
class NmrService
{
public function CheckEnableNmrTime($date,$time){
// 根据时间查询二线可用号源区分上下午二线需预约体检时间1小时后
$AspNet = new AspNetZhuanController();
$nmrPlans=$AspNet::ErXian(['yyid'=>6,'data'=>[$date],'action'=>"1"],uniqid());
if($time<="12:00") $end_time="12:00";
if($time>"12:00") $end_time="23:59";
if(!isset($nmrPlans[$date]) or empty($nmrPlans[$date])) return ['status'=>false,'datetime'=>''];
$planTime = new DateTime($time);
$planTime->modify('+1 hour');
$plan_time=$planTime->format('H:i');
$enable_datetime='';
foreach ($nmrPlans[$date] as $nmp_p){
if($nmp_p['Time']>=$plan_time and $nmp_p['Time']<=$end_time and $nmp_p['keyong']==="0"){
$enable_datetime=$date." ".$nmp_p['Time'];
break;
}
}
if($enable_datetime<>''){
return ['status'=>true,'datetime'=>$enable_datetime];
}else{
return ['status'=>false,'datetime'=>$enable_datetime];
}
}
}