From f063b979e7c284b2ee058fdc5896e7a8d71db711 Mon Sep 17 00:00:00 2001 From: yanzai Date: Tue, 22 Jul 2025 16:53:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E7=BA=BF=E6=94=B9=E7=BA=A6bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/API/AspNetZhuanController.php | 12 +- .../Controllers/API/H5/OrderController.php | 144 +++++++++++++----- 2 files changed, 119 insertions(+), 37 deletions(-) diff --git a/Laravel/app/Http/Controllers/API/AspNetZhuanController.php b/Laravel/app/Http/Controllers/API/AspNetZhuanController.php index 8b4403c..875fd2f 100644 --- a/Laravel/app/Http/Controllers/API/AspNetZhuanController.php +++ b/Laravel/app/Http/Controllers/API/AspNetZhuanController.php @@ -203,8 +203,16 @@ class AspNetZhuanController extends Controller if ($res['code'] == "200") { return $res; } else { + if (strpos($save_res, '排班计划与周排班都不存在') !== false) { + return [ + 'code'=>'200', + 'data'=>[], + 'msg'=>'', + ]; + } else { + throw new HttpResponseException(\Yz::echoError1("调用".$mark."接口失败:" . $res['msg'])); + } - throw new HttpResponseException(\Yz::echoError1("调用".$mark."接口失败:" . $res['msg'])); } } else { @@ -215,7 +223,7 @@ class AspNetZhuanController extends Controller self::$request->response_data = $body; self::$request->save(); - throw new HttpResponseException(\Yz::echoError1("调用".$mark."接口失败:" . $status . "body:" . $body)); + throw new HttpResponseException(\Yz::echoError1("调用".$mark."接口异常:" . $status . "body:" . $body)); } } public static function Post2($url,$data,$mark) diff --git a/Laravel/app/Http/Controllers/API/H5/OrderController.php b/Laravel/app/Http/Controllers/API/H5/OrderController.php index b36035b..2966520 100644 --- a/Laravel/app/Http/Controllers/API/H5/OrderController.php +++ b/Laravel/app/Http/Controllers/API/H5/OrderController.php @@ -50,7 +50,7 @@ class OrderController extends Controller $datetime = new DateTime($list->created_at); $timestamp = $datetime->getTimestamp(); $list->end_time = $timestamp + (60 * $WaitingPaymentTime); - if (time() > $list->end_time) { + if (time() > $list->end_time and strpos($list->source, '线下体检预约') === false) { $list->status = 3; } } @@ -532,7 +532,6 @@ class OrderController extends Controller if(isset($yuyue_fangshi) and $yuyue_fangshi<>'GeJianPlanFront') { //个检先选号源此处不提示 不拦截 return \Yz::echoError1($p_nmr_data['name'] . '号源不可用,请重新选择'); } - } $plan_nmr_temp[] = $p_nmr_data; @@ -750,49 +749,113 @@ class OrderController extends Controller return \Yz::Return(true,"操作完成",[]); } //如果有二线号源,根据体检时间查询二线可用号源,区分上下午,二线需预约体检时间1小时后 + $leixing=null; + $keywords = ['磁','食管镜','肠镜检']; $buyInfo=json_decode($orderInfo->buy_info,true); $db_nmr_info=json_decode($orderInfo->erxian_appointment_info,true); - if(isset($buyInfo['nmr_list']) and !empty($buyInfo['nmr_list']) and isset($db_nmr_info) and empty($db_nmr_info)){ +// if(isset($buyInfo['nmr_list']) and !empty($buyInfo['nmr_list']) and isset($db_nmr_info) and empty($db_nmr_info)){ +// $temp_erxian=[]; +// foreach ($buyInfo['nmr_list'] as $k=>$v){ +// $cha_item=DB::table('items')->where(['item_id'=>$v['item_id'],'status'=>1])->first(); +// if(!!$cha_item){ +// $temp_erxian[]=[ +// 'item_id'=>$v['item_id'], +// 'name'=>$cha_item->name, +// 'price'=>$cha_item->price, +// 'time'=>'', +// 'date'=>'', +// 'gid'=>'', +// ]; +// } +// } +// $db_nmr_info=$temp_erxian; +// } + if(isset($db_nmr_info) and !empty($db_nmr_info)){ $temp_erxian=[]; - foreach ($buyInfo['nmr_list'] as $k=>$v){ - $cha_item=DB::table('items')->where(['item_id'=>$v['item_id'],'status'=>1])->first(); - if(!!$cha_item){ - $temp_erxian[]=[ - 'item_id'=>$v['item_id'], - 'name'=>$cha_item->name, - 'price'=>$cha_item->price, - 'time'=>'', - 'date'=>'', - 'gid'=>'', - ]; + foreach ($db_nmr_info as $k=>$v){ + foreach ($keywords as $index => $keyword) { + if (strpos($v['name'], $keyword) !== false) { + $leixing=$index+1; } } + $temp_erxian[]=[ + 'item_id'=>$v['item_id'], + 'name'=>$v['name'], + 'price'=>$v['price'], + 'time'=>'', + 'date'=>'', + 'gid'=>'', + 'leixing'=>$leixing, + ]; + + } $db_nmr_info=$temp_erxian; } $nmr_info=[]; if (isset($db_nmr_info) and !empty($db_nmr_info)) { foreach ($db_nmr_info as $erxian_item) { - $nmrPlans=$AspNet::ErXian(['yyid'=>6,'data'=>[$planInfo->date],'action'=>"1"],uniqid()); - $end_time="23:59"; - if(!isset($nmrPlans[$planInfo->date]) or empty($nmrPlans[$planInfo->date])) return \Yz::echoError1("二线号源不可用,请重新选择日期"); - $temp_date=[]; - $planTime = new DateTime($planInfo->time); - $planTime->modify('+1 hour'); - $plan_time=$planTime->format('H:i'); - foreach ($nmrPlans[$planInfo->date] as $nmp_p){ - if($nmp_p['Time']>=$plan_time and $nmp_p['Time']<=$end_time and $nmp_p['keyong']==="0"){ - $temp_date=[ - "item_id"=>$erxian_item['item_id'], - "name"=>$erxian_item['name'], - "price"=>$erxian_item['price'], - "time"=>$nmp_p['Time'], - "date"=>$planInfo->date, - ]; - $nmr_info[]=$temp_date; - break; + foreach ($keywords as $index => $keyword) { + if (strpos($erxian_item['name'], $keyword) !== false) { + $leixing=$index+1; } } - if(empty($temp_date)) return \Yz::echoError1("二线号源不可用,请重新选择日期"); + if($leixing==1){ + $nmrPlans=$AspNet::ErXian(['yyid'=>6,'data'=>[$planInfo->date],'action'=>"1",'leixing'=>$leixing],uniqid()); + $end_time="23:59"; + if(!isset($nmrPlans[$planInfo->date]) or empty($nmrPlans[$planInfo->date])) return \Yz::echoError1("二线号源不可用,请重新选择日期"); + $temp_date=[]; + $planTime = new DateTime($planInfo->time); + $planTime->modify('+1 hour'); + $plan_time=$planTime->format('H:i'); + foreach ($nmrPlans[$planInfo->date] as $nmp_p){ + if($nmp_p['Time']>=$plan_time and $nmp_p['Time']<=$end_time and $nmp_p['keyong']==="0"){ + $temp_date=[ + "item_id"=>$erxian_item['item_id'], + "name"=>$erxian_item['name'], + "price"=>$erxian_item['price'], + "time"=>$nmp_p['Time'], + "date"=>$planInfo->date, + ]; + $nmr_info[]=$temp_date; + break; + } + } + if(empty($temp_date)) return \Yz::echoError1("二线号源不可用,请重新选择日期"); + } + if($leixing==2 || $leixing==3){ + $find=false; + $startDate = $planInfo->date; + $date = new DateTime($startDate); + $date->modify('+1 day'); // 先跳过当天 + for ($i = 0; $i < 15; $i++) { + $newdate = $date->format('Y-m-d'); + $nmrPlans=$AspNet::ErXian(['yyid'=>6,'data'=>[$newdate],'action'=>"1",'leixing'=>$leixing],uniqid()); + if(!isset($nmrPlans[$newdate]) or empty($nmrPlans[$newdate])){ + $date->modify('+1 day'); + continue; + } + foreach ($nmrPlans[$newdate] as $nmp_p){ + if($nmp_p['keyong']==="0"){ + $temp_date=[ + "item_id"=>$erxian_item['item_id'], + "name"=>$erxian_item['name'], + "price"=>$erxian_item['price'], + "time"=>$nmp_p['Time'], + "date"=>$newdate, + ]; + $nmr_info[]=$temp_date; + $find=true; + break; + } + } + if($find) break; + // 增加一天 + $date->modify('+1 day'); + + } + } + + } } @@ -800,6 +863,11 @@ class OrderController extends Controller //判断二线号源日期时间是否改变,如果改变校验号源有效性 foreach ($nmr_info as $key=>$nmr_item){ foreach ($db_nmr_info as $db_nmr_item){ + foreach ($keywords as $index => $keyword) { + if (strpos($db_nmr_item['name'], $keyword) !== false) { + $leixing=$index+1; + } + } if($nmr_item['item_id']==$db_nmr_item['item_id']){ if(!($nmr_item['date']==$db_nmr_item['date'] and $nmr_item['time']==$db_nmr_item['time'] and $db_nmr_item['gid']<>"")){ $p_nmr_data = [ @@ -810,7 +878,7 @@ class OrderController extends Controller 'price' => $nmr_item['price'], ]; //调用接口校验号源是否可用 - $erxian_status = $AspNet::ErXian(['YYRQ' => $p_nmr_data['date'], 'YYSJ' => $p_nmr_data['time'], 'yyid' => $yyid, 'action' => 4], uniqid()); + $erxian_status = $AspNet::ErXian(['YYRQ' => $p_nmr_data['date'], 'YYSJ' => $p_nmr_data['time'], 'yyid' => $yyid, 'action' => 4,'leixing'=>$leixing], uniqid()); if ($erxian_status !== true) return \Yz::echoError1($p_nmr_data['name'] . '号源不可用,请重新选择'); } continue; @@ -822,9 +890,14 @@ class OrderController extends Controller foreach ($db_nmr_info as $key2=> $db_nmr_item){ if($nmr_item['item_id']==$db_nmr_item['item_id']){ if(!($nmr_item['date']==$db_nmr_item['date'] and $nmr_item['time']==$db_nmr_item['time'])){ + foreach ($keywords as $index => $keyword) { + if (strpos($db_nmr_item['name'], $keyword) !== false) { + $leixing=$index+1; + } + } //先取消 if($db_nmr_item['gid']<>""){ - $AspNet::ErXian(['id' =>$db_nmr_item['gid'], 'yyid' => $yyid, 'action' => 3], uniqid());//取消 + $AspNet::ErXian(['id' =>$db_nmr_item['gid'], 'yyid' => $yyid, 'action' => 3,'leixing'=>$leixing], uniqid());//取消 $db_nmr_info[$key2]['gid']=''; $ex_u= DB::table('orders')->where(['id' => $orderInfo->id])->update([ 'erxian_appointment_info'=>json_encode($db_nmr_info, JSON_UNESCAPED_UNICODE), @@ -855,6 +928,7 @@ class OrderController extends Controller 'ZCRQ'=>$nowDateTime, 'yyid'=>$yyid, 'action'=>2, + 'leixing'=>$leixing ]; //调用接口预约二线 $erxian_yuyue= $AspNet::ErXian($p_nmr_data, uniqid());