Merge branch 'master' of gitee.com:hainatravel/information-system

feature/pay
cyc 6 years ago
commit 64efa74490

@ -3,9 +3,11 @@
if (!defined('BASEPATH')) if (!defined('BASEPATH'))
exit('No direct script access allowed'); exit('No direct script access allowed');
class Information extends CI_Controller { class Information extends CI_Controller
{
function __construct() { function __construct()
{
parent::__construct(); parent::__construct();
$this->permission->is_admin(); $this->permission->is_admin();
//$this->output->enable_profiler(TRUE); //$this->output->enable_profiler(TRUE);
@ -22,11 +24,13 @@ class Information extends CI_Controller {
$this->load->library('Amplib'); //加载AMP处理类 $this->load->library('Amplib'); //加载AMP处理类
} }
public function index() { public function index()
{
echo '信息首页'; echo '信息首页';
} }
public function add($is_parent_id) { public function add($is_parent_id)
{
//添加空内容. //添加空内容.
$this->InfoContents_model->Add('', 'New Information', '', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', 0, '', 0, '', ''); $this->InfoContents_model->Add('', 'New Information', '', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', 0, '', 0, '', '');
$infocontent = $this->InfoContents_model->get_ic_contents($this->InfoContents_model->insert_id); $infocontent = $this->InfoContents_model->get_ic_contents($this->InfoContents_model->insert_id);
@ -44,7 +48,8 @@ class Information extends CI_Controller {
} }
//移动结构顺序 //移动结构顺序
public function move() { public function move()
{
//网站会提交一个同级节点id列表字符串按照这个去排序 //网站会提交一个同级节点id列表字符串按照这个去排序
$parent_id = $this->input->post('pid'); $parent_id = $this->input->post('pid');
$idsStr = $this->input->post('ids'); $idsStr = $this->input->post('ids');
@ -65,7 +70,8 @@ class Information extends CI_Controller {
//把文章移动到任意板块文章下 //把文章移动到任意板块文章下
//is_id 信息结构IDis_parent_id即将转移到的信息结构id //is_id 信息结构IDis_parent_id即将转移到的信息结构id
public function move_by_is_id() { public function move_by_is_id()
{
$data = array(); $data = array();
$is_id = $this->input->post('is_id'); $is_id = $this->input->post('is_id');
$is_parent_id = $this->input->post('is_parent_id'); $is_parent_id = $this->input->post('is_parent_id');
@ -90,7 +96,8 @@ class Information extends CI_Controller {
return TRUE; return TRUE;
} }
public function delete($is_id) { public function delete($is_id)
{
//查询结构信息 //查询结构信息
$Structure = $this->InfoStructures_model->Detail($is_id); $Structure = $this->InfoStructures_model->Detail($is_id);
if ($Structure == FALSE) { if ($Structure == FALSE) {
@ -124,7 +131,8 @@ class Information extends CI_Controller {
} }
} }
public function edit($is_id) { public function edit($is_id)
{
set_time_limit(30); set_time_limit(30);
//$this->output->enable_profiler(true); //$this->output->enable_profiler(true);
//查询结构信息 //查询结构信息
@ -188,37 +196,37 @@ class Information extends CI_Controller {
if ($Structure->is_sitecode=='ct'){ if ($Structure->is_sitecode == 'ct') {
$data['infoTypeList'] = $this->config->item('InfoType_ct'); $data['infoTypeList'] = $this->config->item('InfoType_ct');
}else { } else {
switch ($data['rootInformation']->ic_ht_area_type) { switch ($data['rootInformation']->ic_ht_area_type) {
case 'c': //城市 case 'c': //城市
$data['infoTypeList'] = $this->config->item('InfoType_city'); $data['infoTypeList'] = $this->config->item('InfoType_city');
$data['unlink_landscape_list'] = $this->Information_model->get_unlink_landscape_list($data['rootInformation']->ic_ht_area_id); $data['unlink_landscape_list'] = $this->Information_model->get_unlink_landscape_list($data['rootInformation']->ic_ht_area_id);
break; break;
case 'p'://省份 case 'p': //省份
$data['infoTypeList'] = $this->config->item('InfoType_province'); $data['infoTypeList'] = $this->config->item('InfoType_province');
break; break;
case 'n'://国家 case 'n': //国家
$data['infoTypeList'] = $this->config->item('InfoType_country'); $data['infoTypeList'] = $this->config->item('InfoType_country');
break; break;
case 't'://特殊区域 case 't': //特殊区域
$data['infoTypeList'] = $this->config->item('InfoType_special'); $data['infoTypeList'] = $this->config->item('InfoType_special');
break; break;
case 'e'://大洲 case 'e': //大洲
$data['infoTypeList'] = array(); $data['infoTypeList'] = array();
break; break;
case 'z'://公民游 case 'z': //公民游
$data['infoTypeList'] = $this->config->item('InfoType_citizen'); $data['infoTypeList'] = $this->config->item('InfoType_citizen');
break; break;
case 'v'://视频 case 'v': //视频
$data['infoTypeList'] = $this->config->item('InfoType_video'); $data['infoTypeList'] = $this->config->item('InfoType_video');
break; break;
case 'f'://节庆 case 'f': //节庆
$data['infoTypeList'] = $this->config->item('InfoType_festival'); $data['infoTypeList'] = $this->config->item('InfoType_festival');
break; break;
case 'pd'://产品管理 case 'pd': //产品管理
$data['infoTypeList'] = $this->config->item('InfoType_product'); $data['infoTypeList'] = $this->config->item('InfoType_product');
//LMR 2016-7-14 //LMR 2016-7-14
if (in_array($this->config->item('site_code'), array('vac', 'vc', 'jp', 'ru', 'it'))) { if (in_array($this->config->item('site_code'), array('vac', 'vc', 'jp', 'ru', 'it'))) {
@ -297,7 +305,8 @@ class Information extends CI_Controller {
exit(); exit();
} */ } */
public function test_proxy($url = false) { public function test_proxy($url = false)
{
$curl = curl_init(); $curl = curl_init();
//curl_setopt($curl,CURLOPT_URL, "http://graph.facebook.com/?id=http://www.chinahighlights.com"); //curl_setopt($curl,CURLOPT_URL, "http://graph.facebook.com/?id=http://www.chinahighlights.com");
//curl_setopt($curl,CURLOPT_URL, 'http://graph.facebook.com/?id=http://www.mybeijingchina.com/beijing-attractions/beihai-park/'); //curl_setopt($curl,CURLOPT_URL, 'http://graph.facebook.com/?id=http://www.mybeijingchina.com/beijing-attractions/beihai-park/');
@ -313,7 +322,8 @@ class Information extends CI_Controller {
} }
// 分享数 lzq // 分享数 lzq
public function statistical_sharing() { public function statistical_sharing()
{
//$info_ic = $this->Information_model->get_ic_url_by_code('mbj'); //$info_ic = $this->Information_model->get_ic_url_by_code('mbj');
$info_ic = $this->Information_model->get_ic_url(); $info_ic = $this->Information_model->get_ic_url();
@ -355,7 +365,8 @@ class Information extends CI_Controller {
$this->load->view('bootstrap3/statistical_sharing'); $this->load->view('bootstrap3/statistical_sharing');
} }
public function edit_save() { public function edit_save()
{
header('Cache-Control: no-cache'); header('Cache-Control: no-cache');
$information = $this->Information_model->Detail($this->input->post('is_id')); $information = $this->Information_model->Detail($this->input->post('is_id'));
if ($information === false) { if ($information === false) {
@ -387,18 +398,18 @@ class Information extends CI_Controller {
//AMP更新和生成 beign //AMP更新和生成 beign
$auto_update_amp = $this->input->get_post('auto_update_amp'); $auto_update_amp = $this->input->get_post('auto_update_amp');
if (!empty($auto_update_amp) && $auto_update_amp == 'true' && $this->input->post('ic_status') == 1) { if (!empty($auto_update_amp) && $auto_update_amp == 'true' && $this->input->post('ic_status') == 1) {
$amp_result=$this->amplib->auto_create($information->ic_id); $amp_result = $this->amplib->auto_create($information->ic_id);
if (!empty($amp_result)) { if (!empty($amp_result)) {
$amp_result = json_decode($amp_result); $amp_result = json_decode($amp_result);
if($amp_result->result=='ok'){ if ($amp_result->result == 'ok') {
$amp_save_result= $this->amplib->edit_save($information->ic_id,$amp_result->data->amp,'1'); $amp_save_result = $this->amplib->edit_save($information->ic_id, $amp_result->data->amp, '1');
if(!empty($amp_save_result)){ if (!empty($amp_save_result)) {
$amp_save_result = json_decode($amp_save_result); $amp_save_result = json_decode($amp_save_result);
if($amp_save_result->name=='no'){ if ($amp_save_result->name == 'no') {
echo json_encode(array('name' => 'no', 'value' => 'AMP转换语法错误请重新进入AMP编辑器检查')); echo json_encode(array('name' => 'no', 'value' => 'AMP转换语法错误请重新进入AMP编辑器检查'));
return; return;
} }
} }
} }
} }
} }
@ -428,7 +439,7 @@ class Information extends CI_Controller {
$update_info_log = $this->update_cache($ic_url, true); $update_info_log = $this->update_cache($ic_url, true);
} else if (strcasecmp($site_code, "cht") == 0 && !empty($auto_update_cache)) { } else if (strcasecmp($site_code, "cht") == 0 && !empty($auto_update_cache)) {
$update_info_log = $this->update_cache($ic_url); $update_info_log = $this->update_cache($ic_url);
} else if (strcasecmp($site_code, "cht") != 0 && strcasecmp($site_code, "gm") != 0) {//非cht站点并且非GM } else if (strcasecmp($site_code, "cht") != 0 && strcasecmp($site_code, "gm") != 0) { //非cht站点并且非GM
$update_info_log = $this->update_cache($ic_url); $update_info_log = $this->update_cache($ic_url);
} }
@ -470,7 +481,8 @@ class Information extends CI_Controller {
} }
//URL不重复检查 //URL不重复检查
function ic_url_check() { function ic_url_check()
{
if ($this->input->post('ignore_url_check')) { if ($this->input->post('ignore_url_check')) {
return true; return true;
} }
@ -484,7 +496,8 @@ class Information extends CI_Controller {
} }
//URL格式检查不能包含大小写、空格等特殊字符 //URL格式检查不能包含大小写、空格等特殊字符
function ic_url_format($url) { function ic_url_format($url)
{
if ($url != mb_strtolower($url) || strpos($url, ' ') !== false || strpos($url, '--') !== false || strpos($url, ')') !== false || strpos($url, '(') !== false || strpos($url, '//') !== false || strpos($url, '\\') !== false) { if ($url != mb_strtolower($url) || strpos($url, ' ') !== false || strpos($url, '--') !== false || strpos($url, ')') !== false || strpos($url, '(') !== false || strpos($url, '//') !== false || strpos($url, '\\') !== false) {
return false; return false;
} }
@ -493,7 +506,8 @@ class Information extends CI_Controller {
//更新静态文件 //更新静态文件
//不用参数提交的原因是可能url带有特殊字符CI会报错 //不用参数提交的原因是可能url带有特殊字符CI会报错
public function update_cache($static_html_url = false, $delete_only = false) { public function update_cache($static_html_url = false, $delete_only = false)
{
$url = !empty($static_html_url) ? $static_html_url : $this->input->post('cache_url'); $url = !empty($static_html_url) ? $static_html_url : $this->input->post('cache_url');
$url = str_replace($this->config->item('site_url'), '', $url); $url = str_replace($this->config->item('site_url'), '', $url);
$original_url = $url; //原始链接 $original_url = $url; //原始链接
@ -518,7 +532,7 @@ class Information extends CI_Controller {
case 'ah': case 'ah':
if ($delete_only === true) { if ($delete_only === true) {
$url = 'https://www.asiahighlights.com/index.php/information/delete_cache_8X913mksJ/?static_html_url=' . $url; $url = 'https://www.asiahighlights.com/index.php/information/delete_cache_8X913mksJ/?static_html_url=' . $url;
} else {// static_html_optimize=comeon 启用静态化压缩和js、css延迟加载 } else { // static_html_optimize=comeon 启用静态化压缩和js、css延迟加载
$url = 'https://www.asiahighlights.com/index.php/information/detail/?static_html_url=' . $url . '&static_html_optimize=comeon'; $url = 'https://www.asiahighlights.com/index.php/information/detail/?static_html_url=' . $url . '&static_html_optimize=comeon';
} }
break; break;
@ -534,16 +548,16 @@ class Information extends CI_Controller {
} }
break; break;
case 'vac'://国际站 case 'vac': //国际站
case 'vc': case 'vc':
case 'it': case 'it':
case 'ru': case 'ru':
case 'jp': case 'jp':
if ($delete_only) { $information = $this->Information_model->Detail($url);
if ($delete_only || $information->ic_ht_area_type === 'q') {
//只删除操作在url修改和不发布信息的时候使用 //只删除操作在url修改和不发布信息的时候使用
$url = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url; $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url;
} else { } else {
$information = $this->Information_model->Detail($url);
$tmp = $url; $tmp = $url;
//判断是否是更新信息 //判断是否是更新信息
// 产品页面不能生成静态页面,比如/beijing/hotel/只是为了在导航显示一个链接,如果生成了静态页面,网前只会显示一个空白页面了 // 产品页面不能生成静态页面,比如/beijing/hotel/只是为了在导航显示一个链接,如果生成了静态页面,网前只会显示一个空白页面了
@ -558,9 +572,9 @@ class Information extends CI_Controller {
if (isset($information->ic_type) && $information->ic_type == 'product') { if (isset($information->ic_type) && $information->ic_type == 'product') {
$url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $tmp; $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $tmp;
} }
//int return direct //int return direct
$cache_url = $this->input->post('cache_url'); $cache_url = $this->input->post('cache_url');
if ($url && !$cache_url) { if ($url && !$cache_url) {
/* /*
ignore_user_abort(true); ignore_user_abort(true);
$ch = curl_init(); $ch = curl_init();
@ -577,24 +591,25 @@ class Information extends CI_Controller {
curl_close($ch); curl_close($ch);
*/ */
$data['async_update'] = $url; $data['async_update'] = $url;
$data[] = array('name' => 'ok', 'value' => '信息保存成功请在8秒后检查更新页面。', 'url' => $url); $data[] = array('name' => 'ok', 'value' => '信息保存成功请在8秒后检查更新页面。', 'url' => $url);
//如果是外部调用就返回结果,内部就不返回了 //如果是外部调用就返回结果,内部就不返回了
if ($cache_url) { if ($cache_url) {
echo json_encode($data); echo json_encode($data);
} }
return $data; return $data;
} }
} }
break; break;
case 'ct'://子站点使用 case 'ct': //子站点使用
case 'sht': case 'sht':
case 'gl': case 'gl':
case 'mbj': case 'mbj':
case 'yz': case 'yz':
$url = $this->config->item('site_url') . $url . '@cache@refresh'; $url = $this->config->item('site_url') . $url . '@cache@refresh';
break; break;
default:return false; default:
return false;
break; break;
} }
@ -623,7 +638,8 @@ class Information extends CI_Controller {
} }
//更新CDN缓存 //更新CDN缓存
public function update_cdn($static_html_url = false) { public function update_cdn($static_html_url = false)
{
$flag = false; //false不更新true更新 $flag = false; //false不更新true更新
$update_site = array('jp', 'ru'); //需要更新CDN的站点 $update_site = array('jp', 'ru'); //需要更新CDN的站点
//需要更新的url //需要更新的url
@ -658,7 +674,8 @@ class Information extends CI_Controller {
} }
//获取产品信息,提供给用户选择进行绑定 //获取产品信息,提供给用户选择进行绑定
function get_products() { function get_products()
{
$HT_productType = $this->input->post('product_type'); $HT_productType = $this->input->post('product_type');
$HT_productName = $this->input->post('product_name'); $HT_productName = $this->input->post('product_name');
//产品类型 //产品类型
@ -679,7 +696,8 @@ class Information extends CI_Controller {
} }
//显示备份的内容 //显示备份的内容
function backup_content($log_id) { function backup_content($log_id)
{
$data['log_info'] = $this->Logs_model->read($log_id); $data['log_info'] = $this->Logs_model->read($log_id);
$data['log_list'] = $this->Logs_model->get_all_backup_list($data['log_info']->log_res_id); $data['log_list'] = $this->Logs_model->get_all_backup_list($data['log_info']->log_res_id);
$this->load->view('bootstrap/header', $data); $this->load->view('bootstrap/header', $data);
@ -688,7 +706,8 @@ class Information extends CI_Controller {
} }
//保存自定义配置 //保存自定义配置
function save_meta() { function save_meta()
{
$im_ic_id = $this->input->post('im_ic_id'); $im_ic_id = $this->input->post('im_ic_id');
$im_key = $this->input->post('im_key'); $im_key = $this->input->post('im_key');
$im_value = $this->input->post('im_value'); $im_value = $this->input->post('im_value');
@ -708,7 +727,8 @@ class Information extends CI_Controller {
} }
//保存自定义配置 //保存自定义配置
function delete_meta() { function delete_meta()
{
$im_ic_id = $this->input->post('im_ic_id'); $im_ic_id = $this->input->post('im_ic_id');
$im_key = $this->input->post('im_key'); $im_key = $this->input->post('im_key');
if ($im_ic_id && $im_key) { if ($im_ic_id && $im_key) {
@ -721,5 +741,4 @@ class Information extends CI_Controller {
echo json_encode($data); echo json_encode($data);
return true; return true;
} }
} }

Loading…
Cancel
Save