From bd41eec8c4785d0325a12009c850339839f0f8ee Mon Sep 17 00:00:00 2001 From: yanzai Date: Tue, 6 Aug 2024 11:27:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=AF=B9=E6=8E=A5=20?= =?UTF-8?q?=E7=9B=88=E8=B0=B7=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=20=E5=88=A4=E6=96=AD=E5=8C=BB=E5=98=B1=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../API/Admin/YeWu/SignInController.php | 4 --- Laravel/app/Lib/Tools.php | 29 ++++++++++++++----- .../Services/Admin/YeWu/PlanListService.php | 2 +- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/SignInController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/SignInController.php index c4fc3ae..698e6b0 100644 --- a/Laravel/app/Http/Controllers/API/Admin/YeWu/SignInController.php +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/SignInController.php @@ -129,10 +129,7 @@ class SignInController extends Controller if (!json_decode($r, true)) { return ['status'=>false,'msg'=>"解析'删除签到接口'数据出错:".$r]; } - $r = $r['SendResult']; $res = json_decode($r, true); - - if($res['isSuccess']==true){ return ['status'=>true,'msg'=>$res['resultMsg'],'data'=>$res['resultDatas']]; }else{ @@ -204,7 +201,6 @@ class SignInController extends Controller if (!json_decode($r, true)) { return ['status'=>false,'msg'=>"解析'删除签到接口'数据出错:".$r]; } - $r = $r['SendResult']; $res = json_decode($r, true); if($res['isSuccess']==true){ return ['status'=>true,'']; diff --git a/Laravel/app/Lib/Tools.php b/Laravel/app/Lib/Tools.php index e6268c4..0bb2002 100644 --- a/Laravel/app/Lib/Tools.php +++ b/Laravel/app/Lib/Tools.php @@ -137,23 +137,38 @@ class Tools curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data); $r = curl_exec($ch); + \Illuminate\Support\Facades\Log::info($r); + $r = ' + + +'; try { - $res = explode('', $r)[1]; - $res = explode('', $res)[0]; - $xmlData = simplexml_load_string($res); - $jsonData = json_encode($xmlData, JSON_UNESCAPED_UNICODE); + $xml = simplexml_load_string($r, 'SimpleXMLElement', LIBXML_NOCDATA); + $namespaces = $xml->getNamespaces(true); + $xml->registerXPathNamespace('soapenv', $namespaces['SOAP-ENV']); + $xml->registerXPathNamespace('ns', 'http://bjgoodwillcis.com'); + +// 提取 CDATA 内容 + $sendResult = $xml->xpath('//ns:SendResult')[0]; + $jsonData = (string)$sendResult; + + + // $res = explode('', $r)[1]; + // $res = explode('', $res)[0]; + // $xmlData = simplexml_load_string($res); + // $jsonData = json_encode($xmlData, JSON_UNESCAPED_UNICODE); }catch (Exception $e) { $jsonData = $e->getMessage(); } + // dd($res); + // $result = json_decode($jsonData, true); - $result = json_decode($jsonData, true); - // dd($result); curl_close($ch); $data=[ 'response_data'=>$r ]; self::RequestLog($data,$log_id); - return $result; + return $jsonData; } public static function RequestLog($arr,$id,$mark='') { //记录请求日志 diff --git a/Laravel/app/Services/Admin/YeWu/PlanListService.php b/Laravel/app/Services/Admin/YeWu/PlanListService.php index 9c63c5c..2747162 100644 --- a/Laravel/app/Services/Admin/YeWu/PlanListService.php +++ b/Laravel/app/Services/Admin/YeWu/PlanListService.php @@ -209,7 +209,7 @@ WHERE $date = new DateTime($entrust_time); $date->modify("+" . $item->check_begin_time . " minutes"); $enableCheckTime = $date;//到此时间后可进行预约 - $plan_dateTime = $planInfo->date . ' ' . $planInfo->begin_time; + $plan_dateTime = $planInfo->date . ' ' . $planInfo->end_time; $plan_dateTime = new DateTime($plan_dateTime); if ($plan_dateTime < $enableCheckTime) return \Yz::echoError1($item->item_name . " 已设置只能预约医嘱开具后" . $item->check_begin_time . "分钟后的时间,请预约" . $enableCheckTime->format("Y-m-d H:i:s") . "之后的时间");