Compare commits

..

No commits in common. 'master' and 'mobile-first' have entirely different histories.

@ -1,37 +0,0 @@
# Disabled
name: 🚀 Deploy INFO-SYS
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
jobs:
gh-win-cn-all-deploy:
name: 🎉 Deploy InfoSys to CN
runs-on: ubuntu-latest
steps:
- name: 🚚 Get latest code
uses: actions/checkout@v3
- name: 📂 Sync files
uses: SamKirkland/FTP-Deploy-Action@v4.3.4
with:
server: ${{ secrets.CN_FTP_SERVER }}
username: ${{ secrets.CN_FTP_USER }}
password: ${{ secrets.CN_FTP_PASSWORD }}
port: ${{ secrets.CN_FTP_PORT }}
local-dir: ./
server-dir: /wwwroot/origin-cht.mycht.cn/
# dry-run: true
# log-level: verbose
exclude: |
**/.git*
**/.git*/**
**/node_modules/**
document/**
download_statement/**
sample/**
**/logs/**
**/web.config
**/author/document/**
*.exe
*.docx

@ -1,183 +0,0 @@
name: 🚀 Deploy INFO-SYS
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
jobs:
gh-win-cn-deploy:
name: 🎉 Deploy InfoSys to CN
runs-on: ubuntu-latest
steps:
- name: 🚚 Get latest code
uses: actions/checkout@v3
- name: 📂 Sync files to CHT
uses: SamKirkland/FTP-Deploy-Action@v4.3.4
with:
server: ${{ secrets.CN_FTP_SERVER }}
username: ${{ secrets.CN_FTP_USER }}
password: ${{ secrets.CN_FTP_PASSWORD }}
port: ${{ secrets.CN_FTP_PORT }}
local-dir: ./
server-dir: /wwwroot/origin-cht.mycht.cn/
# dry-run: true
# log-level: verbose
exclude: |
**/.git*
**/.git*/**
**/node_modules/**
document/**
download_statement/**
sample/**
**/logs/**
**/web.config
**/author/document/**
*.exe
*.docx
.ftp-deploy-sync-state.json
gh-win-us-deploy:
needs: gh-win-cn-deploy
name: 🎉 Deploy InfoSys to US
runs-on: ubuntu-latest
steps:
- name: 🚚 Get latest code
uses: actions/checkout@v3
- name: 📂 Sync files to CHT
uses: SamKirkland/FTP-Deploy-Action@v4.3.4
with:
server: ${{ secrets.US_FTP_SERVER }}
username: ${{ secrets.US_FTP_USER }}
password: ${{ secrets.US_FTP_PASSWORD }}
port: ${{ secrets.US_FTP_PORT }}
local-dir: ./
server-dir: /information-system/
# dry-run: true
exclude: |
**/.git*
**/.git*/**
**/node_modules/**
document/**
download_statement/**
sample/**
**/logs/**
**/web.config
**/author/document/**
*.exe
*.docx
.ftp-deploy-sync-state.json
- name: 📂 Sync files to CT
uses: SamKirkland/FTP-Deploy-Action@v4.3.4
with:
server: ${{ secrets.US_FTP_SERVER }}
username: ${{ secrets.US_FTP_USER }}
password: ${{ secrets.US_FTP_PASSWORD }}
port: ${{ secrets.US_FTP_PORT }}
local-dir: ./
server-dir: /origin-ct.mycht.cn/
# dry-run: true
exclude: |
**/.git*
**/.git*/**
**/node_modules/**
document/**
download_statement/**
sample/**
**/logs/**
**/web.config
**/author/document/**
*.exe
*.docx
.ftp-deploy-sync-state.json
hn-notification:
needs: gh-win-cn-deploy
name: 🔔 Send notificaiton
runs-on: ubuntu-latest
if: always() # set "always"
steps:
- name: 🚚 Get latest code
uses: actions/checkout@v3
# run this action to get the workflow conclusion
# You can get the conclusion via env (env.WORKFLOW_CONCLUSION)
- uses: technote-space/workflow-conclusion-action@v3
- name: Expose git commit data
uses: rlespinasse/git-commit-data-action@v1
- name: Print git commit data
run: |
echo "Get workflow conclusion"
echo " - ${{ env.WORKFLOW_CONCLUSION }}"
echo "Get commit info"
echo " - ${{ env.GIT_COMMIT_SHA }}"
echo " - ${{ env.GIT_COMMIT_SHORT_SHA }}"
# echo "Get author info"
# echo " - ${{ env.GIT_COMMIT_AUTHOR }}"
# echo " - ${{ env.GIT_COMMIT_AUTHOR_NAME }}"
# echo " - ${{ env.GIT_COMMIT_AUTHOR_EMAIL }}"
# echo "Get committer info"
# echo " - ${{ env.GIT_COMMIT_COMMITTER }}"
# echo " - ${{ env.GIT_COMMIT_COMMITTER_NAME }}"
# echo " - ${{ env.GIT_COMMIT_COMMITTER_EMAIL }}"
# echo "Get message info"
# echo " - ${{ env.GIT_COMMIT_MESSAGE_SUBJECT }}"
# echo " - ${{ env.GIT_COMMIT_MESSAGE_SUBJECT_SANITIZED }}"
# echo " - ${{ env.GIT_COMMIT_MESSAGE_BODY }}"
- name: ✉ Send some mail
uses: dawidd6/action-send-mail@v3
with:
# Specify connection via URL (replaces server_address, server_port, secure,
# username and password)
#
# Format:
#
# * smtp://user:password@server:port
# * smtp+starttls://user:password@server:port
# connection_url: ${{secrets.MAIL_CONNECTION}}
# Required mail server address if not connection_url:
server_address: hwsmtp.exmail.qq.com
# Server port, default 25:
server_port: 465
# Optional whether this connection use TLS (default is true if server_port is 465)
secure: true
# Optional (recommended) mail server username:
username: ${{secrets.MAIL_USERNAME}}
# Optional (recommended) mail server password:
password: ${{secrets.MAIL_PASSWORD}}
# Required mail subject:
subject: ${{env.WORKFLOW_CONCLUSION}} ${{ github.repository }}
# Required recipients' addresses:
to: ${{ env.GIT_COMMIT_COMMITTER_EMAIL }}
# Required sender full name (address can be skipped):
from: Git # <user@example.com>
# Optional plain body:
body: |
${{ env.WORKFLOW_CONCLUSION }}
${{ github.repository }}
${{ env.GIT_COMMIT_SHORT_SHA }}: ${{ env.GIT_COMMIT_MESSAGE_SUBJECT }}
# Optional HTML body read from file:
# html_body: file://README.html
# Optional carbon copy recipients:
# cc: lyt@hainatravel.com
# Optional blind carbon copy recipients:
# bcc: r2d2@example.com,hansolo@example.com
# Optional recipient of the email response:
# reply_to: luke@example.com
# Optional Message ID this message is replying to:
# in_reply_to: <random-luke@example.com>
# Optional unsigned/invalid certificates allowance:
ignore_cert: true
# Optional converting Markdown to HTML (set content_type to text/html too):
convert_markdown: true
# Optional attachments:
# attachments: attachments.zip,git.diff,./dist/static/*.js
# Optional priority: 'high', 'normal' (default) or 'low'
priority: low

8
.gitignore vendored

@ -1,8 +1,5 @@
.idea
.phpintel
/info.php
.*.json.bak
.ftp-deploy-sync-state.json
.svn/*
*/logs/log*
/web.config
@ -10,12 +7,7 @@
/kcfinder/cache/*
*/cache/*
/author/document/*
*/settlement_files/*
*/statement_files/*
*/paypal_activities/*
/author/document/*
/application/libraries/composer
/application/config/database.php

@ -1,6 +1,4 @@
# information-system
网前订单数量查看 https://cht.mycht.cn/info.php/look_order/status
商务加传统订单超过500页面报错可用于监控
test
商务加传统订单超过500页面报错可用于监控

@ -18,7 +18,7 @@
* Note that in order for this to work you need to provision credentials
* specifically for CCU - you cannot extend existing credentials to add
* CCU as it's managed under "CCU" in the API credential system.
*
*
* Configure->Organization->Manage APIs
* Select "CCU APIs"
* Create client collections/clients
@ -26,54 +26,53 @@
*
* Put the credentials in ~/.edgerc as demonstrated by api-kickstart/sample_edgerc
*/
namespace Akamai\Open\Example;
require_once __DIR__ . '/cli/init.php';
class CcuClient
{
/**
* @var \Akamai\Open\EdgeGrid\Client
*/
protected $client;
public function __construct()
{
$this->client = \Akamai\Open\EdgeGrid\Client::createFromEdgeRcFile('ccu');
/**
* @var \Akamai\Open\EdgeGrid\Client
*/
protected $client;
}
public function __construct()
{
$this->client = \Akamai\Open\EdgeGrid\Client::createFromEdgeRcFile('ccu');
}
public function postPurgeRequest($hostname, $objects)
{
$purge_body = [
'objects' => $objects
];
$response = $this->client->post('/ccu/v3/invalidate/url', [
'body' => json_encode($purge_body),
'headers' => ['Content-Type' => 'application/json']
]);
return $response;
}
public function postPurgeRequest($hostname, $objects)
{
$purge_body = [
'objects' => $objects
];
$response = $this->client->post('/ccu/v3/invalidate/url', [
'body' => json_encode($purge_body),
'headers' => ['Content-Type' => 'application/json']
]);
return $response;
}
}
$ccu = new CcuClient();
$url = $_POST['url'];
echo $url;die();
try {
$objects = [
$url
];
$objects = [
$url
];
$purge = $ccu->postPurgeRequest('data.chinahighlights.com', $objects);
$response = json_decode($purge->getBody());
if ($response->httpStatus == 201) {
echo '{"msg":"success"}';
} else {
echo json_encode($response);
}
$purge = $ccu->postPurgeRequest('data.chinarundreisen.com', $objects);
$response = json_decode($purge->getBody());
if($response->httpStatus == 201){
echo '{"msg":"success"}';
}else{
echo json_encode($response);
}
} catch (\GuzzleHttp\Exception\ClientException $e) {
header("status: 404 not found");
echo "An error occurred: " . $e->getMessage() . "\n";
header("status: 404 not found");
echo "An error occurred: " .$e->getMessage(). "\n";
}

@ -0,0 +1 @@
deny from all

File diff suppressed because it is too large Load Diff

@ -47,7 +47,6 @@ $active_group = 'HT';
$active_record = TRUE;
require 'C:/database_conn.php';
//require 'c:/database_conn_local.php';
/* End of file database.php */
/* Location: ./application/config/database.php */

@ -18,19 +18,17 @@ class Cache extends CI_Controller
private $current_domain = '';
//文件更新日期
private $file_time = array();
function __construct()
{
parent::__construct();
if (!$this->input->get('site_code')) {
$this->permission->is_admin();
}
$this->permission->is_admin();
$this->load->model('Area_model');
$this->load->model('InfoStructures_model');
$this->load->model('Information_model');
$this->site_code = $this->input->get('site_code') ? $this->input->get('site_code') : $this->config->item('site_code');
$this->site_code = $this->config->item('site_code');
}
/**
*
* 公有函数:扫描已有缓存文件并更新。
@ -38,48 +36,36 @@ class Cache extends CI_Controller
* 必要参数:
* @param String $site_code
*
*/
*/
public function update()
{
$returnType = $this->input->get('type');
//设置缓存文件文件夹
$cache_config = $this->config->item('cache');
$current_cache_config = $cache_config[$this->site_code];
$this->dir = $current_cache_config['cache_path'];
//设置当前站点
$this->current_domain = $current_cache_config['site_url']; //$this->config->item('site_url');
$this->current_domain = $this->config->item('site_url');
//echo $this->config->item('site_url');
//设置缓存更新接口及POST参数
$this->cache_api = $current_cache_config['cache_api'];
$this->post_para = $current_cache_config['cache_api_para'];
//遍历缓存文件夹
$this->tree($this->dir, $this->file, $this->path, $this->file_time);
//print_r($this->file);
//print_r($this->path);
//print_r($this->file_time);
//die();
//按目录筛选结果
$this->filter($this->file, $this->path);
//整理需要传递到视图的数据
$data['file'] = $this->file;
$data['path'] = $this->path;
$data['file_time'] = $this->file_time;
$data['cache_api'] = $this->cache_api;
$data['post_para'] = $this->post_para;
if ($returnType === 'json') {
//print_r($cache_config[$this->site_code]);
//echo('json');
//print_r($data['file']);
echo (json_encode($data['file']));
} else {
//视图
$this->load->view('cache/update', $data);
}
//视图
$this->load->view('cache/update', $data);
}
/**
*
* 公有函数:扫描已有缓存文件并更新。
@ -87,7 +73,7 @@ class Cache extends CI_Controller
* 必要参数:
* @param String $site_code
*
*/
*/
public function sitemap()
{
header("Content-type:text/xml");
@ -95,7 +81,7 @@ class Cache extends CI_Controller
$cache_config = $this->config->item('cache');
$current_cache_config = $cache_config[$this->site_code];
$this->dir = $current_cache_config['cache_path'];
//设置当前站点
$this->current_domain = $this->config->item('site_url');
//设置缓存更新接口及POST参数
@ -105,7 +91,7 @@ class Cache extends CI_Controller
$this->tree($this->dir, $this->file, $this->path, $this->file_time);
//按目录筛选结果
$this->filter($this->file, $this->path);
//整理需要传递到视图的数据
$data['file'] = $this->file;
$data['path'] = $this->path;
@ -114,23 +100,25 @@ class Cache extends CI_Controller
$data['post_para'] = $this->post_para;
//排序file数组
sort($data['file']);
sort ($data['file']);
//生成sitemap
$dom = new DomDocument('1.0', 'utf-8');
$urlset = $dom->createElement('urlset');
$urlset->setAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
$dom->appendchild($urlset);
foreach ($data['file'] as $f) {
foreach ($data['file'] as $f)
{
$url = $dom->createElement('url');
$loc = $dom->createElement('loc');
$text = $dom->createTextNode($f);
$loc->appendchild($text);
$url->appendchild($loc);
$urlset->appendchild($url);
}
}
echo ($dom->saveXML());
echo($dom->saveXML());
}
@ -144,34 +132,34 @@ class Cache extends CI_Controller
* @param Array $path - 存放路径结果的数组引用
* @param Array $file_time - 存放文件更新日期的数组引用
*
*/
*/
private function tree($dir, &$file, &$path, &$file_time)
{
$mydir = dir($dir);
while ($f = $mydir->read()) {
if (is_dir("$dir/$f") && $f != "." && $f != ".." && (strpos($dir, '/cn/') === false) && (strpos($dir, '/amp/') === false) && (strpos($dir, '/js/') === false)) {
while($f = $mydir->read())
{
if(is_dir("$dir/$f") && $f!="." && $f!=".." && (strpos($dir, '/cn/')===false) && (strpos($dir, '/amp/')===false))
{
$path[] = "$dir/$f";
$this->tree("$dir/$f", $file, $path, $file_time);
} else {
if ($f != '.' && $f != '..' && (strpos($f, '/cn/') === false) && (strpos($f, '/amp/') === false) && (strpos($f, '.pdf') === false) && (strpos($f, '.mobile.htm') === false) && (strpos($f, '/js/') === false) && (strpos($f, '.amp') === false)) {
$file_temp = str_replace('/index.htm###', '', $f . '###');
$file_temp = str_replace('###', '', $file_temp);
$path_temp = str_replace($this->dir, '', $dir);
$url_temp = $this->current_domain . $path_temp . '/' . $file_temp;
$url_temp = str_replace('/index.htm', '/', $url_temp);
}
else
{
if ($f!='.' && $f!='..' && (strpos($dir, '/cn/')===false) && (strpos($dir, '/amp/')===false) && (strpos($f, '.pdf')===false))
{
$file_temp = str_ireplace('/index.htm###', '', $f.'###');
$file_temp = str_ireplace('###', '', $file_temp);
$path_temp = str_ireplace($this->dir, '', $dir);
$url_temp = $this->current_domain.$path_temp.'/'.$file_temp;
$file_time[$url_temp] = date("F d Y H:i:s", filemtime("$dir/$f"));
$encode = mb_detect_encoding($url_temp, array('ASCII', 'GBK', 'ISO-8859-1', 'UTF-8'));
$_url_temp = mb_convert_encoding($url_temp, 'UTF8', $encode);
$file[] = $_url_temp;
$file[] = $url_temp;
}
}
}
$mydir->close();
}
/**
*
* 私有函数:筛选目录和文件。
@ -185,18 +173,22 @@ class Cache extends CI_Controller
*/
private function filter(&$file, &$path)
{
if (isset($_POST['p']) && !empty($_POST['p'])) {
if (isset($_POST['p']) && !empty($_POST['p']))
{
//删选文件
foreach ($file as &$f) {
(stripos($f, $_POST['p']) !== false) or $f = false;
foreach ($file as &$f)
{
(stripos($f, $_POST['p'])!==false) or $f = false;
}
$file = array_filter($file);
//删选目录
foreach ($path as &$p) {
(stripos($p, $_POST['p']) !== false) or $p = false;
foreach ($path as &$p)
{
(stripos($p, $_POST['p'])!==false) or $p = false;
}
$path = array_filter($path);
}
}
}
//end of Cache

@ -39,16 +39,4 @@ class City extends CI_Controller
redirect(site_url('information/edit/' . $is_id));
}
//$is_sort=-99 代表根节点
public function addnode($is_parent_id,$is_sort=-99){
$Structure = $this->InfoStructures_model->Detail($is_parent_id);
if ($is_parent_id!=='-99' && $Structure == FALSE ) {
show_404();
}
$ic_id=$this->InfoContents_model->add_use_ORM('infoContents',array('ic_url_title'=>'new information','ic_title'=>'new information','ic_sitecode'=>$this->config->item('site_code')));
$this->InfoStructures_model->Add($is_parent_id,$ic_id,$is_sort);
redirect(site_url('information/edit/' . $this->InfoStructures_model->insert_id));
}
}

@ -183,38 +183,6 @@ where ic_sitecode=? and ic_url like \'%'.trim($item_url).'%\' order by ic_id asc
}
}
public function clear_css_html(){
$this->HT = $this->load->database('HT', true);
$html_string='';
$sql= " select top 500 ic_id,ic_url,ic_content from infoContents where ic_sitecode='ch' and (ic_content like '%tourPublishers%' or ic_content like '%class=\"monthWeather\"%') ";
$query=$this->HT->query($sql);
if($query->num_rows() > 0){
foreach ($query->result() as $item) {
$html_string=str_replace('class="monthWeather"','class="infotable"' ,$item->ic_content);
$html_object=str_get_html( $html_string);
if (empty($html_object)) {
echo '文件加载失败:'.$item->ic_url.'<br/>';
continue;
}else{
foreach ($html_object->find('.tourPublishers') as $hidden_item) {
$hidden_item->outertext = '';
}
$html_string=$html_object->save();
$sql_update='update infoContents set ic_content = N? where ic_id=?';
$this->HT->query($sql_update,array($html_string,$item->ic_id));
//print_r($this->HT->queries);
echo $item->ic_url;echo '<br/>';
//echo $html_string;
}
}
}else{
echo 'done';
}
}
public function clear_site()
{
$this->Import_model->import_clear_site();

@ -29,7 +29,7 @@ class Info_amp extends CI_Controller
$pc_html = $this->input->get_post('pc_html');
$pc_css = $this->input->get_post('pc_css');
$css = $this->input->get_post('css');
$schema = $this->input->get_post('schema');
$schema = $this->input->get_post('schema');
$script = $this->input->get_post('script');
$status = $this->input->get_post('status');
@ -86,7 +86,7 @@ class Info_amp extends CI_Controller
} else {
$this->InfoMetas_model->update($icid, 'AMP_SCRIPT', $script);
}
//schema
//schema
$meta = $this->InfoMetas_model->get($icid, 'AMP_SCHEMA');
if ($meta === FALSE) {
$this->InfoMetas_model->add($icid, 'AMP_SCHEMA', $schema);
@ -103,10 +103,10 @@ class Info_amp extends CI_Controller
echo json_encode(array(
"succ" => true
));
} catch (Exception $e) {
} catch(Exception $e) {
echo json_encode(array(
"succ" => false,
"message" => "save_amp() -> " . $e->getMessage()
"message" => "save_amp() -> ".$e->getMessage()
));
}
} else {
@ -162,17 +162,17 @@ class Info_amp extends CI_Controller
$site = '';
break;
}
$json = $this->InfoMetas_model->get($icid, 'AMP_JSON');
$status = $this->InfoMetas_model->get($icid, 'AMP_STATUS');
$schema = $this->InfoMetas_model->get($icid, 'AMP_SCHEMA');
$schema = $this->InfoMetas_model->get($icid, 'AMP_SCHEMA');
if ($json) {
echo json_encode(array(
"succ" => true,
"icid" => $icid,
"icurl" => $site . $ic->ic_url,
"icurl" => $site.$ic->ic_url,
"json" => $json,
"schema" => $schema,
"schema" => $schema,
"status" => $status
));
} else {
@ -275,14 +275,14 @@ class Info_amp extends CI_Controller
if ($show_photo_meta == 'no') {
$use_photo = '';
} else {
$use_photo = $this->config->item('site_image_url') . $info->ic_photo;
$use_photo = $this->config->item('site_image_url').$info->ic_photo;
}
if ($info->ic_type === 'c_attraction' || $info->ic_template === 'city_info_attractions_list' || $info->ic_template === 'r_tpl_empty_navi1p') {
$list_info = true;
} else {
$list_info = false;
}
if ($list_info || !empty($info->ic_content) && !empty($info->ic_url) && stripos($info->ic_url, '/test/') === false) {
if ($list_info || !empty($info->ic_content) && !empty($info->ic_url) && stripos($info->ic_url, '/test/')===false) {
array_push($newrs, array(
'is_path' => $info->is_path,
'ic_url' => $info->ic_url,
@ -312,12 +312,12 @@ class Info_amp extends CI_Controller
if ($show_photo_meta == 'no') {
$use_photo = '';
} else {
$use_photo = $this->config->item('site_image_url') . $ic->ic_photo;
$use_photo = $this->config->item('site_image_url').$ic->ic_photo;
}
echo json_encode(array(
"succ" => true,
"info" => $ic->ic_content ? $ic->ic_content : "<p>" . $ic->ic_seo_description . "</p>",
"title" => $ic->ic_title,
"info" => $ic->ic_content ? $ic->ic_content : "<p>".$ic->ic_seo_description."</p>",
"title" => $ic->ic_title,
"photo" => $use_photo,
"url" => $ic->ic_url,
"site" => $this->config->item('site_url')
@ -336,13 +336,12 @@ class Info_amp extends CI_Controller
}
}
public function handel_png_source()
{
public function handel_png_source() {
//ini_set('memory_limit', '50M');
$png_base64 = $this->input->post('png_base64');
//$png_base64 = 'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==';
$file = md5($png_base64) . '.jpg';
$path = realpath('../cht-system/views/information/word_img') . '/' . $file;
$file = md5($png_base64).'.jpg';
$path = realpath('../cht-system/views/information/word_img').'/'.$file;
$png_base64 = str_replace('data:image/png;base64,', '', $png_base64);
$png_base64 = str_replace('data:image/jpg;base64,', '', $png_base64);
$png_base64 = base64_decode($png_base64);
@ -352,26 +351,25 @@ class Info_amp extends CI_Controller
//释放内存
imagedestroy($im);
$size = getimagesize($path);
if ($png_base64 && $size) {
echo (json_encode(array(
if($png_base64 && $size) {
echo(json_encode(array(
'status' => 'success',
'path' => '/information-view/information/word_img/' . $file,
'path' => '/information-view/information/word_img/'.$file,
'width' => $size[0],
'height' => $size[1]
)));
} else {
echo (json_encode(array(
echo(json_encode(array(
'status' => 'error'
)));
}
}
public function handel_image_source()
{
public function handel_image_source() {
@ini_set('memory_limit', '256M');
$file = $_FILES['file'];
if (!$file) {
echo (json_encode(array(
echo(json_encode(array(
'status' => 'error',
'msg' => "图片上传失败。"
)));
@ -380,20 +378,20 @@ class Info_amp extends CI_Controller
$usr = $this->input->post('usr');
$icid = $this->input->post('icid');
//转移文件
$md5_file = md5($usr . $icid . $file['name']);
$md5_file = md5($usr.$icid.$file['name']);
//ext
$ext = mb_strtolower(strrchr($file["name"], '.'));
$ext = mb_strtolower(strrchr($file["name"],'.'));
if ($ext != '.jpg') {
echo (json_encode(array(
echo(json_encode(array(
'status' => 'error',
'msg' => '只能接收(.jpg)图片。',
'filename' => $file["name"]
)));
return;
}
$md5_name = $md5_file . $ext;
$md5_name = $md5_file.$ext;
//临时docx文件
$image_path = realpath('../cht-system/views/information/word_img') . '/' . basename($md5_name);
$image_path = realpath('../cht-system/views/information/word_img').'/'.basename($md5_name);
$html = 'to use mammoth';
if (move_uploaded_file($file['tmp_name'], $image_path)) {
//图片处理
@ -401,32 +399,31 @@ class Info_amp extends CI_Controller
imagejpeg($im, $image_path);
imagedestroy($im);
$size = getimagesize($image_path);
if ($size) {
echo (json_encode(array(
if($size) {
echo(json_encode(array(
'status' => 'success',
'path' => '/information-view/information/word_img/' . $md5_name,
'path' => '/information-view/information/word_img/'.$md5_name,
'width' => $size[0],
'height' => $size[1]
)));
} else {
echo (json_encode(array(
echo(json_encode(array(
'status' => 'error'
)));
}
} else {
echo (json_encode(array(
echo(json_encode(array(
'status' => 'error',
'msg' => "图片文件解析失败。"
)));
}
}
public function handel_word_source()
{
public function handel_word_source() {
@ini_set('memory_limit', '256M');
$file = $_FILES['file'];
if (!$file) {
echo (json_encode(array(
echo(json_encode(array(
'status' => 'error',
'msg' => "文件上传失败。"
)));
@ -435,46 +432,46 @@ class Info_amp extends CI_Controller
$usr = $this->input->post('usr');
$icid = $this->input->post('icid');
//转移文件
$md5_file = md5($usr . $icid . $file['name']);
$md5_file = md5($usr.$icid.$file['name']);
//ext
$ext = mb_strtolower(strrchr($file["name"], '.'));
$ext = mb_strtolower(strrchr($file["name"],'.'));
if ($ext != '.docx') {
echo (json_encode(array(
echo(json_encode(array(
'status' => 'error',
'msg' => '只能接收word(.docx)文档。'
)));
return;
}
$md5_name = $md5_file . $ext;
$md5_name = $md5_file.$ext;
//临时docx文件
$docx_path = realpath('../cht-system/views/information/word_source') . '/' . basename($md5_name);
$docx_path = realpath('../cht-system/views/information/word_source').'/'.basename($md5_name);
$html = 'to use mammoth';
if (move_uploaded_file($file['tmp_name'], $docx_path)) {
$docx_dir = realpath('../cht-system/views/information/word_source');
//图片及html目录
$img_dir = $docx_dir . '/' . $md5_file;
$img_dir = $docx_dir.'/'.$md5_file;
is_dir($img_dir) || mkdir($img_dir, 0777);
//临时html文件
$docx_parh = $img_dir . '/' . $md5_name;
$docx_parh = $img_dir.'/'.$md5_name;
$html_parh = str_ireplace('.docx', '.html', $docx_parh);
//运行docx转化插件
if ($_SERVER['SERVER_NAME'] == 'localhost' || $_SERVER['SERVER_NAME'] == '202.103.68.62') {
$yarnbin = 'C:\Users\cht77\AppData\Local\Yarn\bin\mammoth ';
$test_host = '//202.103.68.62:9096';
} else {
$yarnbin = 'C:\Users\lmr\AppData\Roaming\npm\mammoth ';
$yarnbin = 'C:\Users\lmr\AppData\Local\Yarn\bin\mammoth ';
$test_host = '';
}
$command = $yarnbin . $docx_path . ' --output-dir=' . $img_dir . ' 2>&1';
//$command = 'C:\Users\lmr\AppData\Local\Yarn\bin\mammoth -h 2>&1';
$command = $yarnbin.$docx_path.' --output-dir='.$img_dir. ' 2>&1';
//$command = 'C:\Users\lmr\AppData\Local\Yarn\bin\mammoth -h 2>&1';
exec($command, $rs, $st);
//图片处理
$scan_img = scandir($img_dir);
$tmp = '';
foreach ($scan_img as $f) {
foreach($scan_img as $f) {
$tmp_ext = mb_strtolower(strrchr($f, '.'));
if ($tmp_ext == '.jpeg') {
$tmp_img = $img_dir . '/' . $f;
$tmp_img = $img_dir.'/'.$f;
$tmp_jpg = str_ireplace('.jpeg', '.jpg', $tmp_img);
$im = imagecreatefromjpeg($tmp_img);
imagejpeg($im, $tmp_jpg);
@ -488,40 +485,38 @@ class Info_amp extends CI_Controller
if (file_exists($html_parh)) {
$html = file_get_contents($html_parh);
} else {
echo (json_encode(array(
echo(json_encode(array(
'status' => 'error',
'html' => $command . ' # ' . $html_parh,
'rs' => print_r($rs, true) . ' # ' . $st
'html' => $command.' # '.$html_parh,
'rs' => print_r($rs, true).' # '.$st
)));
return;
}
$html = preg_replace('/src="([\d]+).jpeg"/i', 'src="' . $test_host . '/information-view/information/word_source/' . $md5_file . '/$1.jpg"', $html);
$html = preg_replace('/src="([\d]+).jpeg"/i', 'src="'.$test_host.'/information-view/information/word_source/'.$md5_file.'/$1.jpg"', $html);
//删除临时html
@unlink($html_parh);
//删除docx文档
@unlink($docx_path);
if ($html) {
echo (json_encode(array(
echo(json_encode(array(
'status' => 'success',
'path' => $docx_path,
'html' => $html
)));
}
} else {
echo (json_encode(array(
echo(json_encode(array(
'status' => 'error',
'msg' => "word文件解析失败。"
)));
}
}
public function save_history()
{
public function save_history() {
$json = $this->input->get_post('json');
$icid = $this->input->get_post('icid');
$action = $this->input->get_post('action') ? '_' . $this->input->get_post('action') : '';
if ($json && $icid) {
$code = $this->Logs_model->backup_meta($icid, $json, 'AMP_HISTORY' . $action);
$code = $this->Logs_model->backup_meta($icid, $json, 'AMP_HISTORY');
echo json_encode(array(
"succ" => true,
"info" => $this->Logs_model->pick_backup_meta($code)
@ -534,8 +529,7 @@ class Info_amp extends CI_Controller
}
}
public function list_history()
{
public function list_history() {
$icid = $this->input->get_post('icid');
if ($icid) {
echo json_encode(array(
@ -550,8 +544,7 @@ class Info_amp extends CI_Controller
}
}
public function pick_history()
{
public function pick_history() {
$log_action_id = $this->input->get_post('log_action_id');
if ($log_action_id) {
echo json_encode(array(
@ -565,4 +558,5 @@ class Info_amp extends CI_Controller
));
}
}
}

@ -1,291 +0,0 @@
<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class infofix extends CI_Controller
{
public $site_code = '';
public function __construct()
{
parent::__construct();
$this->load->model('Information_model');
$this->load->model('infoContents_model');
$this->load->model('infoMetas_model');
$this->load->model('logs_model');
$this->site_code = $this->input->get('site_code') ? $this->input->get('site_code') : $this->config->item('site_code');
header('Access-Control-Allow-Origin: *');
}
/**
* 根据关键词搜索信息
*/
public function list_info_by_keys()
{
// 防止超时
set_time_limit(0);
// json参数
$site = $this->input->get_post('site');
$keys = $this->input->get_post('keys');
$key_arr = explode(',', $keys);
// 容错
if (
empty($site) ||
empty($keys) ||
mb_stripos($keys, '/') === false
) {
echo json_encode(array());
return false;
}
// 关键字信息
$rs = $this->Information_model->list_by_keywords($site, $key_arr);
// 调整数据
foreach ($rs as $info) {
$key_with_content = array();
foreach ($key_arr as $key) {
// 链接
$sub_url = mb_stripos($info->ic_url, $key) !== false ? $info->ic_url : '';
if ($sub_url) {
$sub_url = str_replace($key, '@@@' . $key . '@@@', $sub_url);
$sub_url = explode('@@@', $sub_url);
}
$limitStr = 100;
// 信息内容
$pos_content = 0;
$pos_content = mb_stripos($info->ic_content, $key);
$sub_content = array();
while ($pos_content) {
$_str = '[...' . mb_substr($info->ic_content, $pos_content - $limitStr, mb_strlen($key) + $limitStr * 2) . '...]';
$_str = str_replace($key, '@@@' . $key . '@@@', $_str);
$_str = explode('@@@', $_str);
array_push($sub_content, $_str);
$pos_content = mb_stripos($info->ic_content, $key, $pos_content + mb_strlen($key));
}
// amp_json
$sub_content2 = array();
if ($info->amp_json) {
$pos_content2 = 0;
$pos_content2 = mb_stripos($info->amp_json, $key);
while ($pos_content2) {
$_str = '[...' . mb_substr($info->amp_json, $pos_content2 - $limitStr, mb_strlen($key) + $limitStr * 2) . '...]';
$_str = str_replace($key, '@@@' . $key . '@@@', $_str);
$_str = explode('@@@', $_str);
array_push($sub_content2, $_str);
$pos_content2 = mb_stripos($info->amp_json, $key, $pos_content2 + mb_strlen($key));
}
}
// amp_body
$sub_content3 = array();
if ($info->amp_body) {
$pos_content3 = 0;
$pos_content3 = mb_stripos($info->amp_body, $key);
while ($pos_content3) {
$_str = '[...' . mb_substr($info->amp_body, $pos_content3 - $limitStr, mb_strlen($key) + $limitStr * 2) . '...]';
$_str = str_replace($key, '@@@' . $key . '@@@', $_str);
$_str = explode('@@@', $_str);
array_push($sub_content3, $_str);
$pos_content3 = mb_stripos($info->amp_body, $key, $pos_content3 + mb_strlen($key));
}
}
if ($sub_url != '' || count($sub_content) != 0 || count($sub_content2) != 0 || count($sub_content3) != 0) {
array_push(
$key_with_content,
array(
'key' => $key,
'sub_url' => $sub_url,
'sub_content' => $sub_content,
'sub_json' => $sub_content2,
'sub_body' => $sub_content3,
)
);
}
}
$info->ic_content = $key_with_content;
unset($info->amp_json);
unset($info->amp_body);
}
echo json_encode($rs);
}
/**
* 更新含有关键的信息
*/
public function update_info_by_keys()
{
// json参数
$site = $this->input->get_post('site');
$keys = $this->input->get_post('keys');
$keyArr = explode('@', $keys); // ic_id@oldurl@newurl@is_id
//sleep(2);
//echo ($keys);
//return true;
// 容错1
if (
empty($site) ||
count($keyArr) != 4 ||
mb_stripos($keys, '/') === false ||
mb_stripos($keys, 'undefined') !== false ||
mb_stripos($keys, 'null') !== false ||
mb_stripos($keys, '@@') !== false ||
mb_stripos($keys, '@ @') !== false
) {
echo json_encode(array('err' => '容错1'));
return false;
}
// 参数解析
$ic_id = $keyArr[0];
$oldStr = $keyArr[1];
$newStr = $keyArr[2];
$is_id = $keyArr[3];
// 容错2
if (
empty($ic_id) ||
empty($is_id) ||
empty($newStr) ||
empty($oldStr) ||
mb_stripos($newStr, '/') === false ||
mb_stripos($oldStr, '/') === false
) {
echo json_encode(array('err' => '容错2'));
return false;
}
// ic_content
$ic = $this->infoContents_model->get_ic_contents2($ic_id);
if (!empty($ic)) {
$ic->ic_content = str_ireplace($oldStr, $newStr, $ic->ic_content);
$this->infoContents_model->force_update($ic_id, $ic->ic_content);
$ic->ic_url = str_ireplace($oldStr, $newStr, $ic->ic_url);
$this->infoContents_model->force_update_url($ic_id, $ic->ic_url);
}
// amp_json
$meta = $this->infoMetas_model->get($ic_id, 'AMP_JSON');
if (!empty($meta)) {
$meta = str_ireplace($oldStr, $newStr, $meta);
$this->infoMetas_model->update($ic_id, 'AMP_JSON', $meta);
}
// amp_body_pc
$meta = $this->infoMetas_model->get($ic_id, 'AMP_BODY_PC');
if (!empty($meta)) {
$meta = str_ireplace($oldStr, $newStr, $meta);
$this->infoMetas_model->update($ic_id, 'AMP_BODY_PC', $meta);
}
echo json_encode($keyArr);
}
/**
* 无条件获取信息内容
* @param mixed $ic_id
*/
public function get_by_icid($ic_id)
{
$ic = $this->infoContents_model->get_ic_contents2($ic_id);
$json = json_decode($this->infoMetas_model->get($ic_id, 'AMP_JSON'));
$use = $this->infoMetas_model->get($ic_id, 'AMP_BODY_PC_STATUS');
if ($ic) {
echo json_encode(
array(
'state' => 0,
'ic_content' => $ic->ic_content,
'pc_use' => $use,
'json' => $json,
)
);
} else {
echo json_encode(
array(
'state' => -1,
'msg' => 'not content by ' . $ic_id,
)
);
}
}
/**
* 无条件更新信息内容(上线前内容)
*/
public function update_by_icid()
{
$ic_id = $this->input->get_post('ic_id');
$ic_content = $this->input->get_post('ic_content');
$this->infoContents_model->force_update($ic_id, $ic_content);
}
/**
* 列举使用旧版构建工具的信息,用于批量替换更新。
* @param mixed $site
*/
public function list_use_hb($site)
{
$rs = $this->infoContents_model->list_use_hb($site);
echo json_encode($rs);
}
/**
* 转化旧版构建工具数据(上线前的准备)
* @param mixed $ic_id
*/
public function migrate_hb($ic_id, $dev = 'prod')
{
// 本地测试参数
$api = 'https://hmk.arachina.com/beta/3733/server_render2';
if ($dev == 'dev') {
$api = 'http://127.0.0.1:3733/server_render2';
sleep(2);
}
// 请求api
$json = $this->infoMetas_model->get($ic_id, 'AMP_JSON');
if (!empty($json)) {
// 请求转化服务器
$post_data = 'json=' . urlencode($json);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //禁止直接显示获取的内容
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$curl_rs = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($curl_rs && ($httpCode == 200 || $httpCode == 201)) {
// 先备份
$is = $this->infoContents_model->get_isid_by_icid($ic_id);
$ic = $this->infoContents_model->get_ic_contents2($ic_id);
$this->logs_model->backup($is->is_id, $ic->ic_content);
// 移除外部包裹标签
$curl_rs = str_replace(array('<my_lmr_tpl>', '</my_lmr_tpl>'), '', $curl_rs);
// 强制更新信息内容
$this->infoContents_model->force_update($ic_id, $curl_rs);
echo json_encode(array('status' => 1));
} else {
echo json_encode(array('status' => -1, 'msg' => 'err1'));
}
} else {
echo json_encode(array('status' => -1, 'msg' => 'err2'));
}
}
}
//end of infofix

File diff suppressed because it is too large Load Diff

@ -3,18 +3,14 @@
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Login extends CI_Controller
{
class Login extends CI_Controller {
function __construct()
{
function __construct() {
parent::__construct();
$this->load->model('Operator_model');
$this->load->helper('cookie');
}
public function index()
{
public function index() {
//添加找回用户密码功能
$usercode = $this->input->get('....ht-user');
if (!empty($usercode)) {
@ -30,8 +26,7 @@ class Login extends CI_Controller
}
//退出登录清空session
public function out()
{
public function out() {
$this->session->unset_userdata('session_admin');
$this->session->unset_userdata('session_site');
$this->session->unset_userdata('session_color');
@ -42,23 +37,18 @@ class Login extends CI_Controller
$this->session->unset_userdata('access_sitecode'); */
$this->session->sess_destroy();
//火车的third_party出票系统删除cookie 20231011 zp
delete_cookie("OPI_SN");
redirect(site_url('login'));
}
//当用户无权限时提醒页面
public function refuse()
{
public function refuse() {
$this->load->view('bootstrap/header');
$this->load->view('bootstrap/accessmanage/refuse');
$this->load->view('bootstrap/footer');
}
//站点切换
public function change_site($site_code)
{
public function change_site($site_code) {
//来源页面,成功切换站点之后转到原始页面去 ,如果在各编辑界面切换则会导致站点错误比如ch的文章id=100切换到gm下就没有id=100只能切换的某个板块
// $referer = empty($_SERVER['HTTP_REFERER']) ? false : $_SERVER['HTTP_REFERER'];
@ -83,8 +73,7 @@ class Login extends CI_Controller
}
//主题切换
public function change_color($color = false)
{
public function change_color($color = false) {
if ($color) {
$this->session->set_userdata('session_color', $color . '-');
} else {
@ -95,8 +84,7 @@ class Login extends CI_Controller
}
//登录检测
public function check()
{
public function check() {
//如果已经登陆则跳到管理首页
if ($this->session->userdata('session_admin')) {
$data[] = array('name' => 'go', 'value' => site_url());
@ -126,7 +114,6 @@ class Login extends CI_Controller
$userdata = $this->Operator_model->get_author_user($this->input->post('user_code'));
$user_site = $this->Access_model->get_user_site_list($userdata['OPI_Code']);
}
//密码正确,再判断是否有站点编辑权限
$site_array = $this->config->item('site');
$user_site = trim($user_site);
@ -135,7 +122,7 @@ class Login extends CI_Controller
$site_item = $site_array[trim($user_site_array[0])];
$this->session->set_userdata('session_admin', $userdata);
$this->session->set_userdata('session_site', $site_item);
// $this->session->set_userdata('session_color', '');
$this->session->set_userdata('session_color', '');
$data[] = array('name' => 'go', 'value' => site_url());
echo json_encode($data);
@ -164,26 +151,4 @@ class Login extends CI_Controller
}
}
//thirdparty trainsystem 使用的登陆
public function indextrain()
{
//由于火车的third_party无法读取外面的session数值所以需要到这里来进行获取及判断判断如果是登陆就跳转会对应页面
//利用cookie来进行判断 2023-10-10 zp
$tmp = $this->session->userdata('session_admin');
$session_id = $this->session->userdata('session_id');
if ($tmp===false){
$this->load->view('bootstrap/login');
}else{
//cookies
$OPI_SN = $tmp["OPI_SN"];
$cookie = array(
'name' => 'OPI_SN',
'value' => $OPI_SN,
'expire' => '8650000'
);
set_cookie($cookie);
redirect(site_url('/apps/trainsystem/pages'));
}
}
}

@ -1,58 +0,0 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Overseas extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
}
//团购信息
public function index()
{
$overseas_id = 1;
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('g', $overseas_id);
if ($rootStructure == FALSE) {
$this->InfoContents_model->Add(
'',
'Overseas',
'root',
'',
'',
'',
'',
'',
'',
0,
0,
'',
'',
0,
0,
'',
'',
$overseas_id,
'g',
0,
'',
''
);
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
} else {
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
}

@ -88,8 +88,6 @@ class Sendmail extends CI_Controller
{
//成功发送
$m->M_Web!='paypal msg' && $order_condition=" or (M_ToEmail='$m->M_ToEmail' and M_ToName='$m->M_ToName' and M_Title='$m->M_Title') ";
$this->Logs_model->write('send_mail_success',$m->M_SN,'成功发送:'.$m->M_ToEmail);
echo 'ok';
}
}

@ -33,8 +33,6 @@ class Sitemap extends CI_Controller {
public function create($site_url, $site_sitemap = false) {
@set_time_limit(0);
ini_set('max_execution_time', '0');
ini_set ('memory_limit', '512M');
$data = array();
$sitemap_string = '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> ';
$data['lastEditList'] = $this->Information_model->get_last_edit_list(false);

@ -1,44 +0,0 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Test extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('feedback_model');
$this->load->model('Information_model');
}
// https://cht.mycht.cn/info.php/test/feedback/?tag=%3Chtml%3E%3Cdiv%3E%3C!--%40FEEDBACK_Shanghai%40--%3E%3C%2Fdiv%3E%3C%2Fhtml%3E
public function feedback()
{
$tag = $this->input->get_post('tag');
$template_path = 'mobile_first/ch';
$feedback_array = array();
preg_match_all('^<!--@FEEDBACK_(.*)@-->^', $tag, $feedback_array);
if (!empty($feedback_array)) {
foreach ($feedback_array[0] as $index => $tag_name) {
$city_name = $feedback_array[1][$index];
echo 'city_name: '.$city_name.'<br>';
echo 'tag_name: '.htmlentities($tag_name).'<br>';
echo 'feedback_data: <br>';
$feedback_data = $this->feedback_model->get_feedback_by_city($city_name);
var_dump($feedback_data);
$feedback_content = $this->load->view(
$template_path . '-feedback',
array('feedback_data' => $feedback_data),
true);
echo $feedback_content;
}
}
}
}

@ -27,7 +27,7 @@ class Welcome extends CI_Controller {
$data['groupList']=$this->Information_model->group_list();
if(is_mobile_first() ){
if($this->config->item('site_code')=='ch' || $this->config->item('site_code')=='ah' ){
$this->load->view('bootstrap3/header', $data);
$this->load->view('bootstrap3/welcome');
@ -58,7 +58,7 @@ class Welcome extends CI_Controller {
$data['search_list'] = $this->Information_model->search_url($search_url);
if (count($data['search_list']) === 0) {
if (!empty($data['all_text_search']) && $data['all_text_search'] == 'true') {
$data['search_list'] = $this->Information_model->search_all_text($data['keywords'],48);
$data['search_list'] = $this->Information_model->search_all_text($data['keywords']);
} else {
$data['search_list'] = $this->Information_model->search($data['keywords']);
}
@ -98,33 +98,23 @@ class Welcome extends CI_Controller {
}
//获取某个信息节点和子节点url
//$is_parent_id 结构id或者是url
public function create_infomation_urls($is_parent_id, $view = false) {
$ic_url=$this->input->get_post('ic_url');
if(!empty($ic_url)){
$structure = $this->Information_model->Detail($ic_url);
}else{
$structure = $this->InfoStructures_model->Detail($is_parent_id);
}
$this->output->enable_profiler(FALSE);
$structure = $this->InfoStructures_model->Detail($is_parent_id);
if (empty($structure)) {
show_404();
return false;
}
$data['all_information'] = $this->Information_model->get_list_by_path($structure->is_path,false,false,'is_id,ic_url,ic_id,ic_status');
$this->load->view('bootstrap3/header', $data);
switch ($view){
case 'amp':
$this->load->view('bootstrap3/refresh_amp_urls');
break;
case 'mobile-first':
$this->load->view('bootstrap3/refresh_mobile_first_urls');
break;
default:
$this->load->view('bootstrap/cache_url', $data);
$data['all_information'] = $this->Information_model->get_list_by_path($structure->is_path);
if ($view == 'amp') {
$this->load->view('bootstrap3/header', $data);
$this->load->view('bootstrap3/refresh_amp_urls');
$this->load->view('bootstrap3/footer');
} else {
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/cache_url', $data);
$this->load->view('bootstrap/footer');
}
$this->load->view('bootstrap/footer');
}
//根据信息节点ID获取信息用于搜索结果的批量更新静态页面
@ -218,6 +208,37 @@ class Welcome extends CI_Controller {
}
}
// $information->ic_content = $htm_doc->saveHTML();
// $this->InfoContents_model->Update(
// $information->ic_id,
// $information->ic_url,
// $information->ic_url_title,
// $information->ic_type,
// $information->ic_title,
// $information->ic_content,
// $information->ic_summary,
// $information->ic_seo_title,
// $information->ic_seo_description,
// $information->ic_seo_keywords,
// $information->ic_show_bread_crumbs,
// $information->ic_status,
// $information->ic_template,
// $information->ic_photo,
// $information->ic_photo_width,
// $information->ic_photo_height,
// $information->ic_recommend_tours,
// $information->ic_recommend_packages,
// $information->ic_ht_area_id,
// $information->ic_ht_area_type,
// $information->ic_ht_product_id,
// $information->ic_ht_product_type,
// $information->ic_author);
// $this->echo_json(array(
// 'status' => 'ok',
// 'infoId' => $info_id,
// 'message' => 'success',
// 'date' => date('Y-m-d h:i:s')
// ));
}
public function count_redirect_nofollow() {
@ -391,18 +412,4 @@ class Welcome extends CI_Controller {
$this->load->view('bootstrap3/recommendlist', $data);
}
/**
* @description: 用于生成一个特殊的根结点is_level和is_sort都为0CT移动优先项目用
* @param {type}
* @return:
* @Date Changed:
*/
public function AddRootNote(){
$this->InfoContents_model->Add('', 'NewRootNote', 'root', 'NewRootNote', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', '', '', 0,
'','');
$this->InfoStructures_model->AddRootNote($this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
redirect(site_url('information/edit/' . $is_id));
}
}

@ -3,22 +3,20 @@
//获取项目类型名称
function get_project_typename($type)
{
$CI = &get_instance();
$type_list = $CI->config->item('project_types');
$CI = & get_instance();
$type_list=$CI->config->item('project_types');
return $type_list[$type];
}
function GetAreaName($HT_areaType, $HT_areaID)
{
$CI = &get_instance();
function GetAreaName($HT_areaType, $HT_areaID) {
$CI = & get_instance();
$CI->load->model('Area_model');
return $CI->Area_model->get_area_name($HT_areaType, $HT_areaID);
}
//查找作者名称,根据参数类型判断查作者表还是翰特表
function get_author_name($author_code_id)
{
$CI = &get_instance();
function get_author_name($author_code_id) {
$CI = & get_instance();
if (is_numeric($author_code_id)) {
$CI->load->model('Infoauthors_model');
$user = $CI->Infoauthors_model->detail_by_id($author_code_id);
@ -36,8 +34,7 @@ function get_author_name($author_code_id)
}
//根据站点id获取站点名称
function get_sitecode($site_id, $site_array)
{
function get_sitecode($site_id, $site_array) {
foreach ($site_array as $item) {
if ($item['site_id'] == $site_id) {
return $item['site_code'];
@ -50,8 +47,7 @@ function get_sitecode($site_id, $site_array)
* 递归创建文件夹
*/
function create_folder_by_path($dir, $mode = 0777)
{
function create_folder_by_path($dir, $mode = 0777) {
if (!is_dir($dir)) {
return @mkdir($dir, $mode, true);
}
@ -61,9 +57,8 @@ function create_folder_by_path($dir, $mode = 0777)
/**
* 获取iis rewrite之前的原始url
*/
function get_origin_url()
{
$CI = &get_instance();
function get_origin_url() {
$CI = & get_instance();
if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
$origin_url = str_replace($CI->config->item('index_page'), '/', $_SERVER['HTTP_X_REWRITE_URL']);
} else {
@ -73,11 +68,10 @@ function get_origin_url()
}
//是否是系列站
function is_series_site()
{
$CI = &get_instance();
function is_series_site() {
$CI = & get_instance();
$sitecode = $CI->config->item('site_code');
if (in_array($sitecode, array('jp', 'vc', 'vac', 'ru', 'it', 'gh_jp', 'gh_vc', 'gh_vac', 'gh_ru', 'gh_it', 'gh_gm', 'gm'))) {
if ($sitecode == 'vc' || $sitecode == 'ru' || $sitecode == 'jp' || $sitecode == 'vac' || $sitecode == 'it') {
return true;
} else {
return false;
@ -86,9 +80,8 @@ function is_series_site()
//是否是子站点
function is_sub_site()
{
$CI = &get_instance();
function is_sub_site() {
$CI = & get_instance();
$sitecode = $CI->config->item('site_code');
if ($sitecode == 'yz' || $sitecode == 'tbt' || $sitecode == 'mbj' || $sitecode == 'sht' || $sitecode == 'gl') {
return true;
@ -97,167 +90,150 @@ function is_sub_site()
}
}
//是否是移动优先站点
function is_mobile_first()
{
$CI = &get_instance();
$sitecode = $CI->config->item('site_code');
if ($sitecode == 'ch' || $sitecode == 'ah' || $sitecode == 'chinatravel' || $sitecode == 'gh' || $sitecode == 'shanghai') {
return true;
} else {
return false;
}
}
function add_meta($im_ic_id, $im_key, $im_value)
{
$CI = &get_instance();
function add_meta($im_ic_id, $im_key, $im_value) {
$CI = & get_instance();
$CI->load->model('InfoMetas_model');
return $CI->InfoMetas_model->add($im_ic_id, $im_key, $im_value);
}
function get_meta($im_ic_id, $im_key)
{
$CI = &get_instance();
function get_meta($im_ic_id, $im_key) {
$CI = & get_instance();
$CI->load->model('InfoMetas_model');
return $CI->InfoMetas_model->get($im_ic_id, $im_key);
}
function update_meta($im_ic_id, $im_key, $im_value)
{
$CI = &get_instance();
function update_meta($im_ic_id, $im_key, $im_value) {
$CI = & get_instance();
$CI->load->model('InfoMetas_model');
return $CI->InfoMetas_model->update($im_ic_id, $im_key, $im_value);
}
function delete_meta($im_ic_id, $im_key)
{
$CI = &get_instance();
function delete_meta($im_ic_id, $im_key) {
$CI = & get_instance();
$CI->load->model('InfoMetas_model');
return $CI->InfoMetas_model->delete($im_ic_id, $im_key);
}
//检查是否有短消息
function have_unread_sms($m_object_type, $m_object_id)
function have_unread_sms($m_object_type,$m_object_id)
{
$CI = &get_instance();
$CI->load->model('InfoSMS_model');
$sms_list = $CI->InfoSMS_model->unread_sms($m_object_type, $m_object_id);
$admin_info = $CI->session->userdata('session_admin');
if (empty($sms_list)) {
return false;
} else {
$sender = get_author_name($sms_list[0]->m_sender);
if ($admin_info['OPI_Name'] == $sender) {
return false;
} else {
return true;
}
}
$CI = & get_instance();
$CI->load->model('InfoSMS_model');
$sms_list=$CI->InfoSMS_model->unread_sms($m_object_type,$m_object_id);
$admin_info=$CI->session->userdata('session_admin');
if(empty($sms_list))
{
return false;
}
else
{
$sender=get_author_name($sms_list[0]->m_sender);
if($admin_info['OPI_Name']==$sender){
return false;
}else{
return true;
}
}
}
//截取字符串
function get_text_short($str, $length = 40, $ext = '', $only_content = false)
{
$str = strip_tags($str);
$str = htmlspecialchars_decode($str);
$strlenth = 0;
$out = '';
$output = '';
$is_length = false;
preg_match_all("/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/", $str, $match);
foreach ($match[0] as $v) {
preg_match("/[\xe0-\xef][\x80-\xbf]{2}/", $v, $matchs);
if (!empty($matchs[0])) {
$strlenth += 1;
} elseif (is_numeric($v)) {
$strlenth += 0.5; // 字符字节长度比例 汉字为1
} else {
$strlenth += 0.5; // 字符字节长度比例 汉字为1
function get_text_short($str, $length = 40, $ext = '',$only_content=false) {
$str = strip_tags($str);
$str = htmlspecialchars_decode($str);
$strlenth = 0;
$out = '';
$output = '';
$is_length = false;
preg_match_all("/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/", $str, $match);
foreach($match[0] as $v){
preg_match("/[\xe0-\xef][\x80-\xbf]{2}/",$v, $matchs);
if(!empty($matchs[0])){
$strlenth += 1;
}elseif(is_numeric($v)){
$strlenth += 0.5; // 字符字节长度比例 汉字为1
}else{
$strlenth += 0.5; // 字符字节长度比例 汉字为1
}
if ($strlenth > $length) {
$output .= $ext;
$is_length=true;
break;
}
$output .= $v;
}
if ($strlenth > $length) {
$output .= $ext;
$is_length = true;
break;
$data['content']=$output;
$data['length']=$is_length;
if ($only_content) {
return $data['content'];
}
$output .= $v;
return $data;
}
$data['content'] = $output;
$data['length'] = $is_length;
if ($only_content) {
return $data['content'];
}
return $data;
}
//平台头部展示所有未读消息数量
function get_all_unread_sms($type = 'author', $author = false)
function get_all_unread_sms($type='author',$author=false)
{
$CI = &get_instance();
$CI = & get_instance();
$CI->load->model('InfoSMS_model');
if (!$author) {
$admin_info = $CI->session->userdata('session_admin');
$author = $admin_info['OPI_Code'];
if(!$author){
$admin_info=$CI->session->userdata('session_admin');
$author=$admin_info['OPI_Code'];
}
if ($type == 'info') {
$unread_sms = $CI->InfoSMS_model->info_unread_sms($author, 'info');
} else {
$unread_sms = $CI->InfoSMS_model->all_unread_sms($author, 'task');
if ($type=='info') {
$unread_sms=$CI->InfoSMS_model->info_unread_sms($author,'info');
}else{
$unread_sms=$CI->InfoSMS_model->all_unread_sms($author,'task');
}
return $unread_sms;
}
//获取不同任务状态的任务数量
function get_task_count_by_status()
{
$CI = &get_instance();
function get_task_count_by_status(){
$CI = & get_instance();
$CI->load->model('Infotasks_model');
$task_count_by_status = $CI->Infotasks_model->get_task_count_by_status();
$task_count_by_status=$CI->Infotasks_model->get_task_count_by_status();
return $task_count_by_status;
}
//获取作者头像
function get_author_photo($author_code_id = false)
function get_author_photo($author_code_id=false)
{
$CI = &get_instance();
$root_url = ''; //'http://data.chtcdn.com';
$avatar = $root_url . '/css/images/avatar.jpg';
if ($author_code_id && is_numeric($author_code_id)) {
$CI->load->model('Infoauthors_model');
$user = $CI->Infoauthors_model->detail_by_id($author_code_id);
if (isset($user->a_photo) && $user->a_photo != '') {
$avatar = $root_url . '/author/document/profile_photo/' . $user->a_photo;
}
}
return $avatar;
$CI = & get_instance();
$root_url='';//'http://data.chtcdn.com';
$avatar=$root_url.'/css/images/avatar.jpg';
if($author_code_id && is_numeric($author_code_id))
{
$CI->load->model('Infoauthors_model');
$user=$CI->Infoauthors_model->detail_by_id($author_code_id);
if(isset($user->a_photo) && $user->a_photo!='')
{
$avatar = $root_url.'/author/document/profile_photo/'.$user->a_photo;
}
}
return $avatar;
}
//补全图片路径
function get_photo_url($photo)
{
$root_url = ''; //'http://data.chtcdn.com';
if ($photo == '') {
$avatar = $root_url . '/css/images/uploadPic.jpg';
} else {
$avatar = $root_url . '/author/document/profile_photo/' . $photo;
function get_photo_url($photo){
$root_url='';//'http://data.chtcdn.com';
if ($photo=='') {
$avatar = $root_url.'/css/images/uploadPic.jpg';
}else{
$avatar = $root_url.'/author/document/profile_photo/'.$photo;
}
return $avatar;
}
//获取待审核作者数量
function un_active_count()
{
$CI = &get_instance();
function un_active_count(){
$CI = & get_instance();
$CI->load->model('Infoauthors_model');
$num = $CI->Infoauthors_model->un_active_count();
$num=$CI->Infoauthors_model->un_active_count();
return $num;
}
//分页函数
function show_page($page)
{
function show_page($page){
$pageSize = $page['pageSize'];
$total = $page['total'];
$url = $page['url'];
@ -266,114 +242,87 @@ function show_page($page)
$startPage = ($currentPage - 1) * $pageSize;
$befor = $after = 0;
$nowview = ceil(($currentPage + 1) / 10);
$befor = $nowview == 1 ? ($nowview - 1) * 10 + 1 : ($nowview - 1) * 10;
if ($pageNumber >= $nowview * 10) {
$after = $nowview * 10;
} else {
$nowview=ceil(($currentPage+1)/10);
$befor = $nowview==1?($nowview-1)*10+1:($nowview-1)*10;
if($pageNumber>=$nowview*10){
$after = $nowview*10;
}else{
$after = $pageNumber;
}
$html = '';
if ($nowview > 1)
$befor--;
if ($pageSize <= $total) {
for ($i = $befor; $i <= $after; $i++) {
if ($i == $currentPage) {
$html='';
if($nowview>1) $befor--;
if ($pageSize <= $total) {
for ($i = $befor; $i <= $after; $i++) {
if ($i == $currentPage) {
$html .= "<li class=\"active\"><a href=\"javascript:void(0)\">{$i}</a></li>";
} else {
}else {
$html .= "<li><a href=\"{$url}/{$i}\">$i</a></li>";
}
}
}
}
}
$res['htmls'] = $html;
$res['prepage'] = $currentPage - 1;
$res['nextpage'] = $currentPage + 1;
$res['totalpage'] = $pageNumber;
return $res;
$res['htmls']=$html;
$res['prepage']=$currentPage - 1;
$res['nextpage']=$currentPage + 1;
$res['totalpage']=$pageNumber;
return $res;
}
//请求URL并返回数组数据
function get_content_by_url($url)
{
//echo $url;
$httpInfo = array();
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //不验证证书
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_URL, $url);
$response = curl_exec($ch);
if ($response === FALSE) {
#echo "cURL Error: " . curl_error($ch);
return false;
}
return $response;
}
function GET_HTTP($url, $data = '', $method = 'GET')
{
$curl = curl_init(); // 启动一个CURL会话
curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在
// if (isset($_SERVER['HTTP_USER_AGENT'])) {
// $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
// } else {
$HTTP_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; curl) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36';
// }
curl_setopt($curl, CURLOPT_USERAGENT, $HTTP_USER_AGENT); // 模拟用户使用的浏览器
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
if ($method == 'POST' && !empty($data)) {
curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包
}
curl_setopt($curl, CURLOPT_TIMEOUT, 45); // 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
$tmpInfo = curl_exec($curl); // 执行操作
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($httpCode >= 400) { //页面状态如果大于400说明页面打不开
log_message('error', " curl {$httpCode} {$url} ");
return false;
}
$errno = curl_errno($curl);
if ($errno !== 0) {
return false;
$error_message = $errno . ' ' . curl_error($curl); //记录错误日志
log_message('error', "train/get_http curl {$error_message}");
}
curl_close($curl); //关闭CURL会话
return $tmpInfo; //返回数据
function get_content_by_url($url) {
//echo $url;
$httpInfo = array();
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //不验证证书
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_URL, $url);
$response = curl_exec($ch);
if ($response === FALSE) {
#echo "cURL Error: " . curl_error($ch);
return false;
}
return $response;
}
//获取内容中图片地址
function get_image_url_by_source($source)
{
$pattern = "/<[img|IMG].*?src=[\'|\"](.*?(?:[\.jpeg|\.png|\.jpg]))[\'|\"].*?[\/]?>/";
preg_match_all($pattern, $source, $match);
return $match;
}
//压缩css代码
function compress_css($buffer)
{
/* remove comments */
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
/* remove tabs, spaces, newlines, etc. */
$buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer);
return $buffer;
}
//把临时多媒体中心预览图片地址替换为网前地址
function replace_image_url($ic_content)
{
$CI = &get_instance();
return str_replace($CI->config->item('media_image_url'), $CI->config->item('site_image_url'), $ic_content);
}
function GET_HTTP($url, $data = '', $method = 'GET') {
$curl = curl_init(); // 启动一个CURL会话
curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
} else {
$HTTP_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36';
}
curl_setopt($curl, CURLOPT_USERAGENT, $HTTP_USER_AGENT); // 模拟用户使用的浏览器
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
if ($method == 'POST' && !empty($data)) {
curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包
}
curl_setopt($curl, CURLOPT_TIMEOUT, 45); // 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
$tmpInfo = curl_exec($curl); // 执行操作
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if($httpCode>=400){//页面状态如果大于400说明页面打不开
log_message('error', " curl {$httpCode} {$url} ");
return false;
}
$errno = curl_errno($curl);
if ($errno !== 0) {
return false;
$error_message = $errno . ' ' . curl_error($curl); //记录错误日志
log_message('error', "train/get_http curl {$error_message}");
}
curl_close($curl); //关闭CURL会话
return $tmpInfo; //返回数据
}

@ -6,45 +6,41 @@ if (!defined('BASEPATH'))
* AMP的相关方法
*/
class Amplib
{
class Amplib {
var $CI;
public function __construct()
{
$this->CI = &get_instance();
public function __construct() {
$this->CI = & get_instance();
$this->CI->load->model('Information_model');
$this->CI->load->model('InfoMetas_model');
$this->CI->load->model('Logs_model');
}
public function edit($ic_id)
{
public function edit($ic_id) {
$data = array();
$data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id);
if ($data['information'] == FALSE) {
show_404();
}
//查询上一次保存记录
$amp_log = $this->CI->Logs_model->get_last_edit_amp($ic_id);
if (!empty($amp_log)) {
$data['last_edit_amp_id'] = $amp_log->log_id;
} else {
$data['last_edit_amp_id'] = '';
}
//查询上一次保存记录
$amp_log = $this->CI->Logs_model->get_last_edit_amp($ic_id);
if(!empty($amp_log)){
$data['last_edit_amp_id'] = $amp_log->log_id;
}else{
$data['last_edit_amp_id'] = '';
}
$this->CI->load->view('bootstrap3/header', $data);
$this->CI->load->view('amp_editor');
$this->CI->load->view('bootstrap3/footer');
}
public function auto_create($ic_id)
{
public function auto_create($ic_id) {
$data = array();
if (strtolower($this->CI->config->item('site_code')) == 'cht') {
$this->CI->Information_model->ic_type = "AND ic.ic_type != 'none'";
}
if(strtolower($this->CI->config->item('site_code')) == 'cht'){
$this->CI->Information_model->ic_type = "AND ic.ic_type != 'none'";
}
$data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id);
if ($data['information'] == FALSE) {
return json_encode(array('result' => 'no', 'data' => '找不到这个页面'));
@ -65,7 +61,7 @@ class Amplib
break;
case 'gm':
$websitehost = 'https://data.chinarundreisen.com';
$html_source_url = 'https://www.chinarundreisen.com/' . $data['information']->ic_url;
$html_source_url = 'http://144.76.185.44:8029' . $data['information']->ic_url;
break;
case 'ct':
$websitehost = 'https://data.chinatravel.com';
@ -79,24 +75,23 @@ class Amplib
$html_source = GET_HTTP($html_source_url);
if (!empty($html_source)) {
$post_data = array('websitehost' => $websitehost, 'template_name' => $site_code, 'create_amp' => 'true', 'htmlsource' => $html_source);
//德语站点走另外一个控制器,其他站点还是走原来的流程
if ($site_code == 'gm') {
if ($data['information']->ic_url == '/massgeschneiderte-china-reisen/') {
return json_encode(array());
} else {
return GET_HTTP(site_url('/apps/htmlcompressor/index_gm/choose_way'), $post_data, 'POST');
}
} elseif ($site_code == 'ah') {
return GET_HTTP(site_url('/apps/htmlcompressor/index_ah/choose_way'), $post_data, 'POST');
} else {
return GET_HTTP(site_url('/apps/htmlcompressor/index/optimize'), $post_data, 'POST');
}
//德语站点走另外一个控制器,其他站点还是走原来的流程
if($site_code == 'gm'){
if($data['information']->ic_url == '/massgeschneiderte-china-reisen/'){
return json_encode(array());
}else{
return GET_HTTP(site_url('/apps/htmlcompressor/index_gm/choose_way'), $post_data, 'POST');
}
}elseif($site_code == 'ah'){
return GET_HTTP(site_url('/apps/htmlcompressor/index_ah/choose_way'), $post_data, 'POST');
}else{
return GET_HTTP(site_url('/apps/htmlcompressor/index/optimize'), $post_data, 'POST');
}
}
return json_encode(array('result' => 'no', 'data' => '不知道哪里错了,看代码'));
}
public function edit_save($ic_id = false, $textarea_htmlcode = false, $amp_status = false)
{
public function edit_save($ic_id = false, $textarea_htmlcode = false, $amp_status = false) {
$data = array();
if ($ic_id === false) {
$ic_id = $this->CI->input->post('ic_id');
@ -116,8 +111,8 @@ class Amplib
//CH的页面没有canonical内容在这里帮补上
$textarea_htmlcode = str_replace('<!--@CANONICAL@-->', $this->CI->config->item('site_url') . $data['information']->ic_url, $textarea_htmlcode);
//备份修改的代码
$this->CI->Logs_model->write('backup_amp', $ic_id, $textarea_htmlcode);
//备份修改的代码
$this->CI->Logs_model->write('backup_amp', $ic_id, $textarea_htmlcode);
//AMP格式验证
if ($amp_status !== '0') {//只有发布的时候才需要验证

@ -1,203 +0,0 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
/*
* 自动加载语种标签
*/
class Currency {
var $USD_Rate; //人民币兑美元汇率
var $EUR_Rate; //人民币兑欧元汇率
var $RUB_Rate; //人民币兑卢布汇率
public function __construct() {
$this->CI = & get_instance();
log_message('debug', "Language Tags Class Initialized");
$this->GetCurrencyRate();
}
function GetCurrencyRate() {
$this->HT = $this->CI->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 $query->result();
}
//根据人民币转换成站点对应的货币
public function GetSiteMoney($RMB, $fromCurrency) {
if (!is_numeric($RMB))
{
return $RMB;
}
$result = $RMB;
if (is_numeric($RMB)) {
switch ($fromCurrency) {
case 'USD':
$result = $RMB / $this->USD_Rate;
break;
case 'EUR':
$result = $RMB / $this->EUR_Rate;
break;
case 'RUB':
$result = $RMB / $this->RUB_Rate;
break;
}
}
return ceil($result);
}
//把美金转换为人民币
public function get_USD_RMB_SUM($USD) {
if (!is_numeric($USD))return $USD;
$result = $USD;
$result = $USD * $this->USD_Rate;
return ceil($result);
}
/**
* 返回站点的汇率。
*
* @author lmr
*/
public function get_site_currencyrate() {
switch (CONST_SITE_CURRENCY) {
case 'USD':
return $this->USD_Rate;
case 'EUR':
return $this->EUR_Rate;
case 'RUB':
return $this->RUB_Rate;
default:
return 1;
}
}
/**
* 返回带money_char的价格。
*
* @param $money Int 价格.
* @return String 带货币符号的价格。
*/
public function get_money_char($money='') {
switch (CONST_SITE_CODE) {
case 'JP':
return $money.'元';
case 'GM':
return '€'.$money;
case 'VC':
return $money.'€';
case 'VAC':
return '$'.$money;
case 'RU':
return '$'.$money;
case 'IT':
return '€'.$money;
case 'SHT':
return '$'.$money;
default:
return '$'.$money;
}
}
/**
* 返回带money_char的价格。
*
* @param $money Int 价格.
* @return String 带货币符号的价格。
*/
public function get_site_money_with_char($money='') {
return $this->get_money_char($this->GetSiteMoney($money));
}
/**
* RMB换算成指定货币。
* @param int money RMB
* @param string char 货币代号usdeur
* @return int 换算价格
*/
public function convert_moneny_by_char($money,$char='')
{
switch (strtolower($char))
{
case 'usd':
return ceil($money/$this->USD_Rate);
case 'eur':
return ceil($money/$this->EUR_Rate);
}
return $money;
}
/**
* 尾数取"9"的定价规则
* 在正负误差值小于或等于16的前提下
* 保证展示价格的个位数和十位数统一取"99"
* 当展示价格的个位数和十位数取"99"的正负误差大于16时
* 通过四舍五入加价实现个位数取"9"
* 详细规则见GitLab issue #12 统一网前展示价格的标准
*/
public function calc_show_price($value=0) {
if (empty($value)) return 0;
if (!is_numeric($value)) return $value;
$val_len = strlen($value);
if ($val_len == 1) return 9;
$discount = 16;
$val_pow = pow(10, $val_len - 1);
$min_val = $val_pow - 1;
$max_val = $min_val + $val_pow;
$max_diff = abs($value - $max_val);
$min_diff = abs($value - $min_val);
if (min($max_diff, $min_diff) > $discount) {
$calc_val = floor($value / 10) * 10 + 9;
} else {
$calc_val = $max_diff > $min_diff ? $min_val : $max_val;
}
return $calc_val;
}
/**
* 获取设置的信用卡卡费
*/
public function cardfee(){
$sql = "SELECT TOP 1 * FROM dbo.SystemSettingInfo WHERE (SSI_Code = 1021001)";
$this->HT = $this->CI->load->database('HT', TRUE);
$query = $this->HT->query($sql);
$row = $query->row();
if (isset($row)){
return $row->SSI_UserValue;
}else{
return 0;
}
}
}

@ -1,9 +0,0 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require '/lib/aliyun-log-php-sdk-master/Log_Autoload.php';
class Aliyun_log_lib extends CI_Controller{
}

@ -1,148 +0,0 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
/*
* HTML的优化处理的类库
*/
class html_optimize_lib
{
var $CI;
public function __construct()
{
$this->CI = &get_instance();
$this->CI->load->model('Information_model');
$this->CI->load->model('InfoMetas_model');
$this->CI->load->library('simple_html_dom_lib');
}
//开启了延迟加载
public function set_lazy_loader($html, $grey_pic)
{
$html_object = str_get_html($html);
foreach ($html_object->find('img') as $image) {
$img_src = $image->src;
/**有些图片不需要延迟加载比如头部第一张图延迟加载会影响CLS的评分所以图片加loader="nolazy"属性就可以不用替换为延迟加载代码。 */
$loader = $image->loader;
if (!empty($loader) && $loader == "nolazy") {
continue;
}
/** 无需延迟加载结束 20210527 zp */
if (!empty($image->originalsrc)) {
$img_src = $image->originalsrc;
}
$image->src = $grey_pic;
$image->loader = 'lazy';
$image->originalsrc = $img_src;
}
return $html_object->save();
}
//获取图片尺寸,$lazy_loader是否开启延迟加载
public function set_image_size($html)
{
$html_object = str_get_html($html);
//拼接图片链接,获取尺寸
$request_size = array();
foreach ($html_object->find('img') as $image) {
$img_src = $image->src;
if (!empty($image->originalsrc)) {
$img_src = $image->originalsrc;
}
//图片已经设置了尺寸的不再修改
if (empty($image->width) && (strpos($img_src, '//data.') !== false || strpos($img_src, '//images.') !== false)) {//以data或者images开头的域名才能获取尺寸
$img_src_urls = parse_url(trim($img_src));
$request_size[$img_src_urls['host']][] = $img_src_urls['path'];
}
}
//请求图片尺寸
$image_sizes = array();
foreach ($request_size as $host => $path) { //拼接的URL有长度限制大量的图片一次性请求就会失败需要分批处理
$parse_url = "https://{$host}/imagesize.php?photo=" . implode(',', $path);
$size_data = GET_HTTP($parse_url);
if (!empty($size_data)) {
$size_data = json_decode($size_data);
foreach ($size_data as $size_item) {
$size_item->photo = "https://" . $host . $size_item->photo;//这个作为索引找到对应url的尺寸
$image_sizes[$size_item->photo] = $size_item;
}
}
}
//print_r($request_size);
//print_r($image_sizes);
//把尺寸写入html内容中
foreach ($html_object->find('img') as $image) {
$img_src = $image->src;
if (!empty($image->originalsrc)) {
$img_src = $image->originalsrc;
}
//图片已经设置了尺寸的不再修改
if (empty($image->width) && (strpos($img_src, '//data.') !== false || strpos($img_src, '//images.') !== false)) {//以data或者images开头的域名才能获取尺寸
$img_src_urls = parse_url(trim($img_src));
$img_index = "https://" . $img_src_urls['host'] . $img_src_urls['path'];
if (!empty($image_sizes[$img_index])) {
$image->width = $image_sizes[$img_index]->width;
$image->height = $image_sizes[$img_index]->height;
}
}
}
return $html_object->save();
}
//获取图片尺寸的本地版本,图片存在相同服务器上,速度比较快
//$dataPath data文件夹本地路径
//$imagesPath images文件夹本地路径
public function set_image_size_local($html, $dataPath, $imagesPath)
{
$html_object = str_get_html($html);
foreach ($html_object->find('img') as $image) {
$img_src = $image->src;
if (!empty($image->originalsrc)) {
$img_src = $image->originalsrc;
}
//图片已经设置了尺寸的不再修改
if (empty($image->width) && (strpos($img_src, '//data.') !== false || strpos($img_src, '//images.') !== false)) {//以data或者images开头的域名才能获取尺寸
$img_src_urls = parse_url(trim($img_src));
$request_size[$img_src_urls['host']][] = $img_src_urls['path'];
$file_path = '';
if (strpos($img_src, '//data.') !== false) {
$file_path = $dataPath . $img_src_urls['path'];
}
if (strpos($img_src, '//images.') !== false) {
$file_path = $imagesPath . $img_src_urls['path'];
}
if (is_file($file_path)) {
$properties = getimagesize($file_path);//获取图片属性读取失败返回false
if ($properties && !empty($properties[0]) && !empty($properties[1])) {
$image->width = $properties[0];
$image->height = $properties[1];
}
}
}
}
return $html_object->save();
}
///查询html的标签然后后面添加新html
public function add_htmlcode($html,$findTag,$addHtml){
$html_object = str_get_html($html);
$findE = $html_object->find($findTag,0);
$findE->outertext = $findE->outertext . $addHtml ;
return $html_object->save();
$html_object->clear();
}
}

@ -1,15 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir//bin/sh" ]; then
"$basedir//bin/sh" "$basedir/../Data/global/node_modules/.bin/mammoth" "$@"
ret=$?
else
/bin/sh "$basedir/../Data/global/node_modules/.bin/mammoth" "$@"
ret=$?
fi
exit $ret

@ -1 +0,0 @@
@"%~dp0\..\Data\global\node_modules\.bin\mammoth.cmd" %*

@ -1,77 +0,0 @@
<?php
class Price_model extends CI_Model {
var $topnum = false; //返回记录数
var $cli_no = false; //线路代号
var $person_size = false; //人等
var $cli_grade = false; //(标准7001、豪华7002、经济7003
var $clp_pricetype = false; //价格类型 1旺季2淡季
var $price_date = false; //查询价格日期区间
var $orderby = false;
function __construct() {
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
}
public function init() {
$this->topnum = false;
$this->cli_no = false;
$this->person_size = false;
$this->cli_grade = false;
$this->clp_pricetype = false;
$this->price_date = false;
$this->orderby = ' ORDER BY cli.CLI_Grade ASC, clp.CLP_PriceStartDate ASC,clp.CLP_PriceType DESC ';
}
public function search($cli_no, $topnum = false, $cli_grade = false, $clp_pricetype = false, $price_date = false) {
$this->init();
$this->topnum = empty($topnum) ? false : $topnum;
$this->cli_no = ' AND cli.CLI_NO = ' . $this->HT->escape($cli_no);
$this->cli_grade = empty($cli_grade) ? false : ' AND cli.CLI_Grade = ' . $this->HT->escape($cli_grade);
$this->clp_pricetype = empty($clp_pricetype) ? false : ' AND clp.CLP_PriceType = ' . $this->HT->escape($clp_pricetype);
$this->price_date = empty($price_date) ? false : " AND '$price_date 00:00:00' BETWEEN clp.CLP_PriceStartDate AND clp.CLP_PriceEndDate ";
return $this->get_list();
}
public function get_list() {
$this->topnum ? $sql = "SELECT TOP " . $this->topnum : $sql = "SELECT ";
$sql .= "
cli.CLI_SN
,cli.CLI_NO
,clp.CLP_SN
,clp.CLP_OneAdultPriceRMB
,clp.CLP_TwoToFiveAdultPriceRMB
,clp.CLP_SixToNineAdultPriceRMB
,clp.CLP_OverTenAdultPriceRMB
,clp.CLP_PriceType
,cli.CLI_Grade
,clp.CLP_PriceStartDate
,clp.CLP_PriceEndDate
FROM CustomerLinePrice clp
INNER JOIN CustomerLineInfo cli
ON cli.CLI_SN = clp.CLP_CLI_SN
WHERE 1 = 1
AND cli.CLI_State IN (1005003 ,1005004)
";
$this->cli_no ? $sql.=$this->cli_no : false;
$this->cli_grade ? $sql.=$this->cli_grade : false;
$this->clp_pricetype ? $sql.=$this->clp_pricetype : false;
$this->price_date ? $sql.=$this->price_date : false;
$this->orderby ? $sql.=$this->orderby : false;
$query = $this->HT->query($sql);
//print_r($this->HT->queries);
if ($this->topnum === 1) {
if ($query->num_rows() > 0) {
$row = $query->row();
return $row;
} else {
return FALSE;
}
} else {
return $query->result();
}
}
}

@ -1,110 +0,0 @@
<?php
class PrimeLinePrice_model extends CI_Model {
var $topnum = false; //返回记录数
var $cli_no = false; //线路代号
var $person_size = false; //人等
var $cli_grade = 7001; //(标准7001、豪华7002、经济7003
var $price_date = false; //查询价格日期区间
var $orderby = false;
// CH: 1; AH: 28; GH : 33
var $DEI_SN = 28;
function __construct() {
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
}
public function init() {
$this->topnum = false;
$this->cli_no = false;
$this->person_size = false;
$this->cli_grade = false;
$this->price_date = false;
$this->orderby = ' ORDER BY plp.PLP_Level ASC,plp.PLP_IsWeekPrice DESC,plp.PLP_AdultUnitPrice DESC ';
}
public function search($cli_no, $topnum = false, $cli_grade = false, $person_size = false, $price_date = false, $DEI_SN = 28) {
$this->init();
$this->cli_no = $cli_no;
$this->topnum = empty($topnum) ? false : $topnum;
$this->cli_grade = empty($cli_grade) ? false : $this->cli_grade = ' AND cli.CLI_Grade = ' . $this->HT->escape($cli_grade);
$this->person_size = empty($person_size) ? false : $this->person_size = " AND $person_size BETWEEN plp.PLP_PersonGradeDown AND plp.PLP_PersonGradeUp ";
if (!empty($price_date)) {
$this->price_date = " AND '$price_date 00:00:00' BETWEEN plp.PLP_StartDate AND plp.PLP_EndDate ";
$week_day = (int) date('w', strtotime($price_date)); //获取当前时间的星期号,用于判断周末价
$this->price_date .="
AND (
(plp.PLP_IsWeekPrice=1 AND plp.PLP_WeekDefine LIKE '%$week_day%')
OR (plp.PLP_IsWeekPrice=0)
)
";
}
$this->DEI_SN = $DEI_SN;
return $this->get_list();
}
public function get_list() {
$this->topnum ? $sql = "SELECT TOP " . $this->topnum : $sql = "SELECT ";
$sql .= "
cli.CLI_SN
,cli.CLI_NO
,cli.CLI_Grade
,plp.PLP_SN
,plp.PLP_CLI_SN
,plp.PLP_Season
,plp.PLP_Area
,plp.PLP_StartDate
,plp.PLP_EndDate
,plp.PLP_PersonGradeDown
,plp.PLP_PersonGradeUp
,plp.PLP_AdultUnitCost
,plp.PLP_AdultUnitPrice
,plp.PLP_RoomDiffPrice
,plp.PLP_ChildRate
,plp.PLP_BabyRate
,plp.PLP_ChildUnitPrice
,plp.PLP_BabyUnitPrice
,plp.PLP_Level
,plp.PLP_IsWeekPrice
,plp.PLP_WeekDefine
,plp.PLP_PriceDate
,plp.PLP_PersonNum
,plp.PLP_VEI_SN
,plp.PLP_Year
,plp.PLP_VPPI_SN
,plp.PLP_VPPD_SN
,plp.PLP_Creator
,plp.PLP_CreateDate
,plp.PLP_LastEditor
,plp.PLP_LastEditDate
FROM PrimeLinePrice plp
INNER JOIN CustomerLineInfo cli
ON cli.CLI_SN = plp.PLP_CLI_SN
WHERE 1 = 1
AND cli.CLI_DEI_SN=?
AND plp.PLP_Year IS NOT NULL
AND cli.CLI_NO = ?
AND cli.CLI_State IN (1005003 ,1005004)
";
$this->person_size ? $sql.=$this->person_size : false;
$this->price_date ? $sql.=$this->price_date : false;
$this->cli_grade ? $sql.=$this->cli_grade : false;
$this->orderby ? $sql.=$this->orderby : false;
$query = $this->HT->query($sql,array($this->DEI_SN,$this->cli_no));
if ($this->topnum === 1) {
if ($query->num_rows() > 0) {
$row = $query->row();
return $row;
} else {
return FALSE;
}
} else {
return $query->result();
}
}
}

@ -12,25 +12,28 @@ class Area_model extends CI_Model
function get_city($city_id)
{
$sql = "SELECT TOP 1 ci.CII_SN, \n"
. " ci.CII_Code, \n"
. " ci2.CII2_Name \n"
. "FROM CItyInfo ci \n"
. " INNER JOIN CItyInfo2 ci2 ON ci2.CII2_CII_SN = ci.CII_SN \n"
. "WHERE ci2.CII2_LGC = ? \n"
. " AND ci.CII_IsTrue = 1 \n"
. " AND ci2.CII2_Name IS NOT NULL \n"
. " AND ci2.CII2_Name <> '' \n"
. " AND ci.CII_Code IS NOT NULL \n"
. " AND ci.CII_Code <> '' \n"
. " AND ci.CII_SN =? \n"
. "ORDER BY \n"
. " ci.CII_Code ASC";
. " ci.CII_Code, \n"
. " ci2.CII2_Name \n"
. "FROM CItyInfo ci \n"
. " INNER JOIN CItyInfo2 ci2 ON ci2.CII2_CII_SN = ci.CII_SN \n"
. "WHERE ci2.CII2_LGC = ? \n"
. " AND ci.CII_IsTrue = 1 \n"
. " AND ci2.CII2_Name IS NOT NULL \n"
. " AND ci2.CII2_Name <> '' \n"
. " AND ci.CII_Code IS NOT NULL \n"
. " AND ci.CII_Code <> '' \n"
. " AND ci.CII_SN =? \n"
. "ORDER BY \n"
. " ci.CII_Code ASC";
$query = $this->HT->query($sql, array($this->config->item('site_lgc'), $city_id));
//print_r($this->HT->queries);
if ($query->result()) {
//print_r($this->HT->queries);
if ($query->result())
{
$row = $query->row();
return $row;
} else {
}
else
{
return FALSE;
}
}
@ -39,19 +42,19 @@ class Area_model extends CI_Model
function get_city_list($PRI_SN)
{
$sql = "SELECT ci.CII_SN, \n"
. " UPPER(ci.CII_Code) AS CII_Code, \n"
. " ci2.CII2_Name \n"
. "FROM CItyInfo ci \n"
. " INNER JOIN CItyInfo2 ci2 ON ci2.CII2_CII_SN = ci.CII_SN \n"
. "WHERE ci2.CII2_LGC = ? \n"
. " AND ci.CII_IsTrue = 1 \n"
. " AND ci2.CII2_Name IS NOT NULL \n"
. " AND ci2.CII2_Name <> '' \n"
. " AND ci.CII_Code IS NOT NULL \n"
. " AND ci.CII_Code <> '' \n"
. " AND ci.CII_PRI_SN = ? \n"
. "ORDER BY \n"
. " ci.CII_Code ASC";
. " UPPER(ci.CII_Code) AS CII_Code, \n"
. " ci2.CII2_Name \n"
. "FROM CItyInfo ci \n"
. " INNER JOIN CItyInfo2 ci2 ON ci2.CII2_CII_SN = ci.CII_SN \n"
. "WHERE ci2.CII2_LGC = ? \n"
. " AND ci.CII_IsTrue = 1 \n"
. " AND ci2.CII2_Name IS NOT NULL \n"
. " AND ci2.CII2_Name <> '' \n"
. " AND ci.CII_Code IS NOT NULL \n"
. " AND ci.CII_Code <> '' \n"
. " AND ci.CII_PRI_SN = ? \n"
. "ORDER BY \n"
. " ci.CII_Code ASC";
$query = $this->HT->query($sql, array($this->config->item('site_lgc'), $PRI_SN));
return $query->result();
}
@ -60,19 +63,19 @@ class Area_model extends CI_Model
function get_municipalities_list()
{
$sql = "SELECT ci.CII_SN, \n"
. " UPPER(ci.CII_Code) AS CII_Code, \n"
. " ci2.CII2_Name \n"
. "FROM CItyInfo ci \n"
. " INNER JOIN CItyInfo2 ci2 ON ci2.CII2_CII_SN = ci.CII_SN \n"
. "WHERE ci2.CII2_LGC = ? \n"
. " AND ci.CII_IsTrue = 1 \n"
. " AND ci2.CII2_Name IS NOT NULL \n"
. " AND ci2.CII2_Name <> '' \n"
. " AND ci.CII_Code IS NOT NULL \n"
. " AND ci.CII_Code <> '' \n"
. " AND ci.CII_SN IN (1,3,4,5,177,178) \n"
. "ORDER BY \n"
. " ci.CII_Code ASC";
. " UPPER(ci.CII_Code) AS CII_Code, \n"
. " ci2.CII2_Name \n"
. "FROM CItyInfo ci \n"
. " INNER JOIN CItyInfo2 ci2 ON ci2.CII2_CII_SN = ci.CII_SN \n"
. "WHERE ci2.CII2_LGC = ? \n"
. " AND ci.CII_IsTrue = 1 \n"
. " AND ci2.CII2_Name IS NOT NULL \n"
. " AND ci2.CII2_Name <> '' \n"
. " AND ci.CII_Code IS NOT NULL \n"
. " AND ci.CII_Code <> '' \n"
. " AND ci.CII_SN IN (1,3,4,5,177,178) \n"
. "ORDER BY \n"
. " ci.CII_Code ASC";
$query = $this->HT->query($sql, array($this->config->item('site_lgc')));
return $query->result();
}
@ -80,18 +83,21 @@ class Area_model extends CI_Model
function get_province($PRI_SN)
{
$sql = "SELECT TOP 1 pi1.PRI_SN, \n"
. " pi2.PRI2_Name \n"
. "FROM PRovinceInfo pi1 \n"
. " INNER JOIN PRovinceInfo2 pi2 ON pi2.PRI2_PRI_SN = pi1.PRI_SN \n"
. "WHERE (pi1.PRI_Country = 1 or pi1.PRI_Country = 10) \n"
. " AND pi1.PRI_SN NOT IN(1,2,3,4) \n"
. " AND pi2.PRI2_LGC = ? \n"
. " AND pi1.PRI_SN = ? ";
. " pi2.PRI2_Name \n"
. "FROM PRovinceInfo pi1 \n"
. " INNER JOIN PRovinceInfo2 pi2 ON pi2.PRI2_PRI_SN = pi1.PRI_SN \n"
. "WHERE (pi1.PRI_Country = 1 or pi1.PRI_Country = 10) \n"
. " AND pi1.PRI_SN NOT IN(1,2,3,4) \n"
. " AND pi2.PRI2_LGC = ? \n"
. " AND pi1.PRI_SN = ? ";
$query = $this->HT->query($sql, array($this->config->item('site_lgc'), $PRI_SN));
if ($query->result()) {
if ($query->result())
{
$row = $query->row();
return $row;
} else {
}
else
{
return FALSE;
}
}
@ -99,12 +105,12 @@ class Area_model extends CI_Model
function get_province_list()
{
$sql = "SELECT pi1.PRI_SN, \n"
. " pi2.PRI2_Name \n"
. "FROM PRovinceInfo pi1 \n"
. " INNER JOIN PRovinceInfo2 pi2 ON pi2.PRI2_PRI_SN = pi1.PRI_SN \n"
. "WHERE (pi1.PRI_Country = 1 or pi1.PRI_Country = 10) \n"
. " AND pi1.PRI_SN NOT IN(1,2,3,4,176,192) \n"
. " AND pi2.PRI2_LGC = ? ";
. " pi2.PRI2_Name \n"
. "FROM PRovinceInfo pi1 \n"
. " INNER JOIN PRovinceInfo2 pi2 ON pi2.PRI2_PRI_SN = pi1.PRI_SN \n"
. "WHERE (pi1.PRI_Country = 1 or pi1.PRI_Country = 10) \n"
. " AND pi1.PRI_SN NOT IN(1,2,3,4,176,192) \n"
. " AND pi2.PRI2_LGC = ? ";
$query = $this->HT->query($sql, array($this->config->item('site_lgc')));
return $query->result();
}
@ -112,16 +118,19 @@ class Area_model extends CI_Model
function get_country($COI_SN)
{
$sql = "SELECT TOP 1 ci.COI_SN, \n"
. " ci2.COI2_Country \n"
. "FROM COuntryInfo ci \n"
. " INNER JOIN COuntryInfo2 ci2 ON ci2.COI2_COI_SN = ci.COI_SN \n"
. "WHERE ci2.COI2_LGC = ? \n"
. " AND ci.COI_SN = ? ";
. " ci2.COI2_Country \n"
. "FROM COuntryInfo ci \n"
. " INNER JOIN COuntryInfo2 ci2 ON ci2.COI2_COI_SN = ci.COI_SN \n"
. "WHERE ci2.COI2_LGC = ? \n"
. " AND ci.COI_SN = ? ";
$query = $this->HT->query($sql, array($this->config->item('site_lgc'), $COI_SN));
if ($query->result()) {
if ($query->result())
{
$row = $query->row();
return $row;
} else {
}
else
{
return FALSE;
}
}
@ -129,22 +138,22 @@ class Area_model extends CI_Model
function get_country_list()
{
$sql = "SELECT ci.COI_SN, \n"
. " ci2.COI2_Country \n"
. "FROM COuntryInfo ci \n"
. " INNER JOIN COuntryInfo2 ci2 ON ci2.COI2_COI_SN = ci.COI_SN \n"
. "WHERE ci2.COI2_LGC = ? \n"
. " AND ci.COI_SN in(1, 2, 19, 22, 24, 27, 28, 29, 30, 31, 35, 562, 591, 517)";
. " ci2.COI2_Country \n"
. "FROM COuntryInfo ci \n"
. " INNER JOIN COuntryInfo2 ci2 ON ci2.COI2_COI_SN = ci.COI_SN \n"
. "WHERE ci2.COI2_LGC = ? \n"
. " AND ci.COI_SN in(1, 2, 19, 22, 24, 27, 28, 29, 30, 31, 35, 562, 591)";
$query = $this->HT->query($sql, array($this->config->item('site_lgc')));
return $query->result();
}
function get_country_list_for_site($country_list)
{
$sql = "SELECT ci.COI_SN, \n"
. " ci2.COI2_Country \n"
. "FROM COuntryInfo ci \n"
. " INNER JOIN COuntryInfo2 ci2 ON ci2.COI2_COI_SN = ci.COI_SN \n"
. "WHERE ci2.COI2_LGC = ? \n"
. " AND ci.COI_SN in($country_list)";
. " ci2.COI2_Country \n"
. "FROM COuntryInfo ci \n"
. " INNER JOIN COuntryInfo2 ci2 ON ci2.COI2_COI_SN = ci.COI_SN \n"
. "WHERE ci2.COI2_LGC = ? \n"
. " AND ci.COI_SN in($country_list)";
$query = $this->HT->query($sql, array($this->config->item('site_lgc')));
return $query->result();
}
@ -152,46 +161,48 @@ class Area_model extends CI_Model
//根据区域类型和ID获取区域名称
function get_area_name($ht_area_type, $ht_area_id)
{
switch ($ht_area_type) {
case 'c': //城市
switch ($ht_area_type)
{
case 'c'://城市
$area = $this->get_city($ht_area_id);
return $area ? $area->CII2_Name : false;
break;
case 'p': //省份
case 'p'://省份
$area = $this->get_province($ht_area_id);
return $area ? $area->PRI2_Name : false;
break;
case 'n': //国家
case 'n'://国家
$area = $this->get_country($ht_area_id);
return $area ? $area->COI2_Country : false;
break;
case 't': //特殊区域
case 't'://特殊区域
break;
case 's': //大洲
break;
case 'z': //公民游
case 's'://大洲
break;
case 'z'://公民游
break;
default:
break;
}
return false;
}
//获取最后编辑信息的50个城市
function get_last_edit_city()
{
$sql = "SELECT DISTINCT TOP 30 ci2.CII2_CII_SN, \n"
. " ci2.CII2_Name \n"
. "FROM CItyInfo2 ci2 \n"
. "WHERE ci2.CII2_LGC = ? \n"
. " AND ci2.CII2_CII_SN IN (SELECT TOP 1000 ic.ic_ht_area_id \n"
. " FROM infoContents ic \n"
. " WHERE ic_ht_area_type = 'c' \n"
. " ORDER BY \n"
. " ic.ic_datetime DESC) \n"
. "ORDER BY \n"
. " ci2.CII2_CII_SN ASC";
$query = $this->HT->query($sql, array($this->config->item('site_lgc')));
return $query->result();
}
//获取最后编辑信息的50个城市
function get_last_edit_city()
{
$sql = "SELECT DISTINCT TOP 30 ci2.CII2_CII_SN, \n"
. " ci2.CII2_Name \n"
. "FROM CItyInfo2 ci2 \n"
. "WHERE ci2.CII2_LGC = ? \n"
. " AND ci2.CII2_CII_SN IN (SELECT TOP 1000 ic.ic_ht_area_id \n"
. " FROM infoContents ic \n"
. " WHERE ic_ht_area_type = 'c' \n"
. " ORDER BY \n"
. " ic.ic_datetime DESC) \n"
. "ORDER BY \n"
. " ci2.CII2_CII_SN ASC";
$query=$this->HT->query($sql,array($this->config->item('site_lgc')));
return $query->result();
}
}

@ -1,255 +0,0 @@
<?php
class Feedback_model extends CI_Model {
function __construct() {
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
}
/**
* 返回最新反馈信息,默认 20条
*/
function get_feedback_newest($row_limit = 20) {
$total_limit = $row_limit * 2;
$feedback_query =
$this->HT->query("
select top ?
tad_content, tai_customerid, tai_title, tai_getdate, tai_url
from Eva_TAInfo tai
left join Eva_TADetail on TAD_TAI_SN=TAI_SN
left join Eva_TAGuidePrize tgp on tgp.TGP_TAI_SN = tai.TAI_SN
where TAD_Content is not null
and isnull(TAI_DeleteFlag,0) = 0 and isnull(tgp.TGP_CheckState, 0) = 136002
order by tai_getdate desc", $total_limit);
$feedback_result = $feedback_query->result();
$feedback_list = [];
$customer_id_list = [];
foreach ($feedback_result as $feedback_row) {
$createdOn = new DateTime($feedback_row->tai_getdate);
$createdOnString = $createdOn->format('M Y');
$feedback_count = COUNT($feedback_list);
if (!in_array($feedback_row->tai_customerid, $customer_id_list) && $feedback_count < $row_limit) {
$feedback = [
'title' => $feedback_row->tai_title,
'customer' => $feedback_row->tai_customerid,
'content' => $feedback_row->tad_content,
'url' => $feedback_row->tai_url,
'createdOn' => $createdOnString
];
$feedback_list[] = $feedback;
$customer_id_list[] = $feedback_row->tai_customerid;
}
}
return $feedback_list;
}
function test_feedback_newest() {
$feedback_query =
$this->HT->query("
select top 40
tad_content, tai_customerid, tai_title, tai_getdate, tai_url
from Eva_TAInfo tai
left join Eva_TADetail on TAD_TAI_SN=TAI_SN
left join Eva_TAGuidePrize tgp on tgp.TGP_TAI_SN = tai.TAI_SN
where TAD_Content is not null
and isnull(TAI_DeleteFlag,0) = 0 and isnull(tgp.TGP_CheckState, 0) = 136002
order by tai_getdate desc");
$feedback_result = $feedback_query->result();
$feedback_list = [];
$customer_id_list = [];
foreach ($feedback_result as $feedback_row) {
$createdOn = new DateTime($feedback_row->tai_getdate);
$createdOnString = $createdOn->format('M Y');
$feedback_count = COUNT($feedback_list);
if (!in_array($feedback_row->tai_customerid, $customer_id_list) && $feedback_count < 20) {
$feedback = [
'title' => $feedback_row->tai_title,
'customer' => $feedback_row->tai_customerid,
// 'content' => $feedback_row->tad_content,
'url' => $feedback_row->tai_url,
'createdOn' => $createdOnString
];
$feedback_list[] = $feedback;
$customer_id_list[] = $feedback_row->tai_customerid;
}
}
return $feedback_list;
}
/**
* 根据城市英文名查找最新八条反馈信息
*/
function get_feedback_by_city_list($city_name_list) {
$feedback_query =
$this->HT->query("
select top 40
tad_content, tai_customerid, tai_title, tai_getdate, tai_url, vci.cii2_name
from Eva_TAInfo
left join Eva_TADetail on TAD_TAI_SN=TAI_SN
left join V_CIty_Info vci on vci.cii_sn = tai_cii_sn and vci.LGC_LGC = 1
where TAD_Content is not null and vci.cii2_name = ?
order by tai_getdate desc",
array($city_name_list[0]));
$first_city_num = $feedback_query->num_rows();
$feedback_result = $feedback_query->result();
$feedback_list = [];
$customer_id_list = [];
foreach ($feedback_result as $feedback_row) {
$createdOn = new DateTime($feedback_row->tai_getdate);
$createdOnString = $createdOn->format('M Y');
$feedback_count = COUNT($feedback_list);
if (!in_array($feedback_row->tai_customerid, $customer_id_list) && $feedback_count < 20) {
$feedback = [
'title' => $feedback_row->tai_title,
'customer' => $feedback_row->tai_customerid,
'content' => $feedback_row->tad_content,
'url' => $feedback_row->tai_url,
'createdOn' => $createdOnString
];
$feedback_list[] = $feedback;
$customer_id_list[] = $feedback_row->tai_customerid;
}
}
$enough_count = 40 - $first_city_num;
if ($enough_count > 0 && count($city_name_list) > 1) {
$feedback_query =
$this->HT->query("
select top ?
tad_content, tai_customerid, tai_title, tai_getdate, tai_url, vci.cii2_name
from Eva_TAInfo
left join Eva_TADetail on TAD_TAI_SN=TAI_SN
left join V_CIty_Info vci on vci.cii_sn = tai_cii_sn and vci.LGC_LGC = 1
where TAD_Content is not null and vci.cii2_name = ?
order by tai_getdate desc",
array($enough_count, $city_name_list[1]));
$feedback_result = $feedback_query->result();
foreach ($feedback_result as $feedback_row) {
$createdOn = new DateTime($feedback_row->tai_getdate);
$createdOnString = $createdOn->format('M Y');
$feedback_count = COUNT($feedback_list);
if (!in_array($feedback_row->tai_customerid, $customer_id_list) && $feedback_count < 20) {
$feedback = [
'title' => $feedback_row->tai_title,
'customer' => $feedback_row->tai_customerid,
'content' => $feedback_row->tad_content,
'url' => $feedback_row->tai_url,
'createdOn' => $createdOnString
];
$feedback_list[] = $feedback;
$customer_id_list[] = $feedback_row->tai_customerid;
}
}
}
return $feedback_list;
}
/**
* 根据城市英文名查找反馈信息
*/
function get_feedback_by_city_name($city_name, $top = 30) {
$feedback_query =
$this->HT->query("
select top ?
tad_content, tai_customerid, tai_title, tai_getdate, tai_url, vci.cii2_name
from Eva_TAInfo
left join Eva_TADetail on TAD_TAI_SN=TAI_SN
left join V_CIty_Info vci on vci.cii_sn = tai_cii_sn and vci.LGC_LGC = 1
where TAD_Content is not null and vci.cii2_name = ?
order by tai_getdate desc",
array($top, $city_name));
$feedback_result = $feedback_query->result();
$feedback_list = [];
$customer_id_list = [];
foreach ($feedback_result as $feedback_row) {
$createdOn = new DateTime($feedback_row->tai_getdate);
$createdOnString = $createdOn->format('M Y');
if (!in_array($feedback_row->tai_customerid, $customer_id_list)) {
$feedback = [
'title' => $feedback_row->tai_title,
'customer' => $feedback_row->tai_customerid,
'content' => $feedback_row->tad_content,
'url' => $feedback_row->tai_url,
'createdOn' => $createdOnString
];
$feedback_list[] = $feedback;
$customer_id_list[] = $feedback_row->tai_customerid;
}
}
return $feedback_list;
}
/**
* 根据顾问英文名查找反馈信息
*/
function get_feedback_by_advisor_name($advisor_name) {
$feedback_query =
$this->HT->query("
select top 3
tad.tad_content,
tai.tai_customerid,
tai.tai_title,
tai.tai_getdate,
tai.tai_url,
vci.cii2_name
from Eva_TAInfo tai
join Eva_TADetail tad on tad.TAD_TAI_SN = tai.TAI_SN
join V_CIty_Info vci on vci.cii_sn = tai.tai_cii_sn and vci.LGC_LGC = 1
where tad.TAD_SN in (
select TAD_SN
from Eva_TADetail e
join V_Operator_Info v on e.TAD_ObjList like '%,' + cast(v.OPI_SN as varchar) + ',%'
where e.TAD_ObjType = 99002
and v.LGC_LGC = 1
and v.OPI2_Name = ?
)
order by tai.tai_getdate desc;
",
array($advisor_name));
$feedback_result = $feedback_query->result();
$feedback_list = [];
$customer_id_list = [];
foreach ($feedback_result as $feedback_row) {
$createdOn = new DateTime($feedback_row->tai_getdate);
$createdOnString = $createdOn->format('M Y');
if (!in_array($feedback_row->tai_customerid, $customer_id_list)) {
$feedback = [
'title' => $feedback_row->tai_title,
'customer' => $feedback_row->tai_customerid,
'content' => $feedback_row->tad_content,
'url' => $feedback_row->tai_url,
'createdOn' => $createdOnString
];
$feedback_list[] = $feedback;
$customer_id_list[] = $feedback_row->tai_customerid;
}
}
return $feedback_list;
}
}

@ -11,8 +11,7 @@ class InfoBokunData_model extends CI_Model {
public function __construct()
{
parent::__construct();
//$this->HT = $this->load->database('HT', TRUE);
$this->HT = $this->load->database('INFORMATION', TRUE);
$this->HT = $this->load->database('HT', TRUE);
}
var $ibd_ic_id;

@ -8,280 +8,86 @@ class InfoContents_model extends CI_Model
function __construct()
{
parent::__construct();
$this->HT = $this->load->database('INFORMATION', TRUE);
$this->HT = $this->load->database('HT', TRUE);
}
public function add_use_ORM($table, $data)
function Add($ic_url, $ic_url_title, $ic_type, $ic_title, $ic_content, $ic_summary, $ic_seo_title, $ic_seo_description, $ic_seo_keywords,
$ic_show_bread_crumbs, $ic_status, $ic_template, $ic_photo, $ic_photo_width, $ic_photo_height, $ic_recommend_tours, $ic_recommend_packages,
$ic_ht_area_id, $ic_ht_area_type, $ic_ht_product_id, $ic_ht_product_type,$ic_author)
{
if ($this->HT->insert($table, $data)) {
return $this->HT->last_id($table);
} else {
return false;
}
}
public function update_use_ORM($table, $data, $where)
{
$this->HT->update($table, $data, $where);
}
function Add(
$ic_url,
$ic_url_title,
$ic_type,
$ic_title,
$ic_content,
$ic_summary,
$ic_seo_title,
$ic_seo_description,
$ic_seo_keywords,
$ic_show_bread_crumbs,
$ic_status,
$ic_template,
$ic_photo,
$ic_photo_width,
$ic_photo_height,
$ic_recommend_tours,
$ic_recommend_packages,
$ic_ht_area_id,
$ic_ht_area_type,
$ic_ht_product_id,
$ic_ht_product_type,
$ic_author
) {
$ic_content = str_replace('http:' . $this->config->item('site_image_url'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url_remote2'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url_org'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url2'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url_remote'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url3'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url_org2'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace('#textarea#', 'textarea', $ic_content);
$ic_content = str_replace('t_e_x_t_a_r_e_a', 'textarea', $ic_content);
$sql = "INSERT INTO infoContents \n"
. " ( \n"
. " ic_url, ic_url_title, ic_type, ic_title, ic_content, ic_summary, ic_seo_title, \n"
. " ic_seo_description, ic_seo_keywords, ic_show_bread_crumbs, ic_status, \n"
. " ic_template, ic_photo,ic_photo_width,ic_photo_height, ic_sitecode, ic_recommend_tours, ic_recommend_packages, \n"
. " ic_ht_area_id, ic_ht_area_type,ic_ht_product_id,ic_ht_product_type,ic_author, ic_datetime \n"
. " ) \n"
. "VALUES \n"
. " ( N?,N?,?,N?,N?,N?,N?,N?,N?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,getdate() )";
$query = $this->HT->query(
$sql,
array(
$ic_url,
$ic_url_title,
$ic_type,
$ic_title,
str_replace(
$this->config->item('media_image_url'),
$this->config->item('site_image_url'),
$ic_content
),
$ic_summary,
$ic_seo_title,
$ic_seo_description,
$ic_seo_keywords,
$ic_show_bread_crumbs,
$ic_status,
$ic_template,
$ic_photo,
$ic_photo_width,
$ic_photo_height,
$this->config->item('site_code'),
$ic_recommend_tours,
$ic_recommend_packages,
$ic_ht_area_id,
$ic_ht_area_type,
$ic_ht_product_id,
$ic_ht_product_type,
$ic_author
)
);
$this->insert_id = $this->HT->last_id('infoContents');
return $query;
}
function Add_with_sitecode(
$ic_url,
$ic_url_title,
$ic_type,
$ic_title,
$ic_content,
$ic_summary,
$ic_seo_title,
$ic_seo_description,
$ic_seo_keywords,
$ic_show_bread_crumbs,
$ic_status,
$ic_template,
$ic_photo,
$ic_photo_width,
$ic_photo_height,
$ic_recommend_tours,
$ic_recommend_packages,
$ic_ht_area_id,
$ic_ht_area_type,
$ic_ht_product_id,
$ic_ht_product_type,
$ic_author,
$site_code = ''
) {
if (empty($site_code)) {
$site_code = $this->config->item('site_code');
}
$ic_content = str_replace('http:' . $this->config->item('site_image_url'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url_remote2'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url_org'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url2'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url_remote'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url3'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url_org2'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace('#textarea#', 'textarea', $ic_content);
$ic_content = str_replace('t_e_x_t_a_r_e_a', 'textarea', $ic_content);
$ic_content=str_replace('http:'.$this->config->item('site_image_url'), $this->config->item('site_image_url'),$ic_content);
$ic_content=str_replace($this->config->item('media_image_url_remote2'), $this->config->item('site_image_url'),$ic_content);
$ic_content=str_replace($this->config->item('media_image_url_org'), $this->config->item('site_image_url'),$ic_content);
$ic_content=str_replace($this->config->item('media_image_url'), $this->config->item('site_image_url'),$ic_content);
$ic_content=str_replace($this->config->item('media_image_url2'), $this->config->item('site_image_url'),$ic_content);
$ic_content=str_replace($this->config->item('media_image_url_remote'), $this->config->item('site_image_url'),$ic_content);
$ic_content=str_replace($this->config->item('media_image_url3'), $this->config->item('site_image_url'),$ic_content);
$ic_content=str_replace($this->config->item('media_image_url_org2'), $this->config->item('site_image_url'),$ic_content);
$ic_content=str_replace('#textarea#', 'textarea',$ic_content);
$sql = "INSERT INTO infoContents \n"
. " ( \n"
. " ic_url, ic_url_title, ic_type, ic_title, ic_content, ic_summary, ic_seo_title, \n"
. " ic_seo_description, ic_seo_keywords, ic_show_bread_crumbs, ic_status, \n"
. " ic_template, ic_photo,ic_photo_width,ic_photo_height, ic_sitecode, ic_recommend_tours, ic_recommend_packages, \n"
. " ic_ht_area_id, ic_ht_area_type,ic_ht_product_id,ic_ht_product_type,ic_author, ic_datetime \n"
. " ) \n"
. "VALUES \n"
. " ( N?,N?,?,N?,N?,N?,N?,N?,N?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,getdate() )";
$query = $this->HT->query(
$sql,
array(
$ic_url,
$ic_url_title,
$ic_type,
$ic_title,
str_replace(
$this->config->item('media_image_url'),
$this->config->item('site_image_url'),
$ic_content
),
$ic_summary,
$ic_seo_title,
$ic_seo_description,
$ic_seo_keywords,
$ic_show_bread_crumbs,
$ic_status,
$ic_template,
$ic_photo,
$ic_photo_width,
$ic_photo_height,
$site_code,
$ic_recommend_tours,
$ic_recommend_packages,
$ic_ht_area_id,
$ic_ht_area_type,
$ic_ht_product_id,
$ic_ht_product_type,
$ic_author
)
);
. " ( \n"
. " ic_url, ic_url_title, ic_type, ic_title, ic_content, ic_summary, ic_seo_title, \n"
. " ic_seo_description, ic_seo_keywords, ic_show_bread_crumbs, ic_status, \n"
. " ic_template, ic_photo,ic_photo_width,ic_photo_height, ic_sitecode, ic_recommend_tours, ic_recommend_packages, \n"
. " ic_ht_area_id, ic_ht_area_type,ic_ht_product_id,ic_ht_product_type,ic_author, ic_datetime \n"
. " ) \n"
. "VALUES \n"
. " ( N?,N?,?,N?,N?,N?,N?,N?,N?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,getdate() )";
$query = $this->HT->query($sql,
array($ic_url, $ic_url_title, $ic_type, $ic_title, str_replace($this->config->item('media_image_url'), $this->config->item('site_image_url'),
$ic_content),
$ic_summary, $ic_seo_title, $ic_seo_description, $ic_seo_keywords, $ic_show_bread_crumbs, $ic_status,
$ic_template, $ic_photo, $ic_photo_width, $ic_photo_height, $this->config->item('site_code'), $ic_recommend_tours, $ic_recommend_packages,
$ic_ht_area_id, $ic_ht_area_type, $ic_ht_product_id, $ic_ht_product_type,$ic_author));
$this->insert_id = $this->HT->last_id('infoContents');
return $query;
}
function Update(
$ic_id,
$ic_url,
$ic_url_title,
$ic_type,
$ic_title,
$ic_content,
$ic_summary,
$ic_seo_title,
$ic_seo_description,
$ic_seo_keywords,
$ic_show_bread_crumbs,
$ic_status,
$ic_template,
$ic_photo,
$ic_photo_width,
$ic_photo_height,
$ic_recommend_tours,
$ic_recommend_packages,
$ic_ht_area_id,
$ic_ht_area_type,
$ic_ht_product_id,
$ic_ht_product_type,
$ic_author
) {
$ic_content = str_replace('http:' . $this->config->item('site_image_url'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url2'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url_org'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url_remote'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url_remote2'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url3'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace($this->config->item('media_image_url_org2'), $this->config->item('site_image_url'), $ic_content);
$ic_content = str_replace('#textarea#', 'textarea', $ic_content);
$ic_content = str_replace('t_e_x_t_a_r_e_a', 'textarea', $ic_content);
function Update($ic_id, $ic_url, $ic_url_title, $ic_type, $ic_title, $ic_content, $ic_summary, $ic_seo_title, $ic_seo_description, $ic_seo_keywords,
$ic_show_bread_crumbs, $ic_status, $ic_template, $ic_photo, $ic_photo_width, $ic_photo_height, $ic_recommend_tours, $ic_recommend_packages,
$ic_ht_area_id, $ic_ht_area_type, $ic_ht_product_id, $ic_ht_product_type,$ic_author)
{
$ic_content=str_replace('http:'.$this->config->item('site_image_url'), $this->config->item('site_image_url'),$ic_content);
$ic_content=str_replace($this->config->item('media_image_url'), $this->config->item('site_image_url'),$ic_content);
$ic_content=str_replace($this->config->item('media_image_url2'), $this->config->item('site_image_url'),$ic_content);
$ic_content=str_replace($this->config->item('media_image_url_org'), $this->config->item('site_image_url'),$ic_content);
$ic_content=str_replace($this->config->item('media_image_url_remote'), $this->config->item('site_image_url'),$ic_content);
$ic_content=str_replace($this->config->item('media_image_url_remote2'), $this->config->item('site_image_url'),$ic_content);
$sql = "UPDATE infoContents \n"
. "SET ic_url = N?, \n"
. " ic_url_title = N?, \n"
. " ic_type = ?, \n"
. " ic_title = N?, \n"
. " ic_content = N?, \n"
. " ic_summary = N?, \n"
. " ic_seo_title = N?, \n"
. " ic_seo_description = N?, \n"
. " ic_seo_keywords = N?, \n"
. " ic_show_bread_crumbs = ?, \n"
. " ic_status = ?, \n"
. " ic_template = ?, \n"
. " ic_photo = ?, \n"
. " ic_photo_width = ?, \n"
. " ic_photo_height = ?, \n"
. " ic_recommend_tours = ?, \n"
. " ic_recommend_packages = ?, \n"
. " ic_datetime = GETDATE() , \n"
. " ic_ht_area_id = ?, \n"
. " ic_ht_area_type = ?, \n"
. " ic_ht_product_id = ?, \n"
. " ic_ht_product_type = ?, \n"
. " ic_author = ? \n"
. "WHERE ic_id = ? \n"
. "AND ic_sitecode = ? ";
$query = $this->HT->query(
$sql,
array(
$ic_url,
$ic_url_title,
$ic_type,
$ic_title,
$ic_content,
$ic_summary,
$ic_seo_title,
$ic_seo_description,
$ic_seo_keywords,
$ic_show_bread_crumbs,
$ic_status,
$ic_template,
$ic_photo,
$ic_photo_width,
$ic_photo_height,
$ic_recommend_tours,
$ic_recommend_packages,
$ic_ht_area_id,
$ic_ht_area_type,
$ic_ht_product_id,
$ic_ht_product_type,
$ic_author,
$ic_id,
$this->config->item('site_code')
)
);
. "SET ic_url = N?, \n"
. " ic_url_title = N?, \n"
. " ic_type = ?, \n"
. " ic_title = N?, \n"
. " ic_content = N?, \n"
. " ic_summary = N?, \n"
. " ic_seo_title = N?, \n"
. " ic_seo_description = N?, \n"
. " ic_seo_keywords = N?, \n"
. " ic_show_bread_crumbs = ?, \n"
. " ic_status = ?, \n"
. " ic_template = ?, \n"
. " ic_photo = ?, \n"
. " ic_photo_width = ?, \n"
. " ic_photo_height = ?, \n"
. " ic_recommend_tours = ?, \n"
. " ic_recommend_packages = ?, \n"
. " ic_datetime = GETDATE() , \n"
. " ic_ht_area_id = ?, \n"
. " ic_ht_area_type = ?, \n"
. " ic_ht_product_id = ?, \n"
. " ic_ht_product_type = ?, \n"
. " ic_author = ? \n"
. "WHERE ic_id = ? \n"
. "AND ic_sitecode = ? ";
$query = $this->HT->query($sql,
array($ic_url, $ic_url_title, $ic_type, $ic_title, $ic_content, $ic_summary,
$ic_seo_title, $ic_seo_description, $ic_seo_keywords, $ic_show_bread_crumbs, $ic_status, $ic_template, $ic_photo, $ic_photo_width, $ic_photo_height,
$ic_recommend_tours, $ic_recommend_packages, $ic_ht_area_id,
$ic_ht_area_type, $ic_ht_product_id, $ic_ht_product_type,$ic_author, $ic_id,$this->config->item('site_code')));
return $query;
}
//强制更新信息
//删除信息
function force_update($ic_id, $ic_content)
{
$sql = "UPDATE infoContents SET ic_content = N? WHERE ic_id = ?";
@ -289,109 +95,74 @@ class InfoContents_model extends CI_Model
return $query;
}
//强制更新信息
function force_update_url($ic_id, $ic_url)
{
$sql = "UPDATE infoContents SET ic_url = N? WHERE ic_id = ?";
$query = $this->HT->query($sql, array($ic_url, $ic_id));
return $query;
}
//删除信息
function Delete($ic_id)
{
$sql = "DELETE \n"
. "FROM infoContents \n"
. "WHERE ic_id = ?";
. "FROM infoContents \n"
. "WHERE ic_id = ?";
$query = $this->HT->query($sql, array($ic_id));
return $query;
}
//递增浏览量
function inc_views($sitecode, $page_url)
{
//查询信息需要过滤url上的域名
if ($page_url && $sitecode) {
$page_url = substr($page_url, strpos($page_url, '/', 8)); //过滤掉url前面的http://
$sql = "UPDATE infoContents \n"
. "SET ic_view = ISNULL(ic_view,0) + 1 \n"
. "WHERE ic_sitecode = ? AND ic_url = N?";
return $this->HT->query($sql, array($sitecode, $page_url));
}
}
//递增浏览量
function inc_views($sitecode,$page_url)
{
//查询信息需要过滤url上的域名
if($page_url && $sitecode)
{
$page_url=substr($page_url,strpos($page_url,'/',8));//过滤掉url前面的http://
$sql = "UPDATE infoContents \n"
. "SET ic_view = ISNULL(ic_view,0) + 1 \n"
. "WHERE ic_sitecode = ? AND ic_url = N?";
return $this->HT->query($sql,array($sitecode,$page_url));
}
}
public function get_ic_contents($ic_id)
{
$sql = "SELECT top 1 ic_id from infoContents where ic_id=?";
$query = $this->HT->query($sql, array($ic_id));
if ($query->result()) {
$sql="SELECT top 1 ic_id from infoContents where ic_id=?";
$query=$this->HT->query($sql,array($ic_id));
if ($query->result())
{
$row = $query->row();
return $row;
} else {
}
else
{
return FALSE;
}
}
public function get_ic_contents2($ic_id)
{
$sql = "SELECT top 1 * from infoContents where ic_id=?";
$query = $this->HT->query($sql, array($ic_id));
if ($query->result()) {
$sql="SELECT top 1 ic_id, ic_content, ic_title, ic_url, ic_photo, ic_sitecode, ic_seo_description from infoContents where ic_id=?";
$query=$this->HT->query($sql,array($ic_id));
if ($query->result())
{
$row = $query->row();
return $row;
} else {
return FALSE;
}
}
public function get_ic_contents2_gm($ic_id)
{
$sql = "SELECT top 1 * from information_gm.dbo.infoContents where ic_id=?";
$query = $this->HT->query($sql, array($ic_id));
if ($query->result()) {
$row = $query->row();
return $row;
} else {
else
{
return FALSE;
}
}
public function get_ic_contents_by_list($ic_id_list)
{
$ic_id_list = trim($ic_id_list);
$ic_id_list .= 0;
$sql = "SELECT * from infoContents where ic_id in ($ic_id_list) order by charindex(','+ltrim(ic_id)+',', ',$ic_id_list,')";
$query = $this->HT->query($sql);
if ($query->result()) {
$ic_id_list=trim($ic_id_list);
$ic_id_list.=0;
$sql="SELECT * from infoContents where ic_id in ($ic_id_list) order by charindex(','+ltrim(ic_id)+',', ',$ic_id_list,')";
$query=$this->HT->query($sql);
if ($query->result())
{
$row = $query->result();
return $row;
} else {
}
else
{
return FALSE;
}
}
public function list_use_hb($site)
{
$sql = "
SELECT c.ic_id, c.ic_url
FROM infoContents c
INNER JOIN infoMetas m
ON c.ic_id = m.im_ic_id
WHERE m.im_key = 'AMP_BODY_PC_STATUS'
AND CONVERT(nvarchar(max), m.im_value) = 'yes'
AND c.ic_sitecode = ?
";
$query = $this->HT->query($sql, array($site));
return $query->result();
}
public function get_isid_by_icid($ic_id)
{
$sql = "
select is_id from infoStructures s
where s.is_ic_id=?
";
$query = $this->HT->query($sql, array($ic_id));
return $query->row();
}
}
}

@ -1,29 +1,25 @@
<?php
class InfoMetas_model extends CI_Model
{
class InfoMetas_model extends CI_Model {
function __construct()
{
function __construct() {
parent::__construct();
$this->HT = $this->load->database('INFORMATION', TRUE);
$this->HT = $this->load->database('HT', TRUE);
}
function add($im_ic_id, $im_key, $im_value)
{
function add($im_ic_id, $im_key, $im_value) {
$sql = "INSERT INTO infoMetas \n"
. " ( \n"
. " im_ic_id, im_key, im_value \n"
. " ) \n"
. "VALUES \n"
. " ( \n"
. " ?, ?, N? \n"
. " )";
return $this->HT->query($sql, array($im_ic_id, $im_key, (string) $im_value));
. " ( \n"
. " im_ic_id, im_key, im_value \n"
. " ) \n"
. "VALUES \n"
. " ( \n"
. " ?, ?, N? \n"
. " )";
return $this->HT->query($sql, array($im_ic_id, $im_key, (string)$im_value));
}
function get_list($im_ic_id, $im_key)
{
function get_list($im_ic_id, $im_key) {
$sql = "
SELECT im.im_id
,im.im_ic_id
@ -37,9 +33,8 @@ class InfoMetas_model extends CI_Model
$query = $this->HT->query($sql, array($im_ic_id, $im_key));
return $query->result();
}
function get_list_by_key($im_ic_id, $im_key)
{
function get_list_by_key($im_key) {
$sql = "
SELECT im.im_id
,im.im_ic_id
@ -55,8 +50,7 @@ class InfoMetas_model extends CI_Model
}
//列表所有含AMPmeta的信息。
public function list_amp($site_code)
{
public function list_amp($site_code) {
$sql = "
SELECT im.im_id
,im.im_ic_id
@ -80,8 +74,7 @@ class InfoMetas_model extends CI_Model
}
//列表所有不含AMPmeta的信息。
public function list_no_amp($site_code)
{
public function list_no_amp($site_code) {
$sql = "
SELECT c0.ic_id, c0.ic_url
FROM infoContents c0
@ -113,8 +106,7 @@ class InfoMetas_model extends CI_Model
}
//按节点列表信息含meta数据
function list_info_by_path_with_meta($is_path, $site_code)
{
function list_info_by_path_with_meta($is_path, $site_code) {
$sql = "SELECT is1.is_id, \n"
. " is1.is_path, \n"
. " ic.ic_id, \n"
@ -138,26 +130,11 @@ class InfoMetas_model extends CI_Model
return $query->result();
}
function get($im_ic_id, $im_key)
{
$sql = "SELECT im.im_value \n"
. "FROM infoMetas im \n"
. "WHERE im.im_ic_id = ? \n"
. " AND im.im_key = ?";
$query = $this->HT->query($sql, array($im_ic_id, $im_key));
if ($query->num_rows() > 0) {
return $query->row()->im_value;
} else {
return false;
}
}
function get_gm($im_ic_id, $im_key)
{
function get($im_ic_id, $im_key) {
$sql = "SELECT im.im_value \n"
. "FROM information_gm.dbo.infoMetas im \n"
. "WHERE im.im_ic_id = ? \n"
. " AND im.im_key = ?";
. "FROM infoMetas im \n"
. "WHERE im.im_ic_id = ? \n"
. " AND im.im_key = ?";
$query = $this->HT->query($sql, array($im_ic_id, $im_key));
if ($query->num_rows() > 0) {
return $query->row()->im_value;
@ -166,19 +143,17 @@ class InfoMetas_model extends CI_Model
}
}
function detail($im_ic_id, $im_key)
{
function detail($im_ic_id, $im_key) {
$sql = "SELECT im.im_value \n"
. "FROM infoMetas im \n"
. "WHERE im.im_ic_id = ? \n"
. " AND im.im_key = ? ORDER BY im.im_id asc";
. "FROM infoMetas im \n"
. "WHERE im.im_ic_id = ? \n"
. " AND im.im_key = ? ORDER BY im.im_id asc";
$query = $this->HT->query($sql, array($im_ic_id, $im_key));
return $query->result();
}
//获取未收录的信息
public function get_unembody_content($datetime, $top_num = 1)
{
public function get_unembody_content($datetime, $top_num = 1) {
$sql = " SELECT TOP $top_num
im_ic_id,
im_value,
@ -197,37 +172,33 @@ class InfoMetas_model extends CI_Model
return $query->result();
}
function update($im_ic_id, $im_key, $im_value)
{
function update($im_ic_id, $im_key, $im_value) {
$sql = "UPDATE infoMetas \n"
. "SET im_value = N? \n"
. "WHERE im_ic_id = ? \n"
. " AND im_key = ?";
return $this->HT->query($sql, array((string) $im_value, $im_ic_id, $im_key));
. "SET im_value = N? \n"
. "WHERE im_ic_id = ? \n"
. " AND im_key = ?";
return $this->HT->query($sql, array((string)$im_value, $im_ic_id, $im_key));
}
function delete($im_ic_id, $im_key)
{
function delete($im_ic_id, $im_key) {
$sql = "DELETE \n"
. "FROM infoMetas \n"
. "WHERE im_ic_id = ? \n"
. " AND im_key = ?";
. "FROM infoMetas \n"
. "WHERE im_ic_id = ? \n"
. " AND im_key = ?";
return $this->HT->query($sql, array($im_ic_id, $im_key));
}
function update_by_id($im_id, $im_value)
{
function update_by_id($im_id, $im_value) {
$sql = "UPDATE infoMetas \n"
. "SET im_value = N? \n"
. "WHERE im_id = ? \n";
. "SET im_value = N? \n"
. "WHERE im_id = ? \n";
return $this->HT->query($sql, array($im_value, $im_id));
}
function delete_by_id($im_id)
{
function delete_by_id($im_id) {
$sql = "DELETE \n"
. "FROM infoMetas \n"
. "WHERE im_id = ? \n";
. "FROM infoMetas \n"
. "WHERE im_id = ? \n";
return $this->HT->query($sql, array($im_id));
}

@ -37,23 +37,17 @@ class InfoSMS_model extends CI_Model
//设置已读
function readed($m_id)
{
/* 不再使用注释-lmr
$sql = "UPDATE infosms \n"
. "SET m_readed = 1 \n"
. "WHERE m_id = ?";
return $this->HT->query($sql,array($m_id));
*/
return array();
}
function readed_for_info($m_object_id,$m_object_type='info')
{
/* 不再使用注释-lmr
$sql = "UPDATE infosms \n"
. "SET m_readed = 1 \n"
. "WHERE m_object_type=? and m_object_id = ?";
return $this->HT->query($sql,array($m_object_type,$m_object_id));
*/
return array();
}
//获取未读消息

@ -8,157 +8,103 @@ class InfoStructures_model extends CI_Model
function __construct()
{
parent::__construct();
$this->HT = $this->load->database('INFORMATION', TRUE);
$this->HT = $this->load->database('HT', TRUE);
}
function Detail($is_id)
{
$sql = "SELECT TOP 1 is1.is_id, \n"
. " is1.is_parent_id, \n"
. " is1.is_path, \n"
. " is1.is_level, \n"
. " is1.is_sort, \n"
. " is1.is_sitecode, \n"
. " is1.is_datetime, \n"
. " is1.is_ic_id \n"
. "FROM infoStructures is1 \n"
. "WHERE is1.is_id = ?";
. " is1.is_parent_id, \n"
. " is1.is_path, \n"
. " is1.is_level, \n"
. " is1.is_sort, \n"
. " is1.is_sitecode, \n"
. " is1.is_datetime, \n"
. " is1.is_ic_id \n"
. "FROM infoStructures is1 \n"
. "WHERE is1.is_id = ?";
$query = $this->HT->query($sql, array($is_id));
//print_r($this->HT->queries);
if ($query->result()) {
if ($query->result())
{
$row = $query->row();
return $row;
} else {
return FALSE;
}
}
function Detail_gm($is_id)
{
$sql = "SELECT TOP 1 is1.is_id, \n"
. " is1.is_parent_id, \n"
. " is1.is_path, \n"
. " is1.is_level, \n"
. " is1.is_sort, \n"
. " is1.is_sitecode, \n"
. " is1.is_datetime, \n"
. " is1.is_ic_id \n"
. "FROM information_gm.dbo.infoStructures is1 \n"
. "WHERE is1.is_id = ?";
$query = $this->HT->query($sql, array($is_id));
//print_r($this->HT->queries);
if ($query->result()) {
$row = $query->row();
return $row;
} else {
else
{
return FALSE;
}
}
function Add($is_parent_id, $is_ic_id = -1, $is_sort = 999)
function Add($is_parent_id, $is_ic_id=-1)
{
if ($is_parent_id == 0) {
if ($is_parent_id == 0)
{
$is_path = '';
$is_level = 1;
} else if ($is_parent_id == -99) {
$is_path = '';
$is_level = 0;
$is_sort = 0;
} else {
$infoStructure = $this->Detail($is_parent_id);
if ($infoStructure) {
$is_path = $infoStructure->is_path;
$is_level = $infoStructure->is_level + 1;
} else {
return false;
}
$is_sort = 999;
}
$sql = "INSERT INTO infoStructures \n"
. " ( \n"
. " is_parent_id, is_path, is_level, is_sort, is_sitecode, is_datetime, is_ic_id \n"
. " ) \n"
. "VALUES \n"
. " ( \n"
. " ?, ?, ?, ?, ?, getdate(), ? \n"
. " )";
$query = $this->HT->query($sql, array($is_parent_id, $is_path, $is_level, $is_sort, $this->config->item('site_code'), $is_ic_id));
$this->insert_id = $this->HT->last_id('infoStructures');
//把自己的ID加到path上
$set_sql = "UPDATE infoStructures \n"
. "SET is_path = is_path + CONVERT(VARCHAR(200), is_id) + ',' \n"
. "WHERE is_id = ?";
$query = $this->HT->query($set_sql, array($this->insert_id));
return $this->insert_id;
}
function Add_with_sitecode($is_parent_id, $is_ic_id = -1, $is_sort = 999, $site_code = '')
{
if (empty ($site_code)) {
$site_code = $this->config->item('site_code');
}
if ($is_parent_id == 0) {
$is_path = '';
$is_level = 1;
} else if ($is_parent_id == -99) {
$is_path = '';
$is_level = 0;
$is_sort = 0;
} else {
else
{
$infoStructure = $this->Detail($is_parent_id);
if ($infoStructure) {
if ($infoStructure)
{
$is_path = $infoStructure->is_path;
$is_level = $infoStructure->is_level + 1;
} else {
$is_sort = 999;
}
else
{
return false;
}
}
$sql = "INSERT INTO infoStructures \n"
. " ( \n"
. " is_parent_id, is_path, is_level, is_sort, is_sitecode, is_datetime, is_ic_id \n"
. " ) \n"
. "VALUES \n"
. " ( \n"
. " ?, ?, ?, ?, ?, getdate(), ? \n"
. " )";
$query = $this->HT->query($sql, array($is_parent_id, $is_path, $is_level, $is_sort, $site_code, $is_ic_id));
. " ( \n"
. " is_parent_id, is_path, is_level, is_sort, is_sitecode, is_datetime, is_ic_id \n"
. " ) \n"
. "VALUES \n"
. " ( \n"
. " ?, ?, ?, ?, ?, getdate(), ? \n"
. " )";
$query = $this->HT->query($sql, array($is_parent_id, $is_path, $is_level, $is_sort, $this->config->item('site_code'), $is_ic_id));
$this->insert_id = $this->HT->last_id('infoStructures');
//把自己的ID加到path上
$set_sql = "UPDATE infoStructures \n"
. "SET is_path = is_path + CONVERT(VARCHAR(200), is_id) + ',' \n"
. "WHERE is_id = ?";
. "SET is_path = is_path + CONVERT(VARCHAR(200), is_id) + ',' \n"
. "WHERE is_id = ?";
$query = $this->HT->query($set_sql, array($this->insert_id));
return $this->insert_id;
}
function GetParent($is_path, $level = 1)
function GetParent($is_path, $level=1)
{
if ($is_path == '') {
if ($is_path == '')
{
return false;
}
$sql = "SELECT TOP 1 is1.is_id, \n"
. " is1.is_parent_id, \n"
. " is1.is_path, \n"
. " is1.is_level, \n"
. " is1.is_sort, \n"
. " is1.is_sitecode, \n"
. " is1.is_datetime, \n"
. " is1.is_ic_id \n"
. "FROM infoStructures is1 \n"
. "WHERE is1.is_level = ? \n"
. " AND is1.is_id IN ($is_path 0) \n"
. "ORDER BY \n"
. " is1.is_id ASC";
. " is1.is_parent_id, \n"
. " is1.is_path, \n"
. " is1.is_level, \n"
. " is1.is_sort, \n"
. " is1.is_sitecode, \n"
. " is1.is_datetime, \n"
. " is1.is_ic_id \n"
. "FROM infoStructures is1 \n"
. "WHERE is1.is_level = ? \n"
. " AND is1.is_id IN ($is_path 0) \n"
. "ORDER BY \n"
. " is1.is_id ASC";
$query = $this->HT->query($sql, array($level));
// print_r($this->HT->queries);
if ($query->result()) {
if ($query->result())
{
$row = $query->row();
return $row;
} else {
}
else
{
return FALSE;
}
}
@ -168,9 +114,12 @@ class InfoStructures_model extends CI_Model
{
$detail = $this->Detail($is_id);
$root = $this->GetParent($detail->is_path, 1);
if ($root) {
if ($root)
{
return $root;
} else { //没有根节点则返回本节点
}
else
{ //没有根节点则返回本节点
return $detail;
}
}
@ -179,12 +128,15 @@ class InfoStructures_model extends CI_Model
function HasChild($is_id)
{
$sql = "SELECT TOP 1 is1.is_id \n"
. "FROM infoStructures is1 \n"
. "WHERE is1.is_parent_id = ?";
. "FROM infoStructures is1 \n"
. "WHERE is1.is_parent_id = ?";
$query = $this->HT->query($sql, array($is_id));
if ($query->result()) {
if ($query->result())
{
return true;
} else {
}
else
{
return FALSE;
}
}
@ -193,8 +145,8 @@ class InfoStructures_model extends CI_Model
function Delete($is_id)
{
$sql = "DELETE \n"
. "FROM infoStructures \n"
. "WHERE is_id = ?";
. "FROM infoStructures \n"
. "WHERE is_id = ?";
$query = $this->HT->query($sql, array($is_id));
return $query;
}
@ -203,9 +155,9 @@ class InfoStructures_model extends CI_Model
function set_sort($is_id, $sort)
{
$sql = "UPDATE infoStructures \n"
. "SET is_datetime = GETDATE(), \n"
. " is_sort = ? \n"
. "WHERE is_id = ?";
. "SET is_datetime = GETDATE(), \n"
. " is_sort = ? \n"
. "WHERE is_id = ?";
$query = $this->HT->query($sql, array($sort, $is_id));
//print_r($this->HT->queries);
return $query;
@ -216,7 +168,8 @@ class InfoStructures_model extends CI_Model
{
$structure = $this->Detail($is_id);
//如果父级相同则不需要重新设置path
if ($parent_id == $structure->is_parent_id) {
if ($parent_id == $structure->is_parent_id)
{
return true;
}
$parent = $this->Detail($parent_id);
@ -226,66 +179,41 @@ class InfoStructures_model extends CI_Model
$set_path = $parent->is_path . $is_id . ',';
$set_sql = "UPDATE infoStructures \n"
. "SET is_parent_id = ?, \n"
. " is_level = ?, \n"
. " is_path = ? \n"
. "WHERE is_id = ?";
. "SET is_parent_id = ?, \n"
. " is_level = ?, \n"
. " is_path = ? \n"
. "WHERE is_id = ?";
$this->HT->query($set_sql, array($set_parent_id, $set_level, $set_path, $is_id));
$structure = $this->Detail($is_id);
//查询当前节点的所有子节点
$sql = "SELECT is1.is_id, \n"
. " is1.is_parent_id, \n"
. " is1.is_path, \n"
. " is1.is_level, \n"
. " is1.is_sort \n"
. "FROM infoStructures is1 \n"
. "WHERE ',' + is1.is_path LIKE '%,$structure->is_id,%' \n"
. "ORDER BY \n"
. " is1.is_level ASC ";
. " is1.is_parent_id, \n"
. " is1.is_path, \n"
. " is1.is_level, \n"
. " is1.is_sort \n"
. "FROM infoStructures is1 \n"
. "WHERE ',' + is1.is_path LIKE '%,$structure->is_id,%' \n"
. "ORDER BY \n"
. " is1.is_level ASC ";
$query = $this->HT->query($sql);
foreach ($query->result() as $item) {
if ($item->is_parent_id != $structure->is_id) {
foreach ($query->result() as $item)
{
if ($item->is_parent_id != $structure->is_id)
{
$structure = $this->Detail($item->is_parent_id);
}
$set_parent_id = $structure->is_id;
$set_level = $structure->is_level + 1;
$set_path = $structure->is_path . $item->is_id . ',';
$set_sql = "UPDATE infoStructures \n"
. "SET is_parent_id = ?, \n"
. " is_level = ?, \n"
. " is_path = ? \n"
. "WHERE is_id = ?";
. "SET is_parent_id = ?, \n"
. " is_level = ?, \n"
. " is_path = ? \n"
. "WHERE is_id = ?";
$this->HT->query($set_sql, array($set_parent_id, $set_level, $set_path, $item->is_id));
}
}
/**
* @description: 用于生成一个特殊的根结点is_level和is_sort都为0CT移动优先项目用
* @param {type}
* @return:
* @Date Changed:
*/
public function AddRootNote($is_ic_id)
{
$sql = "INSERT INTO infoStructures \n"
. " ( \n"
. " is_parent_id, is_path, is_level, is_sort, is_sitecode, is_datetime, is_ic_id \n"
. " ) \n"
. "VALUES \n"
. " ( \n"
. " ?, ?, ?, ?, ?, getdate(), ? \n"
. " )";
$query = $this->HT->query($sql, array(-99, '', 0, 0, $this->config->item('site_code'), $is_ic_id));
$this->insert_id = $this->HT->last_id('infoStructures');
//把自己的ID加到path上
$set_sql = "UPDATE infoStructures \n"
. "SET is_path = is_path + CONVERT(VARCHAR(200), is_id) + ',' \n"
. "WHERE is_id = ?";
$query = $this->HT->query($set_sql, array($this->insert_id));
return $this->insert_id;
}
}

@ -5,8 +5,7 @@ class infoAccessmanage_model extends CI_Model
function __construct()
{
parent::__construct();
$this->HT = $this->load->database('INFORMATION', TRUE);
$this->HT229 = $this->load->database('HT', TRUE);
$this->HT = $this->load->database('HT', TRUE);
}
//获取用户结构列表
@ -20,7 +19,7 @@ class infoAccessmanage_model extends CI_Model
iam_author
FROM infoaccessmanage
INNER JOIN infoStructures is1 ON iam_is_id = is1.is_id
LEFT JOIN tourmanager.dbo.OperatorInfo ON iam_author=OPI_Code
LEFT JOIN OperatorInfo ON iam_author=OPI_Code
ORDER BY is1.is_level ASC,
is1.is_sort ASC,
is1.is_path ASC";
@ -408,7 +407,7 @@ class infoAccessmanage_model extends CI_Model
if ($undefined) {
$undefined_sql="AND OPI_Code NOT IN (SELECT iam_author FROM infoaccessmanage)";
}
$sql = "SELECT * FROM tourmanager.dbo.OperatorInfo WHERE DeleteFlag=0 $undefined_sql";
$sql = "SELECT * FROM OperatorInfo WHERE DeleteFlag=0 $undefined_sql";
$query = $this->HT->query($sql);
return $query->result();
}
@ -428,7 +427,7 @@ class infoAccessmanage_model extends CI_Model
$undefined_sql.=" AND a_id NOT IN ($authors)";
}
$sql = "SELECT * FROM tourmanager.dbo.infoAuthors $undefined_sql";
$sql = "SELECT * FROM infoAuthors $undefined_sql";
$query = $this->HT->query($sql);
return $query->result();
}

@ -12,7 +12,7 @@ class Infoauthors_model extends CI_Model
function __construct()
{
parent::__construct();
$this->HT = $this->load->database('INFORMATION', TRUE);
$this->HT = $this->load->database('HT', TRUE);
}
function init()

File diff suppressed because it is too large Load Diff

@ -12,18 +12,18 @@ class Landscape_model extends CI_Model
function search_list($keyword)
{
$sql = "SELECT TOP 8 lsi.LSI_SN, \n"
. " lsi.LSI_ID, \n"
. " lsi.LSI_City, \n"
. " lsi2.LSI2_Name, \n"
. " ci2.CII2_Name \n"
. "FROM tourmanager.dbo.LandScapeInfo lsi \n"
. " INNER JOIN tourmanager.dbo.LandScapeInfo2 lsi2 ON lsi2.LSI2_LSI_SN = lsi.LSI_SN \n"
. " AND lsi2.LSI2_LGC = ? \n"
. " INNER JOIN tourmanager.dbo.CItyInfo2 ci2 ON ci2.CII2_CII_SN = lsi.LSI_City \n"
. " AND ci2.CII2_LGC = ? \n"
. "WHERE lsi.LSI_Publish = 1 \n"
. " AND (lsi.LSI_ParentSN IS NULL OR lsi.LSI_ParentSN = 0) \n"
. " AND lsi2.LSI2_Name LIKE N? ";
. " lsi.LSI_ID, \n"
. " lsi.LSI_City, \n"
. " lsi2.LSI2_Name, \n"
. " ci2.CII2_Name \n"
. "FROM LandScapeInfo lsi \n"
. " INNER JOIN LandScapeInfo2 lsi2 ON lsi2.LSI2_LSI_SN = lsi.LSI_SN \n"
. " AND lsi2.LSI2_LGC = ? \n"
. " INNER JOIN CItyInfo2 ci2 ON ci2.CII2_CII_SN = lsi.LSI_City \n"
. " AND ci2.CII2_LGC = ? \n"
. "WHERE lsi.LSI_Publish = 1 \n"
. " AND (lsi.LSI_ParentSN IS NULL OR lsi.LSI_ParentSN = 0) \n"
. " AND lsi2.LSI2_Name LIKE N? ";
$query = $this->HT->query($sql, array($this->config->item('site_lgc'), $this->config->item('site_lgc'), '%' . urldecode($keyword) . '%'));
//print_r($this->HT->queries);
return $query->result();
@ -32,20 +32,23 @@ class Landscape_model extends CI_Model
function get_landscape_title($lsi_sn)
{
$sql = "SELECT TOP 1 lsi2.LSI2_Name \n"
. "FROM LandScapeInfo lsi \n"
. " INNER JOIN LandScapeInfo2 lsi2 ON lsi2.LSI2_LSI_SN = lsi.LSI_SN \n"
. " AND lsi2.LSI2_LGC = ? \n"
. " INNER JOIN CItyInfo2 ci2 ON ci2.CII2_CII_SN = lsi.LSI_City \n"
. " AND ci2.CII2_LGC = ? \n"
. "WHERE lsi.LSI_Publish = 1 \n"
. " AND (lsi.LSI_ParentSN IS NULL OR lsi.LSI_ParentSN = 0) \n"
. " AND lsi.LSI_SN = ?";
$query = $this->HT->query($sql, array($this->config->item('site_lgc'), $this->config->item('site_lgc'), $lsi_sn));
. "FROM LandScapeInfo lsi \n"
. " INNER JOIN LandScapeInfo2 lsi2 ON lsi2.LSI2_LSI_SN = lsi.LSI_SN \n"
. " AND lsi2.LSI2_LGC = ? \n"
. " INNER JOIN CItyInfo2 ci2 ON ci2.CII2_CII_SN = lsi.LSI_City \n"
. " AND ci2.CII2_LGC = ? \n"
. "WHERE lsi.LSI_Publish = 1 \n"
. " AND (lsi.LSI_ParentSN IS NULL OR lsi.LSI_ParentSN = 0) \n"
. " AND lsi.LSI_SN = ?";
$query = $this->HT->query($sql, array($this->config->item('site_lgc'), $this->config->item('site_lgc'),$lsi_sn));
//print_r($this->HT->queries);
if ($query->result()) {
if ($query->result())
{
$row = $query->row();
return $row->LSI2_Name;
} else {
}
else
{
return FALSE;
}
}
@ -55,26 +58,31 @@ class Landscape_model extends CI_Model
function get_detail($lsi_sn)
{
$sql = "SELECT TOP 1 lsi.LSI_SN, \n"
. " lsi.LSI_ID, \n"
. " lsi.LSI_City, \n"
. " lsi2.LSI2_Name, \n"
. " lsi2.LSI2_Intro, \n"
. " lsi2.LSI2_ShortIntro, \n"
. " ci2.CII2_Name \n"
. "FROM LandScapeInfo lsi \n"
. " INNER JOIN LandScapeInfo2 lsi2 ON lsi2.LSI2_LSI_SN = lsi.LSI_SN \n"
. " AND lsi2.LSI2_LGC = ? \n"
. " INNER JOIN CItyInfo2 ci2 ON ci2.CII2_CII_SN = lsi.LSI_City \n"
. " AND ci2.CII2_LGC = ? \n"
. "WHERE lsi.LSI_Publish = 1 \n"
. " AND (lsi.LSI_ParentSN IS NULL OR lsi.LSI_ParentSN = 0) \n"
. " AND lsi.LSI_SN = ?";
. " lsi.LSI_ID, \n"
. " lsi.LSI_City, \n"
. " lsi2.LSI2_Name, \n"
. " lsi2.LSI2_Intro, \n"
. " lsi2.LSI2_ShortIntro, \n"
. " ci2.CII2_Name \n"
. "FROM LandScapeInfo lsi \n"
. " INNER JOIN LandScapeInfo2 lsi2 ON lsi2.LSI2_LSI_SN = lsi.LSI_SN \n"
. " AND lsi2.LSI2_LGC = ? \n"
. " INNER JOIN CItyInfo2 ci2 ON ci2.CII2_CII_SN = lsi.LSI_City \n"
. " AND ci2.CII2_LGC = ? \n"
. "WHERE lsi.LSI_Publish = 1 \n"
. " AND (lsi.LSI_ParentSN IS NULL OR lsi.LSI_ParentSN = 0) \n"
. " AND lsi.LSI_SN = ?";
$query = $this->HT->query($sql, array($this->config->item('site_lgc'), $this->config->item('site_lgc'), $lsi_sn));
if ($query->num_rows() > 0) {
if ($query->num_rows() > 0)
{
$row = $query->row();
return $row;
} else {
return FALSE;
}
else
{
return FALSE;
}
}
}
}

@ -14,7 +14,7 @@ class Logs_model extends CI_Model
public function __construct()
{
parent::__construct();
$this->HT = $this->load->database('INFORMATION', true);
$this->HT = $this->load->database('HT', true);
}
public function init()
@ -178,7 +178,7 @@ class Logs_model extends CI_Model
public function list_backup_meta($is_id, $meta_code)
{
$this->init();
$this->top_num = 50;
$this->top_num = 100;
$this->log_res_id = " AND il.log_res_id =" . $this->HT->escape($is_id);
$this->log_action = " AND il.log_action like 'backup_meta_" . $meta_code . "_%'";
return $this->get_list();
@ -231,7 +231,7 @@ class Logs_model extends CI_Model
,log_datetime
)
VALUES
( ?,?,N?,?,N?,GETDATE())
( ?,?,N?,?,?,GETDATE())
";
$query = $this->HT->query($sql, array('write_test', 0, '数据库写入测试', 'system', 'system'));
@ -254,21 +254,9 @@ class Logs_model extends CI_Model
. " ) \n"
. "VALUES \n"
. " ( \n"
. " ?, ?, N?, ?, N?, GETDATE() \n"
. " ?, ?, N?, ?, ?, GETDATE() \n"
. " )";
// fix 外部站点调用
$op_code = null;
if ($admin_info['OPI_Code']) {
$op_code = $admin_info['OPI_Code'];
}
$op_name = 'outside';
if ($admin_info['OPI_Name']) {
$op_name = $admin_info['OPI_Name'];
}
$query = $this->HT->query($sql, array($log_action, $is_id, $log_content, $op_code, $op_name));
$query = $this->HT->query($sql, array($log_action, $is_id, $log_content, $admin_info['OPI_Code'], $admin_info['OPI_Name']));
$this->insert_id = $this->HT->last_id('infoLogs');
return $query;
//print_r($this->HT->queries);
@ -288,4 +276,5 @@ class Logs_model extends CI_Model
$query = $this->HT->query($sql, array($ic_id));
return $query->row();
}
}
}

@ -6,159 +6,152 @@ class Operator_model extends CI_Model
function __construct()
{
parent::__construct();
$this->HT = $this->load->database('INFORMATION', TRUE);
$this->HT229 = $this->load->database('HT', TRUE);
$this->HT = $this->load->database('HT', TRUE);
}
//输入用户名和密码,检查是否可以正确
function check_login($user_code, $password)
{
$sql = "SELECT TOP 1 1 \n"
. "FROM tourmanager.dbo.OperatorInfo oi \n"
. "WHERE oi.OPI_Code = N? \n"
. " AND CONVERT(VARCHAR(100), oi.OPI_Password) = N? ";
. "FROM OperatorInfo oi \n"
. "WHERE oi.OPI_Code = N? \n"
. " AND CONVERT(VARCHAR(100), oi.OPI_Password) = N? ";
$query = $this->HT->query($sql, array($user_code, $password));
//print_r($this->HT->queries);
if ($query->num_rows() > 0) {
if ($query->num_rows() > 0)
{
return 1;
} else {
$author_sql = "SELECT TOP 1 1 FROM tourmanager.dbo.infoAuthors WHERE a_email=? AND a_password=?";
}
else
{
$author_sql = "SELECT TOP 1 1 FROM infoAuthors WHERE a_email=? AND a_password=?";
$author_query = $this->HT->query($author_sql, array($user_code, $password));
if ($author_query->num_rows() > 0) {
if ($author_query->num_rows() > 0)
{
return 2;
} else {
}
else{
return FALSE;
}
}
}
function get_password($user_code)
{
function get_password($user_code)
{
$sql = "SELECT TOP 1 oi.OPI_Password \n"
. "FROM tourmanager.dbo.OperatorInfo oi \n"
. "WHERE oi.OPI_Code = N?";
. "FROM OperatorInfo oi \n"
. "WHERE oi.OPI_Code = N?";
$query = $this->HT->query($sql, array($user_code));
//print_r($this->HT->queries);
if ($query->num_rows() > 0) {
if ($query->num_rows() > 0)
{
$row = $query->row_array();
return $row;
} else {
return FALSE;
}
}
else
{
return FALSE;
}
}
//获取登录用户详细信息
function get_user($user_code)
{
if (empty($user_code)) {
return false;
}
if(empty($user_code))
{
return false;
}
$sql = "SELECT TOP 1 oi.OPI_SN, \n"
. " oi.OPI_Name, \n"
. " oi.OPI_Email, \n"
. " oi.OPI_FirstName, \n"
. " oi.OPI_Code \n"
. "FROM tourmanager.dbo.OperatorInfo oi \n"
. "WHERE oi.OPI_Code = N?";
. " oi.OPI_Name, \n"
. " oi.OPI_Email, \n"
. " oi.OPI_FirstName, \n"
. " oi.OPI_Code \n"
. "FROM OperatorInfo oi \n"
. "WHERE oi.OPI_Code = N?";
$query = $this->HT->query($sql, array($user_code));
//print_r($this->HT->queries);
if ($query->num_rows() > 0) {
if ($query->num_rows() > 0)
{
$row = $query->row_array();
return $row;
} else {
return FALSE;
}
else
{
return FALSE;
}
}
//获取作者平台的作者信息
public function get_author_user($a_email)
{
public function get_author_user($a_email){
$sql = "SELECT TOP 1
a_id as OPI_SN,
a_email as OPI_Email,
a_name as OPI_Name,
a_name as OPI_FirstName,
a_id as OPI_Code
FROM tourmanager.dbo.infoAuthors
FROM infoAuthors
WHERE a_email=? AND a_active=1";
$query = $this->HT->query($sql, array($a_email));
if ($query->num_rows() > 0) {
if ($query->num_rows() > 0)
{
$row = $query->row_array();
return $row;
} else {
return FALSE;
}
else
{
return FALSE;
}
}
//获取作者信息
function get_author($user_code = array())
//获取作者信息
function get_author($user_code=array())
{
$user_code_str = '';
foreach ($user_code as $user_item) {
$user_code_str .= "'" . $user_item . "',";
}
$user_code_str .= "'0'";
$user_code_str='';
foreach($user_code as $user_item)
{
$user_code_str.="'".$user_item."',";
}
$user_code_str.="'0'";
$sql = "SELECT oi.OPI_SN, \n"
. " oi.OPI_Name, \n"
. " oi.OPI_Email, \n"
. " oi.OPI_FirstName, \n"
. " oi.OPI_Code \n"
. "FROM tourmanager.dbo.OperatorInfo oi \n"
. "WHERE oi.OPI_Code IN ( $user_code_str )";
. " oi.OPI_Name, \n"
. " oi.OPI_Email, \n"
. " oi.OPI_FirstName, \n"
. " oi.OPI_Code \n"
. "FROM OperatorInfo oi \n"
. "WHERE oi.OPI_Code IN ( $user_code_str )";
$query = $this->HT->query($sql);
//print_r($this->HT->queries);
return $query->result();
return $query->result();
}
//获取作者的昵称
function get_author_nikename($user_code)
{
$sql = "
SELECT top 1 isnull(uio.NickName,'') as NickName,uio.customPic, uio.userid, uio.sex, uio.Email,uio.intro
,OPI_SN,OPI_Name,OPI_Email,OPI_FirstName,OPI_Code
FROM tourmanager.dbo.OperatorInfo left JOIN
tourmanager.dbo.UserInfo uio ON uio.Email = tourmanager.dbo.OperatorInfo.OPI_Email
WHERE tourmanager.dbo.OperatorInfo.OPI_Code = '{$user_code}'
";
$query = $this->HT->query($sql);
if ($query->num_rows() > 0) {
$row = $query->row();
return $row;
} else {
return FALSE;
}
}
//HT中所有账号
function all()
{
//HT中所有账号
function all()
{
$sql = "SELECT oi.OPI_SN, \n"
. " oi.OPI_Name, \n"
. " oi.OPI_Email, \n"
. " oi.OPI_FirstName, \n"
. " oi.OPI_Code \n"
. "FROM tourmanager.dbo.OperatorInfo oi \n"
. "WHERE oi.deleteFlag=0 \n"
. "ORDER BY OPI_Code ASC ";
. " oi.OPI_Name, \n"
. " oi.OPI_Email, \n"
. " oi.OPI_FirstName, \n"
. " oi.OPI_Code \n"
. "FROM OperatorInfo oi \n"
. "WHERE oi.deleteFlag=0 \n"
. "ORDER BY OPI_Code ASC ";
$query = $this->HT->query($sql);
//print_r($this->HT->queries);
return $query->result();
}
return $query->result();
}
//获取当前站点的作者
public function get_site_user($site_code)
{
public function get_site_user($site_code){
$sql = "SELECT oi.OPI_SN,
oi.OPI_Name,
oi.OPI_Email,
oi.OPI_FirstName,
oi.OPI_Code
FROM tourmanager.dbo.OperatorInfo oi INNER JOIN infoaccessownsite i ON oi.OPI_Code=i.iao_author AND i.iao_other='editor'
FROM OperatorInfo oi INNER JOIN infoaccessownsite i ON oi.OPI_Code=i.iao_author AND i.iao_other='editor'
WHERE i.iao_site=?";
$query = $this->HT->query($sql, $site_code);
$query = $this->HT->query($sql,$site_code);
return $query->result();
}
}

@ -1,63 +0,0 @@
<?php
class recommends_and_tips_model extends CI_Model
{
function __construct()
{
parent::__construct();
$this->HT = $this->load->database('INFORMATION', TRUE);
}
public function recommends_list($is_id)
{
$sql = " SELECT
ir.ir_id
,ir.ir_is_id
,ir.ir_keyword
,ir.ir_name
,ir.ir_pointer_is_id
,ir.ir_pointer_it_id
,ir.ir_rule
,ir.ir_urls
,ir.ir_datetime
,ir.ir_sitecode
from infoRecommends ir
where 1=1
AND ir.ir_sitecode=?
AND ir.ir_is_id=?
";
$query = $this->HT->query($sql, array($this->config->item('site_code'), $is_id));
//print_r($this->INFO->queries);
return $query->result();
}
public function tips_detail($it_id)
{
$timestamp=time();
$sql = " SELECT TOP 1
it.it_id
,it.it_title
,it.it_expires
,it.it_code
,it.it_content
,it.it_sitecode
,it.it_datetime
from infoTips it
where 1=1
AND it.it_sitecode=?
AND it.it_id=?
AND it.it_expires>=?
";
$query = $this->HT->query($sql, array($this->config->item('site_code'), $it_id,$timestamp));
//print_r($this->HT->queries);
if ($query->num_rows() > 0) {
$row = $query->row();
return $row;
} else {
return FALSE;
}
}
}

@ -1,131 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Trippest_model extends CI_Model {
function __construct()
{
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
//$this->HT = $this->load->database('TOURMANAGER_LOCAL', TRUE);
}
/**
* @description: 根据信息标题获取对应的翰特包价线路内容
* @param {string} $pagecode
* @return:
*/
function get_pagdetail($pagcode){
$sql = " SELECT top 1 P1.PAG_ExtendType, P1.PAG_NeedTime,p2.PAG2_Name,P1.PAG_SN,p2.PAG2_Attraction,
P1.PAG_Code,P1.PAG_Title, CItyInfo2.CII2_Name
,P1.PAG_Type
,PAG_Scheme
,PAG_GuideLan
,PAG2_TimeDetail
,p1.PAG_SourceType
FROM dbo.BIZ_PackageInfo P1 INNER JOIN
dbo.BIZ_PackageInfo2 p2 ON P1.PAG_SN = p2.PAG2_PAG_SN INNER JOIN
dbo.CItyInfo2 ON P1.PAG_CII_SN = dbo.CItyInfo2.CII2_CII_SN AND
dbo.CItyInfo2.CII2_LGC=1
WHERE (p1.pag_dei_sn=32) AND
(p2.PAG2_LGC = 1)
AND (isnull(P1.DeleteFlag,0)<>1)
AND (p1.PAG_Code = ?) ";
// AND (p2.PAG2_Check = 2)
// AND (isnull(P1.DeleteFlag,0) <>1) ";
$query = $this->HT->query($sql,array($pagcode));
if ($query->num_rows()>0){
return $query->row();
}else{
return null;
}
}
/**
* @description: 根据一日游code获取对应人数的成人价格
* @param {string} $pagecode 线路代码
* @param int $personnum 人数
* @return:
*/
function get_price($pagcode,$personnum){
$sql = "select top 1 isnull(PKP_AdultNetPrice,0) as PKP_AdultNetPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
from BIZ_PackagePrice
inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
where BIZ_PackagePrice.Checked=2
and (BIZ_PackageInfo.PAG_Code = ?)
AND (pag_dei_sn=32)
and ? between PKP_PersonStart and PKP_PersonStop
and CONVERT(varchar(12),getdate(),111) between pkp_validdate and pkp_invaliddate
order by PKP_PriceGrade ";
$param = array($pagcode,$personnum);
$query = $this->HT->query($sql,$param);
if ($query->num_rows()>0){
return $query->row();
}else{
$sql = " select top 1 isnull(PKP_AdultNetPrice,0) as PKP_AdultNetPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
from BIZ_PackagePrice
inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
where BIZ_PackagePrice.Checked=2
and (BIZ_PackageInfo.PAG_Code = ?)
AND (pag_dei_sn=32)
and ? between PKP_PersonStart and PKP_PersonStop
order by PKP_AdultNetPrice desc ";
$query = $this->HT->query($sql,$param);
if ($query->num_rows()>0){
return $query->row();
}else
{
return null;
}
}
}
/**
* @description: 获取对应的接送产品列表
* @param {type}
* @return:
*/
function GetTransfer($PagSn){
$sql = "SELECT p2.PAG2_Name
,P1.PAG_SN
,p2.PAG2_Attraction
,P1.PAG_Code
FROM dbo.BIZ_PackageInfo P1
INNER JOIN dbo.BIZ_PackageInfo2 p2 ON P1.PAG_SN = p2.PAG2_PAG_SN
WHERE p2.PAG2_LGC = 108
AND P1.PAG_SN IN (
SELECT BTE_Trade
FROM BIZ_PackageTree
WHERE BTE_TradeType = 11
AND isnull(BTE_ParentID, 0) = 0
AND BTE_Trade = ?
UNION
SELECT BTE_Trade
FROM BIZ_PackageTree
WHERE BTE_ParentID = (
SELECT BTE_ID
FROM BIZ_PackageTree
WHERE BTE_TradeType = 11
AND isnull(BTE_ParentID, 0) = 0
AND BTE_Trade = ?
)
) order by PAG2_Order desc ";
$param = array($PagSn, $PagSn);
$query = $this->HT->Query($sql,$param);
return $query->result();
}
}
/* End of file Trippest_model.php */

@ -103,9 +103,6 @@ class Index extends CI_Controller
if (!$result) {
$data[] = array('name' => 'no', 'value' => '关联失败,请联系管理员!');
echo json_encode($data);
}else{
$data[] = array('name' => 'ok', 'value' => '关联成功!');
echo json_encode($data);
}
}
@ -169,25 +166,4 @@ class Index extends CI_Controller
}
echo $result;
}
//批量更新广告相关静态页面
//$ad_is_id 广告的结构ID
/*
public function update_www_cache($ad_is_id){
$data = array();
$data['ad_is_id']=$ad_is_id;
$data['advertise'] = $this->advertise_model->get_advertise_treeid($data['ad_is_id']);
if(empty($data['advertise'])){
show_404();
return false;
}
//广告绑定的页面
$data['webpage_list'] = $this->advertise_model->get_advertise_page($data['ad_is_id']);
if(!empty($data['webpage_list'])){
foreach ($data['webpage_list'] as $item){
echo $item->adp_ic_url.'<br/>';
}
}
}
*/
}

@ -41,8 +41,7 @@
<div class="col-xs-8 form-group nopadding">
<div class="col-xs-24 nopadding">广告位置</div>
<select class="form-control col-xs-18" name="ad_place" id="ad_place" style="display:block !important;">
<option value="right_row" <?php echo $advertise->ad_place == 'right_row' ? 'selected' : ''; ?>>页面右侧</option>
<select class="form-control col-xs-24" name="ad_place" id="ad_place" style="display:block !important;">
<option value="left_nav_top" <?php echo $advertise->ad_place == 'left_nav_top' ? 'selected' : ''; ?>>左导航顶部</option>
<option value="left_nav_bottom" <?php echo $advertise->ad_place == 'left_nav_bottom' ? 'selected' : ''; ?>>左导航底部</option>
<option value="right_nav_top" <?php echo $advertise->ad_place == 'right_nav_top' ? 'selected' : ''; ?>>右导航顶部</option>
@ -83,11 +82,9 @@
<div class="webpage_list">
<div id="webpage_list">
<?php foreach ($webpage_list as $key => $p) { ?>
<span class="col-xs-24" id="<?php echo 'page_info_box' . $key; ?>" style="border:1px dashed #666;height:100px;margin-bottom:20px;padding:0px">
<a href="<?php echo site_url('/welcome/create_infomation_urls/0/mobile-first?ic_url=').$p->adp_ic_url; ?>" target="_blank"> <em title="更新静态页面" class=" glyphicon glyphicon-refresh text-danger pull-right"></em></a>
<em data-adpid="<?php echo $p->adp_id; ?>" title="删除" class="delete-page glyphicon glyphicon-minus-sign text-danger pull-left"></em><br/>
<a href="javascript:void(0);" class="col-xs-24" id="<?php echo 'page_info_box' . $key; ?>" style="border:1px dashed #666;height:100px;margin-bottom:20px;padding:0px">
<div class="col-xs-24 edit_pageinfo" style="height:100%;padding:10px 10px;overflow:hidden;">
<em data-adpid="<?php echo $p->adp_id; ?>" class="delete-page glyphicon glyphicon-minus-sign text-danger pull-right"></em>
<span class="text-muted urlinfo" data-adpid="<?php echo $p->adp_id; ?>" data-urlinfo="<?php echo $p->adp_ic_url; ?>"><?php echo $p->adp_ic_url; ?></span>
<span class="col-xs-24 nopadding text-muted forselfinfo" style="font-size:12px;" data-forself="<?php echo $p->adp_forself; ?>">
<?php
@ -109,7 +106,7 @@
?>
</span>
</div>
</span>
</a>
<?php } ?>
</div>
</div>
@ -143,8 +140,8 @@
<form class="col-xs-24" data-flag="form_pageinfo_edit" method="post" action="<?php echo site_url('thirdparty/advertise/index/page_edit'); ?>">
<div class="col-xs-24 btn-lg"></div>
<div class="form-group">
<label for="exampleInputEmail1">页面链接URL</label>
<input type="text" class="form-control adp_ic_url" name="adp_ic_url" placeholder="要关联的信息页面url 或信息标题ID,如:/beijing/">
<label for="exampleInputEmail1">页面链接URL、信息内容ID</label>
<input type="text" class="form-control adp_ic_url" name="adp_ic_url" placeholder="要关联的信息页面url 或信息标题ID,如:/beijing/或5362">
</div>
<div class="col-xs-24 btn-sm"></div>

@ -1,320 +0,0 @@
<?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');
}
var $imageCdn = "//images.chinatravel.com";//有些HT绑定图片需要加cdn
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($price);
}else{
$price = "0";
}
$result["price"] = $price;
echo json_encode($result);
}else{
$result["status"]="no param";
echo json_encode($result);
}
}
/**
* @description: 获取HT及信息平台的一日游列表数据
* @param {*}
* @return {*}
* @Date Changed:
*/
public function getDaytripList(){
//先处理传递过来的参数逗号隔开两个参数的格式城市名称父ID
$whereHT="";
$whereInfo="";
if (isset($_GET["param"])){
$param = str_replace("'","''",$_GET["param"]);
if (strpos($param,",")!== false){
$city = explode(",",$param)[0];
$whereHT = " and (CII2_Name ='".$city."') ";
$parentid = explode(",",$param)[1];
$whereInfo = " and is_parent_id = '".$parentid."'";
}else{
$whereHT = " and (CII2_Name ='".$param."') ";
$whereInfo = " and is_parent_id = -1 ";
}
}
$list = $this->api_model->getDaytripList($whereHT,$whereInfo);
foreach ($list as $row) {
//获取价格
$price = $this->api_model->getDaytripsPrice($row->code,2);
if ($price!=null){
$PKP_AdultSpecialPrice = $price->PKP_AdultSpecialPrice;
$PKP_AdultPrice = $price->PKP_AdultPrice;
if ($PKP_AdultPrice!=$PKP_AdultSpecialPrice && $PKP_AdultSpecialPrice>0){
$addPrice = $this->currency->convert_moneny_by_char($PKP_AdultSpecialPrice,"USD");
}else{
$addPrice= $this->currency->convert_moneny_by_char($PKP_AdultPrice,"USD");
}
}else{
$addPrice=0;
}
//URL
if (empty($row->url)){
$str_Url = "/china-day-trips/".strtolower($row->code).".htm";
$row->url = $str_Url; //更新url
}
//图片
if (!empty($row->pic1)){
$picurl = $row->pic1;
}else if(!empty($row->pic2)){
$picurl = $row->pic2;
}else{
$picurl="//data.chinatravel.com/images/loading2.gif";
}
$row->price = $addPrice; //新增价格属性
$picurl = $this->api_model->getPicCdn($picurl).$picurl;
$row->pic =$picurl; //图片地址
}
echo json_encode($list);
}
/**
* @description: 获取新旧网站的子类列表
* @param {*} $old_pid
* @param {*} $new_pid
* @return {*}
* @Date Changed:
*/
public function getGuideList($old_pid = null,$new_pid=null)
{
//处理参数
if (isset($_GET["param"])){
$param = str_replace("'","''",$_GET["param"]);
if (strpos($param,",")!== false){
$new_pid = explode(",",$param)[0];
$old_pid = explode(",",$param)[1];
}else{
$old_pid = -1;
$new_pid = $param;
}
}
if (empty($old_pid) || !is_numeric($old_pid)){
$old_pid = -1 ;
}
if (empty($new_pid)|| !is_numeric($new_pid)){
$new_pid = -1;
}
$list = $this->api_model->getGuideList($old_pid,$new_pid);
foreach ($list as $row) {
//图片
if (!empty($row->ic_photo)){
$picurl = $row->ic_photo;
}else if (!empty($row->pic1)){
$picurl = $row->pic1;
}else{
$picurl="//data.chinatravel.com/images/no-photos.jpg";
}
// if (strpos($picurl,"chinatravel.com")!== false){
// }else{
// $picurl = $this->imageCdn.$picurl;
// }
$picurl = $this->api_model->getPicCdn($picurl).$picurl;
$row->pic = $picurl; //显示图片地址
}
echo json_encode($list);
}
/**
* @description: 获取线路sn
* @param {*} $clino
* @return {*}
* @Date Changed:
*/
public function getCliSn(){
//处理参数
if (isset($_GET["param"])){
$param = $_GET["param"];
$result["status"]="ok";
$tour = $this->api_model->getCliSn($param);
$CLI_SN = $tour->CLI_SN;
if (!empty($CLI_SN)){
$result["clisn"]=$CLI_SN;
}else {
$result["clisn"]=0;
}
}else{
$result["status"]="no param";
$result["clisn"]=0;
}
echo json_encode($result);
}
/**
* @description: 一日游价格表
* @param {*}
* @return {*}
* @Date Changed:
*/
public function getDaytripPriceList(){
if (isset($_GET["param"])){
$param = str_replace("'","''",$_GET["param"]);
$list = $this->api_model->getDaytripPriceList($param);
if (!empty($list)){
if (count($list)==1){
//echo "1";
foreach ($list as $row) {
$PKP_AdultPrice = $row->PKP_AdultPrice;
$PKP_AdultSpecialPrice = $row->PKP_AdultSpecialPrice;
if ($PKP_AdultPrice!=$PKP_AdultSpecialPrice && $PKP_AdultSpecialPrice>0){
$PKP_AdultPrice=$PKP_AdultSpecialPrice;
}
$PKP_AdultPrice = $this->currency->convert_moneny_by_char($PKP_AdultPrice,"USD");
echo '<table border="0" align="center" cellpadding="10" cellspacing="1" class="pricetable"><tr><th>>1 Person</th></tr><tr><td><strong class="orange"> $'.$PKP_AdultPrice.'</strong></td></tr></table>';
}
}else{
//echo "2";
$str_th="";
$str_td="";
foreach ($list as $row) {
$PKP_AdultPrice = $row->PKP_AdultPrice;
$PKP_AdultSpecialPrice = $row->PKP_AdultSpecialPrice;
if ($PKP_AdultPrice!=$PKP_AdultSpecialPrice && $PKP_AdultSpecialPrice>0){
$PKP_AdultPrice=$PKP_AdultSpecialPrice;
}
$PKP_AdultPrice = $this->currency->convert_moneny_by_char($PKP_AdultPrice,"USD");
$PKP_PersonStart = $row->PKP_PersonStart;
$PKP_PersonStop = $row->PKP_PersonStop;
//'根据数据生成显示内容
if ($PKP_PersonStart == $PKP_PersonStop){
$str_th .= "<th> ".$PKP_PersonStart." Person</th>";
}
else if ($PKP_PersonStop=="1000") {
$str_th .= "<th> >".$PKP_PersonStart." Person</th>";
}
else{
$str_th .= "<th> ".$PKP_PersonStart." - ".$PKP_PersonStop." Person</th>";
}
$str_td .="<td><strong class='orange'> $ ".$PKP_AdultPrice."</strong></td>";
}
echo '<table border="0" align="center" cellpadding="10" cellspacing="1" class="pricetable"><tr>'.$str_th.'</tr><tr>'.$str_td.'</tr></table>';
}
}
}else{
echo "";
}
}
/**
* @description: 拷贝旧内容
* @param {*} 新信息ic_id ,旧URL
* @return {*}
* @Date Changed:
*/
public function copyOldUrl(){
//参数
$id = $this->input->post("id");
$oldUrl = $this->input->post("oldurl");
//调用拷贝
$update = $this->api_model->copyOldUrl($id,$oldUrl);
if ($update){
$result["status"]="ok";
}else{
$result["status"]="error";
}
$result["id"]=$id;
$result["oldUrl"]=$oldUrl;
echo json_encode($result);
}
}
/* End of file Api.php */

@ -1,297 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Apish extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('apish_model');
$this->load->library('Currency');
}
var $imageCdn = "//images.shanghaihighlights.com";//有些HT绑定图片需要加cdn
public function index()
{
echo("<1>apish</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->apish_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->apish_model->getTourPrice($param);
$result["pricecn"]=$price;
if (is_numeric($price)){
$price = $this->currency->calc_show_price($price);
}else{
$price = "0";
}
$result["price"] = $price;
echo json_encode($result);
}else{
$result["status"]="no param";
echo json_encode($result);
}
}
/**
* @description: 获取HT及信息平台的一日游列表数据
* @param {*}
* @return {*}
* @Date Changed:
*/
public function getDaytripList(){
//先处理传递过来的参数逗号隔开两个参数的格式城市名称父ID
$whereHT="";
$whereInfo="";
if (isset($_GET["param"])){
$param = str_replace("'","''",$_GET["param"]);
if (strpos($param,",")!== false){
$city = explode(",",$param)[0];
$whereHT = " and (CII2_Name ='".$city."') ";
$parentid = explode(",",$param)[1];
$whereInfo = " and is_parent_id = '".$parentid."'";
}else{
$whereHT = " and (CII2_Name ='".$param."') ";
$whereInfo = " and is_parent_id = -1 ";
}
}
$list = $this->apish_model->getDaytripList($whereHT,$whereInfo);
foreach ($list as $row) {
//获取价格
$price = $this->apish_model->getDaytripsPrice($row->code,2);
if ($price!=null){
$PKP_AdultSpecialPrice = $price->PKP_AdultSpecialPrice;
$PKP_AdultPrice = $price->PKP_AdultPrice;
if ($PKP_AdultPrice!=$PKP_AdultSpecialPrice && $PKP_AdultSpecialPrice>0){
$addPrice = $this->currency->convert_moneny_by_char($PKP_AdultSpecialPrice,"USD");
}else{
$addPrice= $this->currency->convert_moneny_by_char($PKP_AdultPrice,"USD");
}
}else{
$addPrice=0;
}
//URL
if (empty($row->url)){
$str_Url = "/shanghai-day-trips/".strtolower($row->code).".htm";
$row->url = $str_Url; //更新url
}
//图片
if (!empty($row->pic1)){
$picurl = $row->pic1;
}else if(!empty($row->pic2)){
$picurl = $row->pic2;
}else{
$picurl="//data.shanghaihighlights.com/image/loading.gif";
}
$row->price = $addPrice; //新增价格属性
$picurl = $this->apish_model->getPicCdn($picurl).$picurl;
$row->pic =$picurl; //图片地址
}
echo json_encode($list);
}
/**
* @description: 获取新旧网站的子类列表
* @param {*} $old_pid
* @param {*} $new_pid
* @return {*}
* @Date Changed:
*/
public function getGuideList($old_pid = null,$new_pid=null)
{
//处理参数
if (isset($_GET["param"])){
$param = str_replace("'","''",$_GET["param"]);
if (strpos($param,",")!== false){
$new_pid = explode(",",$param)[0];
$old_pid = explode(",",$param)[1];
}else{
$old_pid = -1;
$new_pid = $param;
}
}
if (empty($old_pid) || !is_numeric($old_pid)){
$old_pid = -1 ;
}
if (empty($new_pid)|| !is_numeric($new_pid)){
$new_pid = -1;
}
$list = $this->apish_model->getGuideList($old_pid,$new_pid);
foreach ($list as $row) {
//图片
if (!empty($row->ic_photo)){
$picurl = $row->ic_photo;
}else if (!empty($row->pic1)){
$picurl = $row->pic1;
}else{
$picurl="//data.chinatravel.com/images/no-photos.jpg";
}
// if (strpos($picurl,"chinatravel.com")!== false){
// }else{
// $picurl = $this->imageCdn.$picurl;
// }
$picurl = $this->apish_model->getPicCdn($picurl).$picurl;
$row->pic = $picurl; //显示图片地址
}
echo json_encode($list);
}
/**
* @description: 获取线路sn
* @param {*} $clino
* @return {*}
* @Date Changed:
*/
public function getCliSn(){
//处理参数
if (isset($_GET["param"])){
$param = $_GET["param"];
$result["status"]="ok";
$tour = $this->apish_model->getCliSn($param);
$CLI_SN = $tour->CLI_SN;
if (!empty($CLI_SN)){
$result["clisn"]=$CLI_SN;
}else {
$result["clisn"]=0;
}
}else{
$result["status"]="no param";
$result["clisn"]=0;
}
echo json_encode($result);
}
/**
* @description: 一日游价格表
* @param {*}
* @return {*}
* @Date Changed:
*/
public function getDaytripPriceList(){
if (isset($_GET["param"])){
$param = str_replace("'","''",$_GET["param"]);
$list = $this->apish_model->getDaytripPriceList($param);
if (!empty($list)){
if (count($list)==1){
//echo "1";
foreach ($list as $row) {
$PKP_AdultPrice = $row->PKP_AdultPrice;
$PKP_AdultSpecialPrice = $row->PKP_AdultSpecialPrice;
if ($PKP_AdultPrice!=$PKP_AdultSpecialPrice && $PKP_AdultSpecialPrice>0){
$PKP_AdultPrice=$PKP_AdultSpecialPrice;
}
$PKP_AdultPrice = $this->currency->convert_moneny_by_char($PKP_AdultPrice,"USD");
echo '<table border="0" align="center" cellpadding="10" cellspacing="1" class="pricetable"><tr><th>>1 Person</th></tr><tr><td><strong class="orange"> $'.$PKP_AdultPrice.'</strong></td></tr></table>';
}
}else{
//echo "2";
$str_th="";
$str_td="";
foreach ($list as $row) {
$PKP_AdultPrice = $row->PKP_AdultPrice;
$PKP_AdultSpecialPrice = $row->PKP_AdultSpecialPrice;
if ($PKP_AdultPrice!=$PKP_AdultSpecialPrice && $PKP_AdultSpecialPrice>0){
$PKP_AdultPrice=$PKP_AdultSpecialPrice;
}
$PKP_AdultPrice = $this->currency->convert_moneny_by_char($PKP_AdultPrice,"USD");
$PKP_PersonStart = $row->PKP_PersonStart;
$PKP_PersonStop = $row->PKP_PersonStop;
//'根据数据生成显示内容
if ($PKP_PersonStart == $PKP_PersonStop){
$str_th .= "<th> ".$PKP_PersonStart." Person</th>";
}
else if ($PKP_PersonStop=="1000") {
$str_th .= "<th> >".$PKP_PersonStart." Person</th>";
}
else{
$str_th .= "<th> ".$PKP_PersonStart." - ".$PKP_PersonStop." Person</th>";
}
$str_td .="<td><strong class='orange'> $ ".$PKP_AdultPrice."</strong></td>";
}
echo '<table border="0" align="center" cellpadding="10" cellspacing="1" class="pricetable"><tr>'.$str_th.'</tr><tr>'.$str_td.'</tr></table>';
}
}
}else{
echo "";
}
}
}
/* End of file Api.php */

@ -1,164 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class TrainDMS extends CI_Controller {
public function __construct(){
parent::__construct();
$this->load->model("dms_model");
}
/**
* @description: 接口总汇,根据接受数据,调用不同接口,返回数据
* @return {*}
* @Date Changed:
*/
public function dmsCallback(){
$back_json = file_get_contents('php://input');
$dms_backdata = json_decode($back_json);
if(!empty($dms_backdata)){
//判断接口调用是否合法
$TimeStamp = $dms_backdata->authentication->timeStamp;
$serviceName = $dms_backdata->authentication->serviceName; //每个接口都有自己名称
$companyId = "haina";
$key = "dms001";
$strSign = $TimeStamp.$serviceName.$companyId.$key; //加密前的令牌
$Sign = md5($strSign);
$messageIdentity = $dms_backdata->authentication->messageIdentity;
$ResultNoticeResponse = new stdClass();
if ($Sign == $messageIdentity){
$ResultNoticeResponse->returnCode = 1;
$ResultNoticeResponse->returnMsg = "success";
//这里正常处理各种接口调用
if ($serviceName=="dms.login"){ //登录
$username = $dms_backdata->loginInfo->username;
$password = $dms_backdata->loginInfo->password;
$ResultNoticeResponse->loginInfo = new stdClass();
$LoginInfo = $this->dms_model->Login($username,$password);
if (empty($LoginInfo)){
$ResultNoticeResponse->loginInfo->status = 0; //账号密码错误。
$ResultNoticeResponse->loginInfo->dt_username = '';
$ResultNoticeResponse->loginInfo->dt_payrule = "";
$ResultNoticeResponse->loginInfo->dt_usertype = "";
$ResultNoticeResponse->loginInfo->dt_HtId = "";
$ResultNoticeResponse->loginInfo->dt_id = "";
}else{
$ResultNoticeResponse->loginInfo->status = 1; //账号密码是否正常。
$ResultNoticeResponse->loginInfo->dt_username = $LoginInfo->dt_username;
$ResultNoticeResponse->loginInfo->dt_payrule = $LoginInfo->dt_payrule;
$ResultNoticeResponse->loginInfo->dt_usertype = $LoginInfo->dt_usertype;
$ResultNoticeResponse->loginInfo->dt_HtId = $LoginInfo->dt_HtId;
$ResultNoticeResponse->loginInfo->dt_id = $LoginInfo->dt_id;
}
}else if($serviceName=="dms.dmlist"){ //分销商列表
$arrKeyword = new stdClass();
$arrKeyword = $dms_backdata->arrKeyword;
$dmlist = $this->dms_model->get_DmList($arrKeyword);
$resultData = $dmlist["data"];
$total = $dmlist["total"];
$ResultNoticeResponse->dmlist = new stdClass();
$ResultNoticeResponse->dmlist->data=$resultData;
$ResultNoticeResponse->dmlist->total = $total;
// "arrKeyword": {
// "s_username": "ssss",
// "s_ename": "vvv",
// "page": false,
// "per_page": 20
// }
}else if($serviceName=="dms.getpayrule"){ //获取支付规则列表数据
$getpayrule = $this->dms_model->get_payrule();
$ResultNoticeResponse->getpayrule = $getpayrule;
}else if ($serviceName=="dms.addsave"){ //添加供应商操作
$formData = new stdClass() ;
$formData = $dms_backdata->formInfo;
$rStatus = $this->dms_model->addsave($formData);
$ResultNoticeResponse->addsave = $rStatus;
}else if ($serviceName=="dms.getDmsDetail") { //修改分销商详细页
$id = $dms_backdata->DmsDetail->dtid;
$dmsDetail = $this->dms_model->getDmsDetail($id);
$ResultNoticeResponse->DmsDetail = $dmsDetail;
}else if ($serviceName=="dms.editsave"){ //修改分销商保存
$formData = new stdClass() ;
$formData = $dms_backdata->formInfo;
$rStatus = $this->dms_model->editsave($formData);
$ResultNoticeResponse->editsave = $rStatus;
}else if ($serviceName=="dms.delete"){ //删除分销商
$id = $dms_backdata->DmsDetail->dtid;
$rStatus = $this->dms_model->dmdDelete($id);
$ResultNoticeResponse->dmsdelete = $rStatus;
}else if ($serviceName == "dms.payrecord"){ //支付记录
$arrKeyword = new stdClass();
$arrKeyword = $dms_backdata->arrKeyword;
$payrecord = $this->dms_model->payrecord($arrKeyword);
$resultData = $payrecord["data"];
$total = $payrecord["total"];
$ResultNoticeResponse->payrecord = new stdClass();
$ResultNoticeResponse->payrecord->data=$resultData;
$ResultNoticeResponse->payrecord->total = $total;
}else if ($serviceName=="dms.payrecord_addsave"){ //支付记录添加
$formData = new stdClass() ;
$formData = $dms_backdata->formInfo;
$rStatus = $this->dms_model->payrecord_addsave($formData);
$ResultNoticeResponse->addsave = $rStatus;
}else if ($serviceName=="dms.payrecord_delete"){ //支付记录删除
$id = $dms_backdata->payrecord->dp_id;
$htid = $dms_backdata->payrecord->dp_HtId;
$rStatus = $this->dms_model->payrecord_delete($id,$htid);
$ResultNoticeResponse->dmsdelete = $rStatus;
}else if ($serviceName=="dms.trainorder"){ //订单列表-火车
$arrKeyword = new stdClass();
$arrKeyword = $dms_backdata->arrKeyword;
$trainorder = $this->dms_model->trainorder($arrKeyword);
$resultData = $trainorder["data"];
$total = $trainorder["total"];
$ResultNoticeResponse->trainorder = new stdClass();
$ResultNoticeResponse->trainorder->data=$resultData;
$ResultNoticeResponse->trainorder->total = $total;
}else if ($serviceName == "dms.dmslisteasy"){ //所有分销商数据,下拉框使用
$getdmseasy = $this->dms_model->get_dmseasy();
$ResultNoticeResponse->getpayrule = $getdmseasy;
}else if ($serviceName=="dms.getpaydetail"){ //获取某一个分销商的所有财务信息
$id = $dms_backdata->htid;
$getpaydetail = $this->dms_model->get_paydetail($id);
$ResultNoticeResponse->getpaydetail = $getpaydetail;
}
}else{
$ResultNoticeResponse->returnCode = 0;
$ResultNoticeResponse->returnMsg = "messageIdentity is error!";
}
echo json_encode($ResultNoticeResponse);
}
}
/**
* @description:
* @return {*}
* @Date Changed:
*/
public function index()
{
}
public function login (){
}
public function addUser(){
}
}
/* End of file TrainDMS.php */

@ -1,205 +0,0 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
/*
* 自动加载语种标签
*/
class Currency {
var $USD_Rate; //人民币兑美元汇率
var $EUR_Rate; //人民币兑欧元汇率
var $RUB_Rate; //人民币兑卢布汇率
public function __construct() {
$this->CI = & get_instance();
log_message('debug', "Language Tags Class Initialized");
$this->GetCurrencyRate();
}
function GetCurrencyRate() {
$this->HT = $this->CI->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 $query->result();
}
//根据人民币转换成站点对应的货币
public function GetSiteMoney($RMB) {
if (!is_numeric($RMB))
{
return $RMB;
}
$result = $RMB;
if (is_numeric($RMB)) {
switch (CONST_SITE_CURRENCY) {
case 'USD':
$result = $RMB / $this->USD_Rate;
break;
case 'EUR':
$result = $RMB / $this->EUR_Rate;
break;
case 'RUB':
$result = $RMB / $this->RUB_Rate;
break;
}
}
return ceil($result);
}
//把美金转换为人民币
public function get_USD_RMB_SUM($USD) {
if (!is_numeric($USD))return $USD;
$result = $USD;
$result = $USD * $this->USD_Rate;
return ceil($result);
}
/**
* 返回站点的汇率。
*
* @author lmr
*/
public function get_site_currencyrate() {
switch (CONST_SITE_CURRENCY) {
case 'USD':
return $this->USD_Rate;
case 'EUR':
return $this->EUR_Rate;
case 'RUB':
return $this->RUB_Rate;
default:
return 1;
}
}
/**
* 返回带money_char的价格。
*
* @param $money Int 价格.
* @return String 带货币符号的价格。
*/
public function get_money_char($money='') {
switch (CONST_SITE_CODE) {
case 'JP':
return $money.'元';
case 'GM':
return '€'.$money;
case 'VC':
return $money.'€';
case 'VAC':
return '$'.$money;
case 'RU':
return '$'.$money;
case 'IT':
return '€'.$money;
case 'SHT':
return '$'.$money;
default:
return '$'.$money;
}
}
/**
* 返回带money_char的价格。
*
* @param $money Int 价格.
* @return String 带货币符号的价格。
*/
public function get_site_money_with_char($money='') {
return $this->get_money_char($this->GetSiteMoney($money));
}
/**
* RMB换算成指定货币。
* @param int money RMB
* @param string char 货币代号usdeur
* @return int 换算价格
*/
public function convert_moneny_by_char($money,$char='')
{
switch (strtolower($char))
{
case 'usd':
return ceil($money/$this->USD_Rate);
case 'eur':
return ceil($money/$this->EUR_Rate);
}
return $money;
}
/**
* 尾数取"9"的定价规则
* 在正负误差值小于或等于16的前提下
* 保证展示价格的个位数和十位数统一取"99"
* 当展示价格的个位数和十位数取"99"的正负误差大于16时
* 通过四舍五入加价实现个位数取"9"
* 详细规则见GitLab issue #12 统一网前展示价格的标准
*/
public function calc_show_price($value=0) {
if (empty($value)) return 0;
if (!is_numeric($value)) return $value;
$val_len = strlen(floatval($value));
if ($val_len == 1) return 9;
$discount = 16;
//$discount =6;
$val_pow = pow(10, $val_len - 1);
$min_val = $val_pow - 1;
$max_val = $min_val + $val_pow;
$max_diff = abs($value - $max_val);
$min_diff = abs($value - $min_val);
if (min($max_diff, $min_diff) > $discount) {
$calc_val = floor($value / 10) * 10 + 9;
} else {
$calc_val = $max_diff > $min_diff ? $min_val : $max_val;
}
return $calc_val;
}
/**
* 获取设置的信用卡卡费
*/
public function cardfee(){
$sql = "SELECT TOP 1 * FROM dbo.SystemSettingInfo WHERE (SSI_Code = 1021001)";
$this->HT = $this->CI->load->database('HT', TRUE);
$query = $this->HT->query($sql);
$row = $query->row();
if (isset($row)){
return $row->SSI_UserValue;
}else{
return 0;
}
}
}

@ -1,59 +0,0 @@
<?php
class Des
{
function encrypt($string,$key)
{
$size = mcrypt_get_block_size('des','ecb');
//$string = mb_convert_encoding($string, 'GBK', 'UTF-8');
$string = $this->pkcs5_pad($string, $size);
$td = mcrypt_module_open('des', '', 'ecb', '');
$iv = @mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
@mcrypt_generic_init($td, $key, $iv);
$data = mcrypt_generic($td, $string);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
$data = base64_encode($data);
return $data;
}
function decrypt($string,$key)
{
$string = base64_decode($string);
$td = mcrypt_module_open('des', '', 'ecb', '');
//使用MCRYPT_DES算法,cbc模式
$iv = @mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
$ks = mcrypt_enc_get_key_size($td);
@mcrypt_generic_init($td, $key, $iv);
//初始处理
$decrypted = mdecrypt_generic($td, $string);
//解密
mcrypt_generic_deinit($td);
//结束
mcrypt_module_close($td);
$result = $this->pkcs5_unpad($decrypted);
//$result = mb_convert_encoding($result, 'UTF-8', 'GBK');
return $result;
}
function pkcs5_pad($text, $blocksize)
{
$pad = $blocksize - (strlen($text) % $blocksize);
return $text . str_repeat(chr($pad), $pad);
}
function pkcs5_unpad($text)
{
$pad = ord($text{strlen($text) - 1});
if ($pad > strlen($text)) {
return false;
}
if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) {
return false;
}
return substr($text, 0, -1 * $pad);
}
}
?>

@ -1,471 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Api_model extends CI_Model {
public function __construct()
{
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
$this->InfoCT = $this->load->database('INFORMATION', TRUE);
}
var $dei_sn = 17; //组别ID
var $CTLGC = 104; //语种
/**
* @description: 根据一日游code获取对应人数的成人价格
* @param {string} $pagecode 线路代码
* @param int $personnum 人数
* @return:
*/
function getDaytripsPrice($pagcode, $personnum)
{
$sql = "select top 1 isnull(PKP_AdultPrice,0) as PKP_AdultPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
,PAG_DefaultVEI_SN
from BIZ_PackagePrice
inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
and BIZ_PackagePrice.PKP_VEI_SN = BIZ_PackageInfo.PAG_DefaultVEI_SN
where (BIZ_PackageInfo.PAG_Code = ?) AND (pag_dei_sn= ? )
and ? between PKP_PersonStart and PKP_PersonStop and CONVERT(varchar(12),getdate(),111) between pkp_validdate and pkp_invaliddate
order by isnull( BIZ_PackageInfo.PAG_DefaultVEI_SN,0) desc,PKP_PriceGrade ";
$param = array($pagcode,$this->dei_sn, $personnum);
$query = $this->HT->query($sql, $param);
if ($query->num_rows() > 0) {
return $query->row();
} else {
//'第二种有默认供应商但是没有当前日期价格的时候
$sql = "select top 1 isnull(PKP_AdultPrice,0) as PKP_AdultPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
,PAG_DefaultVEI_SN
from BIZ_PackagePrice
inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
and BIZ_PackagePrice.PKP_VEI_SN = BIZ_PackageInfo.PAG_DefaultVEI_SN
where (BIZ_PackageInfo.PAG_Code = ? ) AND (pag_dei_sn= ? )
and ? between PKP_PersonStart and PKP_PersonStop
order by pkp_invaliddate desc,PKP_PriceGrade ";
$query = $this->HT->query($sql, $param);
if ($query->num_rows() > 0) {
return $query->row();
}else{
//'第三种没有默认供应商但是有当前日期价格的时候
$sql = "select top 1 isnull(PKP_AdultPrice,0) as PKP_AdultPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
,PAG_DefaultVEI_SN
from BIZ_PackagePrice
inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
where (BIZ_PackageInfo.PAG_Code = ? ) AND (pag_dei_sn= ? )
and ? between PKP_PersonStart and PKP_PersonStop and CONVERT(varchar(12),getdate(),111) between pkp_validdate and pkp_invaliddate
order by isnull( BIZ_PackageInfo.PAG_DefaultVEI_SN,0) desc,PKP_PriceGrade ";
$query = $this->HT->query($sql, $param);
if ($query->num_rows() > 0) {
return $query->row();
}else{
//'第四种无默认供应商无当前日期价格
$sql = "select top 1 isnull(PKP_AdultPrice,0) as PKP_AdultPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
,PAG_DefaultVEI_SN
from BIZ_PackagePrice
inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
where (BIZ_PackageInfo.PAG_Code = ? ) AND (pag_dei_sn= ? )
and ? between PKP_PersonStart and PKP_PersonStop
order by pkp_invaliddate desc,PKP_PriceGrade ";
$query = $this->HT->query($sql, $param);
if ($query->num_rows() > 0) {
return $query->row();
}else {
return null;
}
}
}
}
}
/**
* @description: 获取精华线路价格2人等
* @param {*}
* @return {*}
* @Date Changed:
*/
function getTourPrice($cli_no){
$CLI_SN = "";
$reust = "";
//'新的GP没有设置以前的2-5人等价格导致读不出价格。把Gp价格放前面计算
$sql = "select top 1 CLI_SN,CLI_PackageClass from CustomerLineInfo
where CLI_NO=? and ( CLI_State = 1005003 or CLI_State=1005004) and CLI_Grade=7001
AND (CLI_DEI_SN= ? )";
$query = $this->HT->query($sql,array($cli_no,$this->dei_sn));
if (!$query->num_rows()>0){
return null;
}else{
$row = $query->row();
if (isset($row)){
$CLI_SN = $row->CLI_SN;
}
//'获取线路是否有travelbuddy,也就是有固定的发团日期
$fut_sql = "SELECT count(*) as CountBuddy FROM FixedGroupDate WHERE FGD_CLI_SN='".$CLI_SN."'";
$futQuery = $this->HT->query($fut_sql);
$futrow = $futQuery->row();
$fut_CountBuddy = $futrow->CountBuddy;
if ($fut_CountBuddy>0){
//读取GP价格
$gpSql ="SELECT TOP 1 FGD_AdultPrice,FGD_Departure,
isnull(FGD_ProAdultPrice,0) as FGD_ProAdultPrice
FROM FixedGroupDate
WHERE (FGD_Departure >= GETDATE())
AND (FGD_CLI_SN = ".$CLI_SN.") AND (FGD_State = 1) ORDER BY FGD_AdultPrice";
$gpquery = $this->HT->query($gpSql);
if ($gpquery->num_rows()>0){
$gpRow = $gpquery->row();
$FGD_AdultPrice = $gpRow->FGD_AdultPrice;
$FGD_ProAdultPrice = $gpRow->FGD_ProAdultPrice;
if ($FGD_ProAdultPrice>0){
$reust = $FGD_ProAdultPrice; //促销价
}else{
$reust=$FGD_AdultPrice;
}
}
}else {
//普通线路价格
$sql = "select top 1
CLI_SN,CLP_TwoToFiveAdultPrice,CLI_PackageClass
FROM CustomerLineInfo INNER JOIN
CustomerLinePrice ON CustomerLineInfo.CLI_SN = CustomerLinePrice.CLP_CLI_SN INNER JOIN
CustomerLineInfo2 ON CustomerLineInfo.CLI_SN = CustomerLineInfo2.CLI2_CLI_SN
where CLI_SN= ? and CLI2_LGC=? and (CLP_Area=1 or CLP_Area=2)
and (CLI_State = 1005004 or CLI_State = 1005003) ORDER BY CLP_TwoToFiveAdultPrice";
$query = $this->HT->query($sql,array($CLI_SN,$this->CTLGC));
if ($query->num_rows()>0){
$reust = $query->row()->CLP_TwoToFiveAdultPrice;
}
}
}
return $reust;
}
/**
* @description: 一日游列表,包含信息平台和HT
* @param {*} $whereHT HT的查询条件
* @param {*} $whereInfo 信息平台的查询条件
* @return {*}
* @Date Changed:
*/
function getDaytripList($whereHT="",$whereInfo=""){
$sql = "select * from(
select * from(
SELECT p2.PAG2_Name as title
,P1.PAG_Code as code
,'' as url
,isnull(p2.PAG2_ImageURL,'') as pic1
,isnull((select top 1 PAP_ImageURL from BIZ_PackagePic where PAP_PII_SN=p2.PAG2_PII_SN),'') as pic2
,'2' as sortby
FROM dbo.BIZ_PackageInfo P1
INNER JOIN dbo.BIZ_PackageInfo2 p2 ON P1.PAG_SN = p2.PAG2_PAG_SN
INNER JOIN dbo.CItyInfo2 ON P1.PAG_CII_SN = dbo.CItyInfo2.CII2_CII_SN AND dbo.CItyInfo2.CII2_LGC = 1
WHERE 1=2 and (p2.PAG2_LGC = 104)
AND (p1.pag_dei_sn = 17)
AND (p2.PAG2_Check = 2)
AND (PAG_Code not in(
SELECT convert(varchar(100),(
SELECT TOP 1 im_value
FROM information_ct.dbo.infoMetas
WHERE im_key = 'meta_product_code'
AND im_ic_id = ic_id
)) AS code
FROM information_ct.dbo.infoContents
INNER JOIN information_ct.dbo.infoStructures ON ic_id = is_ic_id
WHERE is_sitecode = 'chinatravel'".$whereInfo."
AND ic_status = 1
))
AND (isnull(P1.DeleteFlag,0) <>1) ".$whereHT."
) Tmp
UNION ALL
SELECT * from (
select ic_url_title as title
,(select top 1 im_value from information_ct.dbo.infoMetas where im_key='meta_product_code' and im_ic_id=ic_id) as code
,ic_url as url , ic_photo as pic1
,(select top 1 im_value from information_ct.dbo.infoMetas where im_key='meta_addon_picture_mobile' and im_ic_id=ic_id) as pic2
,'1' as sortby
FROM information_ct.dbo.infoContents
inner join information_ct.dbo.infoStructures on ic_id=is_ic_id
WHERE is_sitecode='chinatravel' ".$whereInfo."
and ic_status=1
) as t
) tball
where 1=1
ORDER BY tball.sortBy ASC
";
$query = $this->HT->query($sql);
return $query->result();
}
/**
* @description: HT获取一日游列表
* @param {*} $city 一日游城市 ,默认必须有城市,不然太多
* @param {*} $where 其它条件
* @return {*}
* @Date Changed:
*/
function getDaytripListHT($city="beijing",$where=""){
$sql = " select * from(
SELECT p2.PAG2_Name
,p2.PAG2_Intro
,P1.PAG_NeedTime
,P1.PAG_SN
,P1.PAG_Leve
,p2.PAG2_Order
,P1.PAG_Code
,p2.PAG2_Attraction
,CItyInfo2.CII2_Name
,isnull((select top 1 PAP_ImageURL from BIZ_PackagePic where PAP_PII_SN=p2.PAG2_PII_SN),'') as NewListImage
,isnull(p2.PAG2_ImageURL,'') as NewListImage2
,dbo.GetFullPathByPII_SN(p2.PAG2_PII_SN, 2) AS picpath
,p2.PAG2_Title
,p1.PAG_Type
,pag2_summary
FROM dbo.BIZ_PackageInfo P1
INNER JOIN dbo.BIZ_PackageInfo2 p2 ON P1.PAG_SN = p2.PAG2_PAG_SN
INNER JOIN dbo.CItyInfo2 ON P1.PAG_CII_SN = dbo.CItyInfo2.CII2_CII_SN AND dbo.CItyInfo2.CII2_LGC = 1
WHERE (p2.PAG2_LGC = ?)
AND (p1.pag_dei_sn = ?)
AND (p2.PAG2_Check = 2)
AND (isnull(P1.DeleteFlag,0) <>1)
) Tmp
where 1=1 ";
if ($city!=""){
$sql .= " AND (CII2_Name ='".$city."')";
}
// $sql .= "and PAG_Code in ('SHALC-1','SHALC-7')";
$sql .= " order by isnull(pag2_order,0) desc,pag_code ";
// echo ($sql);
$param = array($this->CTLGC,$this->dei_sn);
$query = $this->HT->query($sql,$param);
return $query->result();
}
/**
* @description: 获取子类信息列表
* @param {type} $old_pid$new_pid 父类的Id,分为旧网站的和新网站的
* @return:
* @Date Changed:
*/
function getGuideList($old_pid,$new_pid){
$sql = " select top 1 ic_url from dbo.infoContents
inner join infoStructures on ic_id=is_ic_id
where is_id = ? ";
$query = $this->InfoCT->query ($sql ,array($new_pid));
if ($query->num_rows()>0){
$url = $query->row()->ic_url;
}else{
$url = "";
}
if ($url==""){$url="nourl";}
////原来读取旧信息数据
// SELECT ic_url,ic_url_title,ic_photo
// ,(select top 1 im_value from infoMetas where im_key='meta_addon_picture_mobile' and im_ic_id=ic_id) as pic2
// ,'2' as sortby
// FROM dbo.infoContents
// inner join infoStructures on ic_id=is_ic_id
// WHERE is_sitecode='ct'
// and ic_status=1
// and is_parent_id = ?
$sql = "
select * from (
SELECT ic_url,ic_url_title,ic_photo
,(select top 1 im_value from infoMetas where im_key='meta_addon_picture_mobile' and im_ic_id=ic_id) as pic2
,'2' as sortby , is_sort
FROM dbo.infoContents
inner join infoStructures on ic_id=is_ic_id
WHERE is_sitecode='chinatravel'
and ic_status=1
and ic_url like ?
and is_parent_id <> ?
UNION ALL
SELECT ic_url,ic_url_title,ic_photo
,(select top 1 im_value from infoMetas where im_key='meta_addon_picture_mobile' and im_ic_id=ic_id) as pic2
,'1' as sortby ,is_sort
FROM dbo.infoContents
inner join infoStructures on ic_id=is_ic_id
WHERE is_sitecode='chinatravel'
and ic_status=1
and is_parent_id = ?
) allbt
order by sortby ,is_sort
";
$qurey = $this->InfoCT->query($sql,array($url."/%",$new_pid,$new_pid));
return $qurey->result();
}
/**
* @description: 获取线路的sn
* @param {*} $clino 线路编码
* @return {*}
* @Date Changed:
*/
function getCliSn($clino=""){
$sql = "select top 1 CLI_SN,CLI_PackageClass from CustomerLineInfo
where CLI_NO=? and CLI_State=1005004
AND (CLI_DEI_SN= ? )";
$query = $this->HT->query($sql,array($clino,$this->dei_sn));
if (!$query->num_rows()>0){
return null;
}else{
return $query->row();
}
}
/**
* @description: 获取一日游价格列表
* @param {*} $pagcode
* @return {*}
* @Date Changed:
*/
function getDaytripPriceList($pagcode){
//1.先根据编码获取SN
$sql = "select top 1 PAG_SN from BIZ_PackageInfo p1
inner join BIZ_PackageInfo2 p2 on p1.PAG_SN = p2.PAG2_PAG_SN
where p1.pag_dei_sn = ?
and p2.PAG2_LGC = ?
and p1.PAG_Code = ?
and p2.PAG2_Check = 2
AND (isnull(P1.DeleteFlag,0) <>1) ";
$query = $this->HT->query($sql,array($this->dei_sn,$this->CTLGC,$pagcode));
if ($query->num_rows()>0){
//2.根据SN获取获取一个供应商的ID不然所有供应商的价格都出来了。
$pagsn = $query->row()->PAG_SN;
$sql = "select top 10 PAG_DefaultVEI_SN,pkp_vei_sn ,*
from BIZ_PackagePrice
left join BIZ_PackageInfo on BIZ_PackageInfo.PAG_DefaultVEI_SN=BIZ_PackagePrice.PKP_VEI_SN
and BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
where PKP_PAG_SN =?
order by isnull( BIZ_PackageInfo.PAG_DefaultVEI_SN,0) desc ,PKP_InvalidDate desc";
$query = $this->HT->query($sql,array($pagsn));
if ($query->num_rows()>0){
$veisn = $query->row()->pkp_vei_sn;
if (!empty($query->row()->PAG_DefaultVEI_SN)){
$veisn = $query->row()->PAG_DefaultVEI_SN;
}
}else{
$veisn=0;
}
//3.根据供应商ID获取对应价格列表
$sql = "SELECT isnull(PKP_AdultPrice, 0) AS PKP_AdultPrice
,isnull(PKP_AdultSpecialPrice, 0) AS PKP_AdultSpecialPrice
,PKP_PersonStart
,PKP_PersonStop
FROM BIZ_PackagePrice
WHERE PKP_PAG_SN = ?
AND PKP_VEI_SN = ?
AND getdate() BETWEEN pkp_validdate AND pkp_invaliddate
and Checked=2
ORDER BY PKP_PersonStart ";
$query = $this->HT->query($sql,array($pagsn,$veisn));
if (!$query->num_rows()>0){
//如果今年没价格,获取去年的价格
$nowYear = date('Y');
for ($i=1;$i<6;$i++){
$price_pyears = $nowYear-$i ."-1-1";
$price_pyears_2 = $nowYear-$i . "-12-31";
$sql = "SELECT isnull(PKP_AdultPrice, 0) AS PKP_AdultPrice
,isnull(PKP_AdultSpecialPrice, 0) AS PKP_AdultSpecialPrice
,PKP_PersonStart
,PKP_PersonStop
FROM BIZ_PackagePrice
WHERE PKP_PAG_SN = ?
AND PKP_VEI_SN = ?
AND pkp_validdate BETWEEN '".$price_pyears."' AND '".$price_pyears_2."' ORDER BY PKP_PersonStart ";
$query = $this->HT->query($sql,array($pagsn,$veisn));
if ($query->num_rows()>0){
break;
}
}
}
if ($query->num_rows()>0){
//4.价格列表返回
return $query->result();
}else {
return null;
}
}else{
return null;
}
}
//根据图片URL判断CDN的地址
function getPicCdn($picurl){
$strCdn ="";
if (strpos($picurl,"chinatravel.com")!== false) {
$strCdn="";
} else if (strpos($picurl,"allpicture")!== false){
$strCdn = "//images.chinatravel.com";
}else if (strpos($picurl,"/album/userupload/")!== false){
$strCdn = "//data.chinatravel.com";
}else if (strpos($picurl,"/images/")!== false) {
$strCdn = "//data.chinatravel.com";
}else{
$strCdn = "//images.chinatravel.com";
}
return $strCdn;
}
/**
* @description: //旧数据导入新数据
* @param {*} $id
* @param {*} $oldUrl
* @return {*}
* @Date Changed:
*/
function copyOldUrl($id,$oldUrl){
$sql = "UPDATE icNew
SET icNew.ic_content = icOld.ic_content
,icNew.ic_summary = icOld.ic_summary
,icNew.ic_title = icOld.ic_title
,icNew.ic_url_title = icOld.ic_url_title
,icNew.ic_seo_title = icOld.ic_seo_title
,icNew.ic_seo_description = icOld.ic_seo_description
,icNew.ic_seo_keywords = icOld.ic_seo_keywords
,icNew.ic_photo = icOld.ic_photo
FROM infoContents icNew
,infoContents icOld
WHERE icNew.ic_id = ?
AND icNew.ic_sitecode = 'chinatravel'
AND icOld.ic_url = ?
AND icOld.ic_sitecode = 'ct'";
return $this->InfoCT->query($sql, array($id,$oldUrl));
}
}
/* End of file Api_model.php */

@ -1,444 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Apish_model extends CI_Model {
public function __construct()
{
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
$this->InfoCT = $this->load->database('INFORMATION', TRUE);
}
var $dei_sn = 25; //组别ID
var $CTLGC = 107; //语种
/**
* @description: 根据一日游code获取对应人数的成人价格
* @param {string} $pagecode 线路代码
* @param int $personnum 人数
* @return:
*/
function getDaytripsPrice($pagcode, $personnum)
{
$sql = "select top 1 isnull(PKP_AdultPrice,0) as PKP_AdultPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
,PAG_DefaultVEI_SN
from BIZ_PackagePrice
inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
and BIZ_PackagePrice.PKP_VEI_SN = BIZ_PackageInfo.PAG_DefaultVEI_SN
where (BIZ_PackageInfo.PAG_Code = ?) AND (pag_dei_sn= ? )
and ? between PKP_PersonStart and PKP_PersonStop and CONVERT(varchar(12),getdate(),111) between pkp_validdate and pkp_invaliddate
order by isnull( BIZ_PackageInfo.PAG_DefaultVEI_SN,0) desc,PKP_PriceGrade ";
$param = array($pagcode,$this->dei_sn, $personnum);
$query = $this->HT->query($sql, $param);
if ($query->num_rows() > 0) {
return $query->row();
} else {
//'第二种有默认供应商但是没有当前日期价格的时候
$sql = "select top 1 isnull(PKP_AdultPrice,0) as PKP_AdultPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
,PAG_DefaultVEI_SN
from BIZ_PackagePrice
inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
and BIZ_PackagePrice.PKP_VEI_SN = BIZ_PackageInfo.PAG_DefaultVEI_SN
where (BIZ_PackageInfo.PAG_Code = ? ) AND (pag_dei_sn= ? )
and ? between PKP_PersonStart and PKP_PersonStop
order by pkp_invaliddate desc,PKP_PriceGrade ";
$query = $this->HT->query($sql, $param);
if ($query->num_rows() > 0) {
return $query->row();
}else{
//'第三种没有默认供应商但是有当前日期价格的时候
$sql = "select top 1 isnull(PKP_AdultPrice,0) as PKP_AdultPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
,PAG_DefaultVEI_SN
from BIZ_PackagePrice
inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
where (BIZ_PackageInfo.PAG_Code = ? ) AND (pag_dei_sn= ? )
and ? between PKP_PersonStart and PKP_PersonStop and CONVERT(varchar(12),getdate(),111) between pkp_validdate and pkp_invaliddate
order by isnull( BIZ_PackageInfo.PAG_DefaultVEI_SN,0) desc,PKP_PriceGrade ";
$query = $this->HT->query($sql, $param);
if ($query->num_rows() > 0) {
return $query->row();
}else{
//'第四种无默认供应商无当前日期价格
$sql = "select top 1 isnull(PKP_AdultPrice,0) as PKP_AdultPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
,PAG_DefaultVEI_SN
from BIZ_PackagePrice
inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
where (BIZ_PackageInfo.PAG_Code = ? ) AND (pag_dei_sn= ? )
and ? between PKP_PersonStart and PKP_PersonStop
order by pkp_invaliddate desc,PKP_PriceGrade ";
$query = $this->HT->query($sql, $param);
if ($query->num_rows() > 0) {
return $query->row();
}else {
return null;
}
}
}
}
}
/**
* @description: 获取精华线路价格2人等
* @param {*}
* @return {*}
* @Date Changed:
*/
function getTourPrice($cli_no){
$CLI_SN = "";
$reust = "";
//'新的GP没有设置以前的2-5人等价格导致读不出价格。把Gp价格放前面计算
$sql = "select top 1 CLI_SN,CLI_PackageClass from CustomerLineInfo
where CLI_NO=? and CLI_State=1005004
AND (CLI_DEI_SN= ? )";
$query = $this->HT->query($sql,array($cli_no,$this->dei_sn));
if (!$query->num_rows()>0){
return null;
}else{
$row = $query->row();
if (isset($row)){
$CLI_SN = $row->CLI_SN;
}
//'获取线路是否有travelbuddy,也就是有固定的发团日期
$fut_sql = "SELECT count(*) as CountBuddy FROM FixedGroupDate WHERE FGD_CLI_SN='".$CLI_SN."'";
$futQuery = $this->HT->query($fut_sql);
$futrow = $futQuery->row();
$fut_CountBuddy = $futrow->CountBuddy;
if ($fut_CountBuddy>0){
//读取GP价格
$gpSql ="SELECT TOP 1 FGD_AdultPrice,FGD_Departure,
isnull(FGD_ProAdultPrice,0) as FGD_ProAdultPrice
FROM FixedGroupDate
WHERE (FGD_Departure >= GETDATE())
AND (FGD_CLI_SN = ".$CLI_SN.") AND (FGD_State = 1) ORDER BY FGD_AdultPrice";
$gpquery = $this->HT->query($gpSql);
if ($gpquery->num_rows()>0){
$gpRow = $gpquery->row();
$FGD_AdultPrice = $gpRow->FGD_AdultPrice;
$FGD_ProAdultPrice = $gpRow->FGD_ProAdultPrice;
if ($FGD_ProAdultPrice>0){
$reust = $FGD_ProAdultPrice; //促销价
}else{
$reust=$FGD_AdultPrice;
}
}
}else {
//普通线路价格
$sql = "select top 1
CLI_SN,CLP_TwoToFiveAdultPrice,CLI_PackageClass
FROM CustomerLineInfo INNER JOIN
CustomerLinePrice ON CustomerLineInfo.CLI_SN = CustomerLinePrice.CLP_CLI_SN INNER JOIN
CustomerLineInfo2 ON CustomerLineInfo.CLI_SN = CustomerLineInfo2.CLI2_CLI_SN
where CLI_SN= ? and CLI2_LGC=? and (CLP_Area=1 or CLP_Area=2)
and CLI_State = 1005004 ORDER BY CLP_TwoToFiveAdultPrice";
$query = $this->HT->query($sql,array($CLI_SN,$this->CTLGC));
if ($query->num_rows()>0){
$reust = $query->row()->CLP_TwoToFiveAdultPrice;
}
}
}
return $reust;
}
/**
* @description: 一日游列表,包含信息平台和HT
* @param {*} $whereHT HT的查询条件
* @param {*} $whereInfo 信息平台的查询条件
* @return {*}
* @Date Changed:
*/
function getDaytripList($whereHT="",$whereInfo=""){
$sql = "select * from(
select * from(
SELECT p2.PAG2_Name as title
,P1.PAG_Code as code
,'' as url
,isnull(p2.PAG2_ImageURL,'') as pic1
,isnull((select top 1 PAP_ImageURL from BIZ_PackagePic where PAP_PII_SN=p2.PAG2_PII_SN),'') as pic2
,'2' as sortby
FROM dbo.BIZ_PackageInfo P1
INNER JOIN dbo.BIZ_PackageInfo2 p2 ON P1.PAG_SN = p2.PAG2_PAG_SN
INNER JOIN dbo.CItyInfo2 ON P1.PAG_CII_SN = dbo.CItyInfo2.CII2_CII_SN AND dbo.CItyInfo2.CII2_LGC = 1
WHERE 1=2 and (p2.PAG2_LGC = 104)
AND (p1.pag_dei_sn = 25)
AND (p2.PAG2_Check = 2)
AND (PAG_Code not in(
SELECT convert(varchar(100),(
SELECT TOP 1 im_value
FROM information_ct.dbo.infoMetas
WHERE im_key = 'meta_product_code'
AND im_ic_id = ic_id
)) AS code
FROM information_ct.dbo.infoContents
INNER JOIN information_ct.dbo.infoStructures ON ic_id = is_ic_id
WHERE is_sitecode = 'shanghai'".$whereInfo."
AND ic_status = 1
))
AND (isnull(P1.DeleteFlag,0) <>1) ".$whereHT."
) Tmp
UNION ALL
SELECT * from (
select ic_url_title as title
,(select top 1 im_value from information_ct.dbo.infoMetas where im_key='meta_product_code' and im_ic_id=ic_id) as code
,ic_url as url , ic_photo as pic1
,(select top 1 im_value from information_ct.dbo.infoMetas where im_key='meta_addon_picture_mobile' and im_ic_id=ic_id) as pic2
,'1' as sortby
FROM information_ct.dbo.infoContents
inner join information_ct.dbo.infoStructures on ic_id=is_ic_id
WHERE is_sitecode='shanghai' ".$whereInfo."
and ic_status=1
) as t
) tball
where 1=1
ORDER BY tball.sortBy ASC
";
$query = $this->HT->query($sql);
return $query->result();
}
/**
* @description: HT获取一日游列表
* @param {*} $city 一日游城市 ,默认必须有城市,不然太多
* @param {*} $where 其它条件
* @return {*}
* @Date Changed:
*/
function getDaytripListHT($city="beijing",$where=""){
$sql = " select * from(
SELECT p2.PAG2_Name
,p2.PAG2_Intro
,P1.PAG_NeedTime
,P1.PAG_SN
,P1.PAG_Leve
,p2.PAG2_Order
,P1.PAG_Code
,p2.PAG2_Attraction
,CItyInfo2.CII2_Name
,isnull((select top 1 PAP_ImageURL from BIZ_PackagePic where PAP_PII_SN=p2.PAG2_PII_SN),'') as NewListImage
,isnull(p2.PAG2_ImageURL,'') as NewListImage2
,dbo.GetFullPathByPII_SN(p2.PAG2_PII_SN, 2) AS picpath
,p2.PAG2_Title
,p1.PAG_Type
,pag2_summary
FROM dbo.BIZ_PackageInfo P1
INNER JOIN dbo.BIZ_PackageInfo2 p2 ON P1.PAG_SN = p2.PAG2_PAG_SN
INNER JOIN dbo.CItyInfo2 ON P1.PAG_CII_SN = dbo.CItyInfo2.CII2_CII_SN AND dbo.CItyInfo2.CII2_LGC = 1
WHERE (p2.PAG2_LGC = ?)
AND (p1.pag_dei_sn = ?)
AND (p2.PAG2_Check = 2)
AND (isnull(P1.DeleteFlag,0) <>1)
) Tmp
where 1=1 ";
if ($city!=""){
$sql .= " AND (CII2_Name ='".$city."')";
}
// $sql .= "and PAG_Code in ('SHALC-1','SHALC-7')";
$sql .= " order by isnull(pag2_order,0) desc,pag_code ";
// echo ($sql);
$param = array($this->CTLGC,$this->dei_sn);
$query = $this->HT->query($sql,$param);
return $query->result();
}
/**
* @description: 获取子类信息列表
* @param {type} $old_pid$new_pid 父类的Id,分为旧网站的和新网站的
* @return:
* @Date Changed:
*/
function getGuideList($old_pid,$new_pid){
$sql = " select top 1 ic_url from dbo.infoContents
inner join infoStructures on ic_id=is_ic_id
where is_id = ? ";
$query = $this->InfoCT->query ($sql ,array($new_pid));
if ($query->num_rows()>0){
$url = $query->row()->ic_url;
}else{
$url = "";
}
if ($url==""){$url="nourl";}
////原来读取旧信息数据
// SELECT ic_url,ic_url_title,ic_photo
// ,(select top 1 im_value from infoMetas where im_key='meta_addon_picture_mobile' and im_ic_id=ic_id) as pic2
// ,'2' as sortby
// FROM dbo.infoContents
// inner join infoStructures on ic_id=is_ic_id
// WHERE is_sitecode='ct'
// and ic_status=1
// and is_parent_id = ?
$sql = "
select * from (
SELECT ic_url,ic_url_title,ic_photo
,(select top 1 im_value from infoMetas where im_key='meta_addon_picture_mobile' and im_ic_id=ic_id) as pic2
,'2' as sortby , is_sort
FROM dbo.infoContents
inner join infoStructures on ic_id=is_ic_id
WHERE is_sitecode='shanghai'
and ic_status=1
and ic_url like ?
and is_parent_id <> ?
UNION ALL
SELECT ic_url,ic_url_title,ic_photo
,(select top 1 im_value from infoMetas where im_key='meta_addon_picture_mobile' and im_ic_id=ic_id) as pic2
,'1' as sortby ,is_sort
FROM dbo.infoContents
inner join infoStructures on ic_id=is_ic_id
WHERE is_sitecode='shanghai'
and ic_status=1
and is_parent_id = ?
) allbt
order by sortby ,is_sort
";
$qurey = $this->InfoCT->query($sql,array($url."/%",$new_pid,$new_pid));
return $qurey->result();
}
/**
* @description: 获取线路的sn
* @param {*} $clino 线路编码
* @return {*}
* @Date Changed:
*/
function getCliSn($clino=""){
$sql = "select top 1 CLI_SN,CLI_PackageClass from CustomerLineInfo
where CLI_NO=? and CLI_State=1005004
AND (CLI_DEI_SN= ? )";
$query = $this->HT->query($sql,array($clino,$this->dei_sn));
if (!$query->num_rows()>0){
return null;
}else{
return $query->row();
}
}
/**
* @description: 获取一日游价格列表
* @param {*} $pagcode
* @return {*}
* @Date Changed:
*/
function getDaytripPriceList($pagcode){
//1.先根据编码获取SN
$sql = "select top 1 PAG_SN from BIZ_PackageInfo p1
inner join BIZ_PackageInfo2 p2 on p1.PAG_SN = p2.PAG2_PAG_SN
where p1.pag_dei_sn = ?
and p2.PAG2_LGC = ?
and p1.PAG_Code = ?
and p2.PAG2_Check = 2
AND (isnull(P1.DeleteFlag,0) <>1) ";
$query = $this->HT->query($sql,array($this->dei_sn,$this->CTLGC,$pagcode));
if ($query->num_rows()>0){
//2.根据SN获取获取一个供应商的ID不然所有供应商的价格都出来了。
$pagsn = $query->row()->PAG_SN;
$sql = "select top 10 PAG_DefaultVEI_SN,pkp_vei_sn ,*
from BIZ_PackagePrice
left join BIZ_PackageInfo on BIZ_PackageInfo.PAG_DefaultVEI_SN=BIZ_PackagePrice.PKP_VEI_SN
and BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
where PKP_PAG_SN =?
order by isnull( BIZ_PackageInfo.PAG_DefaultVEI_SN,0) desc ,PKP_InvalidDate desc";
$query = $this->HT->query($sql,array($pagsn));
if ($query->num_rows()>0){
$veisn = $query->row()->pkp_vei_sn;
if (!empty($query->row()->PAG_DefaultVEI_SN)){
$veisn = $query->row()->PAG_DefaultVEI_SN;
}
}else{
$veisn=0;
}
//3.根据供应商ID获取对应价格列表
$sql = "SELECT isnull(PKP_AdultPrice, 0) AS PKP_AdultPrice
,isnull(PKP_AdultSpecialPrice, 0) AS PKP_AdultSpecialPrice
,PKP_PersonStart
,PKP_PersonStop
FROM BIZ_PackagePrice
WHERE PKP_PAG_SN = ?
AND PKP_VEI_SN = ?
AND getdate() BETWEEN pkp_validdate AND pkp_invaliddate
and Checked=2
ORDER BY PKP_PersonStart ";
$query = $this->HT->query($sql,array($pagsn,$veisn));
if (!$query->num_rows()>0){
//如果今年没价格,获取去年的价格
$nowYear = date('Y');
for ($i=1;$i<6;$i++){
$price_pyears = $nowYear-$i ."-1-1";
$price_pyears_2 = $nowYear-$i . "-12-31";
$sql = "SELECT isnull(PKP_AdultPrice, 0) AS PKP_AdultPrice
,isnull(PKP_AdultSpecialPrice, 0) AS PKP_AdultSpecialPrice
,PKP_PersonStart
,PKP_PersonStop
FROM BIZ_PackagePrice
WHERE PKP_PAG_SN = ?
AND PKP_VEI_SN = ?
AND pkp_validdate BETWEEN '".$price_pyears."' AND '".$price_pyears_2."' ORDER BY PKP_PersonStart ";
$query = $this->HT->query($sql,array($pagsn,$veisn));
if ($query->num_rows()>0){
break;
}
}
}
if ($query->num_rows()>0){
//4.价格列表返回
return $query->result();
}else {
return null;
}
}else{
return null;
}
}
//根据图片URL判断CDN的地址
function getPicCdn($picurl){
$strCdn ="";
if (strpos($picurl,"shanghaihighlights.com")!== false) {
$strCdn="";
} else if (strpos($picurl,"allpicture")!== false){
$strCdn = "//images.shanghaihighlights.com";
}else if (strpos($picurl,"/album/userupload/")!== false){
$strCdn = "//data.shanghaihighlights.com";
}else if (strpos($picurl,"/image/")!== false) {
$strCdn = "//data.shanghaihighlights.com";
}else{
$strCdn = "//images.shanghaihighlights.com";
}
return $strCdn;
}
}
/* End of file Api_model.php */

@ -1,402 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Dms_model extends CI_Model {
function __construct() {
parent::__construct();
$this->HT = $this->load->database('TOURMANAGER_LOCAL', TRUE);
$this->INFO = $this->load->database('INFORMATION_LOCAL', TRUE);
}
/**
* @description:
* @return {*}
* @Date Changed:
*/
function Login($username,$password){
$sql = "select top 1 dt_id,dt_username,dt_payrule,dt_usertype,dt_HtId from DMS_Distributor ";
$sql .= " where dt_status=1 and dt_username=? and dt_password=? ";
$query = $this->INFO->query($sql,array($username,$password));
if ($query->num_rows() > 0) {
return $query->row();
}else{
return null;
}
}
/**
* 订单列表
*/
function trainorder($arrKeyword){
$htid = $arrKeyword->htid ==false?-1:$arrKeyword->htid;
$page = $arrKeyword->page ==false?0:$arrKeyword->page;
$pagesize = $arrKeyword->per_page>0 ? $arrKeyword->per_page :20;
if ($page < 1) {
$page = 1;
}
$sql = " SELECT * from (
select row_number() over (order by COLI_ApplyDate desc) as rownumber, COLI_SN,COLI_ID,COLI_ApplyDate,COLI_servicetype,COLI_State,COLI_sourcetype,COLI_GUT_SN
,GUT_Title,GUT_FirstName,GUT_LastName
,tb2.*
from BIZ_ConfirmLineInfo bci
inner join BIZ_Guest bg on bci.COLI_GUT_SN = bg.GUT_SN
outer apply ( select top 1 COLD_COLI_SN,FlightsNo,DepartureCity,ArrivalCity from BIZ_ConfirmLineDetail inner join BIZ_FlightsOrderInfo
on FOI_COLD_SN=COLD_SN where COLD_COLI_SN=bci.COLI_SN) tb2
where COLI_State in(8,9,61,62)
AND COLI_servicetype='2'
and isnull(DeleteFlag,0)<>1 ";
if ($htid == 32083 || $htid==32084){
$sql .= " and COLI_sourcetype in(32083,32084) ";
}else {
$sql .= " and COLI_sourcetype ='".$htid."'";
}
$sql .= " )t ";
$sql2 = $sql." Where t.rownumber > ? And t.rownumber <= ?";
$begin = ($page - 1) * $pagesize;
$end = $begin + $pagesize;
$qurey = $this->HT->query($sql);
$count = $qurey->num_rows(); //总记录数
$qurey2 = $this->HT->query($sql2, array($begin, $end));
//return 数据和总数
return array('data' => $qurey2->result(), 'total' => $count);
}
/**
* @description:
* @param {*} $arrKeyword
* @return {*}
* @Date Changed:
*/
function get_DmList($arrKeyword){
$s_username = $arrKeyword->s_username ==false?"": trim($arrKeyword->s_username);
$s_ename = $arrKeyword->s_ename ==false?"": trim($arrKeyword->s_ename);
$page = $arrKeyword->page ==false?0:$arrKeyword->page;
$pagesize = $arrKeyword->per_page>0 ? $arrKeyword->per_page :20;
if ($page < 1) {
$page = 1;
}
$sql = "SELECT * from (
SELECT row_number() over (order by dt_id desc) as rownumber,dt_id,dt_username,dt_password,dt_HTid,dt_payrule,dt_usertype,isnull(dt_status,1) as dt_status
,(select dpr_rule from dms_payrule where dpr_id = dt_payrule) as dpr_rule
,(select syc2_CodeDiscribe FROM tourmanager.dbo.V_System_Code where SYC_Type=32 AND LGC_LGC=2 AND SYC_SN=dt_HtId) as dmsName
,isnull((select SUM(dp_paymoney) from DMS_PayRecord where dp_HtId=dt_HtId and dp_status>0),0) as TrainPaySum
from DMS_Distributor
)t where 1=1 ";
if ($s_username!=""){
$sql .= " and dt_username like '%".$s_username."%' ";
}
if ($s_ename!=""){
$sql .= " and dmsName like '%".$s_ename."%' ";
}
$sql2 = $sql . " and t.rownumber > ? And t.rownumber <= ? order by dt_id desc";
$begin = ($page - 1) * $pagesize;
$end = $begin + $pagesize;
$qurey = $this->INFO->query($sql);
$count = $qurey->num_rows(); //总记录数
$qurey2 = $this->INFO->query($sql2, array($begin, $end));
//计算订单总额
$returndata = $qurey2->result();
foreach ($returndata as $item) {
$paydetail = $this->get_paydetail($item->dt_HTid);
$trainOrderCount = $paydetail->count;
$trainOrderTotal = $paydetail->total;
$item->trainOrderCount = $trainOrderCount;
$item->trainOrderTotal = $trainOrderTotal;
}
//return 数据和总数
return array('data' => $returndata, 'total' => $count);
}
/**
* 获取支付规则列表数据
*/
function get_payrule(){
$sql = "select * from dms_payrule ";
$query = $this->INFO->query($sql);
return $query->result();
}
function get_dmseasy(){
$sql = " select * from DMS_Distributor where dt_usertype='distributor'
order by dt_username ";
$query = $this->INFO->query($sql);
return $query->result();
}
/**
* 获取某一个分销商的所有财务信息
*/
function get_paydetail($id){
$sql = "select count(*) as oCount from BIZ_ConfirmLineInfo where COLI_State in(8,9,61,62) AND COLI_servicetype='2' and isnull(DeleteFlag,0)<>1 ";
if ($id == 32083 || $id==32084){
$sql .= " and COLI_sourcetype in(32083,32084) ";
}else{
$sql .= " and COLI_sourcetype ='".$id."' ";
}
$query = $this->HT->query($sql);
if ($query->num_rows()>0){
$count = $query->row()->oCount;
}else{
$count = 0;
}
//付款规则
$sql = "select top 1 dt_payrule from DMS_Distributor where dt_htid='".$id."'";
$query = $this->INFO->query($sql);
if ($query->num_rows()>0){
$rule = $query->row()->dt_payrule;
}else{
$rule = 0;
}
if ($rule == 1){
$total = $count * 1;
}else if ($rule == 2 ){
$total = $count * 2;
}
else if ($rule == 3 ){
//按人数来算 ,1美元/人
$rSql = "select isnull(sum(COLD_PersonNum),0) as sumP from BIZ_ConfirmLineDetail
inner join BIZ_FlightsOrderInfo on FOI_COLD_SN=COLD_SN
where COLD_COLI_SN in( select COLI_SN from BIZ_ConfirmLineInfo where COLI_sourcetype='".$id."' and COLI_State in(8,9,61,62)
AND COLI_servicetype='2' and isnull(DeleteFlag,0)<>1)";
$queryR = $this->HT->query($rSql);
if ($queryR->num_rows()>0){
$total = $queryR->row()->sumP;
}else{
$total = 0 ;
}
}else {
$total = 0;
}
//已支付
$sql = "select isnull(SUM(dp_paymoney),0) as osum from DMS_PayRecord where dp_HtId= '".$id."'";
$query = $this->INFO->query($sql);
if ($query->num_rows()>0){
$sum = $query->row()->osum;
}else{
$sum = 0;
}
$result = new stdClass();
$result->count = $count;
$result->total = round($total,2);
$result->sum = round($sum,2);
return $result;
}
function addsave($formData){
$username = isset($formData->username)?$formData->username:"";
$password = isset($formData->password)?$formData->password:"";
$Htid = isset($formData->HtId)?$formData->HtId:0;
$payrule = isset($formData->payrule)?$formData->payrule:1;
$usertype = isset($formData->usertype)?$formData->usertype:"";
$result = new stdClass;
if ($usertype!=""){ //用户类型不为空才能进行添加
//先判断htid是否重复重复的话不允许添加.管理员不需要判断
$sql = "select * from DMS_Distributor where dt_HtId=? and dt_usertype='distributor'";
$query = $this->INFO->query($sql, array($Htid));
if ($query->num_rows() > 0) {
$result->status = 0;
$result->msg = "翰特编码重复,不允许添加!";
}else{
$sql = "insert into DMS_Distributor (dt_username,dt_password,dt_HtId,dt_payrule,dt_usertype) values (?,?,?,?,?)";
$query = $this->INFO->query($sql ,array($username,$password,$Htid,$payrule,$usertype));
if ($query === true){
$result->status = 1;
$result->msg = "数据添加成功!";
}else{
$result->status = 0;
$result->msg = "数据插入数据库失败,请联系管理员!";
}
}
}else{
$result->status = 0;
$result->msg = "用户类型错误!";
}
return $result;
}
/**
* 保存修改
*/
function editsave($formData){
$username = isset($formData->username)?$formData->username:"";
$password = isset($formData->password)?$formData->password:"";
$Htid = isset($formData->HtId)?$formData->HtId:0;
$payrule = isset($formData->payrule)?$formData->payrule:1;
$usertype = isset($formData->usertype)?$formData->usertype:"";
$id = isset($formData->id)?$formData->id:0;
$result = new stdClass;
if ($usertype!=""){ //用户类型不为空才能进行添加
//先判断htid是否重复重复的话不允许添加.管理员不需要判断
$sql = "select * from DMS_Distributor where dt_HtId=? and dt_usertype='distributor' and dt_id<>?";
$query = $this->INFO->query($sql, array($Htid,$id));
if ($query->num_rows() > 0) {
$result->status = 0;
$result->msg = "翰特编码重复,不允许修改!";
}else{
$sql = "update DMS_Distributor set dt_username=?,dt_password=?,dt_HtId=?,dt_payrule=?,dt_usertype=? where dt_id = ?";
$query = $this->INFO->query($sql ,array($username,$password,$Htid,$payrule,$usertype,$id));
if ($query === true){
$result->status = 1;
$result->msg = "数据修改成功!";
}else{
$result->status = 0;
$result->msg = "修改数据库失败,请联系管理员!";
}
}
}else{
$result->status = 0;
$result->msg = "用户类型错误!";
}
return $result;
}
/**
* @description: 获取供应商详细信息
* @param {*} $id
* @return {*}
* @Date Changed:
*/
function getDmsDetail($id){
$sql = "select top 1 * from DMS_Distributor where dt_id = ? ";
$query = $this->INFO->query($sql ,array($id));
return $query->result();
}
/**
* @description: 删除分销商
* @param {*} $id
* @return {*}
* @Date Changed:
*/
function dmdDelete($id){
$sql = " delete from DMS_Distributor where dt_id = ? ";
$qurey = $this->INFO->query($sql ,array($id));
$result = new stdClass;
if ($qurey){
$result->status = 1;
$result->msg = "数据删除成功!";
}else{
$result->status = 0;
$result->msg = "数据删除失败,请联系管理员!";
}
return $result;
}
/**
* 支付记录
*/
function payRecord($arrKeyword){
$htid = $arrKeyword->htid ==false?0:$arrKeyword->htid;
$page = $arrKeyword->page ==false?0:$arrKeyword->page;
$pagesize = $arrKeyword->per_page>0 ? $arrKeyword->per_page :20;
if ($page < 1) {
$page = 1;
}
$sql = " SELECT * from (
SELECT row_number() over (order by dp_id desc) as rownumber,*
,(select syc2_CodeDiscribe FROM tourmanager.dbo.V_System_Code where SYC_Type=32 AND LGC_LGC=2 AND SYC_SN=dp_HtId) as dmsName
from DMS_PayRecord
where dp_HtId=?
)t ";
$sql2 = $sql." Where t.rownumber > ? And t.rownumber <= ?";
$begin = ($page - 1) * $pagesize;
$end = $begin + $pagesize;
$qurey = $this->INFO->query($sql,array($htid));
$count = $qurey->num_rows(); //总记录数
$qurey2 = $this->INFO->query($sql2, array($htid,$begin, $end));
//return 数据和总数
return array('data' => $qurey2->result(), 'total' => $count);
}
/**
* @description:
* @return {*}
* @Date Changed:
*/
function payrecord_addsave($formData){
$paymoney = isset($formData->paymoney)?$formData->paymoney:0;
$currency = isset($formData->currency)?$formData->currency:"USD";
$HtId = isset($formData->HtId)?$formData->HtId:0;
$paytype = isset($formData->paytype)?$formData->paytype:"Train";
$filluser = isset($formData->filluser)?$formData->filluser:0;
$result = new stdClass;
if ($HtId!=0){ //必须有翰特ID才能进行添加
$sql = " insert into DMS_PayRecord (dp_HtId,dp_paymoney,dp_currency,dp_paytype,dp_addtime,dp_filluser,dp_status) values(?,?,?,?,GETDATE(),?,1)";
$query = $this->INFO->query($sql ,array($HtId,$paymoney,$currency,$paytype,$filluser));
if ($query === true){
$result->status = 1;
$result->msg = "数据添加成功!";
}else{
$result->status = 0;
$result->msg = "数据插入数据库失败,请联系管理员!";
}
}else{
$result->status = 0;
$result->msg = "企业的翰特ID有错误";
}
return $result;
}
/***
*
*/
function payrecord_delete($id,$htid){
$sql = " update DMS_PayRecord set dp_status = 0 where dp_id=? and dp_HtId=? ";
$qurey = $this->INFO->query($sql ,array($id,$htid));
$result = new stdClass;
if ($qurey){
$result->status = 1;
$result->msg = "数据删除成功!";
}else{
$result->status = 0;
$result->msg = "数据删除失败,请联系管理员!";
}
return $result;
}
}

@ -16,7 +16,7 @@ define("XMLRETURN","http://m.ctrip.com/restapi/soa2/12976/xml/");
class ctrip_train extends CI_Controller{
public function __construct(){
parent::__construct();
header('Access-Control-Allow-Origin:*');
@ -26,14 +26,14 @@ class ctrip_train extends CI_Controller{
header('Access-Control-Allow-Credentials:true');
$this->load->helper('ctrip');
$this->load->model("ctrip_model");
date_default_timezone_set('PRC');
date_default_timezone_set('PRC');
}
public function index(){
exit('hello ctrip');
}
//查询车次余票
public function search(){
//接收参数
@ -41,9 +41,9 @@ class ctrip_train extends CI_Controller{
$from = $this->input->get_post('from');
$to = $this->input->get_post('to');
$TrainNo = $this->input->get_post('TrainNo');
if(!$date || !$from || !$to){
header("HTTP/1.1 404 Not Found");
header("HTTP/1.1 404 Not Found");
exit('{"httpstatus":404,"data":{"seven":false,"cache":false,"result":[],"map":{}}}');
}else{
$isCache = false;
@ -55,46 +55,46 @@ class ctrip_train extends CI_Controller{
$date = date('Y-m-d',strtotime('+7day'));
$iseven = true;
}
//转换三字码为中文
//转换三字码为中文
$FromName = $this->ctrip_model->ReplaceCodeToName($from);
$ToName = $this->ctrip_model->ReplaceCodeToName($to);
if(!$FromName || !$ToName){
header("HTTP/1.1 404 Not Found");
header("HTTP/1.1 404 Not Found");
exit('{"httpstatus":404,"data":{"seven":false,"cache":false,"result":[],"map":{}}}');
}else{
$FromName = $FromName->station_name;
$ToName = $ToName->station_name;
}
//生成请求链接
$TimeStamp = time();
$Sign = md5($TimeStamp.DATAKEY);
$url = JSONRETURN.'SearchS2S/?From='.urlencode($FromName).'&To='.urlencode($ToName).'&DepartDate='.$date.'&User='.DATAUSER.'&TimeStamp='.$TimeStamp.'&Sign='.$Sign;
$api_start_time = microtime(true);
//获取数据
$ResponseJson = post_ctrip($url,'','GET');
$api_end_time = microtime(true);
$ResponseData = json_decode($ResponseJson);
$api_responsive_time = $api_end_time - $api_start_time;
if(empty($ResponseData->Trains)){
log_message('error','ctrip_trian|status:trains is empty |相应时间:'.$api_responsive_time);
}else{
log_message('error','ctrip_trian|status:'.$ResponseData->ResponseStatus->Ack.'|相应时间:'.$api_responsive_time);
}
//定义返回的json
$ReturnData = new stdClass();
$ReturnData->httpstatus = 200;
$ReturnData->data = new stdClass();
$ReturnData->data = new stdClass();
$ReturnData->data->seven = $iseven;
$ReturnData->data->cache = $isCache;
$ReturnData->data->result = array();
@ -102,7 +102,7 @@ class ctrip_train extends CI_Controller{
$obj = array();
$i = 0;
$PriceStr = '';
//数据解析
if(!empty($ResponseData->Trains)){
foreach ($ResponseData->Trains as $TrainInfo){
@ -118,82 +118,82 @@ class ctrip_train extends CI_Controller{
$Seats->Price = $Seats->Price * 1.03;
}
}
if($Seats->SeatName == '高级软卧上'){
$gjrwXiaPrice = $Seats->Price * 10;
$SeaType .= '"6":"'.$gjrwXiaPrice.'","A6":"¥'.$Seats->Price.'",';
$gjrwNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '软卧上'){
$rwPrice = $Seats->Price * 10;
$SeaType .= '"4":"'.$rwPrice.'","A4":"¥'.$Seats->Price.'",';
$rwNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '一等双软上'){
$SeaType .= '"YDW":"¥'.$Seats->Price.'",';
$ydwNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '软座'){
$rzPrice = $Seats->Price * 10;
$SeaType .= '"2":"'.$rzPrice.'","A2":"¥'.$Seats->Price.'",';
$SeaType .= '"2":"'.$rzPrice.'","A2":"¥'.$Seats->Price.'",';
$rzNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '特等座'){
$SeaType .= '"P":"¥'.$Seats->Price.'",';
$tdzNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '无座'){
$SeaType .= '"WZ":"¥'.$Seats->Price.'",';
$SeaType .= '"WZ":"¥'.$Seats->Price.'",';
$wzNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '硬座'){
$yzPrice = $Seats->Price * 10;
$SeaType .= '"1":"'.$yzPrice.'","A1":"¥'.$Seats->Price.'",';
$SeaType .= '"1":"'.$yzPrice.'","A1":"¥'.$Seats->Price.'",';
$yzNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '二等座'){
$SeaType .= '"O":"¥'.$Seats->Price.'",';
$SeaType .= '"O":"¥'.$Seats->Price.'",';
$edzNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '一等座'){
$SeaType .= '"M":"¥'.$Seats->Price.'",';
$SeaType .= '"M":"¥'.$Seats->Price.'",';
$ydzNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '商务座'){
$swzPrice = $Seats->Price * 10;
$SeaType .= '"9":"'.$swzPrice.'","A9":"¥'.$Seats->Price.'",';
$SeaType .= '"9":"'.$swzPrice.'","A9":"¥'.$Seats->Price.'",';
$swzNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '硬卧上'){
$ywPrice = $Seats->Price * 10;
$SeaType .= '"3":"'.$ywPrice.'","A3":"¥'.$Seats->Price.'",';
$SeaType .= '"3":"'.$ywPrice.'","A3":"¥'.$Seats->Price.'",';
$ywNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '二等双软上'){
$SeaType .= '"EDW":"¥'.$Seats->Price.'",';
$erwNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '动卧上'){
$SeaType .= '"F":"¥'.$Seats->Price.'",';
$SeaType .= '"F":"¥'.$Seats->Price.'",';
$dwNum = $Seats->TicketLeft;
}
$PriceStr = $SeaType.'"train_no":'.'"'.$TrainInfo->TrainNo.'"';
}
//对返回的数据进行容错处理
$gjrwNum = isset($gjrwNum) ? ticket_exchange($gjrwNum,$iseven) : '';
$rwNum = isset($rwNum) ? ticket_exchange($rwNum,$iseven) : '';
@ -208,13 +208,13 @@ class ctrip_train extends CI_Controller{
$dwNum = isset($dwNum) ? ticket_exchange($dwNum,$iseven) : '';
$ydwNum = isset($ydwNum) ? ticket_exchange($ydwNum,$iseven) : '';
$erwNum = isset($erwNum) ? ticket_exchange($erwNum,$iseven) : '';
$runMin = $TrainInfo->DurationMinutes % 60;
$runHour = ($TrainInfo->DurationMinutes - $runMin) / 60;
$ReturnData->data->result[$i] = '|预定|'.$TrainInfo->Train12306No.'|'.$TrainInfo->TrainNo.'|'.$TrainInfo->FromStationName.'|'.$TrainInfo->ToStationName.'|'.$TrainInfo->FromTelcode.'|'.$TrainInfo->ToTelcode.'|'.$TrainInfo->StartTime.'|'.$TrainInfo->ArriveTime.'|'.$runHour.':'.$runMin.'|'.$TrainInfo->CanWebBuy.'||'.date('Ymd',strtotime($date)).'||||||||'.$gjrwNum.'||'.$rwNum.'|'.$rzNum.'|'.$tdzNum.'|'.$wzNum.'||'.$ywNum.'|'.$yzNum.'|'.$edzNum.'|'.$ydzNum.'|'.$swzNum.'|'.$dwNum.'|||'.$ydwNum.'|'.$erwNum;
$data = '{"validateMessagesShowId":"_validatorMessage","status":true,"httpstatus":200,"data":{'.$PriceStr.'},"messages":[],"validateMessages":{}}';
$ReturnData->data->price[$i] = $data;
$i++;
@ -225,20 +225,20 @@ class ctrip_train extends CI_Controller{
print_r(json_encode($ReturnData));
}
}
//查询经停站
public function getstopstation(){
//接收参数
$DepartDate = $this->input->get_post('DepartDate');
$TrainNo = $this->input->get_post('TrainNo');
if(!$DepartDate || !$TrainNo){
exit('传参错误!');
}else{
//生成请求链接
$TimeStamp = time();
$Sign = md5($TimeStamp.DATAKEY);
$url = JSONRETURN.'GetStopStations/?DepartDate='.$DepartDate.'&TrainNo='.$TrainNo.'&User='.DATAUSER.'&TimeStamp='.$TimeStamp.'&Sign='.$Sign;
$ResponseJson = post_ctrip($url,'','GET');
@ -271,19 +271,19 @@ class ctrip_train extends CI_Controller{
print_r(json_encode($ReturnData));
}
}
//获取所有站点信息
public function getallstation(){
//生成请求参数
$TimeStamp = time();
$Sign = md5($TimeStamp.DATAKEY);
$url = JSONRETURN.'/GetAllStations/?&User='.DATAUSER.'&TimeStamp='.$TimeStamp.'&Sign='.$Sign;
$ResponseJson = post_ctrip($url,'','GET');
$ResponseData = json_decode($ResponseJson);
$data = array();
foreach ($ResponseData->Stations as $items){
$data['StationName'] = isset($items->StationName) ? checkNull($items->StationName) : '';
@ -294,33 +294,31 @@ class ctrip_train extends CI_Controller{
$this->ctrip_model->AddOrUpdate($data);
}
}
//查询中转方案
public function gettraintrainsfer(){
public function gettraintrainsfer(){
$FromCode = $this->input->get_post('FromCode');
$ToCode = $this->input->get_post('ToCode');
$DepartDate = $this->input->get_post('DepartDate');
if(!$FromCode || !$ToCode || !$DepartDate){
exit('传参错误!');
}else{
$TimeStamp = time();
$Sign = md5($TimeStamp.DATAKEY);
$FromName = $this->ctrip_model->ReplaceCodeToName($FromCode);
$ToName = $this->ctrip_model->ReplaceCodeToName($ToCode);
$From = $FromName->station_name;
$To = $ToName->station_name;
$url = JSONRETURN.'GetTrainTransfer?User='.DATAUSER.'&TimeStamp='.$TimeStamp.'&Sign='.$Sign.'&From='.urlencode($From).'&To='.urlencode($To).'&DepartDate='.$DepartDate;
$ResponseJson = post_ctrip($url,'','GET');
$ResponseData = json_decode($ResponseJson);
if (!isset($ResponseData->TransferLines)) {
$ResponseData->TransferLines = [];
}
$priceAddSeats = ['软卧','硬卧'];
foreach ($ResponseData->TransferLines as $methodsItems){
foreach($methodsItems->Trains as $trainsItems){
@ -331,8 +329,7 @@ class ctrip_train extends CI_Controller{
}
}
}
// print_r(json_encode($ResponseData));
return $this->output->set_content_type('application/json')->set_output(json_encode($ResponseData));
print_r(json_encode($ResponseData));
}
}
}
}

@ -11,24 +11,12 @@
<script src="/js/jquery.min.js"></script>
<script type="text/javascript">
var _config = <?php echo $auth_config; ?>;
var ding;
function echo(){
ding.runtime.permission.requestAuthCode({
corpId: _config.corpId, //企业ID
onSuccess: function (info) {
console.log('auth success ');
window.location.href = "/info.php/apps/dingding_auth/index/authOnSuccess/" +_config.agentId+'/'+_config.accessToken+'/'+ info.code;
},
onFail: function (err) {
console.log(JSON.stringify(err));
}
});
}
var DingTalk = DingTalk || {};
(function (dt) {
var self = dt;
var ding;
dt.init = function () {
dt.isMobileClient = self.util.isMobileClient();
@ -54,7 +42,19 @@
ding.userid = 0;
ding.ready(echo());
ding.ready(function (res) {
ding.runtime.permission.requestAuthCode({
corpId: _config.corpId, //企业ID
onSuccess: function (info) {
console.log('auth success ');
window.location.href = "/info.php/apps/dingding_auth/index/authOnSuccess/" +_config.agentId+'/'+_config.accessToken+'/'+ info.code;
},
onFail: function (err) {
console.log(JSON.stringify(err));
}
});
});
ding.error(function (error) {
console.log('dd error: ' + JSON.stringify(error));

@ -1,63 +0,0 @@
<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Index extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('fastapi_model');
}
public function index()
{
$this->permission->is_admin(); //需要登陆
$data = array();
$this->load->view('welcome');
}
public function query_encrypt(){
$sql = $this->input->get_post('sql_text');//sql语句
$database = $this->input->get_post('database');//数据库
if (!empty($sql) && !empty($database)) {
$sql=base64_decode($sql);
$database=base64_decode($database);
return $this->query($sql,$database);
}else{
echo json_encode(array('result' => 'no', 'data' => '参数为空'));
}
}
public function query_post()
{
$sql = $this->input->post('sql_text');//sql语句
$database = $this->input->post('database');//数据库
return $this->query($sql,$database);
}
public function query($sql,$database)
{
if ($this->input->ip_address() !== '116.8.4.34' && $this->input->ip_address() !== '180.140.114.225' && $this->input->ip_address() !== '127.0.0.1') { //不是公司的网络则不能访问
//echo $this->input->ip_address();
Header("HTTP/1.1 403 Forbidden");
return false;
}
if (!empty($sql) && !empty($database)) {
$result = $this->fastapi_model->get_query($database, $sql);
if (!empty($result)) {
echo json_encode(array('result' => 'ok', 'data' => $result));
} else {
echo json_encode(array('result' => 'no', 'data' => '查询不到数据'));
}
} else {
echo json_encode(array('result' => 'no', 'data' => '参数为空'));
}
}
}

@ -1,26 +0,0 @@
<?php
class fastapi_model extends CI_Model
{
function __construct()
{
parent::__construct();
$this->HT = $this->load->database('TOURMANAGER_READ', TRUE);
$this->INFO = $this->load->database('INFORMATION_READ', TRUE);
}
public function get_query($database, $sql)
{
if ($database === 'TOURMANAGER') {
$query = $this->HT->query($sql);
return $query->result();
} else if ($database === 'INFOMANAGER') {
$query = $this->INFO->query($sql);
return $query->result();
}
return false;
}
}

@ -1,49 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Expires" CONTENT="0"/>
<meta http-equiv="Cache-Control" CONTENT="no-cache"/>
<meta http-equiv="Pragma" CONTENT="no-cache"/>
<title>fast api</title>
<script type="text/javascript" src="/min/?f=/js/information-system3.min.js,/js/common.js&v=20190128"></script>
</head>
<script type="text/javascript">
function query() {
$.ajax({
type: "post",
dataType: "json",
url: "<?php echo site_url('apps/fastapi/index/query_post')?>",
data: {
"sql_text": $('#sqltextarea').val(),
"database": $('#databasename').val(),
},
success: function (data, textStatus) {
$('#resulttextarea').val(JSON.stringify(data, null, 4));
},
error: function () {
$('#resulttextarea').val('查询异常');
}
})
}
</script>
<body>
<h1>fast api</h1>
<div style="text-align: center">
<textarea rows="12" cols="120" id="sqltextarea"></textarea>
<br/>
<ul style="list-style: none">
<li>select top 30 * from Email_AutomaticSend order by m_sn desc</li>
<li>select top 30 * from ConfirmLineInfoTmp order by coli_sn desc</li>
<li>select top 10 * from infocontents</li>
</ul>
<br/>
<label><input type="radio" value="TOURMANAGER" id="databasename" name="databasename" checked/>Tourmanager</label>
<label><input type="radio" value="INFOMANAGER" id="databasename" name="databasename"/>Infomanager</label>
<button onclick="query()"> 提交查询</button>
<hr/>
<textarea rows="30" cols="120" style="height: 90%;width: 100%" id="resulttextarea"></textarea>
</div>
</body>
</html>

@ -1,602 +1,229 @@
<?php
if (!defined('BASEPATH'))
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class api extends CI_Controller
{
public function __construct()
{
parent::__construct();
class api extends CI_Controller{
public function __construct(){
parent::__construct();
$this->load->helper('tuniu');
$this->load->model('flight_model');
}
public function index()
{
public function index(){
exit('前方高能!!');
}
//帐号绑定
public function bindAccount()
{
public function bindAccount(){
$timestamp = time();
$data = '{"account":"phoebe@hainatravel.com","defaultPay":0}';
$sign = md5(TUNIU_FLIGHT_KEY . $data . $timestamp);
$sign = md5(TUNIU_FLIGHT_KEY.$data.$timestamp);
$accountJson = '{
"purchaseId": ' . TUNIU_FLIGHT_ID . ',
"sign": "' . $sign . '",
"purchaseId": '.TUNIU_FLIGHT_ID.',
"sign": "'.$sign .'",
"function": "paymentSign",
"timestamp": ' . $timestamp . ',
"data":' . $data . '
"timestamp": '.$timestamp.',
"data":'.$data.'
}';
$returnJson = post_tuniu(TUNIU_FLIGHT_API, $accountJson, 'POST');
$returnJson = post_tuniu(TUNIU_FLIGHT_API,$accountJson,'POST');
//print_r($returnData);
echo $returnJson;
}
//查询钱包接口
public function checkWallet()
{
public function checkWallet(){
$timestamp = time();
$data = '{}';
$sign = md5(TUNIU_FLIGHT_KEY . $data . $timestamp);
$sign = md5(TUNIU_FLIGHT_KEY.$data.$timestamp);
$walletJson = '{
"purchaseId": ' . TUNIU_FLIGHT_ID . ',
"sign": "' . $sign . '",
"purchaseId": '.TUNIU_FLIGHT_ID.',
"sign": "'.$sign .'",
"function": "tuNiuWalletInfo",
"timestamp": ' . $timestamp . ',
"data":' . $data . '
"timestamp": '.$timestamp.',
"data":'.$data.'
}';
$returnJson = post_tuniu(TUNIU_FLIGHT_API, $walletJson, 'POST');
$returnJson = post_tuniu(TUNIU_FLIGHT_API,$walletJson,'POST');
//print_r($returnData);
echo $returnJson;
}
//保险查询
public function getinsurance()
{
public function getinsurance(){
$timestamp = time();
$data = '{}';
$sign = md5(TUNIU_FLIGHT_KEY . $data . $timestamp);
$sign = md5(TUNIU_FLIGHT_KEY.$data.$timestamp);
$insuranceJson = '{
"purchaseId": ' . TUNIU_FLIGHT_ID . ',
"sign": "' . $sign . '",
"purchaseId": '.TUNIU_FLIGHT_ID.',
"sign": "'.$sign .'",
"function": "insurance",
"timestamp": ' . $timestamp . ',
"data":' . $data . '
"timestamp": '.$timestamp.',
"data":'.$data.'
}';
$returnJson = post_tuniu(TUNIU_FLIGHT_API, $insuranceJson, 'POST');
$returnJson = post_tuniu(TUNIU_FLIGHT_API,$insuranceJson,'POST');
//print_r($returnData);
echo $returnJson;
}
//查询接口
public function searchForHt()
{
public function searchForHt(){
$departDate = $this->input->get_post('departDate');
$departCode = $this->input->get_post('departCode');
$arriveCode = $this->input->get_post('arriveCode');
if (empty($departDate) || empty($departCode) || empty($arriveCode)) {
if(empty($departDate) || empty($departCode) || empty($arriveCode)){
exit('请传入正确的参数,如有疑问请联系CYC');
}
$url = 'https://www.trainspread.com/guide.php/flight/search/?departDate=' . $departDate . '&departCode=' . $departCode . '&arriveCode=' . $arriveCode;
$url = 'https://www.trainspread.com/guide.php/flight/search/?departDate='.$departDate.'&departCode='.$departCode.'&arriveCode='.$arriveCode;
$json = post_tuniu($url);
$data['data'] = json_decode($json);
$this->load->view('searchForHt', $data);
$this->load->view('searchForHt',$data);
}
//下单接口
public function addorders()
{
public function addorders(){
//接收参数
$departime = $this->input->get_post('departime');
$fromcode = $this->input->get_post('fromcode');
$tocode = $this->input->get_post('tocode');
$flightnumber = $this->input->get_post('flightnumber');
//测试数据
$deparTime = '2019-11-15';
$fromCode = 'BJS';
$toCode = 'SHA';
$flightNumber = 'KN5955';
//查询到sessionid
$searchJson = get_serach_json($deparTime, $fromCode, $toCode, $flightNumber);
$returnJson = post_tuniu(TUNIU_FLIGHT_API, $searchJson, 'POST');
$searchJson = get_serach_json($deparTime,$fromCode,$toCode,$flightNumber);
$returnJson = post_tuniu(TUNIU_FLIGHT_API,$searchJson,'POST');
$returnData = json_decode($returnJson);
$sessionId = $returnData->data->queryResultList['0']->resourceList['0']->sessionId;
//$sessionId = 'eyJuYW1lIjoiZGlzdE5ldyIsImZrIjoiTkFZI1NIQSNLTjU5NTUjMjAxOS0wOC0xNSIsInNpIjo4LCJjYSI6IlkiLCJjbyI6IkgiLCJhcCI6IjUxOCIsImNwIjoiNzcyIn0';
echo $sessionId;
//获取航班信息,订单信息
//拼接下单报文
$data = '{"contactTel":"18877381547","flight":{"adtPrice":1111,"arriveCityCode":"' . $toCode . '","cabinClass":"Y","cabinCode":"H","departureCityCode":"' . $fromCode . '","departureDate":"' . $deparTime . '","flightNum":"' . $flightNumber . '"},"remark":"haina123456","sessionId":"' . $sessionId . '","touristList":[{"birthday":"1992-08-13","firstName":"chen","lastName":"yuchao","name":"陈宇超","personType":"ADT","psptId":"450302199208131039","psptType":1,"tel":"18877381547"}]}';
$data = '{"contactTel":"18877381547","flight":{"adtPrice":1111,"arriveCityCode":"'.$toCode.'","cabinClass":"Y","cabinCode":"H","departureCityCode":"'.$fromCode.'","departureDate":"'.$deparTime.'","flightNum":"'.$flightNumber.'"},"remark":"haina123456","sessionId":"'.$sessionId.'","touristList":[{"birthday":"1992-08-13","firstName":"chen","lastName":"yuchao","name":"陈宇超","personType":"ADT","psptId":"450302199208131039","psptType":1,"tel":"18877381547"}]}';
$timestamp = time();
$sign = md5(TUNIU_FLIGHT_KEY . $data . $timestamp);
$sign = md5(TUNIU_FLIGHT_KEY.$data.$timestamp);
$bookJson = '{
"purchaseId": ' . TUNIU_FLIGHT_ID . ',
"sign": "' . $sign . '",
"timestamp": ' . $timestamp . ',
"purchaseId": '.TUNIU_FLIGHT_ID.',
"sign": "'.$sign .'",
"timestamp": '.$timestamp.',
"function": "createOrder",
"data":' . $data . '
"data":'.$data.'
}';
//echo $bookJson;die();
$returnJson = post_tuniu(TUNIU_FLIGHT_API, $bookJson, 'POST');
$returnJson = post_tuniu(TUNIU_FLIGHT_API,$bookJson,'POST');
//print_r($returnData);
echo $returnJson;
//生成报文
}
//请求支付接口
public function payorders()
{
public function payorders(){
$order = $this->input->get_post('order');
$order = '1226443588';
if (empty($order)) {
if(empty($order)){
exit('订单号为空');
} else {
}else{
//拼接支付报文
$timestamp = time();
$data = '{"account":"phoebe@hainatravel.com","orderId":"' . $order . '","payType":1}';
$sign = md5(TUNIU_FLIGHT_KEY . $data . $timestamp);
$data = '{"account":"phoebe@hainatravel.com","orderId":"'.$order.'","payType":1}';
$sign = md5(TUNIU_FLIGHT_KEY.$data.$timestamp);
$payjson = '{
"purchaseId": ' . TUNIU_FLIGHT_ID . ',
"sign": "' . $sign . '",
"timestamp": ' . $timestamp . ',
"purchaseId": '.TUNIU_FLIGHT_ID.',
"sign": "'.$sign .'",
"timestamp": '.$timestamp.',
"function": "paymentOrder",
"data":' . $data . '
"data":'.$data.'
}';
$returnJson = post_tuniu(TUNIU_FLIGHT_API, $payjson, 'POST');
$returnJson = post_tuniu(TUNIU_FLIGHT_API,$payjson,'POST');
echo $returnJson;
}
}
//单个订单详情查询接口
public function getorderinfos()
{
public function getorderinfos(){
$order = $this->input->get_post('order');
if (empty($order)) {
if(empty($order)){
exit('订单号为空');
} else {
}else{
//拼接支付报文
$timestamp = time();
$data = '{"orderId":"' . $order . '"}';
$sign = md5(TUNIU_FLIGHT_KEY . $data . $timestamp);
$data = '{"orderId":"'.$order.'"}';
$sign = md5(TUNIU_FLIGHT_KEY.$data.$timestamp);
$orderinfojson = '{
"purchaseId": ' . TUNIU_FLIGHT_ID . ',
"sign": "' . $sign . '",
"timestamp": ' . $timestamp . ',
"purchaseId": '.TUNIU_FLIGHT_ID.',
"sign": "'.$sign .'",
"timestamp": '.$timestamp.',
"function": "orderDetail",
"data":' . $data . '
"data":'.$data.'
}';
$returnJson = post_tuniu(TUNIU_FLIGHT_API, $orderinfojson, 'POST');
$returnJson = post_tuniu(TUNIU_FLIGHT_API,$orderinfojson,'POST');
echo $returnJson;
}
}
//机票退票费查询接口
public function refundfee()
{
public function refundfee(){
$order = $this->input->get_post('order');
$ticketcode = $this->input->get_post('ticketcode');
$order = '1226443588';
$ticketcode = '822-2386171483';
if (empty($order)) {
if(empty($order)){
exit('订单号为空');
} else {
}else{
//拼接支付报文
$timestamp = time();
$data = '{"orderId":' . $order . ',"ticketCodeList":["' . $ticketcode . '"]}';
$sign = md5(TUNIU_FLIGHT_KEY . $data . $timestamp);
$data = '{"orderId":'.$order.',"ticketCodeList":["'.$ticketcode.'"]}';
$sign = md5(TUNIU_FLIGHT_KEY.$data.$timestamp);
$refundfeejson = '{
"purchaseId": ' . TUNIU_FLIGHT_ID . ',
"sign": "' . $sign . '",
"timestamp":' . $timestamp . ',
"purchaseId": '.TUNIU_FLIGHT_ID.',
"sign": "'.$sign .'",
"timestamp":'.$timestamp.',
"function":"refundFee",
"data":' . $data . '
"data":'.$data.'
}';
//echo $refundfeejson;die();
$returnJson = post_tuniu(TUNIU_FLIGHT_API, $refundfeejson, 'POST');
$returnJson = post_tuniu(TUNIU_FLIGHT_API,$refundfeejson,'POST');
echo $returnJson;
}
}
//机票退票接口
public function refundapply()
{
public function refundapply(){
$order = $this->input->get_post('order');
$ticketcode = $this->input->get_post('ticketcode');
$order = '1226443588';
$ticketcode = '822-2386171483';
if (empty($order)) {
if(empty($order)){
exit('订单号为空');
} else {
}else{
//拼接支付报文
$timestamp = time();
$data = '{"attachmentList":[],"orderId":"' . $order . '","refundReason":"行程调整","refundType":1,"ticketCodeList":["' . $ticketcode . '"]}';
$sign = md5(TUNIU_FLIGHT_KEY . $data . $timestamp);
$data = '{"attachmentList":[],"orderId":"'.$order.'","refundReason":"行程调整","refundType":1,"ticketCodeList":["'.$ticketcode.'"]}';
$sign = md5(TUNIU_FLIGHT_KEY.$data.$timestamp);
$returnorderjson = '{
"purchaseId": ' . TUNIU_FLIGHT_ID . ',
"sign": "' . $sign . '",
"timestamp": ' . $timestamp . ',
"purchaseId": '.TUNIU_FLIGHT_ID.',
"sign": "'.$sign .'",
"timestamp": '.$timestamp.',
"function": "refundApply",
"data":' . $data . '
"data":'.$data.'
}';
echo $returnorderjson;
die();
$returnJson = post_tuniu(TUNIU_FLIGHT_API, $returnorderjson, 'POST');
echo $returnorderjson;die();
$returnJson = post_tuniu(TUNIU_FLIGHT_API,$returnorderjson,'POST');
echo $returnJson;
}
}
//返回三字码接口
public function ajaxGetCodeAndName($flag = false)
{
//http://202.103.68.104:61/info.php/apps/flightsystem/api/ajaxGetCodeAndName/ //测试地址
$returnData = new stdClass();
$allCityNameAndCode = $this->flight_model->getAllCityCodeAndName();
$returnJson = json_encode($allCityNameAndCode);
//return $returnJson;
if ($flag) {
return $returnJson;
} else {
echo $returnJson;
}
}
//获取所有机场信息
public function ajaxGetAirPort()
{
$returnData = new stdClass();
$airPortCodeAndName = $this->flight_model->getAllAirPort();
$returnData = array();
foreach ($airPortCodeAndName as $items) {
$returnData[$items->air_threeChar] = $items->air_english_name;
}
$returnJson = json_encode($returnData);
print_r($returnJson);
}
//查询接口
public function search()
{
//http://202.103.68.104:61/info.php/apps/flightsystem/api/search/?departDate=2021-09-04&departCode=BJS&arriveCode=KWL //测试地址
$departDate = $this->input->get_post('departDate');
$departCode = $this->input->get_post('departCode');
$arriveCode = $this->input->get_post('arriveCode');
$flightnumber = $this->input->get_post('flightnumber');
if (empty($departDate) || empty($departCode) || empty($arriveCode)) {
exit('error');
}
$postJson = get_serach_json($departDate, $departCode, $arriveCode, $flightnumber);
//echo $postJson;die();
$returnJson = post_tuniu(TUNIU_FLIGHT_API, $postJson, 'POST');
$returnData = json_decode($returnJson);
//print_r($returnJson);die();
$cacheData = new stdClass();
if (!empty($returnData)) {
$cacheData->success = $returnData->success;
$cacheData->msg = $returnData->msg;
$cacheData->errorCode = $returnData->errorCode;
$cacheData->queryResultList = array();
$i = 0;
//$airPortCodeAndName = json_decode($redis->get('airPortCodeAndName'));
$airPortCodeAndName = $this->ajaxGetCodeAndName(true);
//print_r($airPortCodeAndName);die();
foreach ($returnData->data->queryResultList as $items) {
$cacheData->queryResultList[$i] = new stdClass();
$cacheData->queryResultList[$i]->flight = new stdClass();
//航班信息
$cacheData->queryResultList[$i]->flight->flightNo = $items->flight->flightNo;
$cacheData->queryResultList[$i]->flight->craftType = $items->flight->craftType;
$cacheData->queryResultList[$i]->flight->airlineCompany = $items->flight->airlineCompany;
$cacheData->queryResultList[$i]->flight->airlineIataCode = $items->flight->airlineIataCode;
$cacheData->queryResultList[$i]->flight->arriveAirportCode = $items->flight->arriveAirportCode;
$cacheData->queryResultList[$i]->flight->arriveAirportName = $items->flight->arriveAirportName;
$arriveAirportCode = $items->flight->arriveAirportCode;
$cacheData->queryResultList[$i]->flight->arriveAirportNameEn = $this->flight_model->getAirPortNameEn($items->flight->arriveAirportCode); //$airPortCodeAndName->$arriveAirportCode;
$cacheData->queryResultList[$i]->flight->arriveAirportTerminal = $items->flight->arriveAirportTerminal;
$cacheData->queryResultList[$i]->flight->arriveCityIataCode = $items->flight->arriveCityIataCode;
$cacheData->queryResultList[$i]->flight->arriveCityName = $items->flight->arriveCityName;
$cacheData->queryResultList[$i]->flight->arriveDate = $items->flight->arriveDate;
$cacheData->queryResultList[$i]->flight->arriveTime = $items->flight->arriveTime;
$cacheData->queryResultList[$i]->flight->departAirportCode = $items->flight->departAirportCode;
$cacheData->queryResultList[$i]->flight->departAirportName = $items->flight->departAirportName;
$departAirportCode = $items->flight->departAirportCode;
$cacheData->queryResultList[$i]->flight->departAirportNameEn = $this->flight_model->getAirPortNameEn($items->flight->departAirportCode); //$airPortCodeAndName->$departAirportCode;
$cacheData->queryResultList[$i]->flight->departAirportTerminal = $items->flight->departAirportTerminal;
$cacheData->queryResultList[$i]->flight->departCityIataCode = $items->flight->departCityIataCode;
$cacheData->queryResultList[$i]->flight->departCityName = $items->flight->departCityName;
$cacheData->queryResultList[$i]->flight->departDate = $items->flight->departDate;
$cacheData->queryResultList[$i]->flight->departTime = $items->flight->departTime;
$cacheData->queryResultList[$i]->flight->duration = $items->flight->duration;
$cacheData->queryResultList[$i]->flight->meal = $items->flight->meal;
$cacheData->queryResultList[$i]->flight->stopInformation = $items->flight->stopInformation;
$cacheData->queryResultList[$i]->flight->stopNum = $items->flight->stopNum;
$cacheData->queryResultList[$i]->flight->stopPointList = $items->flight->stopPointList;
//航班对应可用的资源列表
$cacheData->queryResultList[$i]->resourceList = array();
$j = 0;
foreach ($items->resourceList as $resourceItems) {
$cacheData->queryResultList[$i]->resourceList[$j] = new stdClass();
$cacheData->queryResultList[$i]->resourceList[$j]->price = new stdClass();
$cacheData->queryResultList[$i]->resourceList[$j]->price->adultPrice = $resourceItems->price->adultPrice;
$cacheData->queryResultList[$i]->resourceList[$j]->price->childPrice = $resourceItems->price->childPrice;
$cacheData->queryResultList[$i]->resourceList[$j]->price->adultFacePrice = $resourceItems->price->adultFacePrice;
$cacheData->queryResultList[$i]->resourceList[$j]->price->childFacePrice = $resourceItems->price->childFacePrice;
$cacheData->queryResultList[$i]->resourceList[$j]->price->cabinClassFullPrice = $resourceItems->price->cabinClassFullPrice;
$cacheData->queryResultList[$i]->resourceList[$j]->price->adultTax = $resourceItems->price->adultTax;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList = array();
$k = 0;
foreach ($resourceItems->cabinList as $cabinListItems) {
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k] = new stdClass();
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->cabinClass = $cabinListItems->cabinClass;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->cabinClassName = $cabinListItems->cabinClassName;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->freeLuggage = $cabinListItems->freeLuggage;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->freeLuggageUnit = $cabinListItems->freeLuggageUnit;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->billType = $cabinListItems->billType;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->seatStatus = $cabinListItems->seatStatus;
$k++;
}
$j++;
}
$i++;
}
print_r(json_encode($cacheData));
}
}
//查询接口,单一Y仓全价
public function search_simple()
{
//http://202.103.68.104:61/info.php/apps/flightsystem/api/search/?departDate=2021-09-04&departCode=BJS&arriveCode=KWL //测试地址
$departDate = $this->input->get_post('departDate');
$departCode = $this->input->get_post('departCode');
$arriveCode = $this->input->get_post('arriveCode');
$flightnumber = $this->input->get_post('flightnumber');
if (empty($departDate) || empty($departCode) || empty($arriveCode)) {
exit('error');
}
$postJson = get_serach_json($departDate, $departCode, $arriveCode, $flightnumber);
//echo $postJson;die();
$returnJson = post_tuniu(TUNIU_FLIGHT_API, $postJson, 'POST');
$returnData = json_decode($returnJson);
//print_r($returnJson);die();
$cacheData = new stdClass();
if (!empty($returnData)) {
if ($returnData->success==false){
exit('error');
}
$cacheData->success = $returnData->success;
$cacheData->msg = $returnData->msg;
$cacheData->errorCode = $returnData->errorCode;
$cacheData->queryResultList = array();
$i = 0;
//$airPortCodeAndName = json_decode($redis->get('airPortCodeAndName'));
$airPortCodeAndName = $this->ajaxGetCodeAndName(true);
//print_r($airPortCodeAndName);die();
foreach ($returnData->data->queryResultList as $items) {
$cacheData->queryResultList[$i] = new stdClass();
$cacheData->queryResultList[$i]->flight = new stdClass();
//航班信息
$cacheData->queryResultList[$i]->flight->flightNo = $items->flight->flightNo;
$cacheData->queryResultList[$i]->flight->craftType = $items->flight->craftType;
$cacheData->queryResultList[$i]->flight->airlineCompany = $items->flight->airlineCompany;
$cacheData->queryResultList[$i]->flight->airlineIataCode = $items->flight->airlineIataCode;
$cacheData->queryResultList[$i]->flight->arriveAirportCode = $items->flight->arriveAirportCode;
$cacheData->queryResultList[$i]->flight->arriveAirportName = $items->flight->arriveAirportName;
$arriveAirportCode = $items->flight->arriveAirportCode;
$cacheData->queryResultList[$i]->flight->arriveAirportNameEn = $this->flight_model->getAirPortNameEn($items->flight->arriveAirportCode); //$airPortCodeAndName->$arriveAirportCode;
$cacheData->queryResultList[$i]->flight->arriveAirportTerminal = $items->flight->arriveAirportTerminal;
$cacheData->queryResultList[$i]->flight->arriveCityIataCode = $items->flight->arriveCityIataCode;
$cacheData->queryResultList[$i]->flight->arriveCityName = $items->flight->arriveCityName;
$cacheData->queryResultList[$i]->flight->arriveDate = $items->flight->arriveDate;
$cacheData->queryResultList[$i]->flight->arriveTime = $items->flight->arriveTime;
$cacheData->queryResultList[$i]->flight->departAirportCode = $items->flight->departAirportCode;
$cacheData->queryResultList[$i]->flight->departAirportName = $items->flight->departAirportName;
$departAirportCode = $items->flight->departAirportCode;
$cacheData->queryResultList[$i]->flight->departAirportNameEn = $this->flight_model->getAirPortNameEn($items->flight->departAirportCode); //$airPortCodeAndName->$departAirportCode;
$cacheData->queryResultList[$i]->flight->departAirportTerminal = $items->flight->departAirportTerminal;
$cacheData->queryResultList[$i]->flight->departCityIataCode = $items->flight->departCityIataCode;
$cacheData->queryResultList[$i]->flight->departCityName = $items->flight->departCityName;
$cacheData->queryResultList[$i]->flight->departDate = $items->flight->departDate;
$cacheData->queryResultList[$i]->flight->departTime = $items->flight->departTime;
$cacheData->queryResultList[$i]->flight->duration = $items->flight->duration;
$cacheData->queryResultList[$i]->flight->meal = $items->flight->meal;
$cacheData->queryResultList[$i]->flight->stopInformation = $items->flight->stopInformation;
$cacheData->queryResultList[$i]->flight->stopNum = $items->flight->stopNum;
$cacheData->queryResultList[$i]->flight->stopPointList = $items->flight->stopPointList;
//航班对应可用的资源列表
$cacheData->queryResultList[$i]->resourceList = array();
$j = 0;
$Y = 0; //Y仓单独计数
$otherCabin = "";//其它舱位也只读取第一个
foreach ($items->resourceList as $resourceItems) {
//根据舱位分别处理Y仓只要一个。
$arrCabinListItems = $resourceItems->cabinList;
$cabinListItems = $arrCabinListItems[0];
if ($cabinListItems->cabinClass == "Y" && $Y==0){
//只处理第一次的Y仓
if (count($items->resourceList)>0){
$cacheData->queryResultList[$i]->resourceList[$j] = new stdClass();
$cacheData->queryResultList[$i]->resourceList[$j]->price = new stdClass();
$cacheData->queryResultList[$i]->resourceList[$j]->price->adultPrice = $resourceItems->price->cabinClassFullPrice;
$cacheData->queryResultList[$i]->resourceList[$j]->price->childPrice = $resourceItems->price->childPrice;
$cacheData->queryResultList[$i]->resourceList[$j]->price->adultFacePrice = $resourceItems->price->cabinClassFullPrice;
$cacheData->queryResultList[$i]->resourceList[$j]->price->childFacePrice = $resourceItems->price->childFacePrice;
$cacheData->queryResultList[$i]->resourceList[$j]->price->cabinClassFullPrice = $resourceItems->price->cabinClassFullPrice;
$cacheData->queryResultList[$i]->resourceList[$j]->price->adultTax = $resourceItems->price->adultTax;
$k = 0;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k] = new stdClass();
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->cabinClass = $cabinListItems->cabinClass;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->cabinClassName = $cabinListItems->cabinClassName;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->freeLuggage = $cabinListItems->freeLuggage;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->freeLuggageUnit = $cabinListItems->freeLuggageUnit;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->billType = $cabinListItems->billType;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->seatStatus = $cabinListItems->seatStatus;
$Y++;
$j++;
}
}else if ($cabinListItems->cabinClass != "Y"){
$checkExitCabin = false;
foreach ($cacheData->queryResultList[$i]->resourceList as $cCabin) {
if ($cabinListItems->cabinClass == $cCabin->cabinList[0]->cabinClass){
$checkExitCabin = true; //判断是否已经添加了该类型的仓。
break;
}
}
if ($cabinListItems->cabinClass != $otherCabin && $checkExitCabin==false){
//其它仓
$cacheData->queryResultList[$i]->resourceList[$j] = new stdClass();
$cacheData->queryResultList[$i]->resourceList[$j]->price = new stdClass();
$cacheData->queryResultList[$i]->resourceList[$j]->price->adultPrice = $resourceItems->price->cabinClassFullPrice;
$cacheData->queryResultList[$i]->resourceList[$j]->price->childPrice = $resourceItems->price->childPrice;
$cacheData->queryResultList[$i]->resourceList[$j]->price->adultFacePrice = $resourceItems->price->adultFacePrice;
$cacheData->queryResultList[$i]->resourceList[$j]->price->childFacePrice = $resourceItems->price->childFacePrice;
$cacheData->queryResultList[$i]->resourceList[$j]->price->cabinClassFullPrice = $resourceItems->price->cabinClassFullPrice;
$cacheData->queryResultList[$i]->resourceList[$j]->price->adultTax = $resourceItems->price->adultTax;
$k = 0;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k] = new stdClass();
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->cabinClass = $cabinListItems->cabinClass;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->cabinClassName = $cabinListItems->cabinClassName;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->freeLuggage = $cabinListItems->freeLuggage;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->freeLuggageUnit = $cabinListItems->freeLuggageUnit;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->billType = $cabinListItems->billType;
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->seatStatus = $cabinListItems->seatStatus;
$otherCabin = $cabinListItems->cabinClass;
$j++;
}
}
// //只读取全价,Y仓
// if ($resourceItems->price->adultFacePrice == $resourceItems->price->cabinClassFullPrice && $resourceItems->price->adultPrice == $resourceItems->price->cabinClassFullPrice){
// //只显示经济舱
// $isY = false;
// foreach ($resourceItems->cabinList as $cabinListItems) {
// if ($cabinListItems->cabinClass == "Y"){
// $isY = true;
// break;
// }
// }
// if ($isY){
// $cacheData->queryResultList[$i]->resourceList[$j] = new stdClass();
// $cacheData->queryResultList[$i]->resourceList[$j]->price = new stdClass();
// $cacheData->queryResultList[$i]->resourceList[$j]->price->adultPrice = $resourceItems->price->adultPrice;
// $cacheData->queryResultList[$i]->resourceList[$j]->price->childPrice = $resourceItems->price->childPrice;
// $cacheData->queryResultList[$i]->resourceList[$j]->price->adultFacePrice = $resourceItems->price->adultFacePrice;
// $cacheData->queryResultList[$i]->resourceList[$j]->price->childFacePrice = $resourceItems->price->childFacePrice;
// $cacheData->queryResultList[$i]->resourceList[$j]->price->cabinClassFullPrice = $resourceItems->price->cabinClassFullPrice;
// $cacheData->queryResultList[$i]->resourceList[$j]->price->adultTax = $resourceItems->price->adultTax;
// $k = 0;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k] = new stdClass();
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->cabinClass = $cabinListItems->cabinClass;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->cabinClassName = $cabinListItems->cabinClassName;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->freeLuggage = $cabinListItems->freeLuggage;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->freeLuggageUnit = $cabinListItems->freeLuggageUnit;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->billType = $cabinListItems->billType;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->seatStatus = $cabinListItems->seatStatus;
// $j++;
// $Y++;
// }
// }else{
// //非全价的只显示其它舱位
// $arrCabinListItems = $resourceItems->cabinList;
// $cabinListItems = $arrCabinListItems[0];
// if ($cabinListItems->cabinClass != "Y"){
// $cacheData->queryResultList[$i]->resourceList[$j] = new stdClass();
// $cacheData->queryResultList[$i]->resourceList[$j]->price = new stdClass();
// $cacheData->queryResultList[$i]->resourceList[$j]->price->adultPrice = $resourceItems->price->adultPrice;
// $cacheData->queryResultList[$i]->resourceList[$j]->price->childPrice = $resourceItems->price->childPrice;
// $cacheData->queryResultList[$i]->resourceList[$j]->price->adultFacePrice = $resourceItems->price->adultFacePrice;
// $cacheData->queryResultList[$i]->resourceList[$j]->price->childFacePrice = $resourceItems->price->childFacePrice;
// $cacheData->queryResultList[$i]->resourceList[$j]->price->cabinClassFullPrice = $resourceItems->price->cabinClassFullPrice;
// $cacheData->queryResultList[$i]->resourceList[$j]->price->adultTax = $resourceItems->price->adultTax;
// $k = 0;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k] = new stdClass();
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->cabinClass = $cabinListItems->cabinClass;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->cabinClassName = $cabinListItems->cabinClassName;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->freeLuggage = $cabinListItems->freeLuggage;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->freeLuggageUnit = $cabinListItems->freeLuggageUnit;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->billType = $cabinListItems->billType;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->seatStatus = $cabinListItems->seatStatus;
// $j++;
// }
// }
}
// //Y仓没有全价的处理默认加上一个全价
// if ($Y===0){
// if (count($items->resourceList)>0){
// $cacheData->queryResultList[$i]->resourceList[$j] = new stdClass();
// $cacheData->queryResultList[$i]->resourceList[$j]->price = new stdClass();
// $resourceList = $items->resourceList;
// $resourceItems = $resourceList[0];
// $cacheData->queryResultList[$i]->resourceList[$j]->price->adultPrice = $resourceItems->price->cabinClassFullPrice;
// $cacheData->queryResultList[$i]->resourceList[$j]->price->childPrice = $resourceItems->price->childPrice;
// $cacheData->queryResultList[$i]->resourceList[$j]->price->adultFacePrice = $resourceItems->price->cabinClassFullPrice;
// $cacheData->queryResultList[$i]->resourceList[$j]->price->childFacePrice = $resourceItems->price->childFacePrice;
// $cacheData->queryResultList[$i]->resourceList[$j]->price->cabinClassFullPrice = $resourceItems->price->cabinClassFullPrice;
// $cacheData->queryResultList[$i]->resourceList[$j]->price->adultTax = $resourceItems->price->adultTax;
// $k = 0;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k] = new stdClass();
// $cabinList = $resourceItems->cabinList;
// $cabinListItems = $cabinList[0];
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->cabinClass = $cabinListItems->cabinClass;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->cabinClassName = $cabinListItems->cabinClassName;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->freeLuggage = $cabinListItems->freeLuggage;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->freeLuggageUnit = $cabinListItems->freeLuggageUnit;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->billType = $cabinListItems->billType;
// $cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->seatStatus = $cabinListItems->seatStatus;
// }
// }
$i++;
}
print_r(json_encode($cacheData));
}
}
}
}

@ -1,77 +0,0 @@
<?php
class flight_model extends CI_Model{
function __construct(){
parent::__construct();
$this->INFO = $this->load->database('INFO', TRUE);
$this->HT=$this->load->database('HT',TRUE);
}
//public $FlightAPI_Code = "http://202.103.68.156:9032"; //本地
public $FlightAPI_Code = "https://www.trainspread.com"; //网前
public function getAllCityCodeAndName(){
$sql = "select city_chinese_name,city_english_name,city_threeChar from city_threeChar";
$query = $this->INFO->query($sql);
return $query->result();
}
public function getAllAirPort(){
$sql = "select air_threeChar,air_english_name from air_threeChar";
$query = $this->INFO->query($sql);
return $query->result();
}
/**
* 根据机场code获取对于的机场英文名 20201229 zp 接口数据突然无法获取机场英文名,估计是删除缓存获取以后的错误
*/
public function getAirPortNameEn($code){
$sql = "select top 1 air_english_name from air_threeChar where air_threeChar ='".$code."'";
$query = $this->INFO->query($sql);
$row = $query->row();
if (isset($row)){
return $row->air_english_name;
}else{
return "";
}
}
/*
* 根据三字码获取对应城市的英文名称
*/
public function getCityNameFromCode($code){
$result = "";
$Url_FlightCode = $this->FlightAPI_Code."/flight/ajaxGetCodeAndName/";
$FlightCodeList = get_http($Url_FlightCode); //获取接口机场列表Json
$Json_FlightCode = json_decode($FlightCodeList);
if (!empty($code)){
foreach($Json_FlightCode as $Item){
if ($Item->city_threeChar==$code){
$result=$Item->city_english_name;
break;
}
}
}
return $result;
}
/*
* 根据航线二字码获取对应的航空公司英文名
*/
public function getAirlineNameEn($code){
$sql = "select top 1 NameEN,NameCN from AirCompany where Code='".$code."'";
$query = $this->HT->query($sql);
$row = $query->row();
if (isset($row)){
return $row->NameEN;
}else{
return "";
}
}
}
?>

@ -10,7 +10,7 @@ class Confirm extends CI_Controller {
$this->load->model('Order_model');
}
// site_code 默认是空CT、AH 网站需要传值
//site_code默认是空ct的站点需要传值
public function index($COLI_SN = false, $visitor_link = false, $token = false,$site_code='') {
$data = array();
if (empty($COLI_SN) || strtoupper(md5($visitor_link)) != strtoupper($token)) {
@ -47,30 +47,6 @@ class Confirm extends CI_Controller {
$this->load->view($site_code.'/confirm_order', $data);
}
// https://www.chinahighlights.com/secureinfoconfirm/confirm/test/991733/20230314153025/82899713caf652fc5e4cbe76655bdd3f/ah
public function test($COLI_SN = false, $visitor_link = false, $token = false,$site_code='') {
$data = array();
if (empty($COLI_SN)) {
echo '<div class="hidden">链接不对</div>';
return false;
}
$data['visitor_link'] = $visitor_link;
$data['userinfo'] = $this->Order_model->get_customer_info($COLI_SN);
$data['username'] = '';
if (!empty($data['userinfo'])) {
foreach ($data['userinfo'] as $v) {
if ($v->CUL_IsLinkMan == 1) {
$data['username'] = $v->MEI_FirstName;
$data['usermail'] = $v->MEI_MailList;
}
}
}
$this->load->view($site_code.'/confirm_order', $data);
}
public function save_confirm_info() {
//客人信息
@ -80,25 +56,23 @@ class Confirm extends CI_Controller {
$passport = $this->input->post('passport');
$expiration_date = $this->input->post('passport_expiration_date');
$nationality = $this->input->post('nationality');
$occupation=$this->input->post('occupation');
$country_code = $this->input->post('country_code');
$contact_phone = $country_code . ' ' . $this->input->post('mobile');
$contact_phone = '座机:' . $this->input->post('landline') . '/手机:' . $this->input->post('mobile');
$COLI_SN = $this->input->post('COLI_SN');
$visitor_link = $this->input->post('visitor_link');
$COLI_ID = $this->input->post('COLI_ID');
//航班信息
$MEI_ArrivalFlightNo = $this->input->post('MEI_ArrivalFlightNo');
$MEI_ArrivalTime = $this->input->post('MEI_ArrivalTime');
$MEI_DepartureFlightNo = $this->input->post('MEI_DepartureFlightNo');
// HTML datetime-local 获取的值2023-05-29T15:45需要替换 T 为空格才能符合数据类型
$MEI_ArrivalTime = str_replace("T", " ", $this->input->post('MEI_ArrivalDate').' '.$this->input->post('MEI_ArrivalTime'));
$MEI_DepartureTime = str_replace("T", " ", $this->input->post('MEI_DepartureDate').' '.$this->input->post('MEI_DepartureTime'));
$MEI_DepartureTime = $this->input->post('MEI_DepartureTime');
//已经确认过
$had_save = $this->Order_model->get_visitor_link($COLI_SN, $visitor_link);
if (!empty($had_save)) {
echo json_encode(array('status' => 'ok'));
return;
@ -131,10 +105,6 @@ class Confirm extends CI_Controller {
$birthday_tmp = date('Y-m-d H:i:s', strtotime($birthday[$key]));
$expiration_date_tmp = date('Y-m-d H:i:s', strtotime($expiration_date[$key]));
// 现在表单只用填写第一个客人的手机,所以其他客人
if ($key > 0) {
$contact_phone = '';
}
$MEI_SN = $this->Order_model->add_customer_info($occupation[$key],$gender[$key], $nationality[$key], $MEI_FirstName, $MEI_LastName, $passport[$key], $expiration_date_tmp, $birthday_tmp, $MEI_Memo, $MEI_Street, '', $contact_phone, 0, $COLI_SN, $visitor_link,$MEI_ArrivalFlightNo,$MEI_ArrivalTime,$MEI_DepartureFlightNo,$MEI_DepartureTime);
}
}
@ -163,15 +133,13 @@ class Confirm extends CI_Controller {
echo json_encode(array('status' => 'no'));
}
}
//只有ch有review功能
function review() {
header('Content-type: application/json;charset=utf-8');
$data = array();
$site_code = $this->input->get('site_code');
$viewName = $site_code.'/mailtext';
$data['postdata'] = $this->input->post();
$mail_text = $this->load->view($viewName, $data, true);
echo json_encode($mail_text);
$data = array();
$data['postdata'] = $this->input->post();
$mail_text = $this->load->view('mailtext', $data, true);
echo json_encode($mail_text);
}
}

File diff suppressed because it is too large Load Diff

@ -1,73 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Thanks for booking with China Highlights!</title>
<meta name="robots" content="noindex,nofollow"/>
<link href="https://www.chinahighlights.com/css/min.php?f=/image/customer_center_data/css/bootstrap.min.css,/image/customer_center_data/css/order.css&v=2015042802" rel="stylesheet">
<!--[if lt IE 9]>
<script src="https://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="https://www.chinahighlights.com/js/min.php?f=/image/customer_center_data/js/jquery.min.js,/image/customer_center_data/js/bootstrap.min.js&v=2015042802"></script>
<link rel="shortcut icon" href="https://www.chinahighlights.com/favicon.ico">
</head>
<body class="modal-open">
<div id="headerWrapper">
<div id="header">
<div id="mainnav" class="nav navbar" role="navigation">
<div class="container-fluid">
<div class="row">
<div class="col-lg-3 col-sm-4 logobox hidden-xs">
<a href="/">
<img src="https://www.chinahighlights.com/image/customer_center_data/css/images/logo-132x104.png" alt="logo">
</a>
</div>
<div class="col-lg-16 col-sm-13 col-lg-offset-3 col-sm-offset-4">
<div class="navbar-header">
<div class="col-xs-24 btn-lg"></div>
</div>
</div>
<div class="col-lg-5 col-sm-7 hidden-xs pull-right nopadding">
<div class="tollfree pull-right">
<div class="col-xs-24 btn-sm"></div>
<div class="currentNo col-sm-24 nopadding"><span class="glyphicon glyphicon-earphone" style="font-size:12px;"></span> 800-2682918 (USA/CA)</div>
<div class="col-sm-24">
<div class="currentNo col-sm-24 nopadding"> 1800-764678 (AU)</div>
<div class="currentNo col-sm-24 nopadding"> 0800-0327753 (UK)</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="bs-example bs-example-modal" data-example-id="static-modal">
<div class="modal" style="display:block;">
<div class="modal-dialog" style="margin-top:200px;">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title text-success" id="modal-title">Success!<a class="anchorjs-link" href="#modal-title"><span class="anchorjs-icon"></span></a></h3>
</div>
<div class="modal-body" style="height:150px;">
<h4 style="padding-top:10px;">For any change, please contact your travel advisor.</h4>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
<div class="modal-backdrop fade in" style="bottom:0;"></div>
</body>
</html>

@ -1,76 +0,0 @@
<p >
China Highlights is not responsible for any costs or consequences which may arise from failure on your part to provide correct information (For example, wrongly spelt names may cause your flight tickets to be cancelled, incorrect incoming flight number may lead to failure in pick-up etc.).<br />
</p>
<h4 class="text-red" style="box-sizing:border-box;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-weight:500;line-height:1.1;color:#AA2E2D;margin-top:10px;margin-bottom:15px;font-size:24px;padding:12px 0 12px 0;border-bottom:1px solid #dddddd;border-top:1px solid #dddddd;white-space:normal;background-color:#FFFFFF;">
Passenger Information
</h4>
<?php foreach ($postdata['sur_name'] as $key => $sur) { ?>
<?php
if (!isset($postdata['given_name'][$key]) || $postdata['given_name'][$key] == 'None')
$postdata['given_name'][$key] = '';
if (!isset($postdata['passport'][$key]) || $postdata['passport'][$key] == 'None')
$postdata['passport'][$key] = '';
if (!isset($postdata['passport_expiration_date'][$key]) || $postdata['passport_expiration_date'][$key] == 'None')
$postdata['passport_expiration_date'][$key] = '';
if (!isset($postdata['birthday'][$key]) || $postdata['birthday'][$key] == 'None')
$postdata['birthday'][$key] = '';
?>
<h3>Passenger <?php echo $key + 1; ?></h3>
<p style="margin:0;">Sur name/First and Middle name:<?php echo $sur . '/' . $postdata['given_name'][$key]; ?></p>
<p style="margin:0;">Passport No.:<?php echo $postdata['passport'][$key]; ?></p>
<p style="margin:0;">Passport Expiration Date:<?php echo $postdata['passport_expiration_date'][$key]; ?></p>
<p style="margin:0;">Birthday:<?php echo $postdata['birthday'][$key]; ?></p>
<?php } ?>
<h3>Contact Information</h3>
<p style="margin:0;">Land line:<?php if (isset($postdata['landline'])) echo $postdata['landline']; ?></p>
<p style="margin:0;">Mobile:<?php if (isset($postdata['mobile'])) echo $postdata['mobile']; ?></p>
<h4 class="text-red" style="box-sizing:border-box;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-weight:500;line-height:1.1;color:#AA2E2D;margin-top:10px;margin-bottom:15px;font-size:24px;padding:12px 0 12px 0;border-bottom:1px solid #dddddd;border-top:1px solid #dddddd;white-space:normal;background-color:#FFFFFF;">
Flight Information
</h4>
<p style="margin:0;">Arrival Flight No.:<?php if (isset($postdata['MEI_ArrivalFlightNo'])) echo $postdata['MEI_ArrivalFlightNo']; ?></p>
<p style="margin:0;">
Arrival date:<?php if (isset($postdata['MEI_ArrivalDate'])) echo $postdata['MEI_ArrivalDate']; ?>
</p>
<p style="margin:0;">
Arrival time:<?php if (isset($postdata['MEI_ArrivalTime'])) echo $postdata['MEI_ArrivalTime']; ?>
</p>
<p style="margin:0;">
Departure Flight no.:<?php if (isset($postdata['MEI_DepartureFlightNo'])) echo $postdata['MEI_DepartureFlightNo']; ?>
</p>
<p style="margin:0;">
Departure date:<?php if (isset($postdata['MEI_DepartureDate'])) echo $postdata['MEI_DepartureDate']; ?>
</p>
<p style="margin:0;">
Departure time:<?php if (isset($postdata['MEI_DepartureTime'])) echo $postdata['MEI_DepartureTime']; ?>
</p>
<h4 class="text-red" style="box-sizing:border-box;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-weight:500;line-height:1.1;color:#AA2E2D;margin-top:10px;margin-bottom:15px;font-size:24px;padding:12px 0 12px 0;border-bottom:1px solid #dddddd;border-top:1px solid #dddddd;white-space:normal;background-color:#FFFFFF;">
Special Request
</h4>
<p style="margin:0;">
<?php if (isset($postdata['special_request'])) echo $postdata['special_request']; ?>
<br />
</p>
<h4 class="text-red" style="box-sizing:border-box;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-weight:500;line-height:1.1;color:#AA2E2D;margin-top:10px;margin-bottom:15px;font-size:24px;padding:12px 0 12px 0;border-bottom:1px solid #dddddd;border-top:1px solid #dddddd;white-space:normal;background-color:#FFFFFF;">
Insurance Information
</h4>
<p style="margin:0;">
<?php if (isset($postdata['insurance_information'])) echo $postdata['insurance_information']; ?>
<br />
</p>
<h4 class="text-red" style="box-sizing:border-box;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-weight:500;line-height:1.1;color:#AA2E2D;margin-top:10px;margin-bottom:15px;font-size:24px;padding:12px 0 12px 0;border-bottom:1px solid #dddddd;border-top:1px solid #dddddd;white-space:normal;background-color:#FFFFFF;">
Emergency Contact Information
</h4>
<p style="margin:0;">
Contact person name:<?php if (isset($postdata['emergency_person_name'])) echo $postdata['emergency_person_name']; ?>
</p>
<p style="margin:0;">
Relationship with him/her:<?php if (isset($postdata['emergency_relationship'])) echo $postdata['emergency_relationship']; ?>
</p>
<p style="margin:0;">
E-mail address:<?php if (isset($postdata['emergency_email'])) echo $postdata['emergency_email']; ?>
</p>
<p style="margin:0;">
Telephone no.:<?php if (isset($postdata['emergency_telephone'])) echo $postdata['emergency_telephone']; ?>
</p>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,73 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Thanks for booking with China Highlights!</title>
<meta name="robots" content="noindex,nofollow"/>
<link href="https://www.chinahighlights.com/css/min.php?f=/image/customer_center_data/css/bootstrap.min.css,/image/customer_center_data/css/order.css&v=2015042802" rel="stylesheet">
<!--[if lt IE 9]>
<script src="https://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="https://www.chinahighlights.com/js/min.php?f=/image/customer_center_data/js/jquery.min.js,/image/customer_center_data/js/bootstrap.min.js&v=2015042802"></script>
<link rel="shortcut icon" href="https://www.chinahighlights.com/favicon.ico">
</head>
<body class="modal-open">
<div id="headerWrapper">
<div id="header">
<div id="mainnav" class="nav navbar" role="navigation">
<div class="container-fluid">
<div class="row">
<div class="col-lg-3 col-sm-4 logobox hidden-xs">
<a href="/">
<img src="https://www.chinahighlights.com/image/customer_center_data/css/images/logo-132x104.png" alt="logo">
</a>
</div>
<div class="col-lg-16 col-sm-13 col-lg-offset-3 col-sm-offset-4">
<div class="navbar-header">
<div class="col-xs-24 btn-lg"></div>
</div>
</div>
<div class="col-lg-5 col-sm-7 hidden-xs pull-right nopadding">
<div class="tollfree pull-right">
<div class="col-xs-24 btn-sm"></div>
<div class="currentNo col-sm-24 nopadding"><span class="glyphicon glyphicon-earphone" style="font-size:12px;"></span> 800-2682918 (USA/CA)</div>
<div class="col-sm-24">
<div class="currentNo col-sm-24 nopadding"> 1800-764678 (AU)</div>
<div class="currentNo col-sm-24 nopadding"> 0800-0327753 (UK)</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="bs-example bs-example-modal" data-example-id="static-modal">
<div class="modal" style="display:block;">
<div class="modal-dialog" style="margin-top:200px;">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title text-success" id="modal-title">Success!<a class="anchorjs-link" href="#modal-title"><span class="anchorjs-icon"></span></a></h3>
</div>
<div class="modal-body" style="height:150px;">
<h4 style="padding-top:10px;">For any change, please contact your travel advisor.</h4>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
<div class="modal-backdrop fade in" style="bottom:0;"></div>
</body>
</html>

@ -62,6 +62,7 @@
</div>
<div class="modal-body" style="height:150px;">
<h4 style="padding-top:10px;">For any change, please contact your travel advisor.</h4>
<p>----<a href="http://www.chinahighlights.com" class="">www.chinahighlights.com</a></p>
</div>
</div><!-- /.modal-content -->

@ -29,12 +29,12 @@
<h4 class="text-red" style="box-sizing:border-box;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-weight:500;line-height:1.1;color:#AA2E2D;margin-top:10px;margin-bottom:15px;font-size:24px;padding:12px 0 12px 0;border-bottom:1px solid #dddddd;border-top:1px solid #dddddd;white-space:normal;background-color:#FFFFFF;">
Flight Information
</h4>
<p style="margin:0;">Arrival Flight No.:<?php if (isset($postdata['MEI_ArrivalFlightNo'])) echo $postdata['MEI_ArrivalFlightNo']; ?></p>
<p style="margin:0;">Arrival China Flight No.:<?php if (isset($postdata['MEI_ArrivalFlightNo'])) echo $postdata['MEI_ArrivalFlightNo']; ?></p>
<p style="margin:0;">
Arrival time:<?php if (isset($postdata['MEI_ArrivalTime'])) echo $postdata['MEI_ArrivalTime']; ?>
</p>
<p style="margin:0;">
Departure Flight no.:<?php if (isset($postdata['MEI_DepartureFlightNo'])) echo $postdata['MEI_DepartureFlightNo']; ?>
Departure China Flight no.:<?php if (isset($postdata['MEI_DepartureFlightNo'])) echo $postdata['MEI_DepartureFlightNo']; ?>
</p>
<p style="margin:0;">
Departure time:<?php if (isset($postdata['MEI_DepartureTime'])) echo $postdata['MEI_DepartureTime']; ?>

@ -1,126 +0,0 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Index extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->permission->is_admin();
$this->load->model('InfoStructures_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('infoRecommends_model');
$this->load->model('infoTips_model');
}
public function index()
{
$data = array();
$data['groupList'] = $this->Information_model->group_list();
$data['tipsList'] = $this->infoTips_model->get_list();
$this->load->view('bootstrap3/header', $data);
$this->load->view('welcome');
$this->load->view('bootstrap3/footer');
}
public function search()
{
$keywords = $this->input->post('keywords');
$byWhat = $this->input->post('byWhat');
$data = array();
$data['groupList'] = $this->Information_model->group_list();
$data['tipsList'] = $this->infoTips_model->search($keywords, $byWhat);
$data['lastKeyword'] = $keywords;
$this->load->view('bootstrap3/header', $data);
$this->load->view('welcome');
$this->load->view('bootstrap3/footer');
}
//节点绑定信息推荐或者广告
public function bind($is_id)
{
$data = array();
$data['information'] = $this->Information_model->Detail($is_id);
if ($data['information'] == FALSE) {
show_404();
return;
}
//如果本身不是分组节点则查询分组信息
if ($data['information']->is_level > 0) {
$data['group_detail'] = $this->Information_model->get_detail_by_path($data['information']->is_path, 0);
}
//查询所有推荐信息
$recommends= $this->infoRecommends_model->detail_list($is_id);
foreach ($recommends as $item){
$data['recommends'][$item->ir_name]=$item;
}
$this->load->view('bootstrap3/header', $data);
$this->load->view('bind');
$this->load->view('bootstrap3/footer');
}
public function bind_info()
{
$data = array();
$ir_is_id = $this->input->post('ir_is_id');
$ir_name = $this->input->post('ir_name');
$data['infoRecommend'] = $this->infoRecommends_model->detail($ir_is_id, $ir_name);
//广告列表
$data['tipsList'] = $this->infoTips_model->get_list();
if (empty($data['infoRecommend'])) {
$data['infoRecommend'] = new StdClass;
$data['infoRecommend']->ir_is_id = $ir_is_id;
$data['infoRecommend']->ir_name = $ir_name;
$data['infoRecommend']->ir_keyword = '';
$data['infoRecommend']->ir_pointer_is_id = null;
$data['infoRecommend']->ir_pointer_it_id = null;
$data['infoRecommend']->ir_urls = '';
$data['infoRecommend']->ir_rule = 'rule_parent';
$data['infoRecommend']->ir_datetime = time();
$data['infoRecommend']->ir_sitecode = $this->config->item('site_code');
$data['infoRecommend']->ir_id = $this->infoRecommends_model->add('infoRecommends', $data['infoRecommend']);
}
echo json_encode($this->load->view('bind_info', $data, true));
}
//根据is_id查询对应的信息用来检查绑定的is是否正确
public function check_is_id_info(){
$ir_pointer_is_id=$this->input->post('ir_pointer_is_id');
if(!empty($ir_pointer_is_id)) {
$information = $this->Information_model->Detail($ir_pointer_is_id);
}
if(!empty($information)){
echo json_encode($information->ic_title);
}else{
echo json_encode('找不到信息');
}
}
public function bind_info_save()
{
$infoRecommend = new StdClass;
$ir_id = $this->input->post('ir_id');
//先查一遍这个数据是否存在,不存在则退出,防止被攻击
if (empty($this->infoRecommends_model->detail_by_ir_id($ir_id))) {
$data[] = array('name' => 'no', 'value' => '查询不到数据,请重试');
} else {
$infoRecommend->ir_rule = $this->input->post('ir_rule');
$infoRecommend->ir_keyword = trim($this->input->post('ir_keyword'));
$infoRecommend->ir_pointer_is_id = $this->input->post('ir_pointer_is_id');
$infoRecommend->ir_pointer_it_id = $this->input->post('ir_pointer_it_id');
$infoRecommend->ir_urls =trim($this->input->post('ir_urls'));
$infoRecommend->ir_datetime =time();
$infoRecommend->ir_id = $this->infoRecommends_model->update('infoRecommends', $infoRecommend, 'ir_id=' . $ir_id);
$data[] = array('name' => 'ok', 'value' => '保存成功!');
}
echo json_encode($data);
}
}

@ -1,88 +0,0 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Tips extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->permission->is_admin();
$this->load->model('InfoStructures_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('infoTips_model');
}
public function index()
{
echo 'Tips index';
}
public function add()
{
$infoTip = new StdClass;
$infoTip->it_title = '新广告';
$infoTip->it_expires = time();
$infoTip->it_content = $this->load->view('templates', false,true);;
$infoTip->it_code = '<!--@TIPS--@-->';
$infoTip->it_datetime = time();
$infoTip->it_sitecode = $this->config->item('site_code');
$infoTip->it_id = $this->infoTips_model->add('infoTips', $infoTip);
redirect(site_url('thirdparty/recommend/tips/edit/' . $infoTip->it_id));
}
public function delete($it_id)
{
$data = array();
$data['infoTip'] = $this->infoTips_model->detail($it_id);
if ($data['infoTip'] == FALSE) {
show_404();
return;
}
$this->infoTips_model->delete('infoTips', 'it_id=' . $it_id);
redirect(site_url('thirdparty/recommend/'));
}
public function edit($it_id)
{
$data = array();
$data['infoTip'] = $this->infoTips_model->detail($it_id);
if ($data['infoTip'] == FALSE) {
show_404();
return;
}
$this->load->view('bootstrap3/header', $data);
$this->load->view('tips_info');
$this->load->view('bootstrap3/footer');
}
public function save()
{
$infoRecommend = new StdClass;
$it_id = $this->input->post('it_id');
//先查一遍这个数据是否存在,不存在则退出,防止被攻击
if (empty($this->infoTips_model->detail($it_id))) {
$data[] = array('name' => 'no', 'value' => '查询不到数据,请重试');
} else {
$infoTip = new StdClass;
$infoTip->it_title = $this->input->post('it_title');
$infoTip->it_expires = strtotime($this->input->post('it_expires'));
$infoTip->it_code = $this->input->post('it_code');
$infoTip->it_content = replace_image_url($this->input->post('it_content'));
$infoTip->it_datetime = time();
$infoTip->it_id = $this->infoTips_model->update('infoTips', $infoTip, 'it_id=' . $it_id);
$data[] = array('name' => 'ok', 'value' => '保存成功!');
}
echo json_encode($data);
}
}

@ -1,96 +0,0 @@
<?php
class infoRecommends_model extends CI_Model
{
var $topnum = false; //返回记录数
var $orderby = false;
var $where = false; //查询条件
function __construct()
{
parent::__construct();
$this->HT = $this->load->database('INFORMATION', TRUE);
}
public function init() {
$this->topnum = false;
$this->where = false;
$this->orderby = ' order by ir_datetime desc ';
}
public function detail($ir_is_id,$ir_name){
$this->init();
$this->topnum = 1;
$this->where = ' AND ir.ir_is_id=' . $this->HT->escape($ir_is_id);
$this->where .= ' AND ir.ir_name=' . $this->HT->escape($ir_name);
return $this->get_list();
}
public function detail_list($ir_is_id){
$this->init();
$this->where = ' AND ir.ir_is_id=' . $this->HT->escape($ir_is_id);
return $this->get_list();
}
public function detail_by_ir_id($ir_id){
$this->init();
$this->topnum = 1;
$this->where = ' AND ir.ir_id=' . $this->HT->escape($ir_id);
return $this->get_list();
}
public function get_list() {
$this->topnum ? $sql = "SELECT TOP " . $this->topnum : $sql = "SELECT ";
$sql .= "
ir.ir_id
,ir.ir_is_id
,ir.ir_keyword
,ir.ir_name
,ir.ir_pointer_is_id
,ir.ir_pointer_it_id
,ir.ir_rule
,ir.ir_urls
,ir.ir_datetime
,ir.ir_sitecode
from infoRecommends ir
where 1=1
AND ir.ir_sitecode=?
";
$this->where ? $sql.=$this->where : false;
$this->orderby ? $sql.=$this->orderby : false;
$query = $this->HT->query($sql,array($this->config->item('site_code')));
//print_r($this->INFO->queries);
if ($this->topnum === 1) {
if ($query->num_rows() > 0) {
$row = $query->row();
return $row;
} else {
return FALSE;
}
} else {
return $query->result();
}
}
public function add($table, $data)
{
if ($this->HT->insert($table, $data)) {
return $this->HT->last_id($table);
} else {
return false;
}
}
public function update($table, $data, $where)
{
return $this->HT->update($table, $data, $where);
}
public function delete($table, $where)
{
return $this->HT->delete($table, $where);
}
}

@ -1,99 +0,0 @@
<?php
class infoTips_model extends CI_Model
{
var $topnum = false; //返回记录数
var $orderby = false;
var $where = false; //查询条件
function __construct()
{
parent::__construct();
$this->HT = $this->load->database('INFORMATION', TRUE);
}
public function init() {
$this->topnum = false;
$this->where = false;
$this->orderby = ' order by it_expires ASC ';
}
public function detail($it_id){
$this->init();
$this->topnum = 1;
$this->where = ' AND it.it_id=' . $this->HT->escape($it_id);
return $this->get_list();
}
public function get_list() {
$this->topnum ? $sql = "SELECT TOP " . $this->topnum : $sql = "SELECT ";
$sql .= "
it.it_id
,it.it_title
,it.it_expires
,it.it_code
,it.it_content
,it.it_sitecode
,it.it_datetime
from infoTips it
where 1=1
AND it.it_sitecode=?
";
$this->where ? $sql.=$this->where : false;
$this->orderby ? $sql.=$this->orderby : false;
$query = $this->HT->query($sql,array($this->config->item('site_code')));
//print_r($this->INFO->queries);
if ($this->topnum === 1) {
if ($query->num_rows() > 0) {
$row = $query->row();
return $row;
} else {
return FALSE;
}
} else {
return $query->result();
}
}
public function search($keywords, $byWhat) {
$whereCodition = '';
if ($byWhat == 'byTitle') {
$whereCodition .= " and it.it_title like '%" . $this->HT->escape_str($keywords) . "%'";
} else if ($byWhat == 'byLabel') {
$whereCodition .= " and it.it_code like '%" . $this->HT->escape_str($keywords) . "%'";
} else if ($byWhat == 'byContent') {
$whereCodition .= " and it.it_content like '%" . $this->HT->escape_str($keywords) . "%'";
}
$searchText =
"select it.it_id ,it.it_title,it.it_expires,it.it_code,it.it_content,it.it_sitecode,it.it_datetime
from infoTips it
where it.it_sitecode=?"
. $whereCodition
. " order by it_expires ASC";
$query = $this->HT->query($searchText, array($this->config->item('site_code')));
return $query->result();
}
public function add($table, $data)
{
if ($this->HT->insert($table, $data)) {
return $this->HT->last_id($table);
} else {
return false;
}
}
public function update($table, $data, $where)
{
return $this->HT->update($table, $data, $where);
}
public function delete($table, $where)
{
return $this->HT->delete($table, $where);
}
}

@ -1,786 +0,0 @@
<div class="container-fluid">
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-16">
<h3> <?php echo empty($group_detail) ? '[ ' . $information->ic_title . ' ]' : '[ ' . $group_detail->ic_url_title . ' ] ' . $information->ic_url_title; ?> </h3>
<div class="row">
<div class="col-md-16">
<div class="panel panel-default">
<div class="panel-heading">文章内容</div>
<div class="panel-body">
<!-- 文中信息推荐 begin -->
<p class="text-primary text-center">&lt;!--@Content-Recommends-Article@--&gt;</p>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Article A <a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Article A')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Article A']) ? '继承上级' : $recommends['Content Article A']->ir_rule . '<br/>' . $recommends['Content Article A']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Article B <a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Article B')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Article B']) ? '继承上级' : $recommends['Content Article B']->ir_rule . '<br/>' . $recommends['Content Article B']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Article C <a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Article C')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Article C']) ? '继承上级' : $recommends['Content Article C']->ir_rule . '<br/>' . $recommends['Content Article C']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Article D <a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Article D')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Article D']) ? '继承上级' : $recommends['Content Article D']->ir_rule . '<br/>' . $recommends['Content Article D']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Article E <a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Article E')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Article E']) ? '继承上级' : $recommends['Content Article E']->ir_rule . '<br/>' . $recommends['Content Article E']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Article F <a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Article F')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Article F']) ? '继承上级' : $recommends['Content Article F']->ir_rule . '<br/>' . $recommends['Content Article F']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Article G <a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Article G')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Article G']) ? '继承上级' : $recommends['Content Article G']->ir_rule . '<br/>' . $recommends['Content Article G']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Article H <a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Article H')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Article H']) ? '继承上级' : $recommends['Content Article H']->ir_rule . '<br/>' . $recommends['Content Article H']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Article I <a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Article I')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Article I']) ? '继承上级' : $recommends['Content Article I']->ir_rule . '<br/>' . $recommends['Content Article I']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Article J <a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Article J')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Article J']) ? '继承上级' : $recommends['Content Article J']->ir_rule . '<br/>' . $recommends['Content Article J']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Article K <a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Article K')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Article K']) ? '继承上级' : $recommends['Content Article K']->ir_rule . '<br/>' . $recommends['Content Article K']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Article L <a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Article L')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Article L']) ? '继承上级' : $recommends['Content Article L']->ir_rule . '<br/>' . $recommends['Content Article L']->ir_keyword; ?>
</div>
</div>
</div>
</div>
<!-- 文中信息推荐 end -->
<hr/>
<!-- 文中线路推荐 begin -->
<p class="text-primary text-center">&lt;!--@Content-Recommends-Tour@--&gt;</p>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Tour A<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Tour A')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Tour A']) ? '继承上级' : $recommends['Content Tour A']->ir_rule . '<br/>' . $recommends['Content Tour A']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Tour B<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Tour B')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Tour B']) ? '继承上级' : $recommends['Content Tour B']->ir_rule . '<br/>' . $recommends['Content Tour B']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Tour C<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Tour C')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Tour C']) ? '继承上级' : $recommends['Content Tour C']->ir_rule . '<br/>' . $recommends['Content Tour C']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Tour D<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Tour D')">
<span class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Tour D']) ? '继承上级' : $recommends['Content Tour D']->ir_rule . '<br/>' . $recommends['Content Tour D']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Tour E<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Tour E')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Tour E']) ? '继承上级' : $recommends['Content Tour E']->ir_rule . '<br/>' . $recommends['Content Tour E']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Tour F<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Tour F')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Tour F']) ? '继承上级' : $recommends['Content Tour F']->ir_rule . '<br/>' . $recommends['Content Tour F']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Tour G<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Tour G')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Tour G']) ? '继承上级' : $recommends['Content Tour G']->ir_rule . '<br/>' . $recommends['Content Tour G']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Tour H<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Tour H')">
<span class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Tour H']) ? '继承上级' : $recommends['Content Tour H']->ir_rule . '<br/>' . $recommends['Content Tour H']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Tour I<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Tour I')">
<span class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Tour I']) ? '继承上级' : $recommends['Content Tour I']->ir_rule . '<br/>' . $recommends['Content Tour I']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Tour J<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Tour J')">
<span class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Tour J']) ? '继承上级' : $recommends['Content Tour J']->ir_rule . '<br/>' . $recommends['Content Tour J']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Tour K<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Tour K')">
<span class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Tour K']) ? '继承上级' : $recommends['Content Tour K']->ir_rule . '<br/>' . $recommends['Content Tour K']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Content Tour L<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Content Tour L')">
<span class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Content Tour L']) ? '继承上级' : $recommends['Content Tour L']->ir_rule . '<br/>' . $recommends['Content Tour L']->ir_keyword; ?>
</div>
</div>
</div>
</div>
<!-- 文中线路推荐 end -->
</div>
</div>
</div>
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-heading">右侧广告-顶<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Tips Right TOP')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Tips Right TOP']) ? '继承上级' : $recommends['Tips Right TOP']->ir_rule; ?>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">右侧广告<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Tips Right')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Tips Right']) ? '继承上级' : $recommends['Tips Right']->ir_rule; ?>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">右侧列表广告 A</div>
<div class="panel-body">
<ol>
<?php for ($i=1; $i<=12; $i++) { ?>
<li>
<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'List Tips Right A_<?php echo $i ?>')"
>
List Tips Right A_<?php echo $i ?> <?php echo empty($recommends['List Tips Right A_'.$i]) ? '继承上级' : $recommends['List Tips Right A_'.$i]->ir_rule; ?>
</a>
</li>
<?php } ?>
</ol>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">右侧列表广告 B</div>
<div class="panel-body">
<ol>
<?php for ($i=1; $i<=12; $i++) { ?>
<li>
<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'List Tips Right B_<?php echo $i ?>')"
>
List Tips Right B_<?php echo $i ?> <?php echo empty($recommends['List Tips Right B_'.$i]) ? '继承上级' : $recommends['List Tips Right B_'.$i]->ir_rule; ?>
</a>
</li>
<?php } ?>
</ol>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">右侧列表广告 C</div>
<div class="panel-body">
<ol>
<?php for ($i=1; $i<=12; $i++) { ?>
<li>
<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'List Tips Right C_<?php echo $i ?>')"
>
List Tips Right C_<?php echo $i ?> <?php echo empty($recommends['List Tips Right C_'.$i]) ? '继承上级' : $recommends['List Tips Right C_'.$i]->ir_rule; ?>
</a>
</li>
<?php } ?>
</ol>
</div>
</div>
</div>
</div>
<!-- 信息推荐 begin -->
<hr/>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Article A <a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Article A')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Article A']) ? '继承上级' : $recommends['Article A']->ir_rule . '<br/>' . $recommends['Article A']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Article B<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Article B')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Article B']) ? '继承上级' : $recommends['Article B']->ir_rule . '<br/>' . $recommends['Article B']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Article C<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Article C')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Article C']) ? '继承上级' : $recommends['Article C']->ir_rule . '<br/>' . $recommends['Article C']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Article D<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Article D')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Article D']) ? '继承上级' : $recommends['Article D']->ir_rule . '<br/>' . $recommends['Article D']->ir_keyword; ?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Article E <a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Article E')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Article E']) ? '继承上级' : $recommends['Article E']->ir_rule . '<br/>' . $recommends['Article E']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Article F<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Article F')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Article F']) ? '继承上级' : $recommends['Article F']->ir_rule . '<br/>' . $recommends['Article F']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Article G<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Article G')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Article G']) ? '继承上级' : $recommends['Article G']->ir_rule . '<br/>' . $recommends['Article G']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Article H<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Article H')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Article H']) ? '继承上级' : $recommends['Article H']->ir_rule . '<br/>' . $recommends['Article H']->ir_keyword; ?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Article I<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Article I')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Article I']) ? '继承上级' : $recommends['Article I']->ir_rule . '<br/>' . $recommends['Article I']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Article J<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Article J')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Article J']) ? '继承上级' : $recommends['Article J']->ir_rule . '<br/>' . $recommends['Article J']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Article K<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Article K')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Article K']) ? '继承上级' : $recommends['Article K']->ir_rule . '<br/>' . $recommends['Article K']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Article L<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Article L')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Article L']) ? '继承上级' : $recommends['Article L']->ir_rule . '<br/>' . $recommends['Article L']->ir_keyword; ?>
</div>
</div>
</div>
</div>
<!-- 信息推荐 end -->
<hr/>
<!-- 线路推荐 begin -->
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Tour A<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Tour A')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Tour A']) ? '继承上级' : $recommends['Tour A']->ir_rule . '<br/>' . $recommends['Tour A']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Tour B<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Tour B')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Tour B']) ? '继承上级' : $recommends['Tour B']->ir_rule . '<br/>' . $recommends['Tour B']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Tour C<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Tour C')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Tour C']) ? '继承上级' : $recommends['Tour C']->ir_rule . '<br/>' . $recommends['Tour C']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Tour D<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Tour D')">
<span class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Tour D']) ? '继承上级' : $recommends['Tour D']->ir_rule . '<br/>' . $recommends['Tour D']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Tour E<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Tour E')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Tour E']) ? '继承上级' : $recommends['Tour E']->ir_rule . '<br/>' . $recommends['Tour E']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Tour F<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Tour F')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Tour F']) ? '继承上级' : $recommends['Tour F']->ir_rule . '<br/>' . $recommends['Tour F']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Tour G<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Tour G')"
> <span
class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Tour G']) ? '继承上级' : $recommends['Tour G']->ir_rule . '<br/>' . $recommends['Tour G']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Tour H<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Tour H')">
<span class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Tour H']) ? '继承上级' : $recommends['Tour H']->ir_rule . '<br/>' . $recommends['Tour H']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Tour I<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Tour I')">
<span class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Tour I']) ? '继承上级' : $recommends['Tour I']->ir_rule . '<br/>' . $recommends['Tour I']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Tour J<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Tour J')">
<span class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Tour J']) ? '继承上级' : $recommends['Tour J']->ir_rule . '<br/>' . $recommends['Tour J']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Tour K<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Tour K')">
<span class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Tour K']) ? '继承上级' : $recommends['Tour K']->ir_rule . '<br/>' . $recommends['Tour K']->ir_keyword; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Tour L<a
href="javascript:void(0);"
onclick="show_bind_info(<?php echo $information->is_id; ?>,'Tour L')">
<span class="pull-right glyphicon glyphicon-cog"></span></a></div>
<div class="panel-body">
<?php echo empty($recommends['Tour L']) ? '继承上级' : $recommends['Tour L']->ir_rule . '<br/>' . $recommends['Tour L']->ir_keyword; ?>
</div>
</div>
</div>
</div>
<!-- 线路推荐 end -->
</div>
<div class="col-md-4">
</div>
</div>
</div>
<!-- 弹出设置框 begin -->
<div class="modal fade" id="bind_modal_box" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content" id="bind_modal_box_content">
</div>
</div>
</div>
<script>
/*流程说明
点击显示窗口清空modal-content内容然后请求API获取信息推荐设置的HTML来填充modal-content
*/
function show_bind_info(ir_is_id, ir_name) {
var url = '<?php echo site_url('thirdparty/recommend/index/bind_info/') ?>';
$('#bind_modal_box_content').html('');
$.ajax({
type: "post",
dataType: "json",
url: url,
data: {
'ir_is_id': ir_is_id,
'ir_name': ir_name
},
success: function (data, textStatus) {
//console.log(data);
$('#bind_modal_box_content').html(data);
$('#bind_modal_box').modal({'backdrop': 'static', 'show': true});
},
error: function () {
$.modaldialog.error('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYCC');
}
});
}
function check_is_id_info() {
var ir_pointer_is_id = $('#ir_pointer_is_id').val();
var url = '<?php echo site_url('thirdparty/recommend/index/check_is_id_info/') ?>';
$.ajax({
type: "post",
dataType: "json",
url: url,
data: {
'ir_pointer_is_id': ir_pointer_is_id,
},
success: function (data, textStatus) {
$('#pointer_check_info').val(data);
},
error: function () {
$.modaldialog.error('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYCC');
}
});
}
</script>
<!-- 弹出设置框 end -->

@ -1,88 +0,0 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title"><?php echo $infoRecommend->ir_name; ?></h4>
</div>
<div class="modal-body">
<form class="form-horizontal" action="<?php echo site_url('thirdparty/recommend/index/bind_info_save') ?>" method="post" id="bind_info_form" name="bind_info_form">
<div class="row">
<div class="col-md-6">
<label> <input type="radio" name="ir_rule" id="ir_rule_parent" <?php echo $infoRecommend->ir_rule=='rule_parent'?'checked':''; ?>
value="rule_parent">继承上级规则</label>
</div>
<div class="col-md-6">
<label> <input type="radio" name="ir_rule" id="ir_rule_same_node_keyword" <?php echo $infoRecommend->ir_rule=='rule_same_node_keyword'?'checked':''; ?>
value="rule_same_node_keyword">同节点关键词</label>
</div>
<div class="col-md-6">
<label> <input type="radio" name="ir_rule" id="ir_rule_same_url_keyword" <?php echo $infoRecommend->ir_rule=='rule_same_url_keyword'?'checked':''; ?>
value="rule_same_url_keyword">
同URL关键词</label>
</div>
<div class="col-md-6">
<label> <input type="radio" name="ir_rule" id="ir_rule_same_node_random" <?php echo $infoRecommend->ir_rule=='rule_same_node_random'?'checked':''; ?>
value="rule_same_node_random">
同节点随机</label>
</div>
<div class="col-md-6">
<label> <input type="radio" name="ir_rule" id="ir_rule_this_node_random" <?php echo $infoRecommend->ir_rule=='rule_this_node_random'?'checked':''; ?>
value="rule_this_node_random">
指定节点随机</label>
</div>
<div class="col-md-6">
<label> <input type="radio" name="ir_rule" id="ir_rule_range_random" value="rule_range_random" <?php echo $infoRecommend->ir_rule=='rule_range_random'?'checked':''; ?>>
以下范围内随机</label>
</div>
<div class="col-md-6">
<label> <input type="radio" name="ir_rule" id="ir_rule_show_tips" <?php echo $infoRecommend->ir_rule=='rule_show_tips'?'checked':''; ?>
value="rule_show_tips">显示广告</label>
</div>
<div class="col-md-6">
<label> <input type="radio" name="ir_rule" id="ir_rule_no_show" <?php echo $infoRecommend->ir_rule=='rule_no_show'?'checked':''; ?>
value="rule_no_show">不显示</label>
</div>
</div>
<br/>
<div class="form-group">
<label for="ir_keyword" class="col-md-5 control-label">H1包含关键词: </label>
<div class="col-md-19">
<input type="text" class="form-control" name="ir_keyword" id="ir_keyword" placeholder="多个关键词以 , 分隔" value="<?php echo $infoRecommend->ir_keyword; ?>">
</div>
</div>
<div class="form-group">
<label for="ir_pointer_is_id" class="col-md-5 control-label">节点ID: </label>
<div class="col-md-19">
<div class="input-group">
<input type="text" class="form-control" id="ir_pointer_is_id" name="ir_pointer_is_id" placeholder="is_id" value="<?php echo $infoRecommend->ir_pointer_is_id; ?>">
<div class="input-group-addon"><a href="javascript:void(0);" onclick="check_is_id_info()">检查</a></div>
<input type="text" class="form-control" disabled id="pointer_check_info" placeholder="节点ID对应的名称">
</div>
</div>
</div>
<div class="form-group">
<label for="ir_keyword" class="col-md-5 control-label">广告列表: </label>
<div class="col-md-12">
<select class="form-control" id="ir_pointer_it_id" name="ir_pointer_it_id">
<?php foreach ($tipsList as $item){ ?>
<option value="<?php echo $item->it_id; ?>" <?php echo $infoRecommend->ir_pointer_it_id==$item->it_id?'selected':''; ?> ><?php echo $item->it_title; ?></option>
<?php } ?>
</select>
</div>
</div>
<textarea class="form-control" rows="6" id="ir_urls" name="ir_urls" placeholder="备选URL列表和随机范围URL列表每行一个"><?php echo $infoRecommend->ir_urls; ?></textarea>
<input type="hidden" name="ir_id" id="ir_id" value="<?php echo $infoRecommend->ir_id; ?>" />
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary" onclick="submitForm('bind_info_form');">保存</button>
</div>

@ -1,56 +0,0 @@
<h1>请修改图片尺寸/ 改完请删除此标题 </h1>
<h3>文中tour广告代码</h3>
<div class="info_ad"><a href="/japan/tours/classic-japan" rel="nofollow" id="infopage-"><img alt="11-Day Classic Japan Tour" class="img-responsive" src="https://data.asiahighlights.com/image/travel-guide/japan/shirakawa-go-village.jpg" /> </a>
<div class="info_ad_content">
<div class="info_ad_name"><a href="/japan/tours/classic-japan" id="infopage-"><strong>11-Day Classic Japan Tour</strong> Tokyo - Takayama - Shirakawa - Kanazawa - Kyoto </a></div>
<div class="info_ad_button"><a href="/japan/tours/classic-japan" rel="nofollow" id="infopage-"><i aria-hidden="true" class="fa fa-angle-right"></i></a></div>
</div>
</div>
<h3>CH 完整的右侧广告代码:</h3>
<div class="expatstour" style="margin: 30px 0; width:auto;">
<div class="tour_img_title"><a href="/tour/zhangjiajietour/hun-3/" rel="nofollow"><img alt="most classic china tour" class="img-responsive" height="415" src="https://images.chinahighlights.com/allpicture/2015/03/e47d1ba34f204510962a6c89_cut_600x550_251.jpg" width="600" /><span class="citytourname">Classic Wonders</span></a></div>
<div class="tourdetailinfo"><span class="expatstourname"><a href="/tour/zhangjiajietour/hun-3/">11-Day Beijing Xi'an Guilin/Yangshuo Shanghai Tour</a></span>
<div class="tourbutton"><a href="/tour/zhangjiajietour/hun-3/" rel="nofollow">View More</a></div>
</div>
</div>
<h3>AH GH 线路卡片 代码:</h3>
<div class="ah_index_tour">
<a href="/india/tours/diwali-festival" rel="nofollow"><img alt="8-Day Diwali Festival in India Golden Triangle Tour 2024" class="img-responsive" src="https://images.asiahighlights.com/allpicture/2020/01/1ce7cfa94db040dcaa147143_cut_2560x800_296.jpg" ><img alt="" class="img-responsive tour_list_map" src="https://data.asiahighlights.com/image/tour/india/map/ah-in-70-map.jpg"></a>
<div class="ah_index_tour_bg">
<h3><a href="/india/tours/diwali-festival">8-Day Diwali Festival in India Golden Triangle Tour 2024</a></h3>
<div class="tour_list_subtitle">Discover Colorful India during the Diwali Festival</div>
<div class="ah_index_tour_button">
<div class="tour_list_price"><strong>Private tour from:</strong> US$1,719</div>
<a href="/india/tours/diwali-festival" rel="nofollow">View More </a></div>
</div>
</div>
<h3>CH 线路卡片 代码:</h3>
<div class="expatstour">
<div class="tour_img_title"><a href="/tour/cht-ft-02/" rel="nofollow"><img alt="China family travel" class="img-responsive" src="https://images.chinahighlights.com/allpicture/2021/10/5405ded6c1a642e8a04f1b45_cut_600x550_251.jpg" ><span class="citytourname">Family Happiness</span></a></div>
<div class="tourdetailinfo"><span class="expatstourname"><a href="/tour/cht-ft-02/" rel="nofollow">11-Day Beijing - Xi'an - Guilin - Shanghai Family Tour</a></span>
<ul class="infolist">
<li>Top <strong>family itinerary</strong></li>
<li>Experience China's countryside life together</li>
</ul>
<div class="tourbutton"><a href="/tour/cht-ft-02/" rel="nofollow">View More</a></div>
</div>
</div>

@ -1,90 +0,0 @@
<script type="text/javascript" src="/wysiwyg/ckeditor.js"></script>
<script language="javascript">
var editor;
window.onload = function () {
editor = CKEDITOR.replace("it_content", {
width: '100%',
height: '560px',
readOnly: false,
filebrowserBrowseUrl: '/wysiwyg/ckfinder/ckfinder.php?sitecode=ch',
filebrowserUploadUrl: '/wysiwyg/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=image',
contentsCss: 'https://proxy-data.chinahighlights.com/css/mobile-first.css'
});
};
$(function () {
$("#it_expires").datepicker({
showButtonPanel: true,
changeMonth:true,
changeYear:true
});
})
</script>
<div class="container-fluid">
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-16">
<form action="<?php echo site_url('thirdparty/recommend/tips/save') ?>"
method="post" id="tips_info_form" name="tips_info_form">
<div class="row">
<div class="col-md-10">
<div class="form-group">
<label for="it_title" ">广告标题</label>
<input type="text" class="form-control" id="it_title" name="it_title"
value="<?php echo $infoTip->it_title; ?>">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="it_title" ">广告代码</label>
<input type="text" class="form-control" id="it_code" name="it_code" readonly
value="<!--@TIPS-<?php echo strtoupper($infoTip->it_sitecode).'-'.$infoTip->it_id; ?>@-->">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="it_expires">过期时间</label>
<input type="text" class="form-control flatpickrEnable" id="it_expires" name="it_expires"
value="<?php echo date('m/d/Y', $infoTip->it_expires); ?>">
</div>
</div>
<div class="col-md-20">
<textarea class="form-control" rows="6" id="it_content" name="it_content"
placeholder="广告内容"><?php echo $infoTip->it_content; ?></textarea>
</div>
<div class="col-md-20">
<br/>
<a href="<?php echo site_url('thirdparty/recommend/tips/delete/' . $infoTip->it_id) ?>"
class="btn btn-danger pull-left">删除</a>
<button type="button" class="btn btn-primary pull-right"
onclick="editor.updateElement();submitForm('tips_info_form');">保存
</button>
</div>
</div>
<input type="hidden" name="it_id" id="it_id" value="<?php echo $infoTip->it_id; ?>"/>
</form>
</div>
<div class="col-md-4">
</div>
</div>
</div>
<br/>

@ -1,97 +0,0 @@
<div class="container-fluid">
<div class="row">
<div class="col-md-1">
</div>
<div class="col-md-9">
<h4>广告管理 <small><a href="<?php echo site_url('thirdparty/recommend/tips/add'); ?>">添加广告</a></small></h4>
<form id="searchForm" method="post" action="<?php echo site_url('thirdparty/recommend/index/search'); ?>" class="navbar-form navbar-left">
<div class="input-group">
<input type="text" class="form-control input-sm" name="keywords" id="keywords" value="<?php if (!empty($lastKeyword)) {echo $lastKeyword;} ?>" style="min-width:450px;">
<input type="hidden" name="byWhat" id="byWhatInput" >
</div>
<span class="input-group-btn">
<button class="btn btn-default btn-sm" id="searchByTitleBtn" type="button">搜索标题</button>
<button class="btn btn-default btn-sm" id="searchByLabelBtn" type="button">搜索标签</button>
<button class="btn btn-default btn-sm" id="searchByContentBtn" type="button">搜索内容</button>
</span>
</form>
<script>
var searchForm = document.getElementById('searchForm');
var searchByTitleBtn = document.getElementById('searchByTitleBtn');
var searchByLabelBtn = document.getElementById('searchByLabelBtn');
var searchByContentBtn = document.getElementById('searchByContentBtn');
var byWhatInput = document.getElementById('byWhatInput');
function submitSearch(byWhat) {
byWhatInput.value = byWhat;
searchForm.submit();
}
searchByTitleBtn.addEventListener('click', function(event) {
submitSearch('byTitle');
});
searchByLabelBtn.addEventListener('click', function(event) {
submitSearch('byLabel');
});
searchByContentBtn.addEventListener('click', function(event) {
submitSearch('byContent');
});
</script>
<table class="table table-striped">
<thead>
<tr>
<th class="col-md-2">#</th>
<th class="col-md-9">标题</th>
<th class="col-md-9">标签</th>
<th class="col-md-4">过期时间</th>
</tr>
</thead>
<tbody>
<?php foreach ($tipsList as $key=>$item){ ?>
<tr class="<?php if($item->it_expires<time()){echo 'danger';} ?>">
<td><?php echo ++$key; ?></td>
<td>
<a href="<?php echo site_url('thirdparty/recommend/tips/edit/'.$item->it_id); ?>"><?php echo $item->it_title; ?></a>
</td>
<td><?php echo htmlspecialchars($item->it_code); ?></td>
<td><?php echo date('m/d/Y', $item->it_expires); ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="col-md-14">
<h4>广告和信息推荐绑定设置</h4>
<?php foreach ($groupList as $item) {
if ($item->is_level == 0) { ?>
<div class="row">
<div class="col-md-24">
<div class="panel panel-default">
<div class="panel-heading"><a
href="<?php echo site_url('thirdparty/recommend/index/bind/' . $item->is_id) ?>"> <?php echo $item->ic_title; ?></a>
</div>
<div class="panel-body">
<ul class="list-inline">
<?php if ($item->is_level == 0) {
foreach ($groupList as $item_child) {
if ($item_child->is_parent_id == $item->is_id) {
echo ' <li><a href="' . site_url('thirdparty/recommend/index/bind/' . $item_child->is_id) . '">' . $item_child->ic_url_title . '</a></li> ';
}
}
} ?>
</ul>
</div>
</div>
</div>
</div>
<?php }
} ?>
</div>
</div>
</div>

@ -218,7 +218,7 @@ class TpBokun_model extends CI_Model
,[PAG_PPI_SN]
)
VALUES
( ?,?,?,?,GETDATE(),?,?,?)
( ?,?,?,GETDATE(),?,?,?)
";
$query = $this->HT229Write->query($sql, array(
@ -351,8 +351,7 @@ class TpBokun_model extends CI_Model
*/
function checkExitHT($PAG_Code)
{
// $sql = "select top 1 * from BIZ_PackageInfo where PAG_Code = ? and isnull(DeleteFlag,0)<>1 ";
$sql = "select top 1 * from BIZ_PackageInfo where PAG_Code = ? "; //删除的也判断
$sql = "select top 1 * from BIZ_PackageInfo where PAG_Code = ? and isnull(DeleteFlag,0)<>1 ";
$query = $this->HT229Write->query($sql, array($PAG_Code));
if ($query->num_rows() > 0) {
$result = true;

@ -52,7 +52,7 @@ class search extends CI_Controller{
//我们的接口相应时间
$responsive_time = $end_time - $this->start_time;
//log_message('error','TRAINSPEED|请求url:'.$this->url.'|聚合相应时间:'.$api_responsive_time.'s|接口运行时间:'.$responsive_time.'s|缓存:'.$this->cache.'|+7天:'.$this->seveth);
log_message('error','TRAINSPEED|请求url:'.$this->url.'|聚合相应时间:'.$api_responsive_time.'s|接口运行时间:'.$responsive_time.'s|缓存:'.$this->cache.'|+7天:'.$this->seveth);
print_r($trainjson);
}
@ -354,8 +354,6 @@ class search extends CI_Controller{
print_r(json_encode($obj));
}
//获取国际火车出发规则
public function get_station_rules(){
@ -427,12 +425,6 @@ class search extends CI_Controller{
header('Content-type: application/json');
print_r(json_encode($return_json));
}
/**获取价格信息 */
public function get_priceinfo($train_no){
$obj = $this->BIZ_intel_train_model->get_priceinfo($train_no);
print_r(json_encode($obj));
}
//获取价格(废弃)
@ -686,8 +678,6 @@ class search extends CI_Controller{
// echo $this->RUB_Rate . '<br/>';
return $this->USD_Rate;
}
}

@ -1,292 +0,0 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class searchnew extends CI_Controller{
public function __construct(){
parent::__construct();
$this->load->model("BIZ_train_model");//加载模型
}
//查询聚合余票接口,对返回的数据进行处理
public function index($train_date=null,$fromStation=null,$toStation=null){
//定义一些变量
$cache = 'no';
$flag = true;
$juheTrainInfo = '';
set_time_limit(0);
//判断数据是否合法
if(!$train_date || !$fromStation || !$toStation){
exit('传参不能为空!');
}else{
if(strlen($fromStation) != 3){
exit('fromStation:参数错误!');
}
if(strlen($toStation) != 3){
exit('toStation:参数错误!');
}
$this->train_date = $train_date;
$now_time = time();
$differ_time = (strtotime($train_date) - $now_time) / 86400;
if($differ_time <= 29){
//调用聚合搜索模块
$juheTrainInfo = $this->juheSearch($train_date,$fromStation,$toStation);
if(empty($juheTrainInfo)){
$flag = 'error';
}
}else{
$flag = 'cache';
}
//调用数据处理模块。
$returnJson = $this->dataOperate($juheTrainInfo,$flag,$fromStation,$toStation);
//调用拼接处理模块
$trainjson = $this->createTrainJson($returnJson);
print_r($trainjson);
die();
}
}
//搜索模块
function juheSearch($train_date,$fromStation,$toStation){
$url = 'http://139.129.246.118:12309/trainTickets/ticketsAvailable?key='.JUHE_TRAIN_API_KEY.'&train_date='.$train_date.'&from_station='.$fromStation.'&to_station='.$toStation;
$this->url = $url;
$juheTrainInfo = $this->get_http($url);
if($this->validateJuhe($juheTrainInfo)){
return $juheTrainInfo;
}else{
return null;
}
}
//缓存处理模块(包含缓存处理)
function dataOperate($trainInfo,$flag,$fromStation,$toStation){
if($flag == 'error'){
$research = $this->juheSearch($this->train_date,$fromStation,$toStation);
if($this->validateJuhe($research)){
$trainInfo = $research;
}else{
$flag = 'cache';
}
}
if($flag == 'cache'){
$cacheTrainInfo = $this->BIZ_train_model->get_train_info($fromStation,$toStation);
if(empty($cacheTrainInfo)){
return null;
}else{
$cache_time = $cacheTrainInfo->tpc_datetime;
$now_time = time();
$differ_time = ($now_time - strtotime($cache_time)) / 86400;
if($differ_time >= 7){
$this->delete_traincache($fromStation,$toStation);
$research = $this->juheSearch(strtotime('+7day'),$fromStation,$toStation);
if($this->validateJuhe($research)){
$trainInfo = $research;
}else{
return null;
}
}
}
}
$this->BIZ_train_model->addOrUpdate($fromStation,$toStation,$trainInfo);
return $trainInfo;
}
//字符串拼接模块
function createTrainJson($returnJson){
if(empty($returnJson)){
}else{
$return_data = new stdClass();
$return_data->data = new stdClass();
$return_data->httpstatus = 200;
//$return_data->reason = $reason;
//$return_data->cache = $cache;
$return_data->data->result = array();
$return_data->data->map = new stdClass();
$obj = array();
$i = 0;
$pricestr = '';
//print_r(json_decode($returnJson));
//die();
if(!empty(json_decode($returnJson)->result->list)){
foreach (json_decode($returnJson)->result->list as $value){
$obj[$value->from_station_code] = $value->from_station_name;
$obj[$value->to_station_code] = $value->to_station_name;
$seat_type = '';
if(isset($value->gjrw_price)){
if($value->gjrw_price > 0){
$gjrwPrice = $value->gjrw_price * 10;
$seat_type .= '"6":"'.$gjrwPrice.'","A6":"¥'.$value->gjrw_price.'",';
}
}
if(isset($value->qtxb_price)){
if($value->qtxb_price > 0){
$seat_type .= '"H":"¥'.$value->qtxb_price.'",';
}
}
if(isset($value->rw_price)){
if($value->rw_price > 0){
$rwPrice = $value->rw_price * 10;
$seat_type .= '"4":"'.$rwPrice.'","A4":"¥'.$value->rw_price.'",';
}
}
if(isset($value->rz_price)){
if($value->rz_price > 0){
$rzPrice = $value->rz_price * 10;
$seat_type .= '"2":"'.$rzPrice.'","A2":"¥'.$value->rz_price.'",';
}
}
if(isset($value->tdz_price)){
if($value->tdz_price > 0){
$seat_type .= '"P":"¥'.$value->tdz_price.'",';
}
}
if(isset($value->wz_price)){
if($value->wz_price > 0){
$wzPrice = $value->wz_price * 10;
$seat_type .= '"WZ":"¥'.$value->wz_price.'",';
}
}
if(isset($value->yw_price)){
if($value->yw_price > 0){
$ywPrice = $value->yw_price * 10;
$seat_type .= '"3":"'.$ywPrice.'","A3":"¥'.$value->yw_price.'",';
}
}
if(isset($value->yz_price)){
if($value->yz_price > 0){
$yzPrice = $value->yz_price * 10;
$seat_type .= '"1":"'.$yzPrice.'","A1":"¥'.$value->yz_price.'",';
}
}
if(isset($value->edz_price)){
if($value->edz_price > 0){
$seat_type .= '"O":"¥'.$value->edz_price.'",';
}
}
if(isset($value->ydz_price)){
if($value->ydz_price > 0){
$seat_type .= '"M":"¥'.$value->ydz_price.'",';
}
}
if(isset($value->swz_price)){
if($value->swz_price > 0){
$swzPrice = $value->swz_price * 10;
$seat_type .= '"9":"'.$swzPrice.'","A9":"¥'.$value->swz_price.'",';
}
}
if(isset($value->dw_price)){
if($value->dw_price > 0){
$seat_type .= '"F":"¥'.$value->dw_price.'",';
}
}
$pricestr = $seat_type.'"train_no":'.'"'.$value->train_no.'"';
//余票字符串
$return_data->data->result[$i] = '|预定|'.$value->train_no.'|'.$value->train_code.'|'.$value->from_station_name.'|'.$value->to_station_name.'|'.$value->from_station_code.'|'.$value->to_station_code.'|'.$value->start_time.'|'.$value->arrive_time.'|'.$value->run_time.'|'.$value->can_buy_now.'||'.$value->train_start_date.'||||||||'.$this->ticket_exchange($value->gjrw_num).'|'.$this->ticket_exchange($value->qtxb_num).'|'.$this->ticket_exchange($value->rw_num).'|'.$this->ticket_exchange($value->rz_num).'|'.$this->ticket_exchange($value->tdz_num).'|'.$this->ticket_exchange($value->wz_num).'||'.$this->ticket_exchange($value->yw_num).'|'.$this->ticket_exchange($value->yz_num).'|'.$this->ticket_exchange($value->edz_num).'|'.$this->ticket_exchange($value->ydz_num).'|'.$this->ticket_exchange($value->swz_num).'|'.$this->ticket_exchange($value->dw_num).'||';
$data = '{"validateMessagesShowId":"_validatorMessage","status":true,"httpstatus":200,"data":{'.$pricestr.'},"messages":[],"validateMessages":{}}';
$return_data->data->price[$i] = $data;
$i++;
}
}
$return_data->data->map = (object)$obj;
print_r($return_data);
}
}
//获取价格(废弃)
/*
fromStationCode出发站三字码
toStationCode:终点站三字码
trainCode:车次号
*/
public function get_price($fromStationCode=null,$toStationCode=null,$trainCode=null){
if(!$fromStationCode || !$toStationCode || !$trainCode){
exit('传参错误!');
}else{
$return_data = $this->BIZ_train_model->get_price($fromStationCode,$toStationCode,$trainCode);
if(!empty($return_data)){
print_r(json_decode($return_data->TPL_Price));
}else{
print_r('没有数据返回');
}
}
}
//验证聚合返回的信息是否正确
function validateJuhe($trainInfo){
if(!empty($trainInfo) && !empty(json_decode($trainInfo)->result)){
return true;
}else{
return false;
}
}
//余票转换
function ticket_exchange($num){
if(isset($this->cache)){
$time = strtotime($this->train_date) - time();
$day = $time / 86400;
if($day > 15){
return '有';
}else{
return $num;
}
}else{
if(is_numeric($num)){
if($num == 0){
return '无';
}elseif($num >= 99){
return '有';
}else{
return $num;
}
}else{
if($num == '--'){
return '';
}
}
}
}
//发送请求
function get_http($url, $data = '', $method = 'GET') {
$curl = curl_init(); // 启动一个CURL会话
curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
if ($method == 'POST' && !empty($data)) {
curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包
}
curl_setopt($curl, CURLOPT_TIMEOUT, 45); // 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
$tmpInfo = curl_exec($curl); // 执行操作
$errno = curl_errno($curl);
if ($errno !== 0) {
return false;
$error_message = $errno . ' ' . curl_error($curl); //记录错误日志
log_message('error', "third_party/train_app/index/get_http curl {$error_message}");
}
curl_close($curl); //关闭CURL会话
return $tmpInfo; //返回数据
}
}
?>

@ -120,11 +120,7 @@ class BIZ_intel_train_model extends CI_Model {
}
public function get_allstations(){
// $sql = "SELECT * FROM TrainStation_intel where station_id != 1";
//2022-4-20 zp 上面所有站点由于印度有8335个站点循环读取系统吃不消用下面的限制有车次的才显示。
$sql = "SELECT * FROM TrainStation_intel
inner join TrainSearch_intel on tsi_ToStation = station_id
where station_id <> 1";
$sql = "SELECT * FROM TrainStation_intel where station_id != 1";
$query = $this->HT->query($sql);
return $query->result();
}
@ -197,12 +193,4 @@ class BIZ_intel_train_model extends CI_Model {
$query = $this->HT->query($sql,array($station_id));
return $query->result();
}
//获取价格信息
function get_priceinfo($train_no){
$sql = "SELECT seatPriceInfo2 FROM trainPrice WHERE train_no = '{$train_no}'";
$query = $this->HT->query($sql);
return $query->row();
}
}

@ -19,21 +19,6 @@ define("DATAKEY","0dbf1652763c2289533e27437a971854");
//携程接口地址
define("JSONRETURN","http://m.ctrip.com/restapi/soa2/12976/json/");
//新携程接口顺途用的企业ID
define("COMPANYID","4003171843");
//新携程接口顺途用的Key
define("CTRIPKEY","hajkrtbc");
// //新携程接口顺途用的企业ID --- 测试用
// define("COMPANYID","1503141150");
// //新携程接口顺途用的Key ----- 测试用
// define("CTRIPKEY","hajkrtba");
//新携程接口(顺途)的地址
define("CTRIPURL","https://apiproxy.ctrip.com/apiproxy/soa2/19946");
//新携程接口(顺途)的订单号前缀
define("SHUNTU_ORDERUSER","HN");
//聚合火车订票API key
define("JUHE_TRAIN_API_KEY","79f03107b921ef31310bd40a1415c1cb");
@ -60,15 +45,6 @@ define("JUHE_TRAIN_EXPORT_API","http://op.juhe.cn/trainTickets/exportAccountChan
//http://op.juhe.cn/trainTickets/exportAccountChange?key=79f03107b921ef31310bd40a1415c1cb&since=2016-10-01 00:00&before=2016-10-30 00:00
// //澜海接口(测试)
// define("LANHAI_appId","3649601564");
// define("LANHAI_KEY","999c1DtJJ4pEbcxeEqJBKw==");
// define("LANHAI_URL","http://ctriptest.lhticket.com/");
//澜海接口(正式)
define("LANHAI_appId","9082253783");
define("LANHAI_KEY","YZ6yrAbv0Qn8CsZwHtZExA==");
define("LANHAI_URL","http://ctrip.lhticket.com/");
//订单状态说明
$config["train_order_status_msg"]=array(
@ -80,13 +56,10 @@ $config["train_order_status_msg"]=array(
"5"=>"出票失败",
"6"=>"线上退票处理中",
"7"=>"(改签)退票成功",
"8"=>"乘客退票失败",
"e"=>"数据错误,提交失败",
"8"=>"乘客退票失败",
"9"=>"改签成功",
"10"=>"退款(差价)",
"11"=>"订单退款",
"12"=>"订单取消"
);
"9"=>"改签成功"
);
//座次配对
$config["train_zw"]=array(
@ -101,8 +74,7 @@ $config["train_zw"]=array(
"1"=>"硬座",
"F"=>"动卧",
"YDW"=>"一等卧",
"EDW"=>"二等卧",
"WZ" =>"无座"
"EDW"=>"二等卧"
);
//数据库座次配对,包厢硬卧(5),无座(WZ),聚合没有
$config["db_train_zw"]=array(
@ -120,7 +92,6 @@ $config["db_train_zw"]=array(
"3"=>"3",
"2"=>"2",
"1"=>"1",
"13"=>"WZ",
"YDW"=>"YDW",
"EDW"=>"EDW"
);
@ -140,31 +111,6 @@ $config["train_passportty"]=array(
"C"=>"港澳通行证",
"G"=>"台湾通行证"
);
//顺途证件类型身份证传1、护照2、回乡证7、台胞证8、外国人永久居留身份证28、港澳台居民居住证32
$config["train_certificateType"]=array(
"2"=>"护照",
"1"=>"身份证",
"7"=>"回乡证",
"8"=>"台胞证",
"28"=>"外国人永久居留身份证2",
"32"=>"港澳台居民居住证"
);
/*退款类型
1差额退款原票出票及改签出票产生的儿童、卧铺差额、抢票差额退款。
推送时间接近与其对应的出票通知、改签通知同步推送
2核销退款退票退款改签后的原票退款 推送时间见下面说明
3异常退款人工操作的异常订单退款 ,人工审核后推送
5无票退款出票失败、改签失败产生的退款和购票失败通知几乎同步推送
*/
$config["train_refundType"]=array(
"1"=>"差额退款",
"2"=>"核销退款",
"3"=>"异常退款",
"5"=>"无票退款"
);
//黑名单用户
$config['black_list'] = array('209582910','539152642','506157109','E66735489','E66735492','E80377215','G23001338','E95287649','345276546','PA4286015','G09382769','G26113116','G25996274','572309763','506620366','505897939','E71156367','E21961674','v716898','561669436','EL657289','533300106','482225223','514815909','592108236','370682199509218814','130924199003161572','410728199011287038','372324199503253215','ED6234008','E69411908','EF1981503');

@ -39,7 +39,7 @@ class addorders extends CI_Controller{
}
}
//自动出票,2024-1-30改用新方法
//自动出票
public function auto_pay_ticket(){
//log_message('error','auto ticket');
date_default_timezone_set('Asia/Shanghai');
@ -165,146 +165,6 @@ class addorders extends CI_Controller{
}
print_r('<table border="1">'.$string.'</table>');
}
//自动出票2.0 2024-1-30 zp
public function auto_pay_ticket_2(){
date_default_timezone_set('Asia/Shanghai');
set_time_limit(180);
//筛选出能自动出票的订单
$auto_pool = $this->BIZ_train_model->auto_check_ticket_2();
// $DepartureDate = strtotime(date('Y-m-d',strtotime("2024-5-9"))); //只取日期部分
// $now = strtotime(date('Y-m-d'));
// $depart_diff = ($DepartureDate - $now) / 86400;
// $saletime = strtotime("17:00");
// $sale_diff = (time() - $saletime) / 3600;
//创建一个不允许自动出票的国际火车票数组
$nation_train = array('K19', 'K23', 'Z8701', 'Z8702', 'Z97', 'Z98', 'Z99', 'Z100', 'K9795','D87');
//创建黑名单
$black_list = $this->config->item('black_list');
$string = '';
foreach($auto_pool as $item){
$this->isauto = 1;
$bpe_sn = '';
$back_message = '';
$cold_sn = $item->COLD_SN;
$coli_id = $item->coli_id;
$auto_flag = 1;
$people_arr = $this->BIZ_train_model->biz_people($cold_sn);
$train_info = $this->BIZ_train_model->biz_order_detail($cold_sn);
//乘客人数大于10人不出票
if(count($people_arr) > 10){
$auto_flag = 0;
$back_message .= '-乘客人数大于10不自动出票';
}
//护照号如果在黑名单的就不自动出票
foreach($people_arr as $people_info){
if(in_array($people_info->BPE_Passport,$black_list)){
$auto_flag = 0;
$back_message .= '-此用户为黑名单用户,不自动出票';
}
if(strlen($people_info->BPE_Passport) >= 18){
$auto_flag = 0;
$back_message .= '-护照位数大于18不自动出票';
}
$bpe_sn .= $people_info->BPE_SN.',';
}
$bpe_sn = substr($bpe_sn,0,strlen($bpe_sn)-1);
//不是已付款状态的票价高于5000不出票以防意外
if($item->COLI_State != '8'){
if($train_info->adultcost > 5000){
$auto_flag = 0;
$back_message .= '-没支付单价大于5000不自动出票';
}
}
//如果为国际火车票就不出票
if(in_array($train_info->FlightsNo, $nation_train) || strlen($train_info->DepartAirport)>3 || strlen($train_info->ArrivalAirport)>3){
$auto_flag = 0;
$back_message .= '-国际火车票不自动出票';
}
//无座的订单不做出票
if($train_info->Aircraft == 'WZ'){
$auto_flag = 0;
$back_message .= '-无座不自动出票';
}
$DepartureDate = strtotime(date('Y-m-d',strtotime($train_info->DepartureDate))); //只取日期部分
$now = strtotime(date('Y-m-d'));
$depart_diff = ($DepartureDate - $now) / 86400;
//如果刚好是第15天的订单(12306的15天预售是算当天的所以时间差是14天)
if($depart_diff==14){
//$this->isauto = 1;
$time_obj = $this->BIZ_train_model->get_saletime($train_info->DepartAirport_cn);
//print_r($time_obj);
if(!empty($time_obj)){
$saletime = strtotime($time_obj->TST_saletime);
}else{
$saletime = strtotime("12:00"); //如果没有设置预售时间默认8点
}
//echo $saletime;
$sale_diff = (time() - $saletime) / 3600;
if($sale_diff > 12){
$auto_flag = 0;
$back_message .= '-超过抢票时间';
}else if($sale_diff <0){
$auto_flag = 0;
$back_message .= '-未到抢票时间';
}
//$time = strtotime(time());
// $autolasttime = $item->ts_autolasttime;
// if(($timestamp = strtotime($autolasttime)) !== false) {
// $time_diff = ($time - strtotime($autolasttime)) / 3600;
// if ($time_diff < 1){
// $auto_flag = 0;
// $back_message .= '-预售期每小时只能提交一次';
// }
// }
}
//只能3次抢票
if ($item->ts_autotimes > 3){
$auto_flag = 0;
$back_message .= '-抢票次数已到3次';
}
if($auto_flag == 0){
$string .= '<tr><td>汉特订单号:'.$coli_id.'('.$cold_sn.')'.$back_message.'</td></tr>';
if($depart_diff==14){
}else{
log_message('error','自动出票错误信息:'.'<table border="1">'.$string.'</table>');
}
}else{
//单个订单提交
//echo $cold_sn.'<br>';
log_message('error','自动出票提交:'.$coli_id.'('.$cold_sn.')');
$this->booktickets($cold_sn,$bpe_sn,'','ctrip'); //调用出票
//$string .= '<tr><td>汉特订单号:'.$coli_id.'('.$cold_sn.')可以自动出票</td></tr>';
}
}
print_r('<table border="1">'.$string.'</table>');
}
//创建一个方法用于接收所有的出票请求
public function booktickets($cold_sn=null,$bpe_sn=null,$selectseat=null,$type=null){
@ -344,7 +204,7 @@ class addorders extends CI_Controller{
$coli_id = $this->BIZ_train_model->cold_sn_get_coli_id($cold_sn)['0']->COLI_ID;
if(empty($this->BIZ_train_model->get_operatorInfo($coli_id))){
$data['email'] = 'vivi@hainatravel.com';
$data['email'] = 'jason@hainatravel.com';
}else{
$data['email'] = $this->BIZ_train_model->get_operatorInfo($coli_id)['0']->OPI_Email;
}
@ -372,19 +232,12 @@ class addorders extends CI_Controller{
return false;
}
if (count($data['people_list']) > 10) {
if (count($data['people_list']) > 5) {
//显示错误,用户超过五个
$reback["mes"]="乘客不能超过个";
$reback["mes"]="乘客不能超过个";
echo json_encode($reback);
return false;
}
// print_r(json_encode($data));
// echo("<hr/>");
// echo($selectseat);
// echo("<hr/>");
// echo($cold_sn);
// die();
switch ($type){
case 'juhe':
@ -396,9 +249,6 @@ class addorders extends CI_Controller{
case 'ctrip':
$this->ctripModel($data,$selectseat,$cold_sn);
break;
case 'lanhai':
$this->lanhaiModel($data,$selectseat,$cold_sn,$bpe_sn); //澜海多传用户SN列表
break;
}
}
@ -690,8 +540,8 @@ class addorders extends CI_Controller{
$reback["order"] = $orderId;
$reback["mes"] = "订单提交成功,等待回调";
}else{
// $reback["mes"] = $confirm_back_json;
// $add_data->status = "e";
$reback["mes"] = $confirm_back_json;
$add_data->status = "e";
}
//本地订单入库
@ -723,53 +573,37 @@ class addorders extends CI_Controller{
$zwcode = $this->db_train_zw[$data['train']->Aircraft]; //座位简码
$zwname = $this->train_zw[$this->db_train_zw[$data['train']->Aircraft]]; //座位名称
$microtime = get_microtime();
$OrderNumber = SHUNTU_ORDERUSER.$microtime; //自生成订单号
//生成接口请求头参数
$TimeStamp = date("Y-m-d H:i:s");
$serviceName = "train.addTrainOrder"; //每个接口都有自己名称
$companyId = COMPANYID;
$key = CTRIPKEY;
$strSign = $TimeStamp.$serviceName.$companyId.$key; //加密前的令牌
$Sign = md5($strSign);
$url = CTRIPURL."/addTrainOrder";
$OrderNumber = ORDERUSER.$microtime;
//拼接发送的报文
$PostData = new stdClass();
$PostData->authentication = new stdClass();
$PostData->authentication->timeStamp = $TimeStamp;
$PostData->authentication->serviceName = $serviceName;
$PostData->authentication->companyId = $companyId;
$PostData->authentication->messageIdentity = $Sign;
$PostData->trainOrderInfo = new stdClass();
$PostData->trainOrderInfo->companyId = $companyId;
$PostData->trainOrderInfo->orderType = 2;
$PostData->trainOrderInfo->orderTicketType = 0;
$PostData->trainOrderInfo->companyOrderId = $OrderNumber;
$PostData->trainOrderInfo->isReservationOrder = null;
$PostData->trainOrderInfo->leakCutOffTime = null;
$PostData->trainOrderInfo->orderInfo = new stdClass();
$PostData->trainOrderInfo->orderInfo->orderTime = $TimeStamp;
$PostData->trainOrderInfo->orderInfo->ticketList['0'] = new stdClass();
$PostData->trainOrderInfo->orderInfo->ticketList['0']->fromStationName = $data['train']->DepartAirport_cn;
$PostData->trainOrderInfo->orderInfo->ticketList['0']->toStationName = $data['train']->ArrivalAirport_cn;
$PostData->trainOrderInfo->orderInfo->ticketList['0']->ticketTime = date('Y-m-d H:i',strtotime($data['train']->DepartureTime));
$PostData->trainOrderInfo->orderInfo->ticketList['0']->trainNo = $data['train']->FlightsNo;
$PostData->trainOrderInfo->orderInfo->ticketList['0']->allAcceptTrainNo = ''; //备选车次,抢票时必传
$PostData->trainOrderInfo->orderInfo->ticketList['0']->acceptDepartDates = ''; //备选日期,抢票时必传
$PostData->trainOrderInfo->orderInfo->ticketList['0']->arrivalDateTime = date('Y-m-d H:i',strtotime($data['train']->ArrivalTime));
$PostData->trainOrderInfo->orderInfo->ticketList['0']->ticketPrice = $data['train']->adultcost;
$PostData->trainOrderInfo->orderInfo->ticketList['0']->seatName = $this->train_zw[$this->db_train_zw[$data['train']->Aircraft]];
$PostData->trainOrderInfo->orderInfo->ticketList['0']->selectedSeat = $selectseat;
$is_accept_standing = '';
if($this->istanding == 'true'){
$is_accept_standing = '无座';
}
$PostData->trainOrderInfo->orderInfo->ticketList['0']->acceptSeat = $is_accept_standing;
$PostData = array();
$time = date('Y-m-d H:i:s',time());
$PostData['Authentication'] = new stdClass();
$PostData['Authentication']->TimeStamp = $time;
$PostData['Authentication']->ServiceName = 'order.PartnerAddOrder';
$PostData['Authentication']->PartnerName = ORDERUSER;
$MessageIdentity = md5($time.'order.PartnerAddOrder'.ORDERKEY);
$PostData['Authentication']->MessageIdentity = $MessageIdentity;
$PostData['TrainOrderService'] = new stdClass();
$PostData['TrainOrderService']->PartnerName = ORDERUSER;
$PostData['TrainOrderService']->Operation = 'add';
$PostData['TrainOrderService']->OrderType = '电子';
$PostData['TrainOrderService']->OrderTicketType = '0';
$PostData['TrainOrderService']->OrderNumber = $OrderNumber;
$PostData['TrainOrderService']->ChannelName = ORDERUSER;
$PostData['TrainOrderService']->Order = new stdClass();
$PostData['TrainOrderService']->Order->OrderTime = $time;
$PostData['TrainOrderService']->Order->OrderMedia = 'pc';
$PostData['TrainOrderService']->Order->TicketItem['0'] = new stdClass();
$PostData['TrainOrderService']->Order->TicketItem['0']->FromStationName = $data['train']->DepartAirport_cn;
$PostData['TrainOrderService']->Order->TicketItem['0']->ToStationName = $data['train']->ArrivalAirport_cn;
$PostData['TrainOrderService']->Order->TicketItem['0']->TicketTime = date('Y-m-d H:i:s',strtotime($data['train']->DepartureTime));
$PostData['TrainOrderService']->Order->TicketItem['0']->TrainNumber = $data['train']->FlightsNo;
$PostData['TrainOrderService']->Order->TicketItem['0']->ArrivalDateTime = date('Y-m-d H:i:s',strtotime($data['train']->ArrivalTime));
$PostData['TrainOrderService']->Order->TicketItem['0']->TicketPrice = $data['train']->adultcost;
$PostData['TrainOrderService']->Order->TicketItem['0']->TicketCount = count($data['people_list']);
$AdultNum = 0;
$ChildNum = 0;
@ -797,72 +631,51 @@ class addorders extends CI_Controller{
//证件类型
switch ($PassagerInfo->BPE_PassportType){
case 'Chinese ID':
$PassportTypeseId = 1;
$PassportTypeseId = "1";
$PassportTypeseidName = "二代身份证";
break;
case 'MainlandTravel Permit from Hong Kong and Macau':
$PassportTypeseId = 7;
$PassportTypeseidName = "回乡证";
break;
case 'Travel Permit from Hong Kong / Macau':
$PassportTypeseId = 7;
$PassportTypeseidName = "回乡证";
$PassportTypeseidName = "港澳通行证";
break;
case 'Travel Permit from Taiwan':
$PassportTypeseId = 8;
$PassportTypeseId = "G";
$PassportTypeseidName = "台湾通行证";
break;
default :
$PassportTypeseId = 2;
$PassportTypeseId = "B";
$PassportTypeseidName = "护照";
break;
}
$passagersdata[$i] = new stdClass();
$passagersdata[$i]->passengerType = $PiaoType;
$passagersdata[$i]->certificateType = $PassportTypeseId;
$passagersdata[$i]->certificateNo = des_encrypt($PassagerInfo->BPE_Passport,$key);;
$passagersdata[$i]->certificateName = chk_sp_name($PassagerInfo->BPE_FirstName.$PassagerInfo->BPE_MiddleName.$PassagerInfo->BPE_LastName);
$passagersdata[$i]->birthday =date('Y-m-d',strtotime($PassagerInfo->BPE_BirthDate));
$passagersdata[$i]->realName = chk_sp_name($PassagerInfo->BPE_FirstName.$PassagerInfo->BPE_MiddleName.$PassagerInfo->BPE_LastName);
$passagersdata[$i]->identityLimitDate = date('Y-m-d',strtotime($PassagerInfo->BPE_PassExpdate));
$passagersdata[$i]->countryCode = "";
$passagersdata[$i]->contactMobile = "";
$passagersdata[$i]->contactEmail = "";
if (!empty($PassagerInfo->BPE_Nationality)){
$regionCode = $PassagerInfo->BPE_Nationality;
if ($regionCode =="TW" || $regionCode=="HK" || $regionCode=="MO"){
$passagersdata[$i]->regionCode = "CN";
}
else if ($regionCode=="UK" || $regionCode=="GB"){
$passagersdata[$i]->regionCode = "GB"; //英国传GB
}else{
$passagersdata[$i]->regionCode = $regionCode; //国家简码 美国us ,中国cn
}
}
$passagersdata[$i]->PassengerType = $PiaoTypeName;
$passagersdata[$i]->PassportType = $PassportTypeseidName;
$passagersdata[$i]->PassportNumber = $PassagerInfo->BPE_Passport;
$passagersdata[$i]->PassportName = chk_sp_name($PassagerInfo->BPE_FirstName.$PassagerInfo->BPE_MiddleName.$PassagerInfo->BPE_LastName);
$passagersdata[$i]->RealName = chk_sp_name($PassagerInfo->BPE_FirstName.$PassagerInfo->BPE_MiddleName.$PassagerInfo->BPE_LastName);
$passagersdata[$i]->ContactEmail = $data['email'];
$i++;
}
$PostData['TrainOrderService']->Order->TicketItem['0']->AuditTicketCount = $AdultNum;
$PostData['TrainOrderService']->Order->TicketItem['0']->ChildTicketCount = $ChildNum;
$PostData['TrainOrderService']->Order->TicketItem['0']->SeatName = $this->train_zw[$this->db_train_zw[$data['train']->Aircraft]];
$PostData['TrainOrderService']->Order->TicketItem['0']->SelectedSeat = $selectseat;
$is_accept_standing = '';
if($this->istanding == 'true'){
$is_accept_standing = '无座';
}
$PostData['TrainOrderService']->Order->TicketItem['0']->AcceptSeat = $is_accept_standing;
//乘客人信息
$PostData->trainOrderInfo->orderInfo->ticketList['0']->passengerList = $passagersdata;
$PostData->trainOrderInfo->orderInfo->frontSeatFlag = 0;
$PostData->trainOrderInfo->orderInfo->orderRemark = "";
$PostData['TrainOrderService']->Order->TicketItem['0']->Passengers = $passagersdata;
$PostData['TrainOrderService']->Order->TicketItem['0']->OrderPrice = $data['train']->adultcost * $AdultNum + $data['train']->childcost * $ChildNum;
$PostData->trainOrderInfo->contactUser = new stdClass();
$PostData->trainOrderInfo->contactUser->contactUserId = '';
$PostData->trainOrderInfo->contactUser->contactName = 'vivi';
$PostData->trainOrderInfo->contactUser->companyId = $companyId;
$PostData->trainOrderInfo->contactUser->countryCode = "86";
$PostData->trainOrderInfo->contactUser->contactMobile = des_encrypt('18877331805',$key) ;
$PostData->trainOrderInfo->extraService = new stdClass();
$PostData->trainOrderInfo->extraService->noVerifyFlag = 1;
$PostData->trainOrderInfo->extraService->lowerBerthFlag = 0;
$PostData->trainOrderInfo->extraService->lowerBerthCount = 0;
$PostData->trainOrderInfo->extraService->grabTicketRate = 1;
$PostData['TrainOrderService']->User = new stdClass();
$PostData['TrainOrderService']->User->UserID = '';
$PostData['TrainOrderService']->User->UserName = 'guilintravel';
$PostData['TrainOrderService']->User->userLoginName = 'guilintravel';
$PostData['TrainOrderService']->User->UserMobile = '18877381547';
//本地添加记录
$add_data = new stdClass();
@ -881,63 +694,27 @@ class addorders extends CI_Controller{
$add_data->endtime = date('H:i',strtotime($data['train']->ArrivalTime));
$add_data->runtime = (strtotime($data['train']->ArrivalTime) - strtotime($data['train']->DepartureTime)) / 60;
$add_data->channel = 'ctrip';
$add_data->isauto = $this->isauto;
//出票次数
$countAuto = $this->train_system_model->get_autotimes($cold_sn);
$add_data->ts_autotimes = $countAuto->countauto + 1; //出票次数+1
$add_data->lanhaiData = ""; //途牛默认澜海数据为空
//存储到数据库
$this->train_system_model->add_orders($add_data);
$add_data->isauto = $this->isauto;
// print_r(json_encode($PostData));
// die();
$ResponseJson = GetPost_http($url,json_encode($PostData,JSON_UNESCAPED_UNICODE),'json');
//存储到数据库
$this->train_system_model->add_orders($add_data);
$Url = 'http://apiproxy.ctrip.com/apiproxy/soa2/13680/PartnerAddOrder';
$ResponseJson = GetPost_http($Url,json_encode($PostData),'json');
$ResponseData = json_decode($ResponseJson);
// print_r(json_encode($PostData));
// die();
//预定请求成功后执行支付
if($ResponseData->returnCode == 1){
//直接获取返回的需要支付的总价,不再计算订单总价
//$total_price = $AdultNum * $data['train']->adultcost + $ChildNum * $data['train']->childcost;
$total_price = $ResponseData->returnData->orderPayDetail->orderAmount;
if ($total_price>0){
log_message('error','下单成功返回信息:'.$ResponseJson);
//执行支付
$this->payorders($OrderNumber,$total_price);
$reback["status"] = 1;
$reback["order"] = $OrderNumber;
$reback["mes"] = "订单提交成功,等待回调";
}else{
$reback["status"] = 1;
$reback["returndata"] = $ResponseData;
$reback["mes"] = "订单提交成功,但是返回的订单总价错误。无法完成支付";
}
if($ResponseData->Status == 'SUCCESS'){
//计算订单总价,进行支付
$total_price = $AdultNum * $data['train']->adultcost + $ChildNum * $data['train']->childcost;
$this->payorders($OrderNumber,$total_price);
$reback["status"] = 1;
$reback["order"] = $OrderNumber;
$reback["mes"] = "订单提交成功,等待回调";
}else{
//log_message('error','下单失败提交数据记录:'.json_encode($PostData,JSON_UNESCAPED_UNICODE));
$reback["mes"] = $ResponseJson;
$add_data->status = "e";
//更新订单
$msgData = new stdClass();
$msgData->bookcallback = $ResponseJson;
$msgData->OrderStatus = "1";
$msgData->ErrorMsg = $ResponseData->returnMessage;
$msgData->ordernumber = $OrderNumber;
$msgData->addOrderData = json_encode($PostData,JSON_UNESCAPED_UNICODE); //失败了记录提交的订单数据
$this->train_system_model->update_orders_msg($msgData);
}
echo json_encode($reback,JSON_UNESCAPED_UNICODE);
echo json_encode($reback);
}
//请求支付
@ -945,205 +722,32 @@ class addorders extends CI_Controller{
if(empty($CtripOrder) && !is_numeric($Price)){
exit('传参错误!');
}
//生成接口请求头参数
$TimeStamp = date("Y-m-d H:i:s");
$serviceName = "train.companyPayOrder"; //每个接口都有自己名称
$companyId = COMPANYID;
$key = CTRIPKEY;
// /** 测试服务器 */
// $companyId = "1503141150";
// $key = "hajkrtba";
$strSign = $TimeStamp.$serviceName.$companyId.$key; //加密前的令牌
$Sign = md5($strSign);
$url = CTRIPURL."/companyPayOrder";
//生成报文
$PostData = new stdClass();
$PostData->authentication = new stdClass();
$PostData->authentication->timeStamp = $TimeStamp;
$PostData->authentication->serviceName = $serviceName;
$PostData->authentication->companyId = $companyId;
$PostData->authentication->messageIdentity = $Sign;
$PostData->orderPayInfo= new stdClass();
$PostData->orderPayInfo->companyId = $companyId;
$PostData->orderPayInfo->companyOrderId = $CtripOrder;
$PostData->orderPayInfo->payedPrice = $Price;
$PostData->orderPayInfo->payTime = $TimeStamp;
$PostData->orderPayInfo->tradeNumber = $CtripOrder;
//$Url = 'http://apiproxy.ctrip.com/apiproxy/soa2/13680/PartnerPayOrder';
// print_r(json_encode($PostData) );
// die();
$ResponseJson = GetPost_http($url,json_encode($PostData),'json');
//生成报文
$PostData = array();
$TimeStamp = time();
$time = date('Y-m-d H:i:s',$TimeStamp);
$PostData['Authentication'] = new stdClass();
$PostData['Authentication']->TimeStamp = $time;
$PostData['Authentication']->ServiceName = 'order.PartnerPayOrder';
$PostData['Authentication']->PartnerName = ORDERUSER;
$MessageIdentity = md5($time.'order.PartnerPayOrder'.ORDERKEY);
$PostData['Authentication']->MessageIdentity = $MessageIdentity;
$PostData['TrainOrderService'] = new stdClass();
$PostData['TrainOrderService']->PartnerName = ORDERUSER;
$PostData['TrainOrderService']->OrderNumber = $CtripOrder;
$PostData['TrainOrderService']->PayedPrice = $Price;
$PostData['TrainOrderService']->PayTime = $time;
$PostData['TrainOrderService']->TradeNumber = $CtripOrder;
$Url = 'http://apiproxy.ctrip.com/apiproxy/soa2/13680/PartnerPayOrder';
$ResponseJson = GetPost_http($Url,json_encode($PostData),'json');
$ResponseData = json_decode($ResponseJson);
$msgData = new stdClass();
$msgData-> bookcallback = $ResponseJson;
$msgData->ordernumber = $CtripOrder;
if ($ResponseData->returnCode==1){
$msgData->OrderStatus = "3";
$msgData->ErrorMsg = $ResponseData->returnMessage;
}else{
$msgData->OrderStatus = "1";
$msgData->ErrorMsg = $ResponseData->returnMessage;
}
//更新订单
$this->train_system_model->update_orders_msg($msgData);
// $reback["mes"] = $ResponseJson;
// print_r(json_encode($reback,JSON_UNESCAPED_UNICODE)) ;
//echo '支付';
//print_r($ResponseData);
//支付同步回调信息 {"Status":"SUCCESS","PartnerName":"guilintravel","OrderNumber":"guilintravel1546071576","OperationDateTime":"2018-12-29 16:19:37","RetCode":0,"ResponseStatus":{"Timestamp":"\/Date(1546071577236+0800)\/","Ack":"Success","Errors":[],"Extension":[]}}
}
//澜海请求出票
function lanhaiModel($data,$selectseat,$cold_sn,$bpe_sn){
$microtime = get_microtime();
$OrderNumber = SHUNTU_ORDERUSER.$microtime; //自生成订单号
//生成接口请求头参数
$mainOrderId = $OrderNumber;
$timestamp = $microtime;
$appId = LANHAI_appId;
$url = LANHAI_URL."api/open/push/order";
//拼接发送的报文
$PostData = new stdClass();
$PostData->mainOrderId = $mainOrderId;
$PostData->timestamp = $timestamp;
$PostData->appId = $appId;
//本地添加记录
$add_data = new stdClass();
$add_data->cold_sn = $cold_sn;
$add_data->ordernumber = $OrderNumber;
$add_data->returncode = '';
$add_data->status = '2';
$add_data->errormsg = '预定中';
$add_data->checi = $data['train']->FlightsNo;
$add_data->fromstationame = $data['train']->DepartAirport_cn;
$add_data->fromstationcode = $data['train']->DepartAirport;
$add_data->tostationame = $data['train']->ArrivalAirport_cn;
$add_data->tostationcode = $data['train']->ArrivalAirport;
$add_data->startdate = date('Y-m-d',strtotime($data['train']->DepartureDate));
$add_data->startime = date('H:i',strtotime($data['train']->DepartureTime));
$add_data->endtime = date('H:i',strtotime($data['train']->ArrivalTime));
$add_data->runtime = (strtotime($data['train']->ArrivalTime) - strtotime($data['train']->DepartureTime)) / 60;
$add_data->channel = 'lanhai';
$add_data->isauto = $this->isauto;
//出票次数
$countAuto = $this->train_system_model->get_autotimes($cold_sn);
$add_data->ts_autotimes = $countAuto->countauto + 1; //出票次数+1
//澜海数据
$lanhaiData = new stdClass();
$lanhaiData->selectseat = $selectseat;
$lanhaiData->bpe_sn = $bpe_sn;
$add_data->lanhaiData = json_encode($lanhaiData,JSON_UNESCAPED_UNICODE);
//存储到数据库
$this->train_system_model->add_orders($add_data);
//print_r(json_encode($PostData));
//die();
$ResponseJson = GetPost_http($url,json_encode($PostData,JSON_UNESCAPED_UNICODE),'json');
$ResponseData = json_decode($ResponseJson);
// print_r($ResponseJson);
// die();
//预定请求成功后执行支付
if($ResponseData->code == 0 && $ResponseData->success){
$reback["status"] = 1;
$reback["order"] = $OrderNumber;
$reback["mes"] = "订单提交成功,请等待澜海出票。在出票信息返回之前,千万不要改动汉特里面的订单数据,以免照成出票数据和订单数据不一致!!!!!".$ResponseData->msg ;
}else{
$reback["status"] = 0;
$reback["order"] = $OrderNumber;
$reback["mes"] = "订单提交失败,".$ResponseData->msg."。订单发送数据:".json_encode($PostData) ;
$add_data->status = "e";
//更新订单
$msgData = new stdClass();
$msgData->bookcallback = $ResponseJson;
$msgData->OrderStatus = "1";
if (isset($ResponseData->returnMessage)){
$msg = $ResponseData->returnMessage;
}else{
$msg = "没有错误信息!";
}
$msgData->ErrorMsg = $msg;
$msgData->ordernumber = $OrderNumber;
$msgData->addOrderData = json_encode($PostData,JSON_UNESCAPED_UNICODE); //失败了记录提交的订单数据
$this->train_system_model->update_orders_msg($msgData);
}
echo json_encode($reback,JSON_UNESCAPED_UNICODE);
}
}
//订单提交返回数据
/*
{
"returnCode": 1,
"returnMessage": "SUCCESS",
"returnData": {
"serviceName": "train.addTrainOrder",
"companyId": "1503141150",
"companyOrderId": "HN1681460139569",
"operationDateTime": "2023-04-14 16:15:56",
"orderPayDetail": {
"orderAmount": 12.00,
"ticketAmount": 6,
"serveAmount": 0,
"extraServeFees": [
{
"feeAmount": 6.00,
"feeType": 141
}
]
}
},
"ResponseStatus": {
"Timestamp": "/Date(1681460156763+0800)/",
"Ack": "Success",
"Errors": [],
"Build": null,
"Version": null,
"Extension": [
{
"Id": "CLOGGING_TRACE_ID",
"Version": null,
"ContentType": null,
"Value": "7715658886832531034"
},
{
"Id": "RootMessageId",
"Version": null,
"ContentType": null,
"Value": "100031671-0a6d18d7-467072-1571193"
}
]
}
}
*/
}

@ -413,115 +413,6 @@ class api extends CI_Controller{
}
}
//澜海账单导出api
public function lanhai_export_excel(){
set_time_limit(0);
//参数
$from_date = $this->input->post("from_date");
$to_date = $this->input->post("to_date");
$examine = $this->input->post("examine");
$importht = $this->input->post("importht");
$reback=array();//返回的数据
$reback["from_date"] = $from_date;
$reback["to_date"] = $to_date;
$reback["examine"] = $examine;
$reback["importht"] = $importht;
if(!empty($from_date) && !empty($to_date)){
//拼接发送的报文
$PostData = new stdClass();
$bodyInfo = new stdclass();
$bodyInfo->startTime = $from_date." 00:00:00";
$bodyInfo->endTime = $to_date." 23:59:59";
$bodyInfo->pageNum = 1;
$bodyInfo->pageSize = 20000;
$authentication = new stdClass(); //需加密的数据
$authentication->appId = LANHAI_appId;
//加密
$this->load->library("aesLanhai");
$aesUnit = new Security();
$resultData = $aesUnit->encryptData(json_encode($bodyInfo));
$PostData->bodyInfo = $resultData;
$PostData->authentication = $authentication;
//echo (json_encode($PostData));
$url = LANHAI_URL."api/open/bill";
$ResponseJson = GetPost_http($url,json_encode($PostData,JSON_UNESCAPED_UNICODE),'json');
$ResponseData = json_decode($ResponseJson);
if($ResponseData->code == 0 && $ResponseData->success){
$string_r = "";//输出
$arr = array();//整合完成的数组,写进excel表的数据
//账单导入到汉特。 先删除同一编码的数据,防止重复
if (!empty($importht)){
$BillSn = date('Ymd',strtotime($from_date)).date('Ymd',strtotime($to_date)); //这是获取开始结束日期作为编码,一定要和下面获取代码一样。
$this->BIZ_train_model->del_lanhai_bill($BillSn);
}
foreach ($ResponseData->data->records as $record) {
# code...
$arrRecord = array();
$arrRecord["saveDay"] = $record->saveDay;
$arrRecord["type"] = $record->type; //类型 包括:出票、低改高、出票退票、改签退票、退票
$arrRecord["mainOrderId"] = $record->mainOrderId; //订单号
$arrRecord["passengerName"] = $record->passengerName; //乘车人
$arrRecord["price"] = $record->price ;//金额,整数是支付票款,负数是退回金额
$arrRecord["wl"] = ""; //外联
$arrRecord["griName"]=""; //团号
$orderData = $this->train_system_model->get_OPIName($record->mainOrderId);
if (!empty($orderData)){
$arrRecord["wl"] = $orderData->OPIName;
$arrRecord["griName"] = $orderData->griName;
}
$arr[] = $arrRecord;
//账单导入到汉特。
if (!empty($importht)){
$AddHt_data = new stdClass(); //账单保存到汉特
$AddHt_data->BillSn = date('Ymd',strtotime($from_date)).date('Ymd',strtotime($to_date));
$AddHt_data->BillDate = $record->saveDay;
$AddHt_data->OrderId = $record->mainOrderId;
$AddHt_data->VEIName = LANHAI_appId;
$AddHt_data->From = "桂林海纳国际旅行社有限公司";
$AddHt_data->BillType = $record->type;
$AddHt_data->OrderType = null;
$AddHt_data->Cost = -($record->price);
$AddHt_data->Memo = $record->handleTime;
//入库
$this->BIZ_train_model->add_lanhai_bill($AddHt_data);
}
}
//print_r($arr);
if(empty($examine)){
//写入excel模板
header("Content-type:application/vnd.ms-excel;charset=utf-8");
header("Content-Disposition:attachment;filename=lanhai_train.xls");
$string_r= $this->load->view("lanhai_transaction_excel",array("arr"=>$arr),TRUE);
echo $string_r;die;
}else{
krsort($arr);//数组倒序
$reback["data"]=$arr;
$this->load->view('header');
$this->load->view('export_lanhai',$reback);
$this->load->view('footer');
}
}
}
}
//订单同步到trainsystem
public function sync_orders(){

@ -8,8 +8,6 @@ class callback extends CI_Controller{
$this->load->helper('train');
$this->load->model("train_system_model");
$this->load->model("BIZ_train_model");
$this->train_certificateType = $this->config->item('train_certificateType');
$this->train_refundType = $this->config->item('train_refundType');
}
public function juhecallback(){
@ -168,40 +166,17 @@ class callback extends CI_Controller{
$this->train_system_model->update_orders($update_data);
}
public function shuntucallback(){
public function ctripcallback(){
$back_json = file_get_contents('php://input');
log_message('error','携程顺途回调信息:'.$back_json);
log_message('error','携程回调信息:'.$back_json);
//$back_json = '{"@attributes":{"xsi":"http:\/\/www.w3.org\/2001\/XMLSchema-instance"},"Authentication":{"TimeStamp":"2019-11-13 10:31:00","ServiceName":"web.order.rescheduleResult","MessageIdentity":"31C01C2EC57C9B1D45C0727918B493AE","PartnerName":"tieyou"},"TrainOrderService":{"OrderInfo":{"OrderNumber":"guilintravel1573543590265","contactName":{},"contactMobile":{},"RescheduleTicketInfo":{"SubOrderId":"0","EOrderNumber":"EG59266341","ResFromStation":"\u6842\u6797","ResToStation":"\u6842\u6797\u5317","ResDepartTime":"2019-12-03 13:50:00","ResArriveTime":"2019-12-03 14:01:00","ResTrainNumber":"D2986","RescheduleTickets":{"RescheduleTicket":{"childBillId":{},"ResCarriageNo":"08","ResSeatNumber":"13F\u53f7","ResSeatName":"\u4e8c\u7b49\u5ea7","ResRealTicketPrice":"5.5","RescheduleLongTrainNum":"EG59266341208013F","eOrderType":"1","passport":"450302199208131039","passportName":"\u9648\u5b87\u8d85","realName":"\u9648\u5b87\u8d85","status":"1","ResFailReasons":{}}}}}}}';
$ctrip_backdata = json_decode($back_json);
// print_r($ctrip_backdata);
// die();
//print_r($ctrip_backdata);
if(!empty($ctrip_backdata)){
//判断回调信息是否正确,主要判断是否是本企业的回调信息
$TimeStamp = $ctrip_backdata->authentication->timeStamp;
$serviceName = $ctrip_backdata->authentication->serviceName; //每个接口都有自己名称
$companyId = COMPANYID;
$key = CTRIPKEY;
/** 测试服务器 */
$strSign = $TimeStamp.$serviceName.$companyId.$key; //加密前的令牌
$Sign = md5($strSign);
$messageIdentity = $ctrip_backdata->authentication->messageIdentity;
$ResultNoticeResponse = new stdClass();
if ($Sign == $messageIdentity){
$ResultNoticeResponse->returnCode = 1;
$ResultNoticeResponse->returnMsg = "success";
}else {
$ResultNoticeResponse->returnCode = 0;
$ResultNoticeResponse->returnMsg = "messageIdentity is error!";
}
echo json_encode($ResultNoticeResponse);
//处理回调的内容,保存到本地及翰特
$update_data = new stdClass();
$update_data->ServiceName = $ctrip_backdata->authentication->serviceName;
$update_data->ServiceName = $ctrip_backdata->Authentication->ServiceName;
$update_data->ordernumber = '';
$update_data->seatsinfo = '';
$update_data->TicketCheck = '';
@ -212,248 +187,168 @@ class callback extends CI_Controller{
$update_data->ElectronicOrderNumber = '';
$update_data->reschedulecallback = '';
$update_data->OrderTicketTime = '';
//新字段
$update_data->operateTradeNo ="";
if($update_data->ServiceName == 'notice.ticketresult'){
if ( $ctrip_backdata->ticketResult->resultCode == 1){
$update_data->OrderStatus = '4';
if (isset($ctrip_backdata->ticketResult->resultMsg)){
$update_data->ErrorMsg = $ctrip_backdata->ticketResult->resultMsg;
} else {
$update_data->ErrorMsg = '出票成功';
if($update_data->ServiceName == 'web.order.notifyTicket'){
$update_data->OrderStatus = '4';
$update_data->ErrorMsg = '出票成功';
$update_data->ordernumber = $ctrip_backdata->TrainOrderService->OrderInfo->OrderNumber;
$update_data->OrderTotleFee = $ctrip_backdata->TrainOrderService->OrderInfo->OrderTotleFee;
$update_data->ElectronicOrderNumber = $ctrip_backdata->TrainOrderService->OrderInfo->ElectronicOrderNumber;
$update_data->bookcallback = $back_json;
$update_data->OrderTicketTime = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfo->OrderTicketTime;
//新添加检票口信息
if(isset($ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->TicketCheck)){
if(!is_object($ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->TicketCheck)){
$update_data->TicketCheck = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->TicketCheck;
}
}
$person_num = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfo->AuditTicketCount + $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfo->ChildTicketCount;
//存储座位信息 转换为英文
$coach_arr = array();
$seats_arr = array();
$seatsinfo_arr = array();
$find = array('车厢','号','上铺','中铺','下铺');
$replace = array('coach','',' upper',' middle',' lower');
$seatsinfo = str_replace($find,$replace,$ctrip_backdata->TrainOrderService->OrderInfo->TicketInfo->SeatNumber);
$seatsinfo = mb_substr($seatsinfo,0,mb_strlen($seatsinfo,'UTF8')-1);
$seatsinfo_arr = explode(',',$seatsinfo);
foreach($seatsinfo_arr as $item){
$coach = mb_substr($item,0,strpos($item,'coach'));
array_push($coach_arr,$coach);
$seat = mb_substr($item,strpos($item,'coach')+5,mb_strlen($item,'UTF8'));
array_push($seats_arr,$seat);
}
$update_data->seatsinfo = '';
if(count(array_unique($coach_arr)) == 1){
$onlycoach = array_unique($coach_arr);
$update_data->seatsinfo .= 'Coach '.$onlycoach[0].',seat ';
foreach ($seats_arr as $seat_items){
$update_data->seatsinfo .= $seat_items .',';
}
}else{
$update_data->OrderStatus = '5';
if (isset($ctrip_backdata->ticketResult->resultMsg)){
$update_data->ErrorMsg = $ctrip_backdata->ticketResult->resultMsg;
}else{
$update_data->ErrorMsg = '出票失败';
for($i=0;$i<count($coach_arr);$i++){
if($i == 0){
$update_data->seatsinfo .= 'Coach '.$coach_arr[$i].',Seat '.$seats_arr[$i].',';
}else{
if($coach_arr[$i] == $coach_arr[$i-1]){
$update_data->seatsinfo .= $seats_arr[$i].',';
}else{
$update_data->seatsinfo .= 'Coach '.$coach_arr[$i].',Seat '.$seats_arr[$i].',';
}
}
}
}
$update_data->ordernumber = $ctrip_backdata->ticketResult->companyOrderId;
if (isset($ctrip_backdata->ticketResult->orderMasterInfo->totalPayAmount)){
$update_data->OrderTotleFee = $ctrip_backdata->ticketResult->orderMasterInfo->totalPayAmount; //总价
}
if (isset($ctrip_backdata->ticketResult->operateTradeNo)) {
$update_data->operateTradeNo = $ctrip_backdata->ticketResult->operateTradeNo; //操作流水号 如产生差额退款或者无票退款,退款通知里会有相同的操作流水号做对应。
}
$update_data->ticketresultcallback = $back_json;
//$update_data->OrderTicketTime = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfo->OrderTicketTime;
//新接口数据,不一定保存到数据库里面,原订单已有,做个记录
if (isset( $ctrip_backdata->ticketResult->ticketSuccTime)){
$update_data->ticketSuccTime = $ctrip_backdata->ticketResult->ticketSuccTime; //出票成功时间
}
$update_data->orderType = $ctrip_backdata->ticketResult->orderMasterInfo->orderType; //订单类型 0电子票 1配送票 2人工客票 3抢票订单
$update_data->contactName = $ctrip_backdata->ticketResult->orderMasterInfo->contactName; //联系人
$update_data->mobileNo = des_decrypt($ctrip_backdata->ticketResult->orderMasterInfo->mobileNo,$key); //联系电话 (DES加密
//人员及车票
$update_data->seatsinfo = substr($update_data->seatsinfo,0,strlen($update_data->seatsinfo)-1);
$data_passager = new stdClass();
foreach ( $ctrip_backdata->ticketResult->passengerInfoList as $pItems) {
$data_passager->ordernumber = $ctrip_backdata->ticketResult->companyOrderId;
//人员列表
if($person_num > 1){
//对订票乘客进行存储
$data_passager->status = '4';
$certificateType = $this->train_certificateType[ $pItems->certificateType]; //证件类型身份证传1、护照2、回乡证7、台胞证8、外国人永久居留身份证28、港澳台居民居住证32
$data_passager->identitytype = $certificateType;
$data_passager->realname = $pItems->certificateName;
$data_passager->numberid = des_decrypt($pItems->certificateNo,$key) ; //证件号码 (DES加密
$data_passager->birthday = $pItems->birthday;
if ($pItems->passengerType==2){
$passengerType = "儿童";
}else{
$passengerType = "成人";
}
$data_passager->ticketype = $passengerType; //乘客类型 1成人 2儿童
$passengerId = $pItems->passengerId;
foreach ( $ctrip_backdata->ticketResult->orderRouteInfoList as $rItems ){
//行程,目前我们都是单程提交,所以这里应该只有单程
$routeId = $rItems->routeId;
if (isset($rItems->elecNo)){
$elecNo = $rItems->elecNo; //电子订单号即12306取票号
$update_data->ElectronicOrderNumber = $elecNo ;
}
if (isset($rItems->checkWindow)){
$checkWindow = $rItems->checkWindow; //检票口
$update_data->TicketCheck = $checkWindow;
}
$data_passager->seatype = $rItems->ticketSeat;
$update_data->trainNo = $rItems->trainNo; //车次
$update_data->departTime = $rItems->departTime; //车次出发时间
$orderTicketInfoList = $ctrip_backdata->ticketResult->orderTicketInfoList ;
if (!empty($orderTicketInfoList)){
foreach ($orderTicketInfoList as $tItems) {
//对应的车票列表
if ($passengerId == $tItems->passengerId && $routeId==$tItems->routeId){
$data_passager->ticketprice = $tItems->realTicketPrice;
$SeatNo = "";
if (isset($tItems->carriageNo)){
$SeatNo.=$tItems->carriageNo."车厢";
}
if (isset($tItems->seatNo)){
$SeatNo.=$tItems->seatNo;
}
$data_passager->seatdetail = $SeatNo;
$data_passager->longtrainno = $tItems->longElecNo;
$data_passager->lanhaiData = ""; //对应澜海那边的数据,这边设置为空
//入库
$data_passager->ordernumber = $ctrip_backdata->TrainOrderService->OrderInfo->OrderNumber;
if(is_array($ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->Tickets->Ticket)){
foreach($ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->Tickets->Ticket as $tickets_item){
if(is_array($tickets_item->DetailInfos->DetailInfo)){
foreach($tickets_item->DetailInfos->DetailInfo as $ticket_item2){
$data_passager->realname = $ticket_item2->PassengerName;
$data_passager->identitytype = $ticket_item2->IdentityType;
$data_passager->numberid = $ticket_item2->NumberID;
$data_passager->ticketype = $tickets_item->TicketType;
$data_passager->ticketprice = $tickets_item->OrderTicketPrice;
$data_passager->seatype = $tickets_item->OrderTicketSeat;
$data_passager->seatdetail = $ticket_item2->SeatNo;
$data_passager->longtrainno = $ticket_item2->LongTrainNo;
$data_passager->TOC_VEI_SN = 28209;
$this->train_system_model->add_passagers($data_passager);
}
}else{
$data_passager->realname = $tickets_item->DetailInfos->DetailInfo->PassengerName;
$data_passager->identitytype = $tickets_item->DetailInfos->DetailInfo->IdentityType;
$data_passager->numberid = $tickets_item->DetailInfos->DetailInfo->NumberID;
$data_passager->ticketype = $tickets_item->TicketType;
$data_passager->ticketprice = $tickets_item->OrderTicketPrice;
$data_passager->seatype = $tickets_item->OrderTicketSeat;
$data_passager->seatdetail = $tickets_item->DetailInfos->DetailInfo->SeatNo;
$data_passager->longtrainno = $tickets_item->DetailInfos->DetailInfo->LongTrainNo;
$data_passager->TOC_VEI_SN = 28209;
$this->train_system_model->add_passagers($data_passager);
}
}
}else{
foreach($ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->Tickets->Ticket->DetailInfos->DetailInfo as $items){
//对订票乘客进行存储
$data_passager->status = '4';
$data_passager->ordernumber = $ctrip_backdata->TrainOrderService->OrderInfo->OrderNumber;
$data_passager->realname = $items->PassengerName;
$data_passager->identitytype = $items->IdentityType;
$data_passager->numberid = $items->NumberID;
$data_passager->ticketype = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->Tickets->Ticket->TicketType;
$data_passager->ticketprice = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->Tickets->Ticket->OrderTicketPrice;
$data_passager->seatype = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->Tickets->Ticket->OrderTicketSeat;
$data_passager->seatdetail = $items->SeatNo;
$data_passager->longtrainno = $items->LongTrainNo;
$data_passager->TOC_VEI_SN = 28209;
$this->train_system_model->add_passagers($data_passager);
}
}
}else{
//对订票乘客进行存储
$data_passager->status = '4';
$data_passager->ordernumber = $ctrip_backdata->TrainOrderService->OrderInfo->OrderNumber;
$data_passager->realname = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->Tickets->Ticket->DetailInfos->DetailInfo->PassengerName;
$data_passager->identitytype = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->Tickets->Ticket->DetailInfos->DetailInfo->IdentityType;
$data_passager->numberid = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->Tickets->Ticket->DetailInfos->DetailInfo->NumberID;
$data_passager->ticketype = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->Tickets->Ticket->TicketType;
$data_passager->ticketprice = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->Tickets->Ticket->OrderTicketPrice;
$data_passager->seatype = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->Tickets->Ticket->OrderTicketSeat;
$data_passager->seatdetail = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->Tickets->Ticket->DetailInfos->DetailInfo->SeatNo;
$data_passager->longtrainno = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->Tickets->Ticket->DetailInfos->DetailInfo->LongTrainNo;
$data_passager->TOC_VEI_SN = 28209;
$this->train_system_model->add_passagers($data_passager);
}
/****************************************************************************************/
//添加支付记录
$add_train_payment_data = new stdClass();
$add_train_payment_data->TOC_Memo = $update_data->ordernumber.'出票费';
$add_train_payment_data->TOC_VEI_SN = "28209";
//根据订单号获取cold_sn
$order_info = $this->train_system_model->get_order_info($update_data->ordernumber);
$cold_sn = $order_info->ts_cold_sn;
$add_train_payment_data->TOC_COLD_SN = $cold_sn;
$add_train_payment_data->TOC_TrainNumber = $update_data->trainNo;
$add_train_payment_data->TOC_DepartureDate = date('Y-m-d',strtotime($update_data->departTime ));
$add_train_payment_data->TOC_TrainNumber = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfo->OrderTicketCheci;
$add_train_payment_data->TOC_DepartureDate = date('Y-m-d',strtotime($ctrip_backdata->TrainOrderService->OrderInfo->TicketInfo->OrderTicketYMD));
$add_train_payment_data->TOC_TicketCost = $update_data->OrderTotleFee;
$add_train_payment_data->poundage = "0";
$add_train_payment_data->FOI_TrainNetOrderNo = $update_data->ElectronicOrderNumber; //电子票号
$add_train_payment_data->poundage = ($person_num*5)."";//手续费,每人五块,转换成字符串
$add_train_payment_data->FOI_TrainNetOrderNo = $update_data->ElectronicOrderNumber;
//print_r($add_train_order_data);die();
$this->BIZ_train_model->add_train_payment($add_train_payment_data);
//记录供应商(瀚特)
$this->BIZ_train_model->update_cold_planvei_sn($cold_sn,'28209');
}else if($update_data->ServiceName == 'notice.ordercancel'){ //订单取消
$update_data->ordernumber = $ctrip_backdata->cancelResult->companyOrderId;
$update_data->OrderStatus = '12';
$update_data->ErrorMsg = '订单取消'.$ctrip_backdata->cancelResult->cancelTime;
}else if($update_data->ServiceName == 'web.order.notifyNoTicket'){
$update_data->ordernumber = $ctrip_backdata->TrainOrderService->OrderInfo->OrderNumber;
$update_data->OrderStatus = '1';
$update_data->ErrorMsg = $ctrip_backdata->TrainOrderService->OrderInfo->NoTicketReasons;
$update_data->confirmcallback = $back_json;
}else if($update_data->ServiceName == 'notice.refundresult'){ //退款通知
$refundType = $ctrip_backdata->refundResult->refundType; //退款类型int
$reason = $ctrip_backdata->refundResult->reason; //退款原因
$refundTime = $ctrip_backdata->refundResult->refundTime; //退款时间
$return_money = $ctrip_backdata->refundResult->refundAmount; //退款金额
$update_data->ordernumber = $ctrip_backdata->refundResult->companyOrderId;
if ($refundType=="1"){
$update_data->OrderStatus = '10';
}else{
$update_data->OrderStatus = '11';
}
$update_data->ErrorMsg = '退款:'.$this->train_refundType[$refundType]." 金额:".$return_money." time:". $refundTime;
$update_data->refundcallback = $back_json;
//翰特添加退款记录
$refund_train_payment = new stdClass();
$return_order = $ctrip_backdata->refundResult->companyOrderId;
$refund_train_payment->TOC_VEI_SN = "28209";
//根据订单号获取cold_sn
$order_info = $this->train_system_model->get_order_info($return_order);
$cold_sn = $order_info->ts_cold_sn;
//print_r($order_info);
//获取longElecNo长电子订单号用来判断是否是多张票退款
$longElecNo="";
if (isset($ctrip_backdata->refundResult->refundDetailInfoList)){
$refundDetailInfoList = $ctrip_backdata->refundResult->refundDetailInfoList;
$longElecNo = $refundDetailInfoList[0]->longElecNo;
}
$memo = $return_order.'_'.$this->train_refundType[$refundType].'_长电子订单号:'. $longElecNo . '_' . $refundTime; //退款集合信息
$refund_train_payment->TOC_Memo = $memo;
$refund_train_payment->TOC_COLD_SN = $cold_sn;
$refund_train_payment->TOC_TrainNumber = $order_info->ts_checi;
$refund_train_payment->TOC_DepartureDate = $order_info->ts_startdate;
$refund_train_payment->TOC_TicketCost = -$return_money;
//print_r($add_train_payment_data);die();
$this->BIZ_train_model->refund_train_payment($refund_train_payment);
}else if($update_data->ServiceName == 'notice.returnresult'){ //退票
$update_data->ordernumber = $ctrip_backdata->returnResult->companyOrderId;
$resultCode = $ctrip_backdata->returnResult->resultCode;
$update_data->ErrorMsg = $ctrip_backdata->returnResult->resultMsg;
$longElecNo = $ctrip_backdata->returnResult->longElecNo;
$returnSuccTime = $ctrip_backdata->returnResult->returnSuccTime; //退票成功时间 yyyy-MM-dd hh:mm:ss
$printStatus = $ctrip_backdata->returnResult->printStatus; //1 已取票 2未取票 0未知
$preRefundAmount = $ctrip_backdata->returnResult->preRefundAmount; // 预计退票退款
$sxfAmount= $ctrip_backdata->returnResult->sxfAmount; //退票手续费
$operateTradeNo = $ctrip_backdata->returnResult->operateTradeNo; //操作流水号 退款通知里会有相同的操作流水号做对应。
$update_data->operateTradeNo=$operateTradeNo;
}else if($update_data->ServiceName == 'web.order.returnTicketNotice'){
$update_data->ordernumber = $ctrip_backdata->TrainOrderService->OrderNumber;
$update_data->OrderStatus = '7';
$update_data->ErrorMsg = $ctrip_backdata->TrainOrderService->refundTicket->reason;
$update_data->returncallback = $back_json;
//退票时还需要单独对对每个乘客存储回调信息
$passpager_info = new stdClass();
$passpager_info->returncallback = $back_json;
$passpager_info->ordernumber = $ctrip_backdata->returnResult->companyOrderId;
$passpager_info->longElecNo = $longElecNo;
if ($resultCode=="1"){
//退票成功
$update_data->OrderStatus = '7';
//退票时还需要单独对对每个乘客存储回调信息
$passpager_info->status = '7';
//保存退票成功信息到trainsystem
if ($printStatus==1){
$pintmsg="已取票";
}else if($printStatus==2){
$pintmsg="未取票";
}else{
$pintmsg="";
}
$msg = "退票成功:".$ctrip_backdata->returnResult->resultMsg."(".$returnSuccTime.",".$pintmsg.",预计退票退款:".$preRefundAmount.",手续费:".$sxfAmount.")";
$update_data->ErrorMsg=$msg;
//退票手续费保存到数据库
//翰特添加退款记录
$returnticket = new stdClass();
$return_order = $ctrip_backdata->returnResult->companyOrderId;
$returnticket->TOC_VEI_SN = "28209";
//根据订单号获取cold_sn
$order_info = $this->train_system_model->get_order_info($return_order);
$cold_sn = $order_info->ts_cold_sn;
//print_r($order_info);
//获取longElecNo长电子订单号用来判断是否是多张票
$longElecNo=$ctrip_backdata->returnResult->longElecNo;
$returnSuccTime = $ctrip_backdata->returnResult->returnSuccTime;
$memo = $return_order.'_长电子订单号:'. $longElecNo . '_' . $returnSuccTime; //退款集合信息
$returnticket->TOC_Memo = $memo;
$returnticket->TOC_COLD_SN = $cold_sn;
$returnticket->TOC_TrainNumber = $order_info->ts_checi;
$returnticket->TOC_DepartureDate = $order_info->ts_startdate;
$returnticket->TOC_TicketCost = -$sxfAmount>0?$sxfAmount:15;
//print_r($add_train_payment_data);die();
$this->BIZ_train_model->returnticket_train($returnticket);
}else{
//退票失败
$update_data->OrderStatus = '8';
//失败也保存下信息
$passpager_info->status = '8';
}
$this->train_system_model->return_update_passpager_info($passpager_info);
$update_data->returncallback = $back_json;
$passpager_info->status = '7';
$passpager_info->ordernumber = $ctrip_backdata->TrainOrderService->OrderNumber;
$passpager_info->realname = $ctrip_backdata->TrainOrderService->refundTicket->realName;
$passpager_info->numberid = $ctrip_backdata->TrainOrderService->refundTicket->passport;
$this->train_system_model->update_passpager_info($passpager_info);
}elseif($update_data->ServiceName == 'web.order.returnRescheduleResult'){
$update_data->ordernumber = $ctrip_backdata->TrainOrderService->OrderNumber;
$update_data->OrderStatus = '7';
@ -468,23 +363,23 @@ class callback extends CI_Controller{
$passpager_info->numberid = $ctrip_backdata->TrainOrderService->refundRescheduleTicket->passport;
$this->train_system_model->update_passpager_info($passpager_info);
}else if($update_data->ServiceName == 'web.order.requestRefund'){
// $return_order = $ctrip_backdata->TrainOrderService->OrderInfo->OrderNumber;
// $return_money = $ctrip_backdata->TrainOrderService->TotalRefundAmount;
$return_order = $ctrip_backdata->TrainOrderService->OrderInfo->OrderNumber;
$return_money = $ctrip_backdata->TrainOrderService->TotalRefundAmount;
// //根据订单号获取cold_sn
// $order_info = $this->train_system_model->get_order_info($return_order);
// $cold_sn = $order_info->ts_cold_sn;
// //print_r($order_info);
//根据订单号获取cold_sn
$order_info = $this->train_system_model->get_order_info($return_order);
$cold_sn = $order_info->ts_cold_sn;
//print_r($order_info);
// $add_train_payment_data->TOC_Memo = $return_order.'_'.$ctrip_backdata->TrainOrderService->OrderInfo->OrderTid;
// $add_train_payment_data->TOC_COLD_SN = $cold_sn;
// $add_train_payment_data->TOC_TrainNumber = $order_info->ts_checi;
// $add_train_payment_data->TOC_DepartureDate = $order_info->ts_startdate;
// $add_train_payment_data->TOC_TicketCost = -$ctrip_backdata->TrainOrderService->TotalRefundAmount;
// $add_train_payment_data->FOI_TrainNetOrderNo=null;
// //print_r($add_train_payment_data);die();
// $this->BIZ_train_model->add_train_payment($add_train_payment_data);
// return false;
$add_train_payment_data->TOC_Memo = $return_order.'_'.$ctrip_backdata->TrainOrderService->OrderInfo->OrderTid;
$add_train_payment_data->TOC_COLD_SN = $cold_sn;
$add_train_payment_data->TOC_TrainNumber = $order_info->ts_checi;
$add_train_payment_data->TOC_DepartureDate = $order_info->ts_startdate;
$add_train_payment_data->TOC_TicketCost = -$ctrip_backdata->TrainOrderService->TotalRefundAmount;
$add_train_payment_data->FOI_TrainNetOrderNo=null;
//print_r($add_train_payment_data);die();
$this->BIZ_train_model->add_train_payment($add_train_payment_data);
return false;
}else if ($update_data->ServiceName == 'web.order.rescheduleResult'){
$update_data->ordernumber = $ctrip_backdata->TrainOrderService->OrderInfo->OrderNumber;
$reschedule_status = $ctrip_backdata->TrainOrderService->OrderInfo->RescheduleTicketInfo->RescheduleTickets->RescheduleTicket->status;
@ -507,12 +402,6 @@ class callback extends CI_Controller{
}
//更新订单信息(出票系统)
$this->train_system_model->update_orders($update_data);
// //返回结果
// $returnResult = new stdClass();
// $returnResult->returnCode = 1;
// $returnResult->returnMsg = "";
// echo(json_encode($returnResult));
}
}
}

File diff suppressed because it is too large Load Diff

@ -1,703 +0,0 @@
<?php
use League\CLImate\TerminalObject\Basic\Json;
defined('BASEPATH') or exit('No direct script access allowed');
class LanHaiTicket extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model("BIZ_train_model");
$this->load->model("train_system_model");
$this->load->helper('train');
$this->db_train_zw = $this->config->item('db_train_zw');
$this->train_zw = $this->config->item('train_zw');
$this->black_list = $this->config->item('black_list');
$this->load->library("lanhaidata");
$this->train_certificateType = $this->config->item('train_certificateType');
$this->train_refundType = $this->config->item('train_refundType');
}
public function index()
{
//出票锁单接口: https://www.mycht.cn/info.php/apps/trainsystem/lanhaiticket/pushorderdetail?mainOrderId=HN1720670129499
//出票回调接口https://www.mycht.cn/info.php/apps/trainsystem/lanhaiticket/pushorderresult/
//退票锁单接口: https://www.mycht.cn/info.php/apps/trainsystem/lanhaiticket/refundorderdetail?dataId=82033
//退票回调接口: https://www.mycht.cn/info.php/apps/trainsystem/lanhaiticket/refundorderresult/
//退款回调接口https://www.mycht.cn/info.php/apps/trainsystem/lanhaiticket/refundpriceresult/
//http://ct.tms.lhticket.com 账号: GLhaina 密码123456
}
/**
* @description: 澜海获取锁单接口通过get方式获取参数mainOrderId订单号
* @return {*}
* @Date Changed:
* 网前地址https://www.mycht.cn/info.php/apps/trainsystem/lanhaiticket/pushorderdetail?mainOrderId=HN1720670129499
*/
public function pushOrderDetail()
{
//获取订单号
$mainOrderId = $this->input->get_post("mainOrderId");
$aes = $this->input->get_post("aes");
if (strpos($mainOrderId, 'HN') !== false) { //由于我们的订单号是HN开头的所以这里做下判断
//根据mainOrderId获取火车票的信息
$ticketfrom = $this->train_system_model->ticketfrom($mainOrderId);
if (!empty($ticketfrom)) {
$cold_sn = $ticketfrom->ts_cold_sn;
$lanhaiRecord = json_decode($ticketfrom->ts_lanhaiData); //澜海特殊数据字段保存了选择的出票人员Id
$data['train'] = $this->BIZ_train_model->biz_order_detail($cold_sn);
$coli_id = $this->BIZ_train_model->cold_sn_get_coli_id($cold_sn)['0']->COLI_ID;
if (empty($this->BIZ_train_model->get_operatorInfo($coli_id))) {
$data['email'] = 'vivi@hainatravel.com';
} else {
$data['email'] = $this->BIZ_train_model->get_operatorInfo($coli_id)['0']->OPI_Email;
}
//乘客信息
$bpe_sn = '';
if (!empty($lanhaiRecord)) {
$bpe_sn = $lanhaiRecord->bpe_sn;
}
if (!empty($bpe_sn)) {
$data['people_list'] = $this->BIZ_train_model->in_bpesn_people_info($bpe_sn);
} else {
//没有找到选择的人员列表,就查询整个订单的人员列表
$people_arr = $this->BIZ_train_model->biz_people($cold_sn);
//护照号如果在黑名单的就不自动出票
foreach ($people_arr as $people_info) {
$bpe_sn .= $people_info->BPE_SN . ',';
}
$bpe_sn = substr($bpe_sn, 0, strlen($bpe_sn) - 1);
$data['people_list'] = $this->BIZ_train_model->in_bpesn_people_info($bpe_sn);
}
$AdultNum = 0;
$ChildNum = 0;
$i = 0;
$lanhaiData = new lanhaiData();
$lanhaiCountryData = json_decode($lanhaiData->CountryData); //国家三字码基础信息
$passagersdata = array();
foreach ($data['people_list'] as $PassagerInfo) {
//乘客类型
switch ($PassagerInfo->BPE_GuestType) {
case 1:
$PiaoType = 1;
$PiaoTypeName = "成人票";
$AdultNum++;
break;
case 2:
$PiaoType = 2;
$PiaoTypeName = "儿童票";
$ChildNum++;
break;
default: //外国人应该就两种票吧
$PiaoType = 1;
$PiaoTypeName = "成人票";
break;
}
//证件类型
switch ($PassagerInfo->BPE_PassportType) {
case 'Chinese ID':
$PassportTypeseId = 1;
$PassportTypeseidName = "二代身份证";
break;
case 'MainlandTravel Permit from Hong Kong and Macau':
$PassportTypeseId = 7;
$PassportTypeseidName = "回乡证";
break;
case 'Travel Permit from Hong Kong / Macau':
$PassportTypeseId = 7;
$PassportTypeseidName = "回乡证";
break;
case 'Travel Permit from Taiwan':
$PassportTypeseId = 8;
$PassportTypeseidName = "台胞证";
break;
default:
$PassportTypeseId = 2;
$PassportTypeseidName = "护照";
break;
}
$passagersdata[$i] = new stdClass();
$passagersdata[$i]->passengerName = chk_sp_name($PassagerInfo->BPE_FirstName . $PassagerInfo->BPE_MiddleName . $PassagerInfo->BPE_LastName);
$passagersdata[$i]->passengerType = $PiaoType; //乘客类型1 成人票2 儿童票
$passagersdata[$i]->passportType = $PassportTypeseId; //证件类型,身份证 1护照 2回乡证 7台胞证 8外国人永久居留身份证 9港澳通行证 10台湾通行证 22港澳台居民居住证 23
$passagersdata[$i]->passportNumber = $PassagerInfo->BPE_Passport; //护照号
$passagersdata[$i]->passengerId = $PassagerInfo->BPE_SN; //乘客ID
$regionCode = "";
$countryName = "";
if (!empty($PassagerInfo->BPE_Nationality)) {
$htCode = $PassagerInfo->BPE_Nationality;
if ($htCode == "TW" || $htCode == "HK" || $htCode == "MO") {
$regionCode = "CHN";
$countryName = "中国";
} else {
foreach ($lanhaiCountryData as $cItem) {
if ($cItem->code == $htCode) {
$regionCode = $cItem->standCode;
$countryName = $cItem->name;
break;
}
}
}
}
$passagersdata[$i]->regionCode = $regionCode; //国家简码 美国USA ,中国CHN
$passagersdata[$i]->countryName = $countryName; //国家名称 中文名称
$passagersdata[$i]->passportExpireDate = date('Y-m-d', strtotime($PassagerInfo->BPE_PassExpdate)); //证件到期
$passagersdata[$i]->birthday = date('Y-m-d', strtotime($PassagerInfo->BPE_BirthDate)); //出生日期
$i++;
}
//拼接发送的报文
$PostData = new stdClass();
$PostData->mainOrderId = $mainOrderId;
$currentTime = date("Y-m-d H:i:s");
$PostData->expireTime = date("Y-m-d H:i:s", strtotime($currentTime . ' +30 minutes'));
$PostData->currentTime = $currentTime;
$PostData->agentCode = LANHAI_appId;
$PostData->contactMobile = "18877331805";
$PostData->extendParams = "";
$PostData->ticketsItems = array();
$PostData->ticketsItems['0'] = new stdClass();
$PostData->ticketsItems['0']->deliveryTicketId = $cold_sn; //行程id,cold_sn
$PostData->ticketsItems['0']->fromStationName = $data['train']->DepartAirport_cn;
$PostData->ticketsItems['0']->toStationName = $data['train']->ArrivalAirport_cn;
$PostData->ticketsItems['0']->trainNumber = $data['train']->FlightsNo; //车次
$PostData->ticketsItems['0']->departTime = date('Y-m-d H:i', strtotime($data['train']->DepartureTime)); //发车时间
$PostData->ticketsItems['0']->arrivalTime = date('Y-m-d H:i', strtotime($data['train']->ArrivalTime)); //到达时间
$PostData->ticketsItems['0']->ticketCount = count($data["people_list"]);
$PostData->ticketsItems['0']->ticketPrice = $data['train']->adultcost; //车票单价,单位(元)
$seatName = $this->train_zw[$this->db_train_zw[$data['train']->Aircraft]]; //座位名称,中文
$PostData->ticketsItems['0']->seatName = $seatName;
$PostData->ticketsItems['0']->acceptSeats = array(); //坐席选项
$lanhaiSeatTypes = json_decode($lanhaiData->seatTypes); //座位选项
foreach ($lanhaiSeatTypes as $seatItem) {
if ($seatItem->seatName == $seatName) {
$PostData->ticketsItems['0']->acceptSeats = $seatItem->seatItems;
break;
}
}
$acceptSeatRemark = "优先出【同排ABCDF座】无法满足可出任意座位不接受站票";
if (($AdultNum + $ChildNum) > 1) {
//多人时
if (strstr($seatName, "卧")) {
$acceptSeatRemark = "客人想要2张下铺最好在同一房间。下铺不足时至少保证在同一房间否则不要出票";
}
} else {
//单人时
}
$PostData->ticketsItems['0']->acceptSeatRemark = $acceptSeatRemark; //行程坐席要求
$PostData->ticketsItems['0']->ticketType = 1;
$PostData->ticketsItems['0']->passengerInfos = $passagersdata;
$total_price = $AdultNum * $data['train']->adultcost + $ChildNum * $data['train']->childcost; //总价
$PostData->orderPrice = $total_price; //订单总价,单位(元)
//加密方式显示
$this->load->library("aesLanhai");
$aesUnit = new Security();
$resultData = $aesUnit->encryptData(json_encode($PostData));
//$resultData = $aesUnit->decryptData($resultData); //测试加解密是否正常。
if ($aes == "false") {
//加个明文显示判断,用来检查数据
$resultData = json_encode($PostData, JSON_UNESCAPED_UNICODE);
}
echo $resultData;
} else {
$ResultNoticeResponse = new stdClass();
$ResultNoticeResponse->returnCode = -1;
$ResultNoticeResponse->success = false;
$ResultNoticeResponse->returnMsg = "mainOrderId错误";
echo json_encode($ResultNoticeResponse);
}
}
}
/**
* 出票结果回调信息
* 网前URLhttps://www.mycht.cn/info.php/apps/trainsystem/lanhaiticket/pushorderresult/
*/
public function pushOrderResult()
{
$back_json = file_get_contents('php://input');
log_message('error', '澜海出票回调信息:' . $back_json);
$lanhai_backdata = json_decode($back_json);
if (!empty($lanhai_backdata)) {
//判断回调信息是否正确,主要判断是否是本企业的回调信息
$companyId = LANHAI_appId;
$messageIdentity = $lanhai_backdata->authentication->appId; //传递的企业ID
$ResultNoticeResponse = new stdClass();
if ($companyId == $messageIdentity) {
$ResultNoticeResponse->retCode = 0;
$ResultNoticeResponse->success = true;
$ResultNoticeResponse->message = "处理成功!";
} else {
$ResultNoticeResponse->returnCode = -1;
$ResultNoticeResponse->success = false;
$ResultNoticeResponse->returnMsg = "appId错误";
}
echo json_encode($ResultNoticeResponse);
//处理回调的内容,保存到本地及翰特
$update_data = new stdClass();
$update_data->ServiceName = "lanhai.ticketresult";
$update_data->ordernumber = '';
$update_data->seatsinfo = '';
$update_data->TicketCheck = '';
$update_data->bookcallback = '';
$update_data->confirmcallback = '';
$update_data->returncallback = '';
$update_data->OrderTotleFee = 0;
$update_data->ElectronicOrderNumber = '';
$update_data->reschedulecallback = '';
$update_data->OrderTicketTime = '';
$update_data->operateTradeNo = "";
if (!empty($lanhai_backdata->bodyInfo)) {
// //需要解密
$this->load->library("aesLanhai");
$aesUnit = new Security();
$bodyINfo = json_decode($aesUnit->decryptData($lanhai_backdata->bodyInfo));
if ($bodyINfo->failCode == 0) {
$update_data->OrderStatus = '4';
if (isset($bodyINfo->resultMsg)) {
$update_data->ErrorMsg = $bodyINfo->resultMsg;
} else {
$update_data->ErrorMsg = '出票成功';
}
} else {
$update_data->OrderStatus = '5';
if (isset($bodyINfo->resultMsg)) {
$update_data->ErrorMsg = $bodyINfo->resultMsg;
} else {
$update_data->ErrorMsg = '出票失败';
}
}
$update_data->ordernumber = $lanhai_backdata->authentication->mainOrderId;
if (isset($bodyINfo->orderPrice)) {
$update_data->OrderTotleFee = $bodyINfo->orderPrice; //总价
}
if (isset($bodyINfo->payTradeNumber)) {
$update_data->operateTradeNo = $bodyINfo->payTradeNumber; ////支付宝流水
}
$update_data->ticketresultcallback = json_encode($bodyINfo);
//$update_data->OrderTicketTime = $lanhai_backdata->TrainOrderService->OrderInfo->TicketInfo->OrderTicketTime;
//新接口数据,不一定保存到数据库里面,原订单已有,做个记录
if (isset($bodyINfo->ticketSuccessTime)) {
$update_data->ticketSuccTime = $bodyINfo->ticketSuccessTime; //出票成功时间
}
// $update_data->orderType = $lanhai_backdata->ticketResult->orderMasterInfo->orderType; //订单类型 0电子票 1配送票 2人工客票 3抢票订单
// $update_data->contactName = $lanhai_backdata->ticketResult->orderMasterInfo->contactName; //联系人
// $update_data->mobileNo = des_decrypt($lanhai_backdata->ticketResult->orderMasterInfo->mobileNo,$key); //联系电话 (DES加密
//人员及车票
if (isset($bodyINfo->eOrderNumber)) {
$elecNo = $bodyINfo->eOrderNumber; //电子订单号即12306取票号
$update_data->ElectronicOrderNumber = $elecNo;
}
if (isset($bodyINfo->ticketList)) { //如果订票成功,需要保存的数据
$data_passager = new stdClass();
foreach ($bodyINfo->ticketList as $tItems) {
if (isset($tItems->ticketCheck)) {
$checkWindow = $tItems->ticketCheck; //检票口
$update_data->TicketCheck = $checkWindow;
}
$update_data->trainNo = $tItems->trainNumber; //车次
$update_data->departTime = $tItems->departTime; //车次出发时间
foreach ($tItems->passengerList as $pItems) {
$data_passager->ordernumber = $update_data->ordernumber;
//人员列表
$data_passager->status = '4';
$certificateType = $this->train_certificateType[$pItems->passportType]; //证件类型,身份证 1护照 2回乡证 7台胞证 8外国人永久居留身份证 9港澳通行证 10台湾通行证 22港澳台居民居住证 23
$data_passager->identitytype = $certificateType;
$data_passager->realname = $pItems->passengerName;
$data_passager->numberid = $pItems->passportNumber; //证件号码
//$data_passager->birthday = $pItems->birthday;
if ($pItems->passengerType == 2) {
$passengerType = "儿童";
} else {
$passengerType = "成人";
}
$data_passager->ticketype = $passengerType; //乘客类型 1成人 2儿童
$data_passager->seatype = $pItems->seatName; //坐席类型
$data_passager->ticketprice = $pItems->realTicketPrice; //实际单价(元)
$SeatNo = "";
if (isset($pItems->carriageNo)) {
$SeatNo .= $pItems->carriageNo . "车厢";
}
if (isset($pItems->seatNo)) {
$SeatNo .= $pItems->seatNo; ////坐席号
}
$data_passager->seatdetail = $SeatNo;
$passengerId = $pItems->passengerId; // //乘客id
$data_passager->longtrainno = $passengerId;
$jsonLanhaiData = new stdClass(); //澜海退票需要传递一些数据,尽量保存到这个里面。这样不用从翰特里面读取了。
$jsonLanhaiData->eOrderNumber = $update_data->ElectronicOrderNumber; //取票号
$data_passager->lanhaiData = json_encode($jsonLanhaiData);
//入库
$this->train_system_model->add_passagers($data_passager);
}
/****************************************************************************************/
//添加支付记录
$add_train_payment_data = new stdClass();
$add_train_payment_data->TOC_Memo = $update_data->ordernumber . '出票费';
$add_train_payment_data->TOC_VEI_SN = "33653";
//根据订单号获取cold_sn
$order_info = $this->train_system_model->get_order_info($update_data->ordernumber);
$cold_sn = $order_info->ts_cold_sn;
$add_train_payment_data->TOC_COLD_SN = $cold_sn;
$add_train_payment_data->TOC_TrainNumber = $update_data->trainNo;
$add_train_payment_data->TOC_DepartureDate = date('Y-m-d', strtotime($update_data->departTime));
$add_train_payment_data->TOC_TicketCost = $update_data->OrderTotleFee;
$passengerNum = $tItems->ticketCount; //车票数
if ($passengerNum>0){
$poundage = $passengerNum*10;
}else{
$poundage = 0;
}
$add_train_payment_data->poundage = $poundage; //手续费
$add_train_payment_data->FOI_TrainNetOrderNo = $update_data->ElectronicOrderNumber; //电子票号
//print_r($add_train_order_data);die();
$this->BIZ_train_model->add_train_payment($add_train_payment_data);
//记录供应商(瀚特)
$this->BIZ_train_model->update_cold_planvei_sn($cold_sn, '33653');
}
}
}
//更新订单信息(出票系统)
$this->train_system_model->update_orders($update_data);
}
}
/**
* 澜海退票锁单接口通过get方式获取前参数dataId
* 网前地址https://www.mycht.cn/info.php/apps/trainsystem/lanhaiticket/refundorderdetail?dataId=82033
*/
public function refundOrderDetail()
{
//获取客人ID
$dataId = $this->input->get_post("dataId");
$aes = $this->input->get_post("aes");
//根据客人ID获取退票数据
$passenger_data = $this->train_system_model->get_passenger_byId($dataId);
if (!empty($passenger_data)) {
//拼接发送的报文
$PostData = new stdClass();
$PostData->id = $passenger_data->tst_id; //dataId
$PostData->mainOrderId = $passenger_data->tst_ordernumber; //出票订单id如产生过线上改签成功则使用改签的dataId
$PostData->priority = 1; //0紧急退票1非紧急退票 默认1
//获取出票是保存的lanhaiData
if (!empty($passenger_data->tst_lanhaiData)){
$lanhaiData = json_decode($passenger_data->tst_lanhaiData);
}
$eOrderNumber = "";
if (isset($lanhaiData->eOrderNumber)){
$eOrderNumber = $lanhaiData->eOrderNumber; //取票号
}
$PostData->eOrderNumber = $eOrderNumber; //取票号
$PostData->passengerType = $passenger_data->tst_ticketype."票"; //票种
$PostData->passportType = $passenger_data->tst_identitytype; //"身份证"; //证件类型
$PostData->passportName = $passenger_data->tst_realname; //姓名
$PostData->passportNumber = $passenger_data->tst_numberid; //证件号
$PostData->departStation = $passenger_data->ts_fromstationame; //发站
$PostData->arriveStation = $passenger_data->ts_tostationame; //到站
$rPrice = $passenger_data->tst_ticketprice;
$PostData->ticketPrice = $rPrice; //票价(元)
$PostData->preRefundPrice = $rPrice; //原票价(元)
$PostData->percent = 100; //比例 默认100,我只取返回记录的价格。不管汉特的价格
$PostData->trainNo = $passenger_data->ts_checi ; //车次
//车厢及座位分解
$tst_seatdetail = $passenger_data->tst_seatdetail;
$carriageNo = "";
$seatNo = "";
if (strpos($tst_seatdetail,"车厢")!=false){
$arrSeat = explode("车厢",$tst_seatdetail);
$carriageNo = $arrSeat[0];
$seatNo = $arrSeat[1];
}
$PostData->carriageNo = $carriageNo; //车厢
$PostData->seatName = $passenger_data->tst_seatstype; //席别
$PostData->seatNo = $seatNo; //席位号
$strDt = $passenger_data->ts_startdate." ".$passenger_data->ts_startime;
$DepartureTime = date('Y-m-d H:i', strtotime($strDt));
// 出发时间前三十分钟的时间
$thirtyMinutesAgo = strtotime('-30 minutes', strtotime($DepartureTime));
$dealine = date('Y-m-d H:i', $thirtyMinutesAgo);
$PostData->ticketTime = $DepartureTime; //发车时间
$PostData->createTime = ""; //可空
$PostData->deadline = $dealine; //处理截止时间 建议最晚处理时间设置为发车前30分钟
$PostData->refundTime = ""; //可空
$PostData->getTicketTime = ""; //可空
$PostData->refundPrice = 0; //可空
$PostData->firstImage = null; //可空
$PostData->secondImage = null; //可空
$PostData->lockStatus = 0; //可空
$PostData->lockUser = ""; //可空
$PostData->status = 0; //可空
$PostData->longEOrderNumber = ""; //可空
$PostData->extendParams = ""; //拓展json对象
//加密方式显示
$this->load->library("aesLanhai");
$aesUnit = new Security();
$resultData = $aesUnit->encryptData(json_encode($PostData));
//$resultData = $aesUnit->decryptData($resultData); //测试加解密是否正常。
if ($aes == "false") {
//加个明文显示判断,用来检查数据
$resultData = json_encode($PostData, JSON_UNESCAPED_UNICODE);
}
echo $resultData;
} else {
$ResultNoticeResponse = new stdClass();
$ResultNoticeResponse->returnCode = -1;
$ResultNoticeResponse->success = false;
$ResultNoticeResponse->returnMsg = "dataId错误";
echo json_encode($ResultNoticeResponse);
}
}
/**
* 澜海退票返回信息
* 网前URLhttps://www.mycht.cn/info.php/apps/trainsystem/lanhaiticket/refundorderresult/
*/
public function refundOrderResult()
{
$back_json = file_get_contents('php://input');
log_message('error', '澜海退票回调信息:' . $back_json);
$lanhai_backdata = json_decode($back_json);
if (!empty($lanhai_backdata)) {
$dataId = $lanhai_backdata->id;
//根据客人ID获取退票数据
$passenger_data = $this->train_system_model->get_passenger_byId($dataId);
$ResultNoticeResponse = new stdClass();
if (!empty($passenger_data)) {
$ResultNoticeResponse->retCode = 0;
$ResultNoticeResponse->success = true;
$ResultNoticeResponse->message = "处理成功!";
echo json_encode($ResultNoticeResponse);
//处理回调的内容,保存到本地及翰特
$update_data = new stdClass();
$update_data->ServiceName = '';
$update_data->ordernumber = '';
$update_data->seatsinfo = '';
$update_data->TicketCheck = '';
$update_data->bookcallback = '';
$update_data->confirmcallback = '';
$update_data->returncallback = '';
$update_data->OrderTotleFee = 0;
$update_data->ElectronicOrderNumber = '';
$update_data->reschedulecallback = '';
$update_data->OrderTicketTime = '';
//新字段
$update_data->operateTradeNo ="";
$update_data->ordernumber = $passenger_data->tst_ordernumber;
$passpager_info = new stdClass();
$passpager_info->returncallback = $back_json;
$passpager_info->ordernumber = $passenger_data->tst_ordernumber;
$passpager_info->tst_id = $dataId; //乘客ID用来更新
//回调的数据正确,开始判断成功还是失败。
if (isset($lanhai_backdata->refundPrice)){ //如果有退款金额,说明退票成功
//退票成功
$update_data->OrderStatus = '7';
//退票时还需要单独对对每个乘客存储回调信息
$passpager_info->status = '7';
$refundPrice = $lanhai_backdata->refundPrice; //退款金额
$update_data->ErrorMsg = "退票成功,"."退票金额:".$refundPrice;
//退票手续费保存到数据库
//翰特添加退款记录
$returnticket = new stdClass();
$return_order = $update_data->ordernumber;
$returnticket->TOC_VEI_SN = "33653";
//根据订单号获取cold_sn
$cold_sn = $passenger_data->ts_cold_sn;
$returnSuccTime = date("Y-m-d H:i:s");
$memo = $return_order.'_退票成功_' . $dataId; //退票集合信息 ,用$dataId是为了标识唯一性
$returnticket->TOC_Memo = $memo;
$returnticket->TOC_COLD_SN = $cold_sn;
$returnticket->TOC_TrainNumber = $passenger_data->ts_checi;
$returnticket->TOC_DepartureDate = $passenger_data->ts_startdate;
$returnticket->TOC_TicketCost = -15;
//print_r($add_train_payment_data);die();
$this->BIZ_train_model->returnticket_train($returnticket);
}else{
//退票失败
$update_data->OrderStatus = '8';
//失败也保存下信息
$passpager_info->status = '8';
$update_data->ErrorMsg = "退票失败:".$lanhai_backdata->failReason;
}
$this->train_system_model->return_update_passager_lanhai($passpager_info);
$update_data->returncallback = $back_json;
//更新订单信息(出票系统)
$this->train_system_model->update_orders($update_data);
} else {
$ResultNoticeResponse->returnCode = -1;
$ResultNoticeResponse->success = false;
$ResultNoticeResponse->returnMsg = "退票订单数据没找到!";
echo json_encode($ResultNoticeResponse);
}
}
}
/**
* 澜海退款回调信息
* 网前URLhttps://www.mycht.cn/info.php/apps/trainsystem/lanhaiticket/refundpriceresult/
*/
public function refundPriceResult(){
$back_json = file_get_contents('php://input');
log_message('error', '澜海退款回调信息:' . $back_json);
$lanhai_backdata = json_decode($back_json);
if (!empty($lanhai_backdata))
{
$id = $lanhai_backdata->id; //线上低改高后的订单为dataId其他情况为出票的mainOrderId
//先判断是否是低改高的订单,目前我们没有改签。
if (1==2){
//这里是改签的操作,目前没有
}else{
//这里的ID是mainOrderId 出票订单ID
$order_info = $this->train_system_model->get_order_info($id);
if (!empty($order_info)){
$ResultNoticeResponse = new stdClass();
$ResultNoticeResponse->retCode = 0;
$ResultNoticeResponse->success = true;
$ResultNoticeResponse->message = "处理成功!";
echo json_encode($ResultNoticeResponse); //找到订单 对应数据就返回处理成功的结果,后面的错误不关澜海那边的事。
//处理回调的内容,保存到本地及翰特
$update_data = new stdClass();
$update_data->ServiceName = '';
$update_data->ordernumber = '';
$update_data->seatsinfo = '';
$update_data->TicketCheck = '';
$update_data->bookcallback = '';
$update_data->confirmcallback = '';
$update_data->returncallback = '';
$update_data->OrderTotleFee = 0;
$update_data->ElectronicOrderNumber = '';
$update_data->reschedulecallback = '';
$update_data->OrderTicketTime = '';
//新字段
$update_data->operateTradeNo ="";
$isOnline = $lanhai_backdata->isOnline; //1线上退款0线下退款
if ($isOnline==1){
$refundType = "线上退款";
}else{
$refundType = "线下退款";
}
$refundTime = date("Y-m-d H:i:s"); //退款时间
$return_money = $lanhai_backdata->refundPrice; //退款金额,单位元
$refundId = $lanhai_backdata->refundId; //退款唯一id(幂等性)
$update_data->ordernumber = $order_info->ts_ordernumber;
$update_data->OrderStatus = '11'; //11是订单退款
$update_data->ErrorMsg = '退款:'.$refundType." 金额:".$return_money." time:". $refundTime;
$update_data->refundcallback = $back_json;
//翰特添加退款记录
$refund_train_payment = new stdClass();
$return_order = $order_info->ts_ordernumber;
$refund_train_payment->TOC_VEI_SN = "33653";
$cold_sn = $order_info->ts_cold_sn;
//print_r($order_info);
$memo = $return_order.'_'.$refundType. '_' . $refundId; //退款集合信息
$refund_train_payment->TOC_Memo = $memo;
$refund_train_payment->TOC_COLD_SN = $cold_sn;
$refund_train_payment->TOC_TrainNumber = $order_info->ts_checi;
$refund_train_payment->TOC_DepartureDate = $order_info->ts_startdate;
$refund_train_payment->TOC_TicketCost = -$return_money;
//print_r($add_train_payment_data);die();
$this->BIZ_train_model->refund_train_payment($refund_train_payment);
//更新订单信息(出票系统)
$this->train_system_model->update_orders($update_data);
}else{
$ResultNoticeResponse = new stdClass();
$ResultNoticeResponse->returnCode = -1;
$ResultNoticeResponse->success = false;
$ResultNoticeResponse->returnMsg = "订单对应数据没找到!";
echo json_encode($ResultNoticeResponse);
}
}
}
}
}
/* End of file lanhaiticket.php */

@ -6,32 +6,18 @@ class pages extends CI_Controller{
public function __construct(){
parent::__construct();
//$this->load->library("permissiontrain");
$this->load->library('session');
$this->load->model("train_system_model");
$this->load->model("BIZ_train_model");
$this->load->helper('train');
$this->load->helper('cookie');
$this->order_status_msg = $this->config->item('train_order_status_msg');
$this->isadmin();
}
function isadmin(){
$OPI_SN = get_cookie("OPI_SN"); //获取对应的cookies
if ($OPI_SN>0){
//已登录
}else{
//$this->permissiontrain->is_admin();
redirect(site_url('login/indextrain'));
}
}
//首页
public function index($coli_id = null){
// if(get_cookie('dingname') == '' && get_cookie('dingunionid') == ''){
// redirect('/apps/dinglogin/login/?returnurl=/apps/trainsystem/pages/');
// }
if(get_cookie('dingname') == '' && get_cookie('dingunionid') == ''){
redirect('/apps/dinglogin/login/?returnurl=/apps/trainsystem/pages/');
}
if($coli_id == null){
$cols_id = $this->input->post("ht_order");
@ -49,22 +35,21 @@ class pages extends CI_Controller{
$list->info[$i] = new StdClass;
$list->info[$i]->people = $this->BIZ_train_model->biz_people($v->COLD_SN);
$list->info[$i]->train = $this->BIZ_train_model->biz_order_detail($v->COLD_SN);
$list->info[$i]->status = $this->train_system_model->get_submitStatus($v->COLD_SN); //判断是否提交过
$list->info[$i]->status = $this->BIZ_train_model->get_biz_jol($v->COLD_SN);
$i++;
}
$list->cols_id=$cols_id;
}
// //查询聚合余额
// $back_data = GetPost_http("http://op.juhe.cn/trainTickets/balance.php?key=79f03107b921ef31310bd40a1415c1cb");
// $back_data = json_decode($back_data);
// if(!empty($back_data->result)){
// $list->balance = $back_data->result;
// }else{
// $list->balance = "NULL";
// }
$list->balance = "NULL";
// print_r(json_encode($list));
//查询聚合余额
$back_data = GetPost_http("http://op.juhe.cn/trainTickets/balance.php?key=79f03107b921ef31310bd40a1415c1cb");
$back_data = json_decode($back_data);
if(!empty($back_data->result)){
$list->balance = $back_data->result;
}else{
$list->balance = "NULL";
}
//print_r($list);
$this->load->view('common/header');
$this->load->view('homepage',$list);
$this->load->view('common/footer');
@ -72,15 +57,13 @@ class pages extends CI_Controller{
//系统列表页面
public function order_list(){
// if(get_cookie('dingname') == '' && get_cookie('dingunionid') == ''){
// redirect('/apps/dinglogin/login/?returnurl=/apps/trainsystem/pages/');
// }
if(get_cookie('dingname') == '' && get_cookie('dingunionid') == ''){
redirect('/apps/dinglogin/login/?returnurl=/apps/trainsystem/pages/');
}
$page_size = 10;
$page = $this->input->get("page");
$order = $this->input->get("order");
$web_code = $this->input->get("web_code");
$channel = $this->input->get("channel");
$where = "1=1";//搜索条件
$page_parameter = "";//返回的分页条件参数
if(empty($page) or !is_numeric($page)){
@ -96,15 +79,10 @@ class pages extends CI_Controller{
$where = "BIZ_ConfirmLineInfo.COLI_WebCode='{$web_code}'";
$page_parameter = "web_code=".$web_code;
}
if (!empty($channel)){
$where = " InfoManager.dbo.trainsystem.ts_channel='{$channel}' ";
$page_parameter = " channel=".$channel;
}
//获取订单数据
$data = $this->train_system_model->get_order($page_size,$page,$where);
// print_r(json_encode($data));die();
//print_r($data);die();
$list["data"]=$data->list;
$this->load->library('pagination');
@ -117,16 +95,14 @@ class pages extends CI_Controller{
$config['cur_tag_open'] = '<li class="active"><a href="#">';
$config['cur_tag_close'] = '</a></li>';
$config['first_tag_open']=$config['last_tag_open']=$config['next_tag_open']=$config['prev_tag_open']=$config['num_tag_open']="<li>";
$config['first_tag_close']=$config['lasbt_tag_close']=$config['next_tag_close']=$config['prev_tag_close']=$config['num_tag_close']="</li>";
$config['first_tag_close']=$config['last_tag_close']=$config['next_tag_close']=$config['prev_tag_close']=$config['num_tag_close']="</li>";
$this->pagination->initialize($config);
$list["page_link"]=$this->pagination->create_links();
foreach ($list["data"] as $key => $value) {
$status = trim($value->ts_status);
$value->info = $this->order_status_msg[$status];//自定义说明信息;
$value->info = $this->order_status_msg[$value->ts_status];//自定义说明信息;
}
@ -137,9 +113,9 @@ class pages extends CI_Controller{
//订单详情页面
public function order(){
// if(get_cookie('dingname') == '' && get_cookie('dingunionid') == ''){
// redirect('/apps/dinglogin/login/?returnurl=/apps/trainsystem/pages/');
// }
if(get_cookie('dingname') == '' && get_cookie('dingunionid') == ''){
redirect('/apps/dinglogin/login/?returnurl=/apps/trainsystem/pages/');
}
$ordernumber = $order=$this->input->get("order");
if(empty($ordernumber)){
@ -167,17 +143,17 @@ class pages extends CI_Controller{
$data['msg'] = $train_infos->ts_errormsg;
$data['passengers'] = $passpager_detail;
// //聚合订单可以查询实时数据
// if($train_infos->ts_channel == 'juhe'){
// $post_data=array(
// "key"=>"79f03107b921ef31310bd40a1415c1cb",
// "orderid"=>$train_infos->ts_ordernumber
// );
// $back_data = GetPost_http("http://op.juhe.cn/trainTickets/orderStatus",$post_data);
// $data['train_date'] = '';
// $data['start_time'] = json_decode($back_data)->result->start_time;
// $data['arrive_time'] = json_decode($back_data)->result->arrive_time;
// }
//聚合订单可以查询实时数据
if($train_infos->ts_channel == 'juhe'){
$post_data=array(
"key"=>"79f03107b921ef31310bd40a1415c1cb",
"orderid"=>$train_infos->ts_ordernumber
);
$back_data = GetPost_http("http://op.juhe.cn/trainTickets/orderStatus",$post_data);
$data['train_date'] = '';
$data['start_time'] = json_decode($back_data)->result->start_time;
$data['arrive_time'] = json_decode($back_data)->result->arrive_time;
}
$this->load->view('bootstrap3/header');
$this->load->view('order',$data);
@ -186,9 +162,9 @@ class pages extends CI_Controller{
//退票页面
public function refund(){
// if(get_cookie('dingname') == '' && get_cookie('dingunionid') == ''){
// redirect('/apps/dinglogin/login/?returnurl=/apps/trainsystem/pages/');
// }
if(get_cookie('dingname') == '' && get_cookie('dingunionid') == ''){
redirect('/apps/dinglogin/login/?returnurl=/apps/trainsystem/pages/');
}
$ordernumber = $order=$this->input->get("order");
if(empty($ordernumber)){
@ -245,237 +221,11 @@ class pages extends CI_Controller{
//账单导出页面
public function export(){
// if(get_cookie('dingname') == '' && get_cookie('dingunionid') == ''){
// redirect('/apps/dinglogin/login/?returnurl=/apps/trainsystem/pages/');
// }
if(get_cookie('dingname') == '' && get_cookie('dingunionid') == ''){
redirect('/apps/dinglogin/login/?returnurl=/apps/trainsystem/pages/');
}
$this->load->view('header');
$this->load->view('export');
$this->load->view('footer');
}
//澜海账单导出页面
public function lanhaiExport(){
$this->load->view('header');
$this->load->view('export_lanhai');
$this->load->view('footer');
}
//预售时间列表
public function presale_list(){
$page_size = 10;
$page = $this->input->get("page");
$stationcn = $this->input->get("stationcn");
$web_code = $this->input->get("web_code");
$where = "1=1";//搜索条件
$page_parameter = "";//返回的分页条件参数
if(empty($page) or !is_numeric($page)){
$page=0;
}
if(!empty($stationcn)){
$where = " TST_station_cn like '%{$stationcn}%' ";
$list["stationcn"] = $stationcn;
$page_parameter = "stationcn=".$stationcn;
}
//获取订单数据
$data = $this->BIZ_train_model->get_presale_list($page_size,$page,$where);
// print_r(json_encode($data));die();
$list["data"]=$data->list;
$this->load->library('pagination');
$config['base_url'] = site_url("/apps/trainsystem/pages/presale_list?{$page_parameter}");
$config['total_rows'] = $data->count;
$config['per_page'] = $page_size;
$config['page_query_string']=TRUE;
$config['query_string_segment']="page";
$config['cur_tag_open'] = '<li class="active"><a href="#">';
$config['cur_tag_close'] = '</a></li>';
$config['first_tag_open']=$config['last_tag_open']=$config['next_tag_open']=$config['prev_tag_open']=$config['num_tag_open']="<li>";
$config['first_tag_close']=$config['lasbt_tag_close']=$config['next_tag_close']=$config['prev_tag_close']=$config['num_tag_close']="</li>";
$this->pagination->initialize($config);
$list["page_link"]=$this->pagination->create_links();
$this->load->view('header');
$this->load->view('presale_list',$list);
$this->load->view('footer');
}
//预售时间编辑
public function presale_edit(){
$ordernumber = $tstid=$this->input->get("tstid");
if(empty($tstid)){
exit('参数错误');
}
//根据ID号查询信息
$saletime_detail = $this->BIZ_train_model->get_saletime_detail($tstid);
$data["info"] = $saletime_detail;
$this->load->view('header');
$this->load->view('presale_edit',$data);
$this->load->view('footer');
}
//预售时间编辑保存
public function presale_editsave(){
$TST_id = $this->input->get_post("TST_id");
$TST_station_cn = trim($this->input->get_post("TST_station_cn"));
$TST_saletime = trim($this->input->get_post("TST_saletime"));
$TST_station_code = trim($this->input->get_post("TST_station_code"));
$data = new stdClass();
$data->TST_id = $TST_id;
$data->TST_station_cn = $TST_station_cn;
$data->TST_saletime = $TST_saletime;
$data->TST_station_code = $TST_station_code;
$this->BIZ_train_model->update_saletime($data);
$rUrl = '<script type="text/javascript">';
$rUrl.= 'alert("修改完成,请查看修改后的信息!!"); window.location.href="/info.php/apps/trainsystem/pages/presale_list";'; // 弹出提示框
//$rUrl.= 'window.location.href="/info.php/apps/trainsystem/pages/presale_edit?tstid='+$TST_id+'";'; // 跳转到目标页面
$rUrl.= '</script>';
echo $rUrl;
}
//澜海查询信息
public function lanhaiMsg(){
$order = $this->input->get_post("order"); //订单号
$type = $this->input->get_post("type"); //出票,退票,账单等类型
$microtime = get_microtime(); //时间戳
//生成接口请求头参数
$timestamp = $microtime;
$appId = LANHAI_appId;
if ($type == "orderticket"){
$url = LANHAI_URL."api/open/get/orderDetails";
}else if ($type == "returnticket"){
$url = LANHAI_URL."api/open/get/orderRefundDetails";
}
//拼接发送的报文
$PostData = new stdClass();
$PostData->mainOrderId = $order;
$PostData->timestamp = $timestamp;
$PostData->appId = $appId;
$ResponseJson = GetPost_http($url,json_encode($PostData),'json');
//log_message('error','澜海出票详细信息:'.$ResponseJson);
$ResponseData = json_decode($ResponseJson);
if (isset($ResponseData->data)){
// //需要解密
$this->load->library("aesLanhai");
$aesUnit = new Security();
$data = json_decode($aesUnit->decryptData($ResponseData->data));
$result = array();
$this->handle_array($data,$type,$result);
$formattedJson = json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
echo "<pre>$formattedJson</pre>";
}else{
$ResultNoticeResponse = new stdClass();
$ResultNoticeResponse->returnCode = -1;
$ResultNoticeResponse->success = false;
$ResultNoticeResponse->returnMsg = "找不到订单数据!";
$formattedJson = json_encode($ResultNoticeResponse, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
echo $formattedJson;
}
}
//循环展示JSON
private function handle_array($arr,$type,&$array_to_fill){
foreach($arr as $key => $value){
if(is_array($value) || is_object($value)){
$array_to_fill[$key] = array();
$this->handle_array($value,$type, $array_to_fill[$key]);
}else{
if ($type=="orderticket"){ //出票特殊显示
if ($key == "passengerType"){
if ($value==0){
$value = "成人";
}else if($value == 1){
$value = "儿童";
}
}
if ($key == "certificateType"){
if ($value==1){
$value = "身份证";
}else if ($value == 2) {
$value = "护照";
}else if ($value == 7){
$value = "回乡证";
}else if ($value == 8 ){
$value = "台胞证";
}
}
if ($key == "status"){
switch ($value) {
case 0:
$value = "待出票";
break;
case 1:
$value = "锁定订单";
break;
case 2:
$value = "已出票";
break;
case 3:
$value = "超时订单";
break;
case 4:
$value = "已驳回";
break;
case 6:
$value = "出票超时";
break;
case 12:
$value = "锁单失败";
break;
default:
# code...
break;
}
}
}
$array_to_fill[$key] = $value;
}
}
}
public function presale_add(){
$this->load->view('header');
$this->load->view('presale_add');
$this->load->view('footer');
}
public function presale_addsave(){
$TST_station_cn = trim($this->input->get_post("TST_station_cn"));
$TST_saletime = trim($this->input->get_post("TST_saletime"));
$TST_station_code = trim($this->input->get_post("TST_station_code"));
$data = new stdClass();
$data->TST_station_cn = $TST_station_cn;
$data->TST_saletime = $TST_saletime;
$data->TST_station_code = $TST_station_code;
$this->BIZ_train_model->add_saletime($data);
$rUrl = '<script type="text/javascript">';
$rUrl.= 'alert("添加完成!!"); window.location.href="/info.php/apps/trainsystem/pages/presale_list";'; // 弹出提示框
$rUrl.= '</script>';
echo $rUrl;
}
}
}

@ -36,7 +36,7 @@ class returnorders extends CI_Controller{
header("HTTP/1.1 404 Not Found");
exit('{"reason":"传参错误","status":"404"}');
}
//网前提交的姓名没有做处理
$passportname = chk_sp_name($passportname);
@ -46,7 +46,6 @@ class returnorders extends CI_Controller{
if(empty($passenger_data)){
header("HTTP/1.1 404 Not Found");
exit('{"reason":"乘客信息为空无法退票","status":"404"}');
//exit('{"reason":"'.$ordernumber.",".$passportname.",".$passportno.'","status":"404"}');
exit('');
}
@ -59,9 +58,6 @@ class returnorders extends CI_Controller{
case 'ctrip':
$this->ctripModel($ticket_data,$passenger_data);
break;
case 'lanhai':
$this->lanhaiModel($ticket_data,$passenger_data);
break;
}
}
@ -133,106 +129,37 @@ class returnorders extends CI_Controller{
}
function ctripModel($ticket_data,$passenger_data){
//生成接口请求头参数
$TimeStamp = date("Y-m-d H:i:s");
$serviceName = "train.artificialTicketReturn"; //每个接口都有自己名称
$companyId = COMPANYID;
$key = CTRIPKEY;
$strSign = $TimeStamp.$serviceName.$companyId.$key; //加密前的令牌
$Sign = md5($strSign);
$url = CTRIPURL."/artificialTicketReturn";
$PostData = new stdClass();
$PostData->authentication = new stdClass();
$PostData->authentication->timeStamp = $TimeStamp;
$PostData->authentication->serviceName = $serviceName;
$PostData->authentication->companyId = $companyId;
$PostData->authentication->messageIdentity = $Sign;
$PostData->companyOrderId = $ticket_data->ts_ordernumber;
$PostData->operator = "vivi";
$PostData->returnServiceFee = "15"; //退票服务费
$PostData->returnTicketList['0'] = new stdClass();
$PostData->returnTicketList['0']->trainNo = $passenger_data->ts_checi;
//车厢及座位分解
$tst_seatdetail = $passenger_data->tst_seatdetail;
$carriageNo = "";
$seatNo = "";
if (strpos($tst_seatdetail,"车厢")!=false){
$arrSeat = explode("车厢",$tst_seatdetail);
$carriageNo = $arrSeat[0];
$seatNo = $arrSeat[1];
}
$PostData->returnTicketList['0']->carriageNo = $carriageNo;
$PostData->returnTicketList['0']->seatNo = $seatNo;
$PostData->returnTicketList['0']->longElecNo = $passenger_data->tst_LongTrainNo;
$PostData->returnTicketList['0']->cardFirstImage = "";
$PostData->returnTicketList['0']->cardSecondImage ="";
// print_r(json_encode($PostData));
// die();
$PostData = array();
$TimeStamp = time();
$time = date('Y-m-d H:i:s',$TimeStamp);
$PostData['Authentication'] = new stdClass();
$PostData['Authentication']->TimeStamp = $time;
$PostData['Authentication']->ServiceName = 'order.ticketReturn';
$PostData['Authentication']->PartnerName = ORDERUSER;
$MessageIdentity = md5($time.'order.ticketReturn'.ORDERKEY);
$PostData['Authentication']->MessageIdentity = $MessageIdentity;
$PostData['TrainOrderService'] = new stdClass();
$PostData['TrainOrderService']->contactName = '陈宇超';
$PostData['TrainOrderService']->contactMobile = '18877381547';
$PostData['TrainOrderService']->OrderNumber = $ticket_data->ts_ordernumber;
$PostData['TrainOrderService']->OperatorType = '0';
$PostData['TrainOrderService']->LongElecNums = array();
$PostData['TrainOrderService']->LongElecNums['0'] = $passenger_data->tst_LongTrainNo;
//发起退票请求
$ResponseJson = GetPost_http($url,json_encode($PostData),'json');
log_message('error','退票返回信息:'.$ResponseJson);
$Url = 'http://apiproxy.ctrip.com/apiproxy/soa2/13680/PartnerReturnTicket';
$ResponseJson = GetPost_http($Url,json_encode($PostData),'json');
$ResponseData = json_decode($ResponseJson);
if($ResponseData->returnCode == 1){
if($ResponseData->Status == 'SUCCESS'){
echo '{"reason":"退票成功","status":"200"}';
}else{
header("HTTP/1.1 404 Not Found");
echo '{"reason":"退票失败","status":"404"}';
}
}
/**
* 澜海退票,这里只是提交退票提交。没有具体退票信息
*/
function lanhaiModel($ticket_data,$passenger_data){
$microtime = get_microtime();
//生成接口请求头参数
$dataId = $passenger_data->tst_id;
$mainOrderId = $passenger_data->tst_ordernumber;
$timestamp = $microtime;
$appId = LANHAI_appId;
$url = LANHAI_URL."api/open/refund/order";
//拼接发送的报文
$PostData = new stdClass();
$PostData->dataId = $dataId;
$PostData->mainOrderId = $mainOrderId;
$PostData->timestamp = $timestamp;
$PostData->appId = $appId;
// print_r(json_encode($PostData));
// die();
$ResponseJson = GetPost_http($url,json_encode($PostData),'json');
log_message('error','澜海退票请求返回信息:'.$ResponseJson);
$ResponseData = json_decode($ResponseJson);
// print_r($ResponseData);
// die();
//退票请求成功后执行支付
if($ResponseData->code == 0 && $ResponseData->success){
echo '{"reason":"退票提交成功","status":"200"}';
}else{
if (isset($ResponseData->msg)){
$errMsg = $ResponseData->msg;
}else{
$errMsg = "";
}
header("HTTP/1.1 404 Not Found");
echo '{"reason":"退票提交失败"'.$errMsg.',"status":"404"}';
}
}
//改签退票
public function returnreschedule(){

@ -59,14 +59,6 @@ function GetPost_http($url, $data = '',$format='') {
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包
if($format == 'json'){
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
}else if ($format=="json_ctrip"){
//新携程接口只开通了116.8.4.34的IP能访问
$header = array(
'CLIENT-IP: 116.8.4.34',
'X-FORWARDED-FOR: 116.8.4.34',
'Content-Type:application/json'
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
}
}
curl_setopt($curl, CURLOPT_TIMEOUT, 40); // 设置超时限制防止死循环
@ -322,103 +314,5 @@ function get_name($seat_code){
}
}
function get_name_cn($seat_code){
if($seat_code){
switch($seat_code){
case 'O' :
return '二等座';
case 'A8' :
return '二等座';
case 'A9' :
return '商务座';
case 'P' :
return '特等座';
case 'M' :
return '一等座';
case 'A7' :
return '一等座';
case 'A6' :
return '高级软卧';
case 'A' :
return '高级软卧';
case '5' :
return '硬卧';
case 'S' :
return '软卧';
case 'A4' :
return '软卧';
case 'F' :
return '动卧';
case 'A3' :
return '硬卧';
case 'A2' :
return '软座';
case 'A1' :
return '硬座';
case 'Q' :
return '观光座';
case 'H' :
return '其它';
case 'WZ' :
return '无座';
case '13' :
return '无座';
case 'YDW' :
return '一等卧';
case 'EDW' :
return '二等卧';
}
}
}
/**
* 解密函数
* 算法des
* 加密模式ecb
* 补齐方法PKCS5
* @param unknown_type $input
*/
function des_encrypt($data, $key) {
$data = pkcs5_pad($data, 8); //确保数据长度是8的倍数并使用PKCS5填充
$iv = "\x01\x02\x03\x04\x05\x06\x07\x08"; //PHP版本的初始化向量可以自定义
$cipher = mcrypt_module_open(MCRYPT_DES, '', MCRYPT_MODE_ECB, '');
mcrypt_generic_init($cipher, $key, $iv);
$encrypted = mcrypt_generic($cipher, $data);
mcrypt_generic_deinit($cipher);
mcrypt_module_close($cipher);
return base64_encode($encrypted); //将密文以base64编码输出
}
function des_decrypt($data, $key) {
$iv = "\x01\x02\x03\x04\x05\x06\x07\x08"; //PHP版本的初始化向量可以自定义
$cipher = mcrypt_module_open(MCRYPT_DES, '', MCRYPT_MODE_ECB, '');
mcrypt_generic_init($cipher, $key, $iv);
$decrypted = mdecrypt_generic($cipher, base64_decode($data)); //将密文先解码后解密
mcrypt_generic_deinit($cipher);
mcrypt_module_close($cipher);
return pkcs5_unpad($decrypted); //移除PKCS5填充并输出明文
}
function pkcs5_pad($text, $blocksize)
{
$pad = $blocksize - (strlen($text) % $blocksize);
return $text . str_repeat(chr($pad), $pad);
}
function pkcs5_unpad($text) {
$pad = ord($text{strlen($text)-1});
if ($pad > strlen($text)) {
return false;
}
if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) {
return false;
}
return substr($text, 0, -1 * $pad);
}
?>

@ -1,51 +0,0 @@
<?php
class aesLanhai{}
/**
* 使用旧的mcrypt来写澜海加解密类
*/
class Security {
private $key;
public function __construct() {
$CI =& get_instance();
$CI->load->config();
$this->key = LANHAI_KEY;
//$this->key = "999c1DtJJ4pEbcxeEqJBKw==";
}
public function encryptData($input) {
$size = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
$input = Security::pkcs5_pad($input, $size);
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_ECB, '');
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
mcrypt_generic_init($td, $this->key, $iv);
$data = mcrypt_generic($td, $input);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
$data = base64_encode($data);
return $data;
}
private static function pkcs5_pad ($text, $blocksize) {
$pad = $blocksize - (strlen($text) % $blocksize);
return $text . str_repeat(chr($pad), $pad);
}
public function decryptData($sStr) {
$decrypted= mcrypt_decrypt(
MCRYPT_RIJNDAEL_128,
$this->key,
base64_decode($sStr),
MCRYPT_MODE_ECB
);
$dec_s = strlen($decrypted);
$padding = ord($decrypted[$dec_s-1]);
$decrypted = substr($decrypted, 0, -$padding);
return $decrypted;
}
}

@ -193,11 +193,4 @@ class BIZ_intel_train_model extends CI_Model {
$query = $this->HT->query($sql,array($station_id));
return $query->result();
}
//获取价格信息
function get_priceinfo($train_no){
$sql = "SELECT seatPriceInfo2 FROM trainPrice WHERE train_no = '{$train_no}'";
$query = $this->HT->query($sql);
return $query->row();
}
}

@ -4,8 +4,8 @@ class BIZ_train_model extends CI_Model {
function __construct() {
parent::__construct();
$this->HT = $this->load->database('TOURMANAGER_LOCAL', TRUE);
$this->INFO = $this->load->database('INFORMATION_LOCAL', TRUE);
$this->HT = $this->load->database('HT', TRUE);
$this->INFO = $this->load->database('INFO', TRUE);
}
//传入一组BPE_SN获取乘客信息
@ -19,11 +19,8 @@ class BIZ_train_model extends CI_Model {
,bbp.BPE_Passport
,bbp.BPE_PassportType
,bbp.BPE_SEX
,CONVERT(VARCHAR(10),BPE_BirthDate,120) as BPE_BirthDate
,(case ISDATE(BPE_PassExpdate)
when 1 then CONVERT(VARCHAR(10),CONVERT(datetime,BPE_PassExpdate,120),120)
else null end) as BPE_PassExpdate
,(select top 1 COI_Code from COuntryInfo where COI_SN=bbp.BPE_Nationality) as BPE_Nationality
,bbp.BPE_BirthDate
,bbp.BPE_PassExpdate
FROM BIZ_BookPeople bbp
WHERE BPE_SN in(".$bpe_sn.")
";
@ -52,12 +49,6 @@ class BIZ_train_model extends CI_Model {
,bbp.BPE_GuestType
,bbp.BPE_Passport
,bbp.BPE_PassportType
,CONVERT(VARCHAR(10),BPE_BirthDate,120) as BPE_BirthDate
,(case ISDATE(BPE_PassExpdate)
when 1 then CONVERT(VARCHAR(10),CONVERT(datetime,BPE_PassExpdate,120),120)
else null end) as BPE_PassExpdate
,(select top 1 COI_Code from COuntryInfo where COI_SN=bbp.BPE_Nationality) as BPE_Nationality
,(select top 1 COI_ID from COuntryInfo where COI_SN=bbp.BPE_Nationality) as Nationality
FROM BIZ_BookPeople bbp
WHERE EXISTS(
SELECT TOP 1 1
@ -161,92 +152,8 @@ class BIZ_train_model extends CI_Model {
//删除多余支付记录
$sql = "delete from BIZ_TrainOrderCost where TOC_COLI_SN = '{$CCSN}' and TOC_TicketCost is null";
$query=$this->HT->query($sql);
// if(empty($data->FOI_TrainNetOrderNo)){ //由于取票号不再是必传回来的参数,所以退票单独做一个函数
// //退票
// $sql="IF NOT EXISTS(
// SELECT TOP 1 1 FROM BIZ_TrainOrderCost
// WHERE TOC_COLD_SN = ? AND TOC_Memo like ?
// )
// INSERT INTO BIZ_TrainOrderCost(
// TOC_Memo,
// TOC_CreateDate,
// TOC_COLI_SN,
// TOC_COLD_SN,
// TOC_TrainNumber,
// TOC_DepartureDate,
// TOC_TicketCost,
// TOC_WL,
// TOC_VEI_SN
// )
// VALUES(?,getdate(),{$CCSN},?,?,?,?,(SELECT COLI_OPI_ID FROM BIZ_ConfirmLineInfo WHERE COLI_SN={$CCSN}),?)";
// $query = $this->HT->query($sql,array($data->TOC_COLD_SN,"%".$data->TOC_Memo."%","退票费 ".$data->TOC_Memo,$data->TOC_COLD_SN,$data->TOC_TrainNumber,$data->TOC_DepartureDate,$data->TOC_TicketCost,$data->TOC_VEI_SN));
// }else{
// }
//---------出票----
//BIZ_FlightsOrderInfo.FOI_TrainNetOrderNo,更新取票号
/*
UPDATE BIZ_FlightsOrderInfo
SET
FOI_TrainNetOrderNo=?
WHERE
FOI_COLD_SN=?
*/
$sql="IF EXISTS(
select * from BIZ_FlightsOrderInfo where FOI_COLD_SN = '$data->TOC_COLD_SN' and (FOI_TrainNetOrderNo is null or FOI_TrainNetOrderNo = '' or FOI_TrainNetOrderNo = '$data->FOI_TrainNetOrderNo'))
UPDATE BIZ_FlightsOrderInfo
SET
FOI_TrainNetOrderNo='$data->FOI_TrainNetOrderNo'
WHERE
FOI_COLD_SN='$data->TOC_COLD_SN'
ELSE
IF NOT EXISTS(select * from BIZ_FlightsOrderInfo where FOI_COLD_SN = '$data->TOC_COLD_SN' and FOI_TrainNetOrderNo LIKE '%$data->FOI_TrainNetOrderNo%')
UPDATE BIZ_FlightsOrderInfo
SET
FOI_TrainNetOrderNo=(select FOI_TrainNetOrderNo from BIZ_FlightsOrderInfo where FOI_COLD_SN = '$data->TOC_COLD_SN') + '&' + '$data->FOI_TrainNetOrderNo'
WHERE
FOI_COLD_SN='$data->TOC_COLD_SN'";
$this->HT->query($sql);
$sql="IF NOT EXISTS(
SELECT TOP 1 1 FROM BIZ_TrainOrderCost
WHERE TOC_COLD_SN = ? AND TOC_Memo like ?
)
INSERT INTO BIZ_TrainOrderCost(
TOC_Memo,
TOC_CreateDate,
TOC_COLI_SN,
TOC_COLD_SN,
TOC_TrainNumber,
TOC_DepartureDate,
TOC_TicketCost,
TOC_WL,
TOC_OtherCost,
TOC_VEI_SN
)
VALUES(?,getdate(),{$CCSN},?,?,?,?,(SELECT isnull(COLI_OPI_ID,29) FROM BIZ_ConfirmLineInfo WHERE COLI_SN={$CCSN}),null,?)";
//,(?,getdate(),{$CCSN},?,?,?,?,(SELECT isnull(COLI_OPI_ID,29) FROM BIZ_ConfirmLineInfo WHERE COLI_SN={$CCSN}),1,?)
$query = $this->HT->query($sql,array($data->TOC_COLD_SN,"%".$data->TOC_Memo."%",$data->TOC_Memo,$data->TOC_COLD_SN,$data->TOC_TrainNumber,$data->TOC_DepartureDate,$data->TOC_TicketCost,$data->TOC_VEI_SN)); //,$data->TOC_Memo." 手续费",$data->TOC_COLD_SN,$data->TOC_TrainNumber,$data->TOC_DepartureDate,$data->poundage,$data->TOC_VEI_SN
return $query;
}
//新增退款记录 refund
public function refund_train_payment($data){
//主表ID下面两个地方用到所以先筛选出来不知道能不能通过合并提高效率
$sql="SELECT COLD_COLI_SN FROM BIZ_ConfirmLineDetail WHERE COLD_SN=?";
$query=$this->HT->query($sql,$data->TOC_COLD_SN);
$query=$query->result();
$CCSN=$query[0]->COLD_COLI_SN;
//删除多余支付记录
$sql = "delete from BIZ_TrainOrderCost where TOC_COLI_SN = '{$CCSN}' and TOC_TicketCost is null";
$query=$this->HT->query($sql);
//退款记录
if(empty($data->FOI_TrainNetOrderNo)){
//退票
$sql="IF NOT EXISTS(
SELECT TOP 1 1 FROM BIZ_TrainOrderCost
WHERE TOC_COLD_SN = ? AND TOC_Memo like ?
@ -262,21 +169,35 @@ class BIZ_train_model extends CI_Model {
TOC_WL,
TOC_VEI_SN
)
VALUES(?,getdate(),{$CCSN},?,?,?,?,(SELECT isnull(COLI_OPI_ID,29) FROM BIZ_ConfirmLineInfo WHERE COLI_SN={$CCSN}),?)";
$query = $this->HT->query($sql,array($data->TOC_COLD_SN,"%".$data->TOC_Memo."%","退款: ".$data->TOC_Memo,$data->TOC_COLD_SN,$data->TOC_TrainNumber,$data->TOC_DepartureDate,$data->TOC_TicketCost,$data->TOC_VEI_SN));
}
//新增退款记录 refund
public function returnticket_train($data){
//主表ID下面两个地方用到所以先筛选出来不知道能不能通过合并提高效率
$sql="SELECT COLD_COLI_SN FROM BIZ_ConfirmLineDetail WHERE COLD_SN=?";
$query=$this->HT->query($sql,$data->TOC_COLD_SN);
$query=$query->result();
$CCSN=$query[0]->COLD_COLI_SN;
//退票手续费记录
VALUES(?,getdate(),{$CCSN},?,?,?,?,(SELECT COLI_OPI_ID FROM BIZ_ConfirmLineInfo WHERE COLI_SN={$CCSN}),?)";
$query = $this->HT->query($sql,array($data->TOC_COLD_SN,"%".$data->TOC_Memo."%","退票费 ".$data->TOC_Memo,$data->TOC_COLD_SN,$data->TOC_TrainNumber,$data->TOC_DepartureDate,$data->TOC_TicketCost,$data->TOC_VEI_SN));
}else{
//出票
//BIZ_FlightsOrderInfo.FOI_TrainNetOrderNo,更新取票号
/*
UPDATE BIZ_FlightsOrderInfo
SET
FOI_TrainNetOrderNo=?
WHERE
FOI_COLD_SN=?
*/
$sql="IF EXISTS(
select * from BIZ_FlightsOrderInfo where FOI_COLD_SN = '$data->TOC_COLD_SN' and (FOI_TrainNetOrderNo is null or FOI_TrainNetOrderNo = '' or FOI_TrainNetOrderNo = '$data->FOI_TrainNetOrderNo'))
UPDATE BIZ_FlightsOrderInfo
SET
FOI_TrainNetOrderNo='$data->FOI_TrainNetOrderNo'
WHERE
FOI_COLD_SN='$data->TOC_COLD_SN'
ELSE
IF NOT EXISTS(select * from BIZ_FlightsOrderInfo where FOI_COLD_SN = '$data->TOC_COLD_SN' and FOI_TrainNetOrderNo LIKE '%$data->FOI_TrainNetOrderNo%')
UPDATE BIZ_FlightsOrderInfo
SET
FOI_TrainNetOrderNo=(select FOI_TrainNetOrderNo from BIZ_FlightsOrderInfo where FOI_COLD_SN = '$data->TOC_COLD_SN') + '&' + '$data->FOI_TrainNetOrderNo'
WHERE
FOI_COLD_SN='$data->TOC_COLD_SN'";
$this->HT->query($sql);
$sql="IF NOT EXISTS(
SELECT TOP 1 1 FROM BIZ_TrainOrderCost
WHERE TOC_COLD_SN = ? AND TOC_Memo like ?
@ -290,12 +211,13 @@ class BIZ_train_model extends CI_Model {
TOC_DepartureDate,
TOC_TicketCost,
TOC_WL,
TOC_OtherCost,
TOC_VEI_SN
)
VALUES(?,getdate(),{$CCSN},?,?,?,?,(SELECT isnull(COLI_OPI_ID,29) FROM BIZ_ConfirmLineInfo WHERE COLI_SN={$CCSN}),?)";
$query = $this->HT->query($sql,array($data->TOC_COLD_SN,"%".$data->TOC_Memo."%","退票: ".$data->TOC_Memo,$data->TOC_COLD_SN,$data->TOC_TrainNumber,$data->TOC_DepartureDate,$data->TOC_TicketCost,$data->TOC_VEI_SN));
VALUES(?,getdate(),{$CCSN},?,?,?,?,(SELECT isnull(COLI_OPI_ID,29) FROM BIZ_ConfirmLineInfo WHERE COLI_SN={$CCSN}),null,?),(?,getdate(),{$CCSN},?,?,?,?,(SELECT isnull(COLI_OPI_ID,29) FROM BIZ_ConfirmLineInfo WHERE COLI_SN={$CCSN}),1,?)";
$query = $this->HT->query($sql,array($data->TOC_COLD_SN,"%".$data->TOC_Memo."%",$data->TOC_Memo,$data->TOC_COLD_SN,$data->TOC_TrainNumber,$data->TOC_DepartureDate,$data->TOC_TicketCost,$data->TOC_VEI_SN,$data->TOC_Memo." 手续费",$data->TOC_COLD_SN,$data->TOC_TrainNumber,$data->TOC_DepartureDate,$data->poundage,$data->TOC_VEI_SN));
}
return $query;
}
public function update_cold_planvei_sn($cold_sn,$planveiSn){
@ -326,104 +248,13 @@ class BIZ_train_model extends CI_Model {
$query = $this->HT->query($sql);
return $query->result();
}
//获取能够自动出票的订单列表2.0版本 20240130 zp (coli_state 11 我的订单 8 已收款 63 出票中 13 新订单(已支付))
function auto_check_ticket_2(){
$sql = "SELECT top 10 COLD_SN ,coli_id,COLD_SPFS,COLI_State,(SELECT TOP 1 GAI_Type FROM BIZ_GroupAccountInfo WHERE GAI_COLI_SN=bcli.COLI_SN AND ISNULL(DeleteFlag,0)=0) as GAI_Type
,cold_startdate
,isnull((select top 1 ts_autotimes from InfoManager.dbo.trainsystem where ts_cold_sn= bcld.cold_sn order by ts_id desc),0) as ts_autotimes
,(select top 1 ts_autolasttime from InfoManager.dbo.trainsystem where ts_cold_sn= bcld.cold_sn order by ts_id desc) as ts_autolasttime
FROM BIZ_ConfirmLineInfo bcli
inner join BIZ_ConfirmLineDetail bcld on COLD_COLI_SN=COLI_SN
INNER JOIN dbo.OperatorInfo ON OPI_SN=COLI_OPI_ID and OPI_DEI_SN=10 AND ISNULL(dbo.OperatorInfo.DeleteFlag,0)=0
WHERE bcli.COLI_ServiceType = '2'
AND bcli.COLI_State in ('13','63')
AND EXISTS(SELECT sum(GAI_SQJE) FROM BIZ_GroupAccountInfo WHERE GAI_COLI_SN=bcli.COLI_SN AND isnull(DeleteFlag,0) = 0 having (bcli.COLI_Price - Sum(GAI_SQJE)) <= 20 AND (Sum(GAI_SQJE) - bcli.COLI_Price) >= -20 )
AND isnull(bcli.DeleteFlag,0) = 0
AND isnull(bcld.DeleteFlag,0) = 0
AND COLD_SPFS < 2
AND ( NOT EXISTS (
SELECT TOP 1 1
FROM InfoManager.dbo.trainsystem
WHERE ts_cold_sn = COLD_SN
) or EXISTS(select Top 1 1 from InfoManager.dbo.trainsystem WHERE ts_cold_sn = COLD_SN
and (ts_status = '5' or ts_status='11')
and ts_cold_sn not in (select ts_cold_sn from InfoManager.dbo.trainsystem
where (ts_status='4' or ts_status='3' or ts_status='2' or ts_status='10') and ts_cold_sn = COLD_SN) ))
AND COLD_SN NOT IN ( select FOI_COLD_SN from BIZ_FlightsOrderInfo where FOI_COLD_SN=COLD_SN and FOI_TrainNetOrderNo>'')
and (COLD_StartDate between GETDATE() and CONVERT(varchar(100),GETDATE()+14,23)+' 23:59')
and isnull((select top 1 ts_autotimes from InfoManager.dbo.trainsystem where ts_cold_sn= bcld.cold_sn order by ts_id desc),0)<4
order by CONVERT(date,cold_startdate),ISNULL(CAST((select TOP 1 TST_saletime from TrainSaleTime where TST_station_cn = (
SELECT TOP 1 TRS_StationCN
FROM TrainStation
WHERE TRS_Code = (select top 1 DepartAirport from BIZ_FlightsOrderInfo where FOI_COLD_SN = cold_sn)
and ISNULL(TRS_StationCN,'')<>''
)) as Time),'18:00')
";
$query = $this->HT->query($sql);
return $query->result();
}
public function get_saletime($station){
$sql = 'select TST_saletime from TrainSaleTime where TST_station_cn = ?';
$query = $this->HT->query($sql,$station);
return $query->row();
}
//预售时间列表
public function get_presale_list($pagesize=10,$page=0,$where="1=1"){
$data=new StdClass();
//获取总条数
$sql="SELECT COUNT(*) AS count FROM TrainSaleTime
WHERE
{$where}
";
$query = $this->HT->query($sql);
$count=$query->result();
$data->count=$count[0]->count;
$sql="SELECT TOP {$pagesize} TST_id,TST_station_cn,TST_station_code,TST_saletime,TST_updatetime from TrainSaleTime
WHERE
TST_id not in ( select top {$page} TST_id from TrainSaleTime where {$where} Order by isnull(TST_updatetime,0) desc,TST_id desc)
AND
{$where}
ORDER BY isnull(TST_updatetime,0) desc,TST_id desc ";
$query = $this->HT->query($sql);
$data->list=$query->result();
return $data;
}
//预售时间详细
public function get_saletime_detail($tstid){
$sql = 'select * from TrainSaleTime where TST_id = ?';
$query = $this->HT->query($sql,$tstid);
return $query->row();
}
//更新预售时间
public function update_saletime($data){
$sql = "update TrainSaleTime
set
TST_station_cn = '{$data->TST_station_cn}',
TST_saletime = '{$data->TST_saletime}',
TST_station_code = '{$data->TST_station_code}',
TST_updatetime = getdate()
where TST_id = '{$data->TST_id}' ";
$query = $this->HT->query($sql);
}
//添加预售时间
public function add_saletime($data){
$sql = " insert into TrainSaleTime (TST_station_cn,TST_saletime,TST_station_code,TST_updatetime)
values (?,?,?,getdate()) ";
$query = $this->HT->query($sql ,array($data->TST_station_cn,$data->TST_saletime,$data->TST_station_code));
}
//筛选符合发送邮件的订单
public function auto_sendmail(){
$time = date('Y-m-d',time());
@ -665,32 +496,4 @@ class BIZ_train_model extends CI_Model {
$sql = "delete from trainsystem where ts_id = '860'";
$query = $this->INFO->query($sql);
}
//添加澜海账单到汉特
function add_lanhai_bill($data){
//2.添加
$sql2 = "insert into BIZ_Platform_BookingInfo_XC (
XC_BillSN,XC_BillDate,XC_OrderID,XC_VEIName,XC_From,XC_BillType,XC_Cost,XC_Memo,XC_Creator,XC_CreateDate
) values (
'{$data->BillSn}',
'{$data->BillDate}',
'{$data->OrderId}',
'{$data->VEIName}',
'{$data->From}',
'{$data->BillType}',
'{$data->Cost}',
'{$data->Memo}',
'29',
getdate()
)";
$query = $this->HT->query($sql2);
}
//删除重复数据
function del_lanhai_bill($BillSn){
//1.删除数据 ,防止重复,根据 XC_BillSn
$sql = "delete from BIZ_Platform_BookingInfo_XC where XC_BillSn = '{$BillSn}' and XC_VEIName='9082253783' ";
$query=$this->HT->query($sql);
}
}

@ -5,8 +5,8 @@ class train_system_model extends CI_Model {
function __construct() {
parent::__construct();
$this->HT = $this->load->database('TOURMANAGER_LOCAL', TRUE);
$this->INFO = $this->load->database('INFORMATION_LOCAL', TRUE);
$this->HT = $this->load->database('HT', TRUE);
$this->INFO = $this->load->database('INFO', TRUE);
}
//获取订单(用于订单列表)
@ -38,10 +38,8 @@ class train_system_model extends CI_Model {
InfoManager.dbo.trainsystem.ts_sendmail,
InfoManager.dbo.trainsystem.ts_m_sn,
InfoManager.dbo.trainsystem.ts_channel,
InfoManager.dbo.trainsystem.ts_autotimes,
BIZ_ConfirmLineInfo.COLI_ID,
BIZ_ConfirmLineInfo.COLI_WebCode
,(select top 1 OPI2_Name from OperatorInfo2 where OPI2_OPI_SN = coli_opi_id and OPI2_LGC=2) as OPIName
FROM
InfoManager.dbo.trainsystem
LEFT JOIN
@ -63,9 +61,7 @@ class train_system_model extends CI_Model {
AND
{$where}
ORDER BY InfoManager.dbo.trainsystem.ts_subtime DESC";
// echo($sql);
// die();
$query = $this->HT->query($sql);
$data->list=$query->result();
return $data;
@ -99,10 +95,7 @@ class train_system_model extends CI_Model {
ts_runtime,
ts_checi,
ts_channel,
ts_isauto,
ts_autotimes,
ts_autolasttime,
ts_lanhaiData
ts_isauto
)
VALUES(
'{$data->cold_sn}',
@ -121,10 +114,7 @@ class train_system_model extends CI_Model {
'{$data->runtime}',
'{$data->checi}',
'{$data->channel}',
'{$data->isauto}',
'{$data->ts_autotimes}',
getdate(),
'{$data->lanhaiData}'
'{$data->isauto}'
)
";
//echo $sql;
@ -132,7 +122,7 @@ class train_system_model extends CI_Model {
}
public function ticketfrom($ts_ordernumber){
$sql = "select ts_channel,ts_cold_sn,ts_ordernumber,ts_lanhaiData from trainsystem where ts_ordernumber = ?";
$sql = "select ts_channel,ts_cold_sn,ts_ordernumber from trainsystem where ts_ordernumber = ?";
$query = $this->INFO->query($sql,array($ts_ordernumber));
return $query->row();
}
@ -156,8 +146,7 @@ class train_system_model extends CI_Model {
tst_seatstype = '{$data->seatype}',
tst_seatdetail = '{$data->seatdetail}',
tst_status = '{$data->status}',
tst_LongTrainNo = '{$data->longtrainno}',
tst_lanhaiData = '{$data->lanhaiData}'
tst_LongTrainNo = '{$data->longtrainno}'
where
tst_ordernumber = '{$data->ordernumber}'
and
@ -175,8 +164,7 @@ class train_system_model extends CI_Model {
tst_ticketprice,
tst_seatstype,
tst_seatdetail,
tst_LongTrainNo,
tst_lanhaiData
tst_LongTrainNo
)VALUES(
'{$data->ordernumber}',
'{$data->status}',
@ -187,8 +175,7 @@ class train_system_model extends CI_Model {
'{$data->ticketprice}',
'{$data->seatype}',
'{$data->seatdetail}',
'{$data->longtrainno}',
'{$data->lanhaiData}'
'{$data->longtrainno}'
)
";
$query =$this->INFO->query($sql);
@ -203,20 +190,12 @@ class train_system_model extends CI_Model {
ts_checkdoor = '{$data->TicketCheck}',
ts_elecnumber = '{$data->ElectronicOrderNumber}',
ts_orderamount = '{$data->OrderTotleFee}',
ts_operateTradeNo = '{$data->operateTradeNo}',
ts_bookcallback = '{$data->bookcallback}',";
//ts_startime = '{$data->OrderTicketTime}',
}else if(!empty($data->ticketresultcallback)){
$where .= "ts_ticketresultcallback = '{$data->ticketresultcallback}',";
ts_bookcallback = '{$data->bookcallback}',
ts_startime = '{$data->OrderTicketTime}',";
}else if(!empty($data->confirmcallback)){
$where .= "ts_confirmcallback = '{$data->confirmcallback}',";
}else if(!empty($data->refundcallback )){
$where .= "ts_refundcallback = '{$data->refundcallback }',";
}else if(!empty($data->returncallback)){
$where .= "ts_returncallback = '{$data->returncallback}',";
if (!empty($data->operateTradeNo)){
$where .= "ts_operateTradeNo = '{$data->operateTradeNo}',";
}
}else if(!empty($data->reschedulecallback)){
$where .= "ts_reschedulecallback = '{$data->reschedulecallback}',";
}
@ -232,39 +211,6 @@ class train_system_model extends CI_Model {
//echo $sql;die();
$query = $this->INFO->query($sql);
}
//更新订单信息,下订单和支付保存状态
public function update_orders_msg($data){
$where = '';
if(!empty($data->bookcallback)){
$where .= " ts_bookcallback = '{$data->bookcallback}',";
}else if(!empty($data->confirmcallback)){
$where .= "ts_confirmcallback = '{$data->confirmcallback}',";
}else if(!empty($data->returncallback)){
$where .= "ts_returncallback = '{$data->returncallback}',";
}else if(!empty($data->reschedulecallback)){
$where .= "ts_reschedulecallback = '{$data->reschedulecallback}',";
}
if (!empty($data->addOrderData)) {
//失败了保存提交的订单数据
$where .= " ts_addOrderData = '{$data->addOrderData}',";
}
$sql ="
update trainsystem
set
ts_status = '{$data->OrderStatus}',
ts_errormsg = '{$data->ErrorMsg}',
".substr($where,0,strlen($where)-1)."
where
ts_ordernumber = '{$data->ordernumber}'
";
//echo $sql;die();
$query = $this->INFO->query($sql);
}
//更新乘客表信息
public function update_passpager_info($data){
@ -283,41 +229,7 @@ class train_system_model extends CI_Model {
";
$query = $this->INFO->query($sql);
}
//更新乘客表信息,顺途新退票不再返回用户姓名及证件号码用longElecNo长电子订单号来判断 2023-4-28 zp
public function return_update_passpager_info($data){
$sql = "update
trainsystem_tickets
set
tst_status = '{$data->status}',
tst_returncallback = '{$data->returncallback}',
tst_lasteditdate = getdate()
where
tst_ordernumber = '{$data->ordernumber}'
and
tst_LongTrainNo = '{$data->longElecNo}'
";
$query = $this->INFO->query($sql);
}
/**
* 更新退票后的乘客信息澜海退票返回乘客的ID其它信息没有。
*/
public function return_update_passager_lanhai($data){
$sql = "update
trainsystem_tickets
set
tst_status = '{$data->status}',
tst_returncallback = '{$data->returncallback}',
tst_lasteditdate = getdate()
where
tst_id = '{$data->tst_id}'
";
$query = $this->INFO->query($sql);
}
//获取订单出票状态
public function get_tickets_info($cold_sn){
$sql = "select top 1 ts_status,ts_ordernumber,ts_elecnumber,ts_seatsinfo from trainsystem where ts_cold_sn = ? and ts_status in ('4','7') order by ts_subtime desc";
@ -352,54 +264,4 @@ class train_system_model extends CI_Model {
$query = $this->INFO->query($sql,array($ordernumber));
return $query->result();
}
//传入COLD_SN获取trainsystem是否存在此订单用来判断是否提交过
function get_submitStatus($cold_sn) {
$sql = "SELECT top 1 ts_cold_sn FROM trainsystem WHERE ts_cold_sn= ?";
$query = $this->INFO->query($sql, $cold_sn);
if($query->num_rows() == 0){
return true;
}else{
return false;
}
}
//获取出票次数,不管是自动还是手动。
public function get_autotimes($cold_sn){
$sql = "select COUNT(*) as countauto from InfoManager.dbo.trainsystem where ts_cold_sn = ? and ts_status=5";
$query = $this->INFO->query($sql, $cold_sn);
return $query->row();
}
/**
* 根据客人ID获取客人信息及出票信息
*/
public function get_passenger_byId($tst_id){
$sql = "select top 1 * from trainsystem_tickets inner join trainsystem on tst_ordernumber=ts_ordernumber and tst_id = ?";
$query = $this->INFO->query($sql,array($tst_id));
return $query->row();
}
//根据订单号获取外联名称
public function get_OPIName($orderNumber){
$sql = "select top 1
(SELECT TOP 1 OPI2_Name
FROM OperatorInfo2
WHERE OPI2_OPI_SN = coli_opi_id
AND OPI2_LGC = 2
) AS OPIName,
(select top 1 Gri_No from GRoupInfo where GRI_SN=BIZ_ConfirmLineInfo.COLI_GRI_SN) as griName
FROM InfoManager.dbo.trainsystem
INNER JOIN BIZ_ConfirmLineInfo ON BIZ_ConfirmLineInfo.COLI_SN = (
SELECT COLD_COLI_SN
FROM BIZ_ConfirmLineDetail
WHERE COLD_SN = InfoManager.dbo.trainsystem.ts_cold_sn
)
where ts_ordernumber=?
";
$query = $this->HT->query($sql,array($orderNumber));
return $query->row();
}
}

@ -5,8 +5,8 @@
</div>
<div class="panel-body">
<form style="width: 80%;" action="http://www.mycht.cn/info.php/apps/trainsystem/api/export_excel/" method="post">
<input type="text" name="from_date" class="date" value="<?php echo empty($from_date)?"":$from_date;?>" autocomplete="off" placeholder="开始日期">&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="to_date" class="date" value="<?php echo empty($to_date)?"":$to_date;?>" autocomplete="off" placeholder="结束日期">
<input type="text" name="from_date" class="date" value="<?php echo empty($from_date)?"":$from_date;?>" autocomplete="off">
<input type="text" name="to_date" class="date" value="<?php echo empty($to_date)?"":$to_date;?>" autocomplete="off">
审核状态:<input type="checkbox" <?php echo empty($examine)?"":"checked";?> name="examine" />&nbsp;&nbsp;&nbsp;
<button type="submit" id="sub" class="btn btn-warning btn-sm"><span class="glyphicon glyphicon-download-alt"></span> Download</button>
</form>

@ -1,81 +0,0 @@
<div style="width:90%;margin:30px auto;">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">交易记录导出&nbsp;<a style="margin-left:50px;" target='_blank' href="<?php echo site_url('apps/train/index/ht_order_list');?>">订单列表>></a> </h3>
</div>
<div class="panel-body">
<form style="width: 80%;" action="/info.php/apps/trainsystem/api/lanhai_export_excel/" method="post">
<input type="text" name="from_date" class="date" value="<?php echo empty($from_date)?"":$from_date;?>" autocomplete="off" placeholder="开始日期">&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="to_date" class="date" value="<?php echo empty($to_date)?"":$to_date;?>" autocomplete="off" placeholder="结束日期">
显示列表:<input type="checkbox" <?php echo empty($examine)?"":"checked";?> name="examine" />&nbsp;&nbsp;|&nbsp;&nbsp;
导入汉特:<input type="checkbox" <?php echo empty($importht)?"":"checked";?> name="importht" />&nbsp; <a href="javascript:void(0);" title="勾选此项后,会以开始时间和结束时间为编码把数据导入汉特。&#10 注意:为了防止重复 请不要有同一时间段的导入。比如8月1日到30日导入然后8月1日到29日又导入一次。"><i
class="text-muted glyphicon glyphicon-question-sign"></i></a>&nbsp;&nbsp;&nbsp;
<button type="submit" id="sub" class="btn btn-warning btn-sm"><span class="glyphicon glyphicon-download-alt"></span> Download</button>
&nbsp;<a href="javascript:void(0);" title="什么都不选点击此按钮下载EXCEL账单选择显示列表就只显示数据。&#10 选择导入汉特后会单独另外进行一个导入的操作。"><i
class="text-muted glyphicon glyphicon-question-sign"></i></a>
</form>
<p style="margin: 0 0 10px; width: 200px; float: left; line-height: 30px;">
<!-- <table class="table table-hover" >
<thead>
<tr><th>时间</th><th>信息</th><th>变化值</th><th>团名</th><th>外联</th></tr>
</thead>
<tbody>
<tr data-id="161130252" title="Popover title" data-container="body" data-toggle="popover" data-placement="top" data-content="顶部的 Popover 中的一些内容">
<td>2016-12-01 11:18:28</td>
<td> 票款(有充值)</td>
<td>-1106.00</td>
<td>R161228-BYW161130252</td>
<td>李毅文</td>
</tr>
</tbody>
</table> -->
<div class="row <?php echo empty($examine)?"hidden":"";?>" style="width:90%;margin:0 auto;">
<div class="">
<table class="table table-hover" id="list_table">
<thead>
<tr><th>日期</th><th>类型</th><th>金额</th><th>订单号</th><th>外联</th><th>团号</th><th>乘客</th></tr>
</thead>
<tbody>
<?php $total=0; $count=0; foreach ($data as $key => $value) {?>
<tr data-id="<?php echo $value["mainOrderId"];?>" title="Popover title" data-container="body" data-toggle="popover" data-placement="top" data-content="顶部的 Popover 中的一些内容">
<td><?php echo $value["saveDay"];?></td><td><?php echo $value["type"];?></td><td><?php echo $value["price"];?></td><td><?php echo $value["mainOrderId"];?></td>
<td><?php echo $value["wl"];?></td><td><?php echo $value["griName"];?></td><td><?php echo $value["passengerName"];?></td>
</tr>
<?php $total += $value["price"]; $count+=1; }?>
<tr><td colspan="2">总额:</td><td colspan="2"><?php echo($total) ?></td><td>记录数:</td><td colspan="2"><?php echo($count) ?></td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="popover fade top in" role="tooltip" id="popover" style="width:auto;max-width: 100% !important;top: 139.6px; left: 50%; display: none;">
<div class="arrow"></div>
<h3 class="popover-title">我的支付</h3>
<div class="popover-content">
<table class="table" id="my_pay_data">
<thead>
<tr>
<td>序号</td><td>车次</td><td>出发日期</td><td>价格</td><td>备注</td>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<script>
$(function(){
$(".date").datepicker({
'dateFormat': 'yy-mm-dd',
'autoclose': true
});
})
</script>

@ -45,8 +45,8 @@ $(function(){
function selseat(seat){
var type = $(seat).attr('type');
var total = $(seat).parent().parent().find('.train-summary .seat_TotalPeople').html();
if(total>=10){
total = 10;
if(total>=5){
total = 5;
$('.seat_TotalPeople').html(total);
}
var count = $(seat).parent().parent().find('.selected').length;
@ -77,8 +77,7 @@ function selseat(seat){
<div style="width:90%;margin:30px auto;">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">翰特订单号&nbsp;<a style="margin-left:50px;" target='_blank' href="<?php echo site_url('apps/trainsystem/pages/order_list');?>">订单列表>></a><a style="margin-left:50px;" target='_blank' href="<?php echo site_url('apps/trainsystem/pages/presale_list');?>">预售时间维护>></a> <a style="margin-left:50px;" target='_blank' href="<?php echo site_url('apps/trainsystem/pages/lanhaiExport');?>">澜海导出账单>></a><span style="margin-left:200px;">版本V2.0</span><!--<span class="pull-right">聚合余额(RMB)<?php echo $balance;?></span> --></h3>
<!-- <a style="margin-left:50px;" target='_blank' href="<?php echo site_url('apps/trainsystem/pages/reschedule');?>">携程改签>></a> -->
<h3 class="panel-title">翰特订单号&nbsp;<a style="margin-left:50px;" target='_blank' href="<?php echo site_url('apps/trainsystem/pages/order_list');?>">订单列表>></a><a style="margin-left:50px;" target='_blank' href="<?php echo site_url('apps/trainsystem/pages/reschedule');?>">携程改签>></a><a style="margin-left:50px;" target='_blank' href="<?php echo site_url('apps/trainsystem/pages/export');?>">导出交易记录>></a> <span style="margin-left:200px;">版本V2.0</span><span class="pull-right">聚合余额(RMB)<?php echo $balance;?></span></h3>
</div>
<div class="panel-body">
<form style="width: 300px;float: left;" action="/info.php/apps/trainsystem/pages/index/" method="post">
@ -136,15 +135,12 @@ function selseat(seat){
<th style="text-align:center;">姓名</th>
<th style="text-align:center;">护照</th>
<th style="text-align:center;">年龄类型</th>
<th style="text-align:center;">出生年月</th>
<th style="text-align:center;">证件有效期</th>
<th style="text-align:center;">国籍</th>
</tr>
</thead>
<tbody>
<?php foreach($v->people as $key=>$p): ?>
<tr>
<?php if ($key < 10){?>
<?php if ($key < 5){?>
<td><input name="" type="checkbox" checked="checked" value="<?php echo $p->BPE_SN;?>" num="<?php echo $key;?>"/></td>
<?php }else{ ?>
<td><input name="" type="checkbox" value="<?php echo $p->BPE_SN;?>" /></td>
@ -153,9 +149,6 @@ function selseat(seat){
<td class="people_name"><?php echo $p->BPE_FirstName." ".$p->BPE_MiddleName." ".$p->BPE_LastName;?></td>
<td><?php echo $p->BPE_Passport;?></td>
<td><?php echo $p->BPE_GuestType==1?"成人":($p->BPE_GuestType==2?"儿童":"婴儿");?></td>
<td><?php echo $p->BPE_BirthDate;?></td>
<td><?php echo $p->BPE_PassExpdate;?></td>
<td><?php echo $p->Nationality . "(".$p->BPE_Nationality .")"; ?></td>
</tr>
<?php endforeach;?>
<tr style="text-align:;">
@ -299,7 +292,7 @@ function selseat(seat){
</tr>
<tr style="text-align:;">
<td>
<button type="button" class="btn btn-success checked_pay" data-order="<?php echo $v->train->FOI_COLD_SN;?>">澜海订票</button>
<button type="button" class="btn btn-success checked_pay" data-order="<?php echo $v->train->FOI_COLD_SN;?>">聚合订票</button>
</td>
<td colspan="4" class="biaoqian"><span class="back_mes" style="color:red;line-height: 30px;"></span>
</td>
@ -411,7 +404,7 @@ function selseat(seat){
var cold_sn = $(this).attr('data-order');
var istanding = $('input[name="istanding_'+cold_sn+'"]').is(':checked');
url2+=$(this).attr("data-order")+"&people="+people_sn+"&selectseat="+selectseat+"&type=lanhai&istanding="+istanding;
url2+=$(this).attr("data-order")+"&people="+people_sn+"&selectseat="+selectseat+"&type=juhe&istanding="+istanding;
var THIS=$(this);
THIS.parent().parent().find(".back_mes").html(" ");//清空提示
@ -423,7 +416,7 @@ function selseat(seat){
},
success:function(data){
THIS.removeAttr("disabled");
THIS.html("澜海订票");
THIS.html("聚合订票");
var str = "<a href='http://www.mycht.cn/info.php/apps/trainsystem/pages/order?order="+data.order+"' target='_blank'>"+data.mes+"</a>";
THIS.parent().parent().find(".back_mes").html(str);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save