From fed5d220e2a20192cffe3a73f0e0dba75435f424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=B9=8F?= Date: Fri, 5 Jun 2020 12:47:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96cht?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tpmanage/controllers/getbokun.php | 19 ++++-- .../tpmanage/controllers/webgetbokun.php | 59 ++++++++++++++++++- .../tpmanage/models/tpBokun_model.php | 32 ++++++++++ 3 files changed, 103 insertions(+), 7 deletions(-) diff --git a/application/third_party/tpmanage/controllers/getbokun.php b/application/third_party/tpmanage/controllers/getbokun.php index 1f192aa9..d55d5d0b 100644 --- a/application/third_party/tpmanage/controllers/getbokun.php +++ b/application/third_party/tpmanage/controllers/getbokun.php @@ -152,6 +152,7 @@ class getbokun extends CI_Controller } } } + echo ("抓取完成!\r\n"); } else { echo "无接口数据!"; } @@ -173,17 +174,22 @@ class getbokun extends CI_Controller //解析后获取需要的参数 $activityId = $ActivityData->id; //产品的activityId,可以获取对应的产品详细内容。 - + $PAGCode = "bk_" . $activityId; //先判断是否是新产品 - $checkNewUrl = $this->webUrl . "/info.php/thirdparty/tpmanage/webgetbokun/checkActivityId/$activityId/"; - $checkNew = json_decode($this->tpBokun_model->getCrulData($checkNewUrl)); - if ($checkNew->return == "yes" && $OverWrive == false) { - return; + // $checkNewUrl = $this->webUrl . "/info.php/thirdparty/tpmanage/webgetbokun/checkActivityId/$activityId/"; + // $checkNew = json_decode($this->tpBokun_model->getCrulData($checkNewUrl)); + // if ($checkNew->return == "yes" && $OverWrive == false) { + // return; + // } + + $checkNew = $this->tpBokun_model->checkExitHT($PAGCode); + if ($checkNew){ + return; //直接判断本地翰特,这样快很多 } //提交网前接口 - $PAGCode = "bk_" . $activityId; + $checkCode = "cits"; //用来防止参数被破解 $PassParam["activityid"] = $activityId; $PassParam["PAG_Code"] = $PAGCode; @@ -217,6 +223,7 @@ class getbokun extends CI_Controller $this->tpBokun_model->PAG2_Title = $ActivityData->description; $pagsn = $this->tpBokun_model->AddProductToHT(); } + echo ("产品:".$PAGCode.",".$pagsn." 完成."); } /** diff --git a/application/third_party/tpmanage/controllers/webgetbokun.php b/application/third_party/tpmanage/controllers/webgetbokun.php index 21a9ffe1..e7abbaaa 100644 --- a/application/third_party/tpmanage/controllers/webgetbokun.php +++ b/application/third_party/tpmanage/controllers/webgetbokun.php @@ -59,6 +59,10 @@ class webgetbokun extends CI_Controller //1.根据城市名称获取对应的is_id作为 父类ID $is_id = $this->get_isid_byCity($CityName); + if ($is_id == 0){ + return ; + } + //2.根据$activityid 抓取接口数据 $activityDeatil = json_decode($this->bokun_lib->get_activity_detail($activityid)); $title = $activityDeatil->title; @@ -297,7 +301,7 @@ class webgetbokun extends CI_Controller if (isset($row)) { $result = $row->is_id; } else { - $result = $this->tpBokun_model->is_topId; + $result = 0 ; //$this->tpBokun_model->is_topId; } return $result; } @@ -425,6 +429,59 @@ class webgetbokun extends CI_Controller echo "无接口数据!\r\n"; } } + + + /** 这里是在cht的信息平台运行的接口 */ + + /** + * @description: 获取CH那边的产品生成接口数据 + * @param {type} + * @return: + * @Date Changed: + */ + function getChtTours($strcity=""){ + if ($strcity==""){ + $strcity = "beijing,guilin,chengdu,shanghai,xian,zhangjiajie,huangshan,yunnan"; + } + $result = array(); + //城市解析 + $arrCity = explode(",",$strcity); + $strParam = ""; + foreach ($arrCity as $city){ + $strParam.="'/day-tours/".strtolower(str_replace(" ","-",$city))."/',"; + } + $strParam = trim($strParam,","); + //$strParam = "/beijing/"; //本地测试 + //传递 + $list = $this->tpBokun_model->getChtTours($strParam); + if ($list){ + + foreach ($list as $Item){ + $data["ic_id"]=$Item->ic_id; + $data["ic_url"]=$Item->ic_url; + $data["ic_title"]=$Item->ic_title; + + //meta属性 + $listmeta = $this->tpBokun_model->getChtToursMeta($Item->ic_id); + if ($listmeta){ + foreach($listmeta as $meta){ + $MetaData["im_key"]=$meta->im_key; + $MetaData["im_value"]=$meta->im_value; + $data["meta"][]=$MetaData; + } + } + + $result[]=$data; + } + + } + if ($result){ + echo json_encode($result); + }else{ + echo json_encode(array("status"=>"none")); + } + + } } /* End of file webgetbokun.php */ diff --git a/application/third_party/tpmanage/models/tpBokun_model.php b/application/third_party/tpmanage/models/tpBokun_model.php index a005de5c..975e597f 100644 --- a/application/third_party/tpmanage/models/tpBokun_model.php +++ b/application/third_party/tpmanage/models/tpBokun_model.php @@ -257,6 +257,38 @@ class TpBokun_model extends CI_Model return $result; } + /** CHT 那边的操作 */ + function getChtTours($strcity){ + $sql = "select * from infoContents + inner join infoStructures on is_ic_id=ic_id + where ic_status = 1 + and is_parent_id in ( + select is_id from infoStructures + inner join infoContents on is_ic_id=ic_id + where 1=1 + and ic_url in (?) + and is_sitecode='cht' + + ) + "; + $query = $this->HT->query($sql,array($strcity)); + return $query->result(); + + } + + /** + * @description: 对应信息的meta + * @param {type} + * @return: + * @Date Changed: + */ + function getChtToursMeta($ic_id){ + $sql = "select * from infoMetas + where im_ic_id=?"; + $qurey = $this->HT->query($sql,array($ic_id)); + return $qurey->result(); + } + /**------其它一些公用函数--- */