You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
information-system/application/third_party/ctrip/models/ctrip_model.php

68 lines
2.1 KiB
PHTML

<?php
class ctrip_model extends CI_Model {
function __construct() {
parent::__construct();
$this->INFO = $this->load->database('INFO', TRUE);
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>»<EFBFBD><C2BB><EFBFBD>
public function AddOrUpdate($data){
$sql = "IF NOT EXISTS(
SELECT 1
FROM train_stations
WHERE
station_telecode = '{$data['Telecode']}'
) BEGIN
INSERT INTO train_stations
(
station_name,
station_telecode,
station_geography,
station_pinyin,
station_address
)
VALUES
(
'{$data['StationName']}','{$data['Telecode']}','{$data['Geography']}','{$data['PinYin']}','{$data['Address']}'
)
END
ELSE
BEGIN
UPDATE train_stations
SET station_name = '{$data['StationName']}',
station_geography = '{$data['Geography']}',
station_pinyin = '{$data['PinYin']}',
station_address = '{$data['Address']}'
WHERE
station_telecode = '{$data['Telecode']}'
END
";
$query = $this->INFO->query($sql);
return $query;
}
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>Ϣ
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>7<EFBFBD><37><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>ݾͲ<DDBE><CDB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><CEBA><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>
public function get_train_cache($tpc_from_station,$tpc_to_station){
$sql = "SELECT
*
FROM
TrainPriceCache
WHERE
tpc_from_station = '$tpc_from_station'
AND
tpc_to_station = '$tpc_to_station'";
$query = $this->INFO->query($sql);
return $query->row();
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>վ<EFBFBD><D5BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public function ReplaceCodeToName($code){
$sql = "SELECT station_name from train_stations where station_telecode = '{$code}'";
$query = $this->INFO->query($sql);
return $query->row();
}
}
?>