From 52facfd868771c65f8c2044995065101998bdd7e Mon Sep 17 00:00:00 2001 From: cyc Date: Mon, 16 Sep 2019 15:51:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=AD=E8=BD=AC=E7=AB=99?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../third_party/ctrip/controllers/ctrip_train.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/application/third_party/ctrip/controllers/ctrip_train.php b/application/third_party/ctrip/controllers/ctrip_train.php index 4943ea3f..0b1eac7f 100644 --- a/application/third_party/ctrip/controllers/ctrip_train.php +++ b/application/third_party/ctrip/controllers/ctrip_train.php @@ -317,8 +317,19 @@ class ctrip_train extends CI_Controller{ $ResponseJson = post_ctrip($url,'','GET'); - //$ResponseData = json_decode($ResponseJson); - print_r($ResponseJson); + $ResponseData = json_decode($ResponseJson); + + $priceAddSeats = ['软卧','硬卧']; + foreach ($ResponseData->TransferLines as $methodsItems){ + foreach($methodsItems->Trains as $trainsItems){ + foreach ($trainsItems->Seats as $seatsItems){ + if(in_array($seatsItems->SeatName,$priceAddSeats)){ + $seatsItems->Price = ceil($seatsItems->Price * 1.2); + } + } + } + } + print_r(json_encode($ResponseData)); } } } \ No newline at end of file