|
|
|
|
@ -105,19 +105,155 @@ class Information extends CI_Controller
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//复制节点结构到任意站点的节点下面。-- lmr - 1225
|
|
|
|
|
//is_id 信息结构ID,
|
|
|
|
|
//复制节点结构到任意站点的节点下面。-- lmr
|
|
|
|
|
//[国际->国际]复制节点结构到任意站点的节点下面。-- lmr
|
|
|
|
|
//is_id 信息结构ID,
|
|
|
|
|
public function copy_by_is_id($src_is_id, $dest_is_id)
|
|
|
|
|
{
|
|
|
|
|
if (empty ($src_is_id) || empty ($src_is_id)) {
|
|
|
|
|
echo 'need 2 is_id';
|
|
|
|
|
echo 'need 2 is_id v1';
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$data = array();
|
|
|
|
|
if ($src_is_id == $dest_is_id || empty ($src_is_id) || empty ($dest_is_id)) {
|
|
|
|
|
echo 'need 2 is_id v2';
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 源节点
|
|
|
|
|
$src = $this->InfoStructures_model->Detail($src_is_id);
|
|
|
|
|
$src_path = $this->Information_model->get_list_by_path($src->is_path, false, $src->is_sitecode);
|
|
|
|
|
// 源子节点
|
|
|
|
|
foreach ($src_path as $n => $item) {
|
|
|
|
|
if ($item->is_id === $src->is_id) {
|
|
|
|
|
unset($src_path[$n]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 目标节点结构
|
|
|
|
|
$dest = $this->InfoStructures_model->Detail($dest_is_id);
|
|
|
|
|
$dest_path = $this->Information_model->get_list_by_path($dest->is_path, false, $dest->is_sitecode);
|
|
|
|
|
// 目标子节点
|
|
|
|
|
foreach ($dest_path as $n => $item) {
|
|
|
|
|
if ($item->is_id === $dest->is_id) {
|
|
|
|
|
unset($dest_path[$n]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 新旧节点对应表
|
|
|
|
|
$node_map = array();
|
|
|
|
|
// 循环复制各个层级的节点。
|
|
|
|
|
foreach ($src_path as $n => $item) {
|
|
|
|
|
|
|
|
|
|
// 定位复制的父节点
|
|
|
|
|
$target_is_id = $dest->is_id;
|
|
|
|
|
foreach ($node_map as $old => $new) {
|
|
|
|
|
if ($item->is_parent_id == $old) {
|
|
|
|
|
$target_is_id = $new;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// info_content
|
|
|
|
|
$item_info_content = $this->InfoContents_model->get_ic_contents2($item->is_ic_id);
|
|
|
|
|
$this->InfoContents_model->Add_with_sitecode(
|
|
|
|
|
$item_info_content->ic_url,
|
|
|
|
|
$item_info_content->ic_url_title,
|
|
|
|
|
$item_info_content->ic_type,
|
|
|
|
|
$item_info_content->ic_title,
|
|
|
|
|
$item_info_content->ic_content,
|
|
|
|
|
$item_info_content->ic_summary,
|
|
|
|
|
$item_info_content->ic_seo_title,
|
|
|
|
|
$item_info_content->ic_seo_description,
|
|
|
|
|
$item_info_content->ic_seo_keywords,
|
|
|
|
|
$item_info_content->ic_show_bread_crumbs,
|
|
|
|
|
$item_info_content->ic_status,
|
|
|
|
|
$item_info_content->ic_template,
|
|
|
|
|
$item_info_content->ic_photo,
|
|
|
|
|
$item_info_content->ic_photo_width,
|
|
|
|
|
$item_info_content->ic_photo_height,
|
|
|
|
|
$item_info_content->ic_recommend_tours,
|
|
|
|
|
$item_info_content->ic_recommend_packages,
|
|
|
|
|
$item_info_content->ic_ht_area_id,
|
|
|
|
|
$item_info_content->ic_ht_area_type,
|
|
|
|
|
$item_info_content->ic_ht_product_id,
|
|
|
|
|
$item_info_content->ic_ht_product_type,
|
|
|
|
|
$item_info_content->ic_author,
|
|
|
|
|
$dest->is_sitecode
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// info_meta
|
|
|
|
|
$item_meta_amp = $this->InfoMetas_model->get($item->is_ic_id, 'AMP');
|
|
|
|
|
$item_meta_ampbody = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_BODY');
|
|
|
|
|
$item_meta_ampcss = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_CSS');
|
|
|
|
|
$item_meta_ampscript = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_SCRIPT');
|
|
|
|
|
$item_meta_ampjson = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_JSON');
|
|
|
|
|
$item_meta_ampstatus = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_STATUS');
|
|
|
|
|
$item_meta_pcstatus = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_BODY_PC_STATUS');
|
|
|
|
|
$item_meta_pcbody = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_BODY_PC');
|
|
|
|
|
$item_meta_pccss = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_CSS_PC');
|
|
|
|
|
$item_meta_pcschema = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_SCHEMA');
|
|
|
|
|
|
|
|
|
|
if (!empty ($item_meta_amp))
|
|
|
|
|
$this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP', $item_meta_amp);
|
|
|
|
|
if (!empty ($item_meta_ampbody))
|
|
|
|
|
$this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_BODY', $item_meta_ampbody);
|
|
|
|
|
if (!empty ($item_meta_ampcss))
|
|
|
|
|
$this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_CSS', $item_meta_ampcss);
|
|
|
|
|
if (!empty ($item_meta_ampscript))
|
|
|
|
|
$this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_SCRIPT', $item_meta_ampscript);
|
|
|
|
|
if (!empty ($item_meta_ampjson))
|
|
|
|
|
$this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_JSON', $item_meta_ampjson);
|
|
|
|
|
if (!empty ($item_meta_ampstatus))
|
|
|
|
|
$this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_STATUS', $item_meta_ampstatus);
|
|
|
|
|
if (!empty ($item_meta_pcstatus))
|
|
|
|
|
$this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_BODY_PC_STATUS', $item_meta_pcstatus);
|
|
|
|
|
if (!empty ($item_meta_pcbody))
|
|
|
|
|
$this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_BODY_PC', $item_meta_pcbody);
|
|
|
|
|
if (!empty ($item_meta_pccss))
|
|
|
|
|
$this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_CSS_PC', $item_meta_pccss);
|
|
|
|
|
if (!empty ($item_meta_pcschema))
|
|
|
|
|
$this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_SCHEMA', $item_meta_pcschema);
|
|
|
|
|
|
|
|
|
|
// gm 补充meta
|
|
|
|
|
$item_meta_addon_css = $this->InfoMetas_model->get($item->is_ic_id, 'meta_addon_css');
|
|
|
|
|
if (!empty ($item_meta_addon_css))
|
|
|
|
|
$this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'meta_addon_css', $item_meta_addon_css);
|
|
|
|
|
|
|
|
|
|
$item_meta_addon_js = $this->InfoMetas_model->get($item->is_ic_id, 'meta_addon_js');
|
|
|
|
|
if (!empty ($item_meta_addon_js))
|
|
|
|
|
$this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'meta_addon_js', $item_meta_addon_js);
|
|
|
|
|
|
|
|
|
|
$item_meta_use_list_picture = $this->InfoMetas_model->get($item->is_ic_id, 'meta_use_list_picture');
|
|
|
|
|
if (!empty ($item_meta_use_list_picture))
|
|
|
|
|
$this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'meta_use_list_picture', $item_meta_use_list_picture);
|
|
|
|
|
|
|
|
|
|
// 添加节点
|
|
|
|
|
$this->InfoStructures_model->Add_with_sitecode($target_is_id, $this->InfoContents_model->insert_id, 999, $dest->is_sitecode);
|
|
|
|
|
$node_map[$item->is_id] = $this->InfoStructures_model->insert_id;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print_r($node_map);
|
|
|
|
|
// print_r($src);
|
|
|
|
|
// print_r($src_path);
|
|
|
|
|
// print_r($dest);
|
|
|
|
|
// print_r($dest_path);
|
|
|
|
|
|
|
|
|
|
//返回状态
|
|
|
|
|
$data[] = array('name' => 'ok', 'value' => 'copy_by_is_id() success!');
|
|
|
|
|
echo json_encode($data);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//[德语->国际]复制节点结构到任意站点的节点下面。-- lmr
|
|
|
|
|
//is_id 信息结构ID,
|
|
|
|
|
public function copy_by_is_id_gm($src_is_id, $dest_is_id)
|
|
|
|
|
{
|
|
|
|
|
if (empty ($src_is_id) || empty ($src_is_id)) {
|
|
|
|
|
echo 'need 2 is_id v1';
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$data = array();
|
|
|
|
|
if ($src_is_id == $dest_is_id || empty ($src_is_id) || empty ($dest_is_id)) {
|
|
|
|
|
echo 'need 2 is_id v2';
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 源节点
|
|
|
|
|
|