From ab9dbdc5d7a38ee415891e50c38e27ea47a619fb Mon Sep 17 00:00:00 2001 From: yanzai Date: Fri, 16 Aug 2024 16:30:59 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E5=AE=8C=E6=88=90=EF=BC=8C?= =?UTF-8?q?=E6=8E=A5=E5=85=A5=E7=9F=AD=E4=BF=A1=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Laravel/app/Lib/Tools.php | 5 +---- .../app/Services/Admin/YeWu/PlanListService.php | 14 ++++++++++++++ Laravel/app/Services/SendMessgeService.php | 8 +++++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Laravel/app/Lib/Tools.php b/Laravel/app/Lib/Tools.php index 1c565ea..75d01a0 100644 --- a/Laravel/app/Lib/Tools.php +++ b/Laravel/app/Lib/Tools.php @@ -138,10 +138,7 @@ class Tools curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data); $r = curl_exec($ch); \Illuminate\Support\Facades\Log::info($r); - $r = ' - - -'; + try { $xml = simplexml_load_string($r, 'SimpleXMLElement', LIBXML_NOCDATA); diff --git a/Laravel/app/Services/Admin/YeWu/PlanListService.php b/Laravel/app/Services/Admin/YeWu/PlanListService.php index 2747162..1b41208 100644 --- a/Laravel/app/Services/Admin/YeWu/PlanListService.php +++ b/Laravel/app/Services/Admin/YeWu/PlanListService.php @@ -2,6 +2,7 @@ namespace App\Services\Admin\YeWu; +use App\Services\SendMessgeService; use DateInterval; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; @@ -309,6 +310,7 @@ WHERE if ($u_mainList) { DB::commit(); + $this->SendMsg($oldMainInfos,$do_type); return \Yz::Return(true, '预约成功', ['planid' => $planid, 'mainlistids' => $mainlistids]); } else { DB::rollBack(); @@ -380,4 +382,16 @@ WHERE } + //短信提醒 + public function SendMsg($infos,$dotype=1) + { + $s=new SendMessgeService(); + foreach ($infos as $key => $info) { + $mainInfo = DB::table('s_list as a') + ->select('a.*', 'b.period_begin_time', 'b.period_end_time') + ->leftJoin('s_period as b', 'a.reservation_time', '=', 'b.id') + ->where(['a.id' => $info->id])->first(); + $s->sendMessage($info->user_phone,'测试短信,项目:'.$mainInfo->entrust.',时间:'.$mainInfo->reservation_date.' '.substr($mainInfo->period_begin_time,0,5).'-'.substr($mainInfo->period_end_time,0,5)); + } + } } diff --git a/Laravel/app/Services/SendMessgeService.php b/Laravel/app/Services/SendMessgeService.php index 8e6cbb3..831819e 100644 --- a/Laravel/app/Services/SendMessgeService.php +++ b/Laravel/app/Services/SendMessgeService.php @@ -51,7 +51,13 @@ class SendMessgeService 'cntx' => $encryptedBody, 'custid' => $this->timestamp // For example purposes, use timestamp as custid ]); + $res=$response->json(); +// if(isset($res['result']) and $res['result']==="0"){ +// +// } - return $response->json(); + + + return $res; } }