|
|
|
@ -142,7 +142,6 @@ class webgetbokun extends CI_Controller
|
|
|
|
|
$this->tpBokun_model->addMeta($ic_id, "meta_trippest_type", "gg");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
$this->tpBokun_model->addMeta($ic_id, "meta_product_code", $PAG_Code); //对应翰特编码
|
|
|
|
|
$this->tpBokun_model->addMeta($ic_id, "meta_facts_city", $activityDeatil->googlePlace->city); //保存一下具体城市
|
|
|
|
@ -434,12 +433,13 @@ class webgetbokun extends CI_Controller
|
|
|
|
|
/** 这里是在cht的信息平台运行的接口 */
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description: 获取CH那边的产品生成接口数据
|
|
|
|
|
* @description: CH那边的产品生成接口数据
|
|
|
|
|
* @param {type}
|
|
|
|
|
* @return:
|
|
|
|
|
* @Date Changed:
|
|
|
|
|
*/
|
|
|
|
|
function getChtTours($strcity=""){
|
|
|
|
|
function getChtTours($strcity = "")
|
|
|
|
|
{
|
|
|
|
|
if ($strcity == "") {
|
|
|
|
|
$strcity = "beijing,guilin,chengdu,shanghai,xian,zhangjiajie,huangshan,yunnan";
|
|
|
|
|
}
|
|
|
|
@ -482,19 +482,93 @@ class webgetbokun extends CI_Controller
|
|
|
|
|
if ($arrmeta) {
|
|
|
|
|
$data["meta"] = $arrmeta;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$result[] = $data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if ($result) {
|
|
|
|
|
echo json_encode($result);
|
|
|
|
|
} else {
|
|
|
|
|
echo json_encode(array("status" => "none", "param" => $strParam));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function CurlCHTTours($city = "")
|
|
|
|
|
{
|
|
|
|
|
$url = "https://cht.mycht.cn/info.php/thirdparty/tpmanage/webgetbokun/getChtTours/";
|
|
|
|
|
if ($city != "") {
|
|
|
|
|
$url = $url . strtolower(str_replace(" ", "-", $city)) . "/";
|
|
|
|
|
}
|
|
|
|
|
$str = $this->tpBokun_model->getCrulData($url); //抓取cht的数据
|
|
|
|
|
$chtData = json_decode($str);
|
|
|
|
|
if (is_array($chtData) && count($chtData) > 0) {
|
|
|
|
|
//导入开始
|
|
|
|
|
foreach ($chtData as $chtItem) {
|
|
|
|
|
// echo ($chtItem->city.",".$chtItem->ic_title."\n\r");
|
|
|
|
|
//判断重复
|
|
|
|
|
if ($this->tpBokun_model->checkChtTours($chtItem->ic_url_title)) {
|
|
|
|
|
echo "已存在:" .$chtItem->ic_url_title. "\r\n";
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//开始导入
|
|
|
|
|
//1.根据城市名称获取对应的is_id作为 父类ID
|
|
|
|
|
$chtCity = str_replace("'", "", str_replace(' ', '-', strtolower($chtItem->city)));
|
|
|
|
|
$is_id = $this->get_isid_byCity($chtCity);
|
|
|
|
|
if ($is_id == 0) {
|
|
|
|
|
continue; //找不到对应城市跳过
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$ic_url = $chtItem->ic_url; //根据原来的URL替换成新的URL
|
|
|
|
|
$ic_url = str_replace("/day-tours/" . $chtCity . "/", "/" . $chtCity . "-tours/", $ic_url);
|
|
|
|
|
$ic_url = str_replace(".htm", "/", $ic_url);
|
|
|
|
|
|
|
|
|
|
$this->tpBokun_model->ic_url = $ic_url;
|
|
|
|
|
|
|
|
|
|
$this->tpBokun_model->ic_url_title = $chtItem->ic_url_title;
|
|
|
|
|
$this->tpBokun_model->ic_title = $chtItem->ic_title;
|
|
|
|
|
$this->tpBokun_model->ic_content = $chtItem->ic_content;
|
|
|
|
|
$this->tpBokun_model->ic_summary = $chtItem->ic_summary;
|
|
|
|
|
$this->tpBokun_model->ic_seo_title = $chtItem->ic_seo_title;
|
|
|
|
|
$this->tpBokun_model->ic_seo_description = $chtItem->ic_seo_description;
|
|
|
|
|
$this->tpBokun_model->ic_seo_keywords = $chtItem->ic_seo_keywords;
|
|
|
|
|
$this->tpBokun_model->ic_photo = $chtItem->ic_photo;
|
|
|
|
|
$this->tpBokun_model->ic_status = 1;
|
|
|
|
|
|
|
|
|
|
//保存信息表
|
|
|
|
|
$tempData = json_decode($this->tpBokun_model->addInfo($is_id));
|
|
|
|
|
if (is_array($tempData)) {
|
|
|
|
|
$ic_id = $tempData[0]->value->ic_id;
|
|
|
|
|
} else {
|
|
|
|
|
$result["status"] = "error";
|
|
|
|
|
echo json_encode($result);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//保存meta表
|
|
|
|
|
if ($ic_id > 0) {
|
|
|
|
|
$metalist = $chtItem->meta;
|
|
|
|
|
if ($metalist) {
|
|
|
|
|
foreach ($metalist as $metaItem) {
|
|
|
|
|
$this->tpBokun_model->addMeta($ic_id, $metaItem->im_key, $metaItem->im_value); //循环导入原来的meta
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$result["status"] = "ok";
|
|
|
|
|
$result["ic_id"] = $ic_id;
|
|
|
|
|
echo json_encode($result);
|
|
|
|
|
echo "\r\n";
|
|
|
|
|
}
|
|
|
|
|
echo "数据导入完成 \r\n";
|
|
|
|
|
} else {
|
|
|
|
|
echo "接口数据读取错误!";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//print_r(json_decode($str));
|
|
|
|
|
// echo $str;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|