|
|
<?php
|
|
|
|
|
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
|
|
class Api extends CI_Controller {
|
|
|
public function __construct()
|
|
|
{
|
|
|
parent::__construct();
|
|
|
$this->load->model('api_model');
|
|
|
$this->load->library('Currency');
|
|
|
|
|
|
}
|
|
|
|
|
|
public function index()
|
|
|
{
|
|
|
echo("<1>api</h1>");
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @description: 返回一日游价格
|
|
|
* @param {*} $returntype
|
|
|
* @return {*}
|
|
|
* @Date Changed:
|
|
|
*/
|
|
|
public function getDaytripsPrice(){
|
|
|
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);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* @description: 获取精华线路价格(2人等)
|
|
|
* @param {*}
|
|
|
* @return {*}
|
|
|
* @Date Changed:
|
|
|
*/
|
|
|
public function getTourPrice(){
|
|
|
if (isset($_GET["param"])){
|
|
|
$param = $_GET["param"];
|
|
|
$result["status"]="ok";
|
|
|
$price = $this->api_model->getTourPrice($param);
|
|
|
$result["pricecn"]=$price;
|
|
|
if (is_numeric($price)){
|
|
|
$price = $this->currency->calc_show_price($this->currency->convert_moneny_by_char($price,"USD"));
|
|
|
}else{
|
|
|
$price = "0";
|
|
|
}
|
|
|
|
|
|
$result["price"] = $price;
|
|
|
echo json_encode($result);
|
|
|
}else{
|
|
|
$result["status"]="no param";
|
|
|
echo json_encode($result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/* End of file Api.php */
|