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); - }