|
|
|
|
@ -214,18 +214,10 @@ class search extends CI_Controller{
|
|
|
|
|
header('Access-Control-Max-Age:0');
|
|
|
|
|
header('Access-Control-Allow-Headers:x-requested-with, Content-Type');
|
|
|
|
|
header('Access-Control-Allow-Credentials:true');
|
|
|
|
|
|
|
|
|
|
$json = file_get_contents('php://input');
|
|
|
|
|
|
|
|
|
|
if(empty($json)){
|
|
|
|
|
header("HTTP/1.1 404 Not Found");
|
|
|
|
|
exit('{"status":"404","reason":"出发站或到达站为空"}');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$trainFrom = json_decode($json)->trainFrom;
|
|
|
|
|
$trainTo = json_decode($json)->trainTo;
|
|
|
|
|
$trainDate = json_decode($json)->trainDate;
|
|
|
|
|
$trainFrom = $this->input->get_post('trainFrom');
|
|
|
|
|
$trainTo = $this->input->get_post('trainTo');
|
|
|
|
|
$trainDate = $this->input->get_post('trainDate');
|
|
|
|
|
|
|
|
|
|
if(empty($trainFrom) || empty($trainTo)){
|
|
|
|
|
header("HTTP/1.1 404 Not Found");
|
|
|
|
|
@ -313,6 +305,7 @@ class search extends CI_Controller{
|
|
|
|
|
$return_json = new StdClass();
|
|
|
|
|
$return_json->status = '200';
|
|
|
|
|
$return_json->reason = '成功的返回';
|
|
|
|
|
$return_json->rate = $this->GetCurrencyRate();
|
|
|
|
|
$return_json->data = $obj;
|
|
|
|
|
$return_json->endata = $enobj;
|
|
|
|
|
print_r(json_encode($return_json));
|
|
|
|
|
@ -600,6 +593,33 @@ class search extends CI_Controller{
|
|
|
|
|
curl_close($curl); //关闭CURL会话
|
|
|
|
|
return $tmpInfo; //返回数据
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function GetCurrencyRate() {
|
|
|
|
|
$this->HT = $this->load->database('HT', TRUE);
|
|
|
|
|
$sql = "SELECT CRI_BuyIn / 100.00 AS tmpExRate, \n"
|
|
|
|
|
. " CRI_Code \n"
|
|
|
|
|
. "FROM tourmanager.dbo.CurrencyRateInfo \n"
|
|
|
|
|
. "WHERE CRI_Code IN ('USD', 'EUR', 'RUB') \n"
|
|
|
|
|
. " AND GETDATE() BETWEEN CRI_Start AND CRI_Stop";
|
|
|
|
|
$query = $this->HT->query($sql);
|
|
|
|
|
foreach ($query->result() as $item) {
|
|
|
|
|
switch ($item->CRI_Code) {
|
|
|
|
|
case 'USD':
|
|
|
|
|
$this->USD_Rate = $item->tmpExRate;
|
|
|
|
|
break;
|
|
|
|
|
case 'EUR':
|
|
|
|
|
$this->EUR_Rate = $item->tmpExRate;
|
|
|
|
|
break;
|
|
|
|
|
case 'RUB':
|
|
|
|
|
$this->RUB_Rate = $item->tmpExRate;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// echo $this->USD_Rate . '<br/>';
|
|
|
|
|
// echo $this->EUR_Rate . '<br/>';
|
|
|
|
|
// echo $this->RUB_Rate . '<br/>';
|
|
|
|
|
return $this->USD_Rate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|