|
|
|
@ -59,9 +59,9 @@ class webgetbokun extends CI_Controller
|
|
|
|
|
//1.根据城市名称获取对应的is_id作为 父类ID
|
|
|
|
|
$is_id = $this->get_isid_byCity($CityName);
|
|
|
|
|
|
|
|
|
|
if ($is_id == 0){
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
if ($is_id == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//2.根据$activityid 抓取接口数据
|
|
|
|
|
$activityDeatil = json_decode($this->bokun_lib->get_activity_detail($activityid));
|
|
|
|
@ -88,11 +88,11 @@ class webgetbokun extends CI_Controller
|
|
|
|
|
foreach ($arrContent as $ContentItem) {
|
|
|
|
|
$strTemp = "";
|
|
|
|
|
$strDay = "";
|
|
|
|
|
if ($ContentItem->day!=1){
|
|
|
|
|
$strDay = "(day ".$ContentItem->day.")";
|
|
|
|
|
if ($ContentItem->day != 1) {
|
|
|
|
|
$strDay = "(day " . $ContentItem->day . ")";
|
|
|
|
|
}
|
|
|
|
|
if ($ContentItem->title != "") {
|
|
|
|
|
$strTemp .= "<h3><i class=\"fa fa-circle\" aria-hidden=\"true\"></i>" . $ContentItem->title.$strDay. "</h3>";
|
|
|
|
|
$strTemp .= "<h3><i class=\"fa fa-circle\" aria-hidden=\"true\"></i>" . $ContentItem->title . $strDay . "</h3>";
|
|
|
|
|
}
|
|
|
|
|
if ($ContentItem->body != "") {
|
|
|
|
|
$strTemp .= $ContentItem->body;
|
|
|
|
@ -137,12 +137,11 @@ class webgetbokun extends CI_Controller
|
|
|
|
|
//先旧的infometa表
|
|
|
|
|
$tempRequireFileds = $activityDeatil->requiredCustomerFields; //根据抓取的需求字段,判断是否需要passport
|
|
|
|
|
if (is_array($tempRequireFileds)) {
|
|
|
|
|
if (is_array($tempRequireFileds[0])){
|
|
|
|
|
if (is_array($tempRequireFileds[0])) {
|
|
|
|
|
if (in_array("passportId", $tempRequireFileds[0])) {
|
|
|
|
|
$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); //保存一下具体城市
|
|
|
|
@ -154,12 +153,12 @@ class webgetbokun extends CI_Controller
|
|
|
|
|
$this->InfoBokunData_model->ibd_Itemvalue = $activityid;
|
|
|
|
|
$ibd_id = $this->InfoBokunData_model->Add();
|
|
|
|
|
|
|
|
|
|
if ($this->InfoBokunData_model->ibd_ItemName == "ActivityID"){
|
|
|
|
|
if ($this->InfoBokunData_model->ibd_ItemName == "ActivityID") {
|
|
|
|
|
$this->InfoBokunData_model->ibd_parentId = 0;
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
$this->InfoBokunData_model->ibd_parentId = $ibd_id; //设置剩余的属性都是这个activityid的子类,避免每条记录都保存activityid
|
|
|
|
|
}
|
|
|
|
|
if (isset($activityDeatil->keyPhoto)){
|
|
|
|
|
if (isset($activityDeatil->keyPhoto)) {
|
|
|
|
|
$this->InfoBokunData_model->ibd_ItemName = "keyPhoto"; //主要图片
|
|
|
|
|
$this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->keyPhoto->originalUrl;
|
|
|
|
|
$this->InfoBokunData_model->ibd_ItemType = "originalUrl";
|
|
|
|
@ -248,13 +247,13 @@ class webgetbokun extends CI_Controller
|
|
|
|
|
$arrAgendaItems = $activityDeatil->agendaItems; //保存产品行程里面的派生图片
|
|
|
|
|
if (is_array($arrAgendaItems)) {
|
|
|
|
|
foreach ($arrAgendaItems as $agendaItem) {
|
|
|
|
|
if (isset($agendaItem->keyPhoto)){
|
|
|
|
|
if (isset($agendaItem->keyPhoto)) {
|
|
|
|
|
if ($agendaItem->keyPhoto != null && $agendaItem->keyPhoto != "") {
|
|
|
|
|
$this->InfoBokunData_model->ibd_ItemName = "AgendaPhoto";
|
|
|
|
|
$this->InfoBokunData_model->ibd_Itemvalue = $agendaItem->keyPhoto->originalUrl;
|
|
|
|
|
if (isset($$agendaItem->keyPhoto->description)){
|
|
|
|
|
if (isset($$agendaItem->keyPhoto->description)) {
|
|
|
|
|
$this->InfoBokunData_model->ibd_ItemDescription = $$agendaItem->keyPhoto->description;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$this->InfoBokunData_model->ibd_ItemType = "originalUrl";
|
|
|
|
|
$this->InfoBokunData_model->Add();
|
|
|
|
|
}
|
|
|
|
@ -267,10 +266,10 @@ class webgetbokun extends CI_Controller
|
|
|
|
|
$this->InfoBokunData_model->ibd_ItemName = "AgendaPhoto";
|
|
|
|
|
$this->InfoBokunData_model->ibd_Itemvalue = $agendaPhotoItem->originalUrl;
|
|
|
|
|
$this->InfoBokunData_model->ibd_ItemType = "originalUrl";
|
|
|
|
|
if (isset($agendaPhotoItem->description)){
|
|
|
|
|
if (isset($agendaPhotoItem->description)) {
|
|
|
|
|
$this->InfoBokunData_model->ibd_ItemDescription = $agendaPhotoItem->description;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->InfoBokunData_model->Add();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -301,7 +300,7 @@ class webgetbokun extends CI_Controller
|
|
|
|
|
if (isset($row)) {
|
|
|
|
|
$result = $row->is_id;
|
|
|
|
|
} else {
|
|
|
|
|
$result = 0 ; //$this->tpBokun_model->is_topId;
|
|
|
|
|
$result = 0; //$this->tpBokun_model->is_topId;
|
|
|
|
|
}
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
@ -331,9 +330,9 @@ class webgetbokun extends CI_Controller
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($str_return != "") {
|
|
|
|
|
echo "新城市添加:" . $str_return."\r\n";
|
|
|
|
|
echo "新城市添加:" . $str_return . "\r\n";
|
|
|
|
|
} else {
|
|
|
|
|
echo "没有新的城市"."\r\n";
|
|
|
|
|
echo "没有新的城市" . "\r\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -419,7 +418,7 @@ class webgetbokun extends CI_Controller
|
|
|
|
|
$PassParam["checkCode"] = $checkCode;
|
|
|
|
|
$strPass = base64_encode(json_encode($PassParam));
|
|
|
|
|
$this->addActivity($strPass);
|
|
|
|
|
echo "\r\n" ;
|
|
|
|
|
echo "\r\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -434,67 +433,142 @@ class webgetbokun extends CI_Controller
|
|
|
|
|
/** 这里是在cht的信息平台运行的接口 */
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description: 获取CH那边的产品生成接口数据
|
|
|
|
|
* @description: CH那边的产品生成接口数据
|
|
|
|
|
* @param {type}
|
|
|
|
|
* @return:
|
|
|
|
|
* @Date Changed:
|
|
|
|
|
*/
|
|
|
|
|
function getChtTours($strcity=""){
|
|
|
|
|
if ($strcity==""){
|
|
|
|
|
function getChtTours($strcity = "")
|
|
|
|
|
{
|
|
|
|
|
if ($strcity == "") {
|
|
|
|
|
$strcity = "beijing,guilin,chengdu,shanghai,xian,zhangjiajie,huangshan,yunnan";
|
|
|
|
|
}
|
|
|
|
|
$result = array();
|
|
|
|
|
//城市解析
|
|
|
|
|
$arrCity = explode(",",$strcity);
|
|
|
|
|
$arrCity = explode(",", $strcity);
|
|
|
|
|
$strParam = "";
|
|
|
|
|
foreach ($arrCity as $city){
|
|
|
|
|
$strParam.="'/day-tours/".strtolower(str_replace(" ","-",$city))."/',";
|
|
|
|
|
foreach ($arrCity as $city) {
|
|
|
|
|
$strParam .= "'/day-tours/" . strtolower(str_replace(" ", "-", $city)) . "/',";
|
|
|
|
|
}
|
|
|
|
|
$strParam = trim($strParam,",");
|
|
|
|
|
$strParam = trim($strParam, ",");
|
|
|
|
|
//$strParam = "'/beijing/','/shanghai/'"; //本地测试
|
|
|
|
|
//传递
|
|
|
|
|
$list = $this->tpBokun_model->getChtTours($strParam);
|
|
|
|
|
if ($list){
|
|
|
|
|
if ($list) {
|
|
|
|
|
|
|
|
|
|
foreach ($list as $Item){
|
|
|
|
|
foreach ($list as $Item) {
|
|
|
|
|
$data["city"] = $Item->city;
|
|
|
|
|
$data["ic_id"]=$Item->ic_id;
|
|
|
|
|
$data["ic_url"]=$Item->ic_url;
|
|
|
|
|
$data["ic_title"]=$Item->ic_title;
|
|
|
|
|
$data["ic_url_title"]=$Item->ic_url_title;
|
|
|
|
|
$data["ic_id"] = $Item->ic_id;
|
|
|
|
|
$data["ic_url"] = $Item->ic_url;
|
|
|
|
|
$data["ic_title"] = $Item->ic_title;
|
|
|
|
|
$data["ic_url_title"] = $Item->ic_url_title;
|
|
|
|
|
$data["ic_content"] = $Item->ic_content;
|
|
|
|
|
$data["ic_summary"] = $Item->ic_summary;
|
|
|
|
|
$data["ic_seo_title"] = $Item->ic_seo_title;
|
|
|
|
|
$data["ic_seo_description"] = $Item->ic_seo_description;
|
|
|
|
|
$data["ic_seo_keywords"] = $Item->ic_seo_keywords;
|
|
|
|
|
$data["ic_photo"]=$Item->ic_photo;
|
|
|
|
|
$data["ic_photo"] = $Item->ic_photo;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//meta属性
|
|
|
|
|
$listmeta = $this->tpBokun_model->getChtToursMeta($Item->ic_id);
|
|
|
|
|
if ($listmeta){
|
|
|
|
|
if ($listmeta) {
|
|
|
|
|
$arrmeta = array();
|
|
|
|
|
foreach($listmeta as $meta){
|
|
|
|
|
$MetaData["im_key"]=$meta->im_key;
|
|
|
|
|
$MetaData["im_value"]=$meta->im_value;
|
|
|
|
|
$arrmeta[]=$MetaData;
|
|
|
|
|
foreach ($listmeta as $meta) {
|
|
|
|
|
$MetaData["im_key"] = $meta->im_key;
|
|
|
|
|
$MetaData["im_value"] = $meta->im_value;
|
|
|
|
|
$arrmeta[] = $MetaData;
|
|
|
|
|
}
|
|
|
|
|
if ($arrmeta){
|
|
|
|
|
$data["meta"]=$arrmeta;
|
|
|
|
|
if ($arrmeta) {
|
|
|
|
|
$data["meta"] = $arrmeta;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$result[]=$data;
|
|
|
|
|
$result[] = $data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if ($result){
|
|
|
|
|
echo json_encode($result);
|
|
|
|
|
}else{
|
|
|
|
|
echo json_encode(array("status"=>"none","param"=>$strParam));
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|