抓取bokun程序更新

mobile-first
赵鹏 6 years ago
parent b3a7e7622b
commit 4c4651c0fa

@ -6,7 +6,7 @@ class getbokun extends CI_Controller
{
//var $webUrl = "http://localhost:105"; //本地调用地址
var $webUrl = "https://ct.mycht.cn/" ; //网前调用地址
var $webUrl = "https://ct.mycht.cn/"; //网前调用地址
public function __construct()
{
parent::__construct();
@ -184,7 +184,7 @@ class getbokun extends CI_Controller
// }
$checkNew = $this->tpBokun_model->checkExitHT($PAGCode);
if ($checkNew){
if ($checkNew) {
return; //直接判断本地翰特,这样快很多
}
@ -223,7 +223,7 @@ class getbokun extends CI_Controller
$this->tpBokun_model->PAG2_Title = $ActivityData->description;
$pagsn = $this->tpBokun_model->AddProductToHT();
}
echo ("产品:".$PAGCode.",".$pagsn." 完成.");
echo ("产品:" . $PAGCode . "," . $pagsn . " 完成.");
}
/**
@ -280,7 +280,20 @@ class getbokun extends CI_Controller
//先判断是否是新产品
$checkNew = $this->tpBokun_model->checkExitHT($PAGCode);
if ($checkNew) {
continue;
//判断是否有价格,没有就导入
$pag_row = $this->tpBokun_model->getToursDetails($PAGCode);
if ($pag_row != null) {
$PAG_SN = $pag_row->PAG_SN;
if ($PAG_SN > 0) {
//有产品ID才能获取对应的价格
if ($this->tpBokun_model->checkPrice($PAG_SN) == false) {
//没价格开始导入
$this->doPrice($PAG_SN,$activityId);
}
}
}
//跳过不再保存主数据
continue;
}
$this->tpBokun_model->PAG_Code = $PAGCode;
$this->tpBokun_model->PAG_Title = $activityData->title;
@ -288,7 +301,9 @@ class getbokun extends CI_Controller
$this->tpBokun_model->PAG2_Name = $activityData->title;
$this->tpBokun_model->PAG2_Title = $activityData->description;
$pagsn = $this->tpBokun_model->AddProductToHT();
echo("添加:".$PAGCode.",".$pagsn."\r\n");
echo ("添加:" . $PAGCode . "," . $pagsn . "\r\n");
//价格开始导入
$this->doPrice($pagsn,$activityId);
}
}
}
@ -298,6 +313,177 @@ class getbokun extends CI_Controller
echo "无接口数据!";
}
}
/**
* @description: 导入价格列表
* @param {type}
* @return:
* @Date Changed:
*/
function doPrice($PAG_SN, $activityId)
{
if ($PAG_SN > 0) {
//价格接口数据
$result = $this->bokun_lib->get_activity_price($activityId);
$result = json_decode($result);
if (is_array($result->pricesByDateRange)) {
foreach ($result->pricesByDateRange as $PriceItem) {
//每个时间段的价格循环
//开始时间
if (isset($PriceItem->from)) {
$starDate = $PriceItem->from;
} else {
$starDate = date('Y-m-d');
}
//结束时间
if (isset($PriceItem->to)) {
$endDate = $PriceItem->to;
} else {
$endDate = date('Y-m-d', strtotime('+1 year',strtotime($starDate)));
}
if (isset($PriceItem->rates) && is_array($PriceItem->rates)) {
foreach ($PriceItem->rates as $PriceItem_rates) {
//rates层
if (isset($PriceItem_rates->passengers) && is_array($PriceItem_rates->passengers)) {
$arrAdultPrice = array(); //存放成人价格列表
$arrOhterPrice = array(); //存放儿童和婴儿价格列表
foreach ($PriceItem_rates->passengers as $PriceItem_rates_passengers) {
$AdultPriceClass = new stdClass;
$OtherPriceClass = new stdClass;
$ticketCategory = $PriceItem_rates_passengers->ticketCategory; //判断是大人,小孩
if ($ticketCategory == "ADULT" || $ticketCategory == "CHILD" || $ticketCategory == "INFANT") {
$priceType = $ticketCategory;
} else {
$priceType = "ADULT";
}
//passengers层
if (isset($PriceItem_rates_passengers->tieredPrices) && is_array($PriceItem_rates_passengers->tieredPrices)) {
//这个是有多个人等价格
foreach ($PriceItem_rates_passengers->tieredPrices as $tieredPricesItem) {
$AdultPriceClass = new stdClass;
$OtherPriceClass = new stdClass;
$minPassengersRequired = $tieredPricesItem->minPassengersRequired;
if (isset($tieredPricesItem->maxPassengersRequired)){
$maxPassengersRequired = $tieredPricesItem->maxPassengersRequired;
}else{
$maxPassengersRequired = $minPassengersRequired;
}
if (isset($tieredPricesItem->amount)){
$amount = $tieredPricesItem->amount;
}else{
$amount = 0;
}
if ($priceType == "ADULT") {
$AdultPriceClass->PersonStart = $maxPassengersRequired;
$AdultPriceClass->PersonStop = $maxPassengersRequired;
$AdultPriceClass->type = "ADULT";
$AdultPriceClass->price = $amount;
$arrAdultPrice[] = $AdultPriceClass;
} elseif ($priceType == "CHILD") {
$OtherPriceClass->PersonStart = $maxPassengersRequired;
$OtherPriceClass->PersonStop = $maxPassengersRequired;
$OtherPriceClass->type = "CHILD";
$OtherPriceClass->price = $amount;
$arrOhterPrice[] = $OtherPriceClass;
} elseif ($priceType == "INFANT") {
$OtherPriceClass->PersonStart = $maxPassengersRequired;
$OtherPriceClass->PersonStop = $maxPassengersRequired;
$OtherPriceClass->type = "INFANT";
$OtherPriceClass->price = $amount;
$arrOhterPrice[] = $OtherPriceClass;
}
}
} elseif (isset($PriceItem_rates_passengers->price)) {
//这个是无人等价格
if ($priceType == "ADULT") {
$AdultPriceClass->PersonStart = 1;
$AdultPriceClass->PersonStop = 100;
$AdultPriceClass->type = "ADULT";
$AdultPriceClass->price = $PriceItem_rates_passengers->price->amount;
$arrAdultPrice[] = $AdultPriceClass;
} elseif ($priceType == "CHILD") {
$OtherPriceClass->PersonStart = 1;
$OtherPriceClass->PersonStop = 100;
$OtherPriceClass->type = "CHILD";
$OtherPriceClass->price = $PriceItem_rates_passengers->price->amount;
$arrOhterPrice[] = $OtherPriceClass;
} elseif ($priceType == "INFANT") {
$OtherPriceClass->PersonStart = 1;
$OtherPriceClass->PersonStop = 100;
$OtherPriceClass->type = "INFANT";
$OtherPriceClass->price = $PriceItem_rates_passengers->price->amount;
$arrOhterPrice[] = $OtherPriceClass;
}
}
}
//分析生存的数组$arrAdultPrice与$arrOhterPrice ,构建可以入库的数据
$arrPackagePrice = array();
foreach ($arrAdultPrice as $aAPItem) {
$PackagePriceClass = new stdClass;
$PersonStart = $aAPItem->PersonStart;
$PersonStop = $aAPItem->PersonStop;
$AdultPrice = $aAPItem->price;
$ChildPrice = $AdultPrice;
$InfantPrice = 0;
foreach ($arrOhterPrice as $aOPItem) {
//循环查找对应的儿童及婴儿价
if ($aOPItem->PersonStart == $PersonStart && $aOPItem->PersonStop == $PersonStop) {
//人数限制范围相同时
if ($aOPItem->type == "CHILD") {
$ChildPrice = $aOPItem->price;
} elseif ($aOPItem->type == "INFANT") {
$InfantPrice = $aOPItem->price;
}
} elseif ($aOPItem->PersonStart == $PersonStart) {
//有时候限制范围不一样,只能去开始的人数来判断
if ($aOPItem->type == "CHILD") {
$ChildPrice = $aOPItem->price;
} elseif ($aOPItem->type == "INFANT") {
$InfantPrice = $aOPItem->price;
}
}
}
//组建人数限制成人价儿童价婴儿价的class
$PackagePriceClass->PKP_PersonStart = $PersonStart;
$PackagePriceClass->PKP_PersonStop = $PersonStop;
$PackagePriceClass->PKP_AdultPrice = $AdultPrice;
$PackagePriceClass->PKP_ChildPrice = $ChildPrice;
$PackagePriceClass->PKP_InfantPrice = $InfantPrice;
$arrPackagePrice[] = $PackagePriceClass;
}
//数据入库
if (count($arrPackagePrice) > 0) {
foreach ($arrPackagePrice as $aPPItem) {
//循环入库
$this->tpBokun_model->PKP_PAG_SN = $PAG_SN;
$this->tpBokun_model->PKP_AdultPrice = $aPPItem->PKP_AdultPrice;
$this->tpBokun_model->PKP_ChildPrice = $aPPItem->PKP_ChildPrice;
$this->tpBokun_model->PKP_InfantPrice = $aPPItem->PKP_InfantPrice;
$this->tpBokun_model->PKP_AdultNetPrice = $aPPItem->PKP_AdultPrice;
$this->tpBokun_model->PKP_ChildNetPrice = $aPPItem->PKP_ChildPrice;
$this->tpBokun_model->PKP_InfantNetPrice = $aPPItem->PKP_InfantPrice;
$this->tpBokun_model->PKP_PersonStart = $aPPItem->PKP_PersonStart;
$this->tpBokun_model->PKP_PersonStop = $aPPItem->PKP_PersonStop;
$this->tpBokun_model->PKP_ValidDate = $starDate;
$this->tpBokun_model->PKP_InvalidDate = $endDate;
$this->tpBokun_model->AddPriceToHT();
echo "添加价格:".$PAG_SN."(".$aPPItem->PKP_PersonStart." - ".$aPPItem->PKP_PersonStop.")". "\r\n";
}
}
}
}
}
}
}
}
}
}
/* End of file getbokun.php */

@ -97,21 +97,99 @@ class webgetbokun extends CI_Controller
if ($ContentItem->body != "") {
$strTemp .= $ContentItem->body;
}
if ($ContentItem->excerpt != "") {
$strTemp .= "<p>" . $ContentItem->excerpt . "</p>";
}
// if ($ContentItem->excerpt != "") {
// $strTemp .= "<p>" . $ContentItem->excerpt . "</p>";
// }
if ($strTemp != "") {
$strContent .= "<div class=\"details-list\">" . $strTemp . "</div>";
}
}
$this->tpBokun_model->ic_content = $strContent;
//简介
$temp_summary = $activityDeatil->description;
if ($activityDeatil->excerpt != "") {
$temp_summary .= "<p>" . $activityDeatil->excerpt . "</p>";
// if ($activityDeatil->excerpt != "") {
// $temp_summary .= "<p>" . $activityDeatil->excerpt . "</p>";
// }
//详细内容使用新的模板把简介及所有行程及对应FAQ信息全部集合
$tourstype='<div class="tours-type">
<ul>
<li><i class="fa fa-history" aria-hidden="true"></i>'.$activityDeatil->durationText.'</li>
<li><i class="fa fa-calendar" aria-hidden="true"></i>Every day</li>
<li><i class="fa fa-tags" aria-hidden="true"></i>City tour</li>
</ul>
<div class="clearfix"></div>
</div>';
//overview
$Description ='<div class="details-box active">
<h2>Description<i class="fa fa-angle-down" aria-hidden="true"></i></h2>
<div class="details-content">
<div class="details-list">
<h3><i class="fa fa-circle" aria-hidden="true"></i>Trip Overview</h3>'.$temp_summary.'
</div>
</div>
</div>';
//行程
$Itinerary ='<div class="details-box ">
<h2>Itinerary<i class="fa fa-angle-down" aria-hidden="true"></i></h2>
<div class="details-content">'.$strContent.'</div></div>';
//FAQ
$tempFaq = $strFaq = '';
if (isset($activityDeatil->included)){
if ($activityDeatil->included!="" && $activityDeatil->included!=null){
$strFaq = '<div class="details-list">
<h3><i class="fa fa-circle" aria-hidden="true"></i>What\'s included?</h3>'.$activityDeatil->included.'</div>';
$tempFaq.=$strFaq;
}
}
if (isset($activityDeatil->excluded)){
if ($activityDeatil->excluded!="" && $activityDeatil->excluded!=null){
$strFaq = '<div class="details-list">
<h3><i class="fa fa-circle" aria-hidden="true"></i>What\'s excluded</h3>'.$activityDeatil->excluded.'</div>';
$tempFaq.=$strFaq;
}
}
if (isset($activityDeatil->requirements)){
if ($activityDeatil->requirements!="" && $activityDeatil->requirements!=null){
$strFaq = '<div class="details-list">
<h3><i class="fa fa-circle" aria-hidden="true"></i>What do I need to bring?</h3>'.$activityDeatil->requirements.'</div>';
$tempFaq.=$strFaq;
}
}
if (isset($activityDeatil->attention)){
if ($activityDeatil->attention!="" && $activityDeatil->attention!=null){
$strFaq = '<div class="details-list">
<h3><i class="fa fa-circle" aria-hidden="true"></i>What need to note</h3>'.$activityDeatil->attention.'</div>';
$tempFaq.=$strFaq;
}
}
if (isset($activityDeatil->noPickupMsg)){
if ($activityDeatil->noPickupMsg!="" && $activityDeatil->noPickupMsg!=null){
$strFaq = '<div class="details-list">
<h3><i class="fa fa-circle" aria-hidden="true"></i>What if my hotel is outside the pickup area</h3>'.$activityDeatil->noPickupMsg.'</div>';
$tempFaq.=$strFaq;
}
}
// if (isset($activityDeatil->ticketMsg)){
// if ($activityDeatil->ticketMsg!="" && $activityDeatil->ticketMsg!=null){
// $strFaq = '<div class="details-list">
// <h3><i class="fa fa-circle" aria-hidden="true"></i>ticketMsg</h3>'.$activityDeatil->ticketMsg.'</div>';
// $tempFaq.=$strFaq;
// }
// }
$FAQ = '<div class="details-box">
<h2>FAQs<i class="fa fa-angle-down" aria-hidden="true"></i></h2>
<div class="details-content">'.$tempFaq.'</div></div>';
$allContent = $tourstype.$Description.$Itinerary.$FAQ;
$this->tpBokun_model->ic_content = $allContent;
$this->tpBokun_model->ic_summary = $temp_summary;
//seo
@ -142,7 +220,10 @@ class webgetbokun extends CI_Controller
}
}
$this->tpBokun_model->addMeta($ic_id, "meta_product_code", $PAG_Code); //对应翰特编码
$this->tpBokun_model->addMeta($ic_id, "meta_facts_city", $activityDeatil->googlePlace->city); //保存一下具体城市
if (isset($activityDeatil->googlePlace->city)){
$this->tpBokun_model->addMeta($ic_id, "meta_facts_city", $activityDeatil->googlePlace->city); //保存一下具体城市
}
//然后保存新建的infobokunData表
$this->InfoBokunData_model->ibd_ic_id = $ic_id; //统一的
@ -192,55 +273,90 @@ class webgetbokun extends CI_Controller
}
//一些FAQ类的属性如includedrequirements
$this->InfoBokunData_model->ibd_ItemName = "included"; //
$this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->included;
$this->InfoBokunData_model->ibd_ItemType = "";
$this->InfoBokunData_model->Add();
//一些FAQ类的属性如includedrequirements,这些内容已经合并到详细内容里面
// $this->InfoBokunData_model->ibd_ItemName = "included"; //
// $this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->included;
// $this->InfoBokunData_model->ibd_ItemType = "";
// $this->InfoBokunData_model->Add();
// $this->InfoBokunData_model->ibd_ItemName = "excluded"; //
// $this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->excluded;
// $this->InfoBokunData_model->ibd_ItemType = "";
// $this->InfoBokunData_model->Add();
// $this->InfoBokunData_model->ibd_ItemName = "requirements"; //
// $this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->requirements;
// $this->InfoBokunData_model->ibd_ItemType = "";
// $this->InfoBokunData_model->Add();
// $this->InfoBokunData_model->ibd_ItemName = "attention"; //
// $this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->attention;
// $this->InfoBokunData_model->ibd_ItemType = "";
// $this->InfoBokunData_model->Add();
// if ($activityDeatil->noPickupMsg != null && $activityDeatil->noPickupMsg != "") {
// $this->InfoBokunData_model->ibd_ItemName = "noPickupMsg"; //
// $this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->noPickupMsg;
// $this->InfoBokunData_model->ibd_ItemType = "";
// $this->InfoBokunData_model->Add();
// }
// if ($activityDeatil->ticketMsg != null && $activityDeatil->ticketMsg != "") {
// $this->InfoBokunData_model->ibd_ItemName = "ticketMsg"; //
// $this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->ticketMsg;
// $this->InfoBokunData_model->ibd_ItemType = "";
// $this->InfoBokunData_model->Add();
// }
//成人,儿童,婴儿信息
$pricingCategories = $activityDeatil->pricingCategories;
if (is_array($pricingCategories)){
foreach ($pricingCategories as $priceCg){
$ItemName_priceCg = "";
$ticketCategory = $priceCg->ticketCategory;
if ( strtoupper($ticketCategory)=="ADULT"){
$ItemName_priceCg = "AdultMsg";
}elseif (strtoupper($ticketCategory)=="CHILD") {
$ItemName_priceCg = "ChildMsg";
}elseif (strtoupper($ticketCategory)=="INFANT") {
$ItemName_priceCg = "InfantMsg";
}else{
$ItemName_priceCg = $ticketCategory."_Msg";
}
$this->InfoBokunData_model->ibd_ItemName = "excluded"; //
$this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->excluded;
$this->InfoBokunData_model->ibd_ItemType = "";
$this->InfoBokunData_model->Add();
$ItemValue_priceCg = "age ".$priceCg->minAge.'-'.$priceCg->maxAge;
$this->InfoBokunData_model->ibd_ItemName = "requirements"; //
$this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->requirements;
$this->InfoBokunData_model->ibd_ItemType = "";
$this->InfoBokunData_model->Add();
$this->InfoBokunData_model->ibd_ItemName = $ItemName_priceCg; //
$this->InfoBokunData_model->ibd_Itemvalue = $ItemValue_priceCg;
$this->InfoBokunData_model->ibd_ItemType = "";
$this->InfoBokunData_model->Add();
}
}
$this->InfoBokunData_model->ibd_ItemName = "attention"; //
$this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->attention;
$this->InfoBokunData_model->ibd_ItemType = "";
$this->InfoBokunData_model->Add();
if (isset($activityDeatil->googlePlace)){
if (isset($activityDeatil->googlePlace->country)){
$this->InfoBokunData_model->ibd_ItemName = "country"; //
$this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->googlePlace->country;
$this->InfoBokunData_model->ibd_ItemType = "";
$this->InfoBokunData_model->Add();
}
$this->InfoBokunData_model->ibd_ItemName = "country"; //
$this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->googlePlace->country;
$this->InfoBokunData_model->ibd_ItemType = "";
$this->InfoBokunData_model->Add();
if (isset($activityDeatil->googlePlace->city)){
$this->InfoBokunData_model->ibd_ItemName = "city"; //
$this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->googlePlace->city;
$this->InfoBokunData_model->ibd_ItemType = "";
$this->InfoBokunData_model->Add();
}
}
$this->InfoBokunData_model->ibd_ItemName = "city"; //
$this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->googlePlace->city;
$this->InfoBokunData_model->ibd_ItemType = "";
$this->InfoBokunData_model->Add();
$this->InfoBokunData_model->ibd_ItemName = "durationText"; //
$this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->durationText;
$this->InfoBokunData_model->ibd_ItemType = "";
$this->InfoBokunData_model->Add();
if ($activityDeatil->noPickupMsg != null && $activityDeatil->noPickupMsg != "") {
$this->InfoBokunData_model->ibd_ItemName = "noPickupMsg"; //
$this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->noPickupMsg;
$this->InfoBokunData_model->ibd_ItemType = "";
$this->InfoBokunData_model->Add();
}
if ($activityDeatil->ticketMsg != null && $activityDeatil->ticketMsg != "") {
$this->InfoBokunData_model->ibd_ItemName = "ticketMsg"; //
$this->InfoBokunData_model->ibd_Itemvalue = $activityDeatil->ticketMsg;
$this->InfoBokunData_model->ibd_ItemType = "";
$this->InfoBokunData_model->Add();
}
$arrAgendaItems = $activityDeatil->agendaItems; //保存产品行程里面的派生图片
if (is_array($arrAgendaItems)) {
@ -249,8 +365,8 @@ class webgetbokun extends CI_Controller
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)) {
$this->InfoBokunData_model->ibd_ItemDescription = $$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();

@ -10,8 +10,8 @@ class TpBokun_model extends CI_Model
{
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
//$this->HT229Write = $this->load->database('HT229Write',TRUE); //本地
$this->HT229Write = $this->load->database('HT',TRUE); //网前
$this->HT229Write = $this->load->database('HT229',TRUE); //本地,包含144本地执行。
// $this->HT229Write = $this->load->database('HT', TRUE); //网前主要是提交到CH服务器导致没有HT229Write的链接错误。网前也不执行这个页面的操作。
$this->load->model("IContent_model");
$this->load->model("IStructures_model");
$CI = &get_instance();
@ -56,12 +56,13 @@ class TpBokun_model extends CI_Model
* @return:
* @Date Changed:
*/
function checkChtTours($ic_url_title){
function checkChtTours($ic_url_title)
{
$sql = "select top 1 * from infoContents where ic_url_title = ?";
$query = $this->HT->query($sql,array($ic_url_title));
if ($query->num_rows()>0){
$query = $this->HT->query($sql, array($ic_url_title));
if ($query->num_rows() > 0) {
return true;
}else{
} else {
return false;
}
}
@ -88,7 +89,7 @@ class TpBokun_model extends CI_Model
/**-------------------抓取程序------------------------- */
//var $is_topId = "278000665"; //本地产品的最高级父类
var $is_topId = "278012793"; //网前产品的最高父类
//ic_content表的字段
var $ic_url = "";
var $ic_url_title = "New Information";
@ -258,6 +259,89 @@ class TpBokun_model extends CI_Model
return $this->pag_sn;
}
/**
* @description: 导入价格到翰特
* @param {type}
* @return:
* @Date Changed:
*/
function AddPriceToHT()
{
$sql = "INSERT INTO [BIZ_PackagePrice]
([PKP_PAG_SN]
,[PKP_VEI_SN]
,[PKP_ARI_SN]
,[PKP_AdultPrice]
,[PKP_ChildPrice]
,[PKP_InfantPrice]
,[PKP_AdultNetPrice]
,[PKP_ChildNetPrice]
,[PKP_InfantNetPrice]
,[PKP_AdultSpecialPrice]
,[PKP_ChildSpecialPrice]
,[PKP_InfantSpecialPrice]
,[PKP_PriceGrade]
,[PKP_PersonStart]
,[PKP_PersonStop]
,[PKP_ValidDate]
,[PKP_InvalidDate]
,[LastEditTime]
,[LastEditor]
,[Checked]
,[CheckOperator]
,[CheckDate]
,[PKP_CustomPrice]
,[Caclrenshu]
,[CaclAssignDate]
,[PKP_AdultCost]
,[PKP_ChildCost]
,[PKP_BabyCost]
,[PKP_PriceType]
,[PKP_ChildRate]
,[PKP_BabyRate]
,[PKP_Currency]
,[PKP_RoomDif]
,[PKP_PAGS_SN])
VALUES
(
'{$this->PKP_PAG_SN}'
,1343
,1
,'{$this->PKP_AdultPrice}'
,'{$this->PKP_ChildPrice}'
,'{$this->PKP_InfantPrice}'
,'{$this->PKP_AdultNetPrice}'
,'{$this->PKP_ChildNetPrice}'
,'{$this->PKP_InfantNetPrice}'
,0
,0
,0
,1
,'{$this->PKP_PersonStart}'
,'{$this->PKP_PersonStop}'
,'{$this->PKP_ValidDate}'
,'{$this->PKP_InvalidDate}'
,getdate()
,0
,2
,0
,getdate()
,2
,1
,getdate()
,0
,0
,0
,0
,1.000
,1.000
,'USD'
,0
,0)";
return $this->HT229Write->query($sql);
}
/**
* @description: 判断翰特是否已经存在
@ -265,20 +349,74 @@ class TpBokun_model extends CI_Model
* @return:
* @Date Changed:
*/
function checkExitHT($PAG_Code){
$sql = "select top 1 * from BIZ_PackageInfo where PAG_Code = ?";
function checkExitHT($PAG_Code)
{
$sql = "select top 1 * from BIZ_PackageInfo where PAG_Code = ? and isnull(DeleteFlag,0)<>1 ";
$query = $this->HT229Write->query($sql, array($PAG_Code));
if ($query->num_rows() > 0) {
$result=true;
$result = true;
} else {
$result=false;
$result = false;
}
return $result;
}
/** CHT 那边的操作 */
function getChtTours($strcity){
/**
* @description: 根据编号,获取线路的详细信息
* @param {type}
* @return:
* @Date Changed:
*/
function getToursDetails($PAG_Code)
{
$sql = " SELECT top 1 P1.PAG_ExtendType, P1.PAG_NeedTime,p2.PAG2_Name,P1.PAG_SN,p2.PAG2_Attraction,
P1.PAG_Code,P1.PAG_Title, CItyInfo2.CII2_Name
,P1.PAG_Type
,PAG_Scheme
,PAG_GuideLan
,PAG2_TimeDetail
,p1.PAG_SourceType
FROM dbo.BIZ_PackageInfo P1 INNER JOIN
dbo.BIZ_PackageInfo2 p2 ON P1.PAG_SN = p2.PAG2_PAG_SN INNER JOIN
dbo.CItyInfo2 ON P1.PAG_CII_SN = dbo.CItyInfo2.CII2_CII_SN AND
dbo.CItyInfo2.CII2_LGC=1
WHERE (p1.pag_dei_sn=34) AND
(p2.PAG2_LGC = 1)
AND (isnull(P1.DeleteFlag,0)<>1)
AND (p1.PAG_Code = ?) ";
// AND (p2.PAG2_Check = 2)
// AND (isnull(P1.DeleteFlag,0) <>1) ";
$query = $this->HT229Write->query($sql, array($PAG_Code));
if ($query->num_rows() > 0) {
return $query->row();
} else {
return null;
}
}
/**
* @description: 判断是否有价格
* @param {type}
* @return:
* @Date Changed:
*/
function checkPrice($PagSn){
$sql = "select * from BIZ_PackagePrice
where PKP_PAG_SN = ? ";
$qurey = $this->HT229Write->query($sql,array($PagSn));
if ($qurey->num_rows()>0){
return true;
}else{
return false;
}
}
/** CHT 那边的操作生成CH上面的产品接口 */
function getChtTours($strcity)
{
$sql = "select (select ic_url_title from infoContents inner join infoStructures on is_ic_id=ic_id where is_id = tbs.is_parent_id) as city
,* from infoContents tbc
inner join infoStructures tbs on tbs.is_ic_id=tbc.ic_id
@ -287,14 +425,13 @@ class TpBokun_model extends CI_Model
select is_id from infoStructures
inner join infoContents on is_ic_id=ic_id
where 1=1
and ic_url in (".$strcity.")
and ic_url in (" . $strcity . ")
and is_sitecode='cht'
)
";
$query = $this->HT->query($sql);
return $query->result();
}
/**
@ -303,10 +440,11 @@ class TpBokun_model extends CI_Model
* @return:
* @Date Changed:
*/
function getChtToursMeta($ic_id){
function getChtToursMeta($ic_id)
{
$sql = "select * from infoMetas
where im_ic_id=? and im_key<>'AMP' and im_key<>'AMP_STATUS' and im_key<>'meta_construction_code' and im_key<>'meta_news_createdate'";
$qurey = $this->HT->query($sql,array($ic_id));
$qurey = $this->HT->query($sql, array($ic_id));
return $qurey->result();
}
@ -354,10 +492,11 @@ class TpBokun_model extends CI_Model
* @return:
* @Date Changed:
*/
function match_chinese($chars,$encoding='utf8'){
$pattern =($encoding=='utf8')?'/[\x{4e00}-\x{9fa5}a-zA-Z0-9]/u':'/[\x80-\xFF]/';
preg_match_all($pattern,$chars,$result);
return join('',$result[0]);
function match_chinese($chars, $encoding = 'utf8')
{
$pattern = ($encoding == 'utf8') ? '/[\x{4e00}-\x{9fa5}a-zA-Z0-9]/u' : '/[\x80-\xFF]/';
preg_match_all($pattern, $chars, $result);
return join('', $result[0]);
}
}

Loading…
Cancel
Save