From 90c6df6bdbb6b1bb2f9ae75008c5af4bc5647541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=B9=8F?= Date: Tue, 30 Mar 2021 15:07:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E8=AF=BB=E5=8F=96=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ctmobilefirst/controllers/api.php | 37 ++++++++++++++----- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/application/third_party/ctmobilefirst/controllers/api.php b/application/third_party/ctmobilefirst/controllers/api.php index edd61cda..ef1dec48 100644 --- a/application/third_party/ctmobilefirst/controllers/api.php +++ b/application/third_party/ctmobilefirst/controllers/api.php @@ -25,17 +25,36 @@ class Api extends CI_Controller { * @Date Changed: */ public function getDaytripsPrice(){ - $pagecode = $_GET["pagecode"]; - if (isset($_GET["personnum"])){ - $personnum=$_GET["personnum"]; - }else{ - $personnum=2; + if (isset($_GET["param"])){ + $param = $_GET["param"]; + if (strpos($param,",")!== false){ + $pagecode = explode(",",$param)[0]; + $personnum=explode(",",$param)[1]; + }else{ + $pagecode = $param; + $personnum=2; + } + if (isset($_GET["personnum"])){ + $personnum=$_GET["personnum"]; + }else{ + $personnum=2; + } + $result["status"]="ok"; + $price = $this->api_model->getDaytripsPrice($pagecode,$personnum); + $PKP_AdultSpecialPrice = $price->PKP_AdultSpecialPrice; + $PKP_AdultPrice = $price->PKP_AdultPrice; + if ($PKP_AdultPrice!=$PKP_AdultSpecialPrice && $PKP_AdultSpecialPrice>0){ + $result["price"] = $this->currency->convert_moneny_by_char($PKP_AdultSpecialPrice,"USD"); + }else{ + $result["price"] = $this->currency->convert_moneny_by_char($PKP_AdultPrice,"USD"); + } + + echo json_encode($result); + }else { + $result["status"]="no param"; + echo json_encode($result); } - $result = $this->api_model->getDaytripsPrice($pagecode,$personnum); - - echo json_encode($result); - }