|
|
<?php
|
|
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
|
|
class Api_model extends CI_Model {
|
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
{
|
|
|
parent::__construct();
|
|
|
$this->HT = $this->load->database('HT', TRUE);
|
|
|
$this->InfoCT = $this->load->database('INFORMATION', TRUE);
|
|
|
$this->load->library('Currency');
|
|
|
}
|
|
|
|
|
|
var $dei_sn = 17; //组别ID
|
|
|
var $CTLGC = 104; //语种
|
|
|
var $WebCode = "chinatravel"; //站点编码
|
|
|
var $WebUrl = "www.chinatravel.com"; //站点URL
|
|
|
var $WebCdn = "data.chinatravel.com"; //站点CDN地址
|
|
|
var $imagesUrl = "images.chinatravel.com"; //站点多媒体库地址
|
|
|
|
|
|
/**
|
|
|
* @description: 根据一日游code获取对应人数的成人价格
|
|
|
* @param {string} $pagecode 线路代码
|
|
|
* @param int $personnum 人数
|
|
|
* @return:
|
|
|
*/
|
|
|
function getDaytripsPrice($pagcode, $personnum)
|
|
|
{
|
|
|
$sql = "select top 1 isnull(PKP_AdultPrice,0) as PKP_AdultPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
|
|
|
,PAG_DefaultVEI_SN
|
|
|
from BIZ_PackagePrice
|
|
|
inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
|
|
|
and BIZ_PackagePrice.PKP_VEI_SN = BIZ_PackageInfo.PAG_DefaultVEI_SN
|
|
|
where (BIZ_PackageInfo.PAG_Code = ?) AND (pag_dei_sn= ? )
|
|
|
and ? between PKP_PersonStart and PKP_PersonStop and CONVERT(varchar(12),getdate(),111) between pkp_validdate and pkp_invaliddate
|
|
|
order by isnull( BIZ_PackageInfo.PAG_DefaultVEI_SN,0) desc,PKP_PriceGrade ";
|
|
|
$param = array($pagcode,$this->dei_sn, $personnum);
|
|
|
|
|
|
$query = $this->HT->query($sql, $param);
|
|
|
if ($query->num_rows() > 0) {
|
|
|
return $query->row();
|
|
|
} else {
|
|
|
//'第二种有默认供应商但是没有当前日期价格的时候
|
|
|
$sql = "select top 1 isnull(PKP_AdultPrice,0) as PKP_AdultPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
|
|
|
,PAG_DefaultVEI_SN
|
|
|
from BIZ_PackagePrice
|
|
|
inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
|
|
|
and BIZ_PackagePrice.PKP_VEI_SN = BIZ_PackageInfo.PAG_DefaultVEI_SN
|
|
|
where (BIZ_PackageInfo.PAG_Code = ? ) AND (pag_dei_sn= ? )
|
|
|
and ? between PKP_PersonStart and PKP_PersonStop
|
|
|
order by pkp_invaliddate desc,PKP_PriceGrade ";
|
|
|
$query = $this->HT->query($sql, $param);
|
|
|
if ($query->num_rows() > 0) {
|
|
|
return $query->row();
|
|
|
}else{
|
|
|
//'第三种没有默认供应商但是有当前日期价格的时候
|
|
|
$sql = "select top 1 isnull(PKP_AdultPrice,0) as PKP_AdultPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
|
|
|
,PAG_DefaultVEI_SN
|
|
|
from BIZ_PackagePrice
|
|
|
inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
|
|
|
where (BIZ_PackageInfo.PAG_Code = ? ) AND (pag_dei_sn= ? )
|
|
|
and ? between PKP_PersonStart and PKP_PersonStop and CONVERT(varchar(12),getdate(),111) between pkp_validdate and pkp_invaliddate
|
|
|
order by isnull( BIZ_PackageInfo.PAG_DefaultVEI_SN,0) desc,PKP_PriceGrade ";
|
|
|
$query = $this->HT->query($sql, $param);
|
|
|
if ($query->num_rows() > 0) {
|
|
|
return $query->row();
|
|
|
}else{
|
|
|
//'第四种无默认供应商无当前日期价格
|
|
|
$sql = "select top 1 isnull(PKP_AdultPrice,0) as PKP_AdultPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
|
|
|
,PAG_DefaultVEI_SN
|
|
|
from BIZ_PackagePrice
|
|
|
inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
|
|
|
where (BIZ_PackageInfo.PAG_Code = ? ) AND (pag_dei_sn= ? )
|
|
|
and ? between PKP_PersonStart and PKP_PersonStop
|
|
|
order by pkp_invaliddate desc,PKP_PriceGrade ";
|
|
|
$query = $this->HT->query($sql, $param);
|
|
|
if ($query->num_rows() > 0) {
|
|
|
return $query->row();
|
|
|
}else {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @description: 获取精华线路价格,2人等
|
|
|
* @param {*}
|
|
|
* @return {*}
|
|
|
* @Date Changed:
|
|
|
*/
|
|
|
function getTourPrice($cli_no){
|
|
|
$CLI_SN = "";
|
|
|
$reust = "";
|
|
|
//'新的GP没有设置以前的2-5人等价格,导致读不出价格。把Gp价格放前面计算
|
|
|
$sql = "select top 1 CLI_SN,CLI_PackageClass from CustomerLineInfo
|
|
|
where CLI_NO=? and ( CLI_State=1005004)
|
|
|
AND (CLI_DEI_SN= ? )";
|
|
|
$query = $this->HT->query($sql,array($cli_no,$this->dei_sn));
|
|
|
if (!$query->num_rows()>0){
|
|
|
return null;
|
|
|
}else{
|
|
|
$row = $query->row();
|
|
|
if (isset($row)){
|
|
|
$CLI_SN = $row->CLI_SN;
|
|
|
}
|
|
|
|
|
|
//'获取线路是否有travelbuddy,也就是有固定的发团日期
|
|
|
$fut_sql = "SELECT count(*) as CountBuddy FROM FixedGroupDate WHERE FGD_CLI_SN='".$CLI_SN."'";
|
|
|
$futQuery = $this->HT->query($fut_sql);
|
|
|
$futrow = $futQuery->row();
|
|
|
$fut_CountBuddy = $futrow->CountBuddy;
|
|
|
|
|
|
if ($fut_CountBuddy>0){
|
|
|
//读取GP价格
|
|
|
$gpSql ="SELECT TOP 1 FGD_AdultPrice,FGD_Departure,
|
|
|
isnull(FGD_ProAdultPrice,0) as FGD_ProAdultPrice
|
|
|
FROM FixedGroupDate
|
|
|
WHERE (FGD_Departure >= GETDATE())
|
|
|
AND (FGD_CLI_SN = ".$CLI_SN.") AND (FGD_State = 1) ORDER BY FGD_AdultPrice";
|
|
|
$gpquery = $this->HT->query($gpSql);
|
|
|
if ($gpquery->num_rows()>0){
|
|
|
$gpRow = $gpquery->row();
|
|
|
$FGD_AdultPrice = $gpRow->FGD_AdultPrice;
|
|
|
$FGD_ProAdultPrice = $gpRow->FGD_ProAdultPrice;
|
|
|
if ($FGD_ProAdultPrice>0){
|
|
|
$reust = $FGD_ProAdultPrice; //促销价
|
|
|
}else{
|
|
|
$reust=$FGD_AdultPrice;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}else {
|
|
|
//普通线路价格
|
|
|
$sql = "select top 1
|
|
|
CLI_SN,CLP_TwoToFiveAdultPrice,CLI_PackageClass,CLP_TwoToFiveAdultPriceRMB
|
|
|
FROM CustomerLineInfo INNER JOIN
|
|
|
CustomerLinePrice ON CustomerLineInfo.CLI_SN = CustomerLinePrice.CLP_CLI_SN INNER JOIN
|
|
|
CustomerLineInfo2 ON CustomerLineInfo.CLI_SN = CustomerLineInfo2.CLI2_CLI_SN
|
|
|
where CLI_SN= ?
|
|
|
and (CLI_State = 1005004 ) ORDER BY CLP_TwoToFiveAdultPrice";
|
|
|
$query = $this->HT->query($sql,array($CLI_SN,$this->CTLGC));
|
|
|
if ($query->num_rows()>0){
|
|
|
$reust = $query->row();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return $reust;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* @description: 一日游列表,包含信息平台和HT
|
|
|
* @param {*} $whereHT HT的查询条件
|
|
|
* @param {*} $whereInfo 信息平台的查询条件
|
|
|
* @return {*}
|
|
|
* @Date Changed:
|
|
|
*/
|
|
|
function getDaytripList($whereHT="",$whereInfo=""){
|
|
|
$sql = "select * from(
|
|
|
|
|
|
select * from(
|
|
|
SELECT p2.PAG2_Name as title
|
|
|
,P1.PAG_Code as code
|
|
|
,'' as url
|
|
|
,isnull(p2.PAG2_ImageURL,'') as pic1
|
|
|
,isnull((select top 1 PAP_ImageURL from BIZ_PackagePic where PAP_PII_SN=p2.PAG2_PII_SN),'') as pic2
|
|
|
,'2' as sortby
|
|
|
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 1=2 and (p2.PAG2_LGC = 104)
|
|
|
AND (p1.pag_dei_sn = '".$this->dei_sn."')
|
|
|
AND (p2.PAG2_Check = 2)
|
|
|
AND (PAG_Code not in(
|
|
|
SELECT convert(varchar(100),(
|
|
|
SELECT TOP 1 im_value
|
|
|
FROM information_ct.dbo.infoMetas
|
|
|
WHERE im_key = 'meta_product_code'
|
|
|
AND im_ic_id = ic_id
|
|
|
)) AS code
|
|
|
FROM information_ct.dbo.infoContents
|
|
|
INNER JOIN information_ct.dbo.infoStructures ON ic_id = is_ic_id
|
|
|
WHERE is_sitecode = '".$this->WebCode."'".$whereInfo."
|
|
|
AND ic_status = 1
|
|
|
))
|
|
|
AND (isnull(P1.DeleteFlag,0) <>1) ".$whereHT."
|
|
|
) Tmp
|
|
|
|
|
|
UNION ALL
|
|
|
|
|
|
SELECT * from (
|
|
|
select ic_url_title as title
|
|
|
,(select top 1 im_value from information_ct.dbo.infoMetas where im_key='meta_product_code' and im_ic_id=ic_id) as code
|
|
|
,ic_url as url , ic_photo as pic1
|
|
|
,(select top 1 im_value from information_ct.dbo.infoMetas where im_key='meta_addon_picture_mobile' and im_ic_id=ic_id) as pic2
|
|
|
,'1' as sortby
|
|
|
FROM information_ct.dbo.infoContents
|
|
|
inner join information_ct.dbo.infoStructures on ic_id=is_ic_id
|
|
|
WHERE is_sitecode='".$this->WebCode."' ".$whereInfo."
|
|
|
and ic_status=1
|
|
|
) as t
|
|
|
) tball
|
|
|
where 1=1
|
|
|
ORDER BY tball.sortBy ASC
|
|
|
";
|
|
|
|
|
|
$query = $this->HT->query($sql);
|
|
|
return $query->result();
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* @description: HT获取一日游列表
|
|
|
* @param {*} $city 一日游城市 ,默认必须有城市,不然太多
|
|
|
* @param {*} $where 其它条件
|
|
|
* @return {*}
|
|
|
* @Date Changed:
|
|
|
*/
|
|
|
function getDaytripListHT($city="beijing",$where=""){
|
|
|
$sql = " select * from(
|
|
|
SELECT p2.PAG2_Name
|
|
|
,p2.PAG2_Intro
|
|
|
,P1.PAG_NeedTime
|
|
|
,P1.PAG_SN
|
|
|
,P1.PAG_Leve
|
|
|
,p2.PAG2_Order
|
|
|
,P1.PAG_Code
|
|
|
,p2.PAG2_Attraction
|
|
|
,CItyInfo2.CII2_Name
|
|
|
,isnull((select top 1 PAP_ImageURL from BIZ_PackagePic where PAP_PII_SN=p2.PAG2_PII_SN),'') as NewListImage
|
|
|
,isnull(p2.PAG2_ImageURL,'') as NewListImage2
|
|
|
,dbo.GetFullPathByPII_SN(p2.PAG2_PII_SN, 2) AS picpath
|
|
|
,p2.PAG2_Title
|
|
|
,p1.PAG_Type
|
|
|
,pag2_summary
|
|
|
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 (p2.PAG2_LGC = ?)
|
|
|
AND (p1.pag_dei_sn = ?)
|
|
|
AND (p2.PAG2_Check = 2)
|
|
|
AND (isnull(P1.DeleteFlag,0) <>1)
|
|
|
) Tmp
|
|
|
where 1=1 ";
|
|
|
if ($city!=""){
|
|
|
$sql .= " AND (CII2_Name ='".$city."')";
|
|
|
}
|
|
|
// $sql .= "and PAG_Code in ('SHALC-1','SHALC-7')";
|
|
|
$sql .= " order by isnull(pag2_order,0) desc,pag_code ";
|
|
|
// echo ($sql);
|
|
|
$param = array($this->CTLGC,$this->dei_sn);
|
|
|
$query = $this->HT->query($sql,$param);
|
|
|
return $query->result();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* @description: 获取子类信息列表
|
|
|
* @param {type} $old_pid,$new_pid 父类的Id,分为旧网站的和新网站的
|
|
|
* @return:
|
|
|
* @Date Changed:
|
|
|
* 这个目前就只有CT能用
|
|
|
*/
|
|
|
function getGuideList($old_pid,$new_pid){
|
|
|
|
|
|
$sql = " select top 1 ic_url from dbo.infoContents
|
|
|
inner join infoStructures on ic_id=is_ic_id
|
|
|
where is_id = ? ";
|
|
|
|
|
|
$query = $this->InfoCT->query ($sql ,array($new_pid));
|
|
|
|
|
|
if ($query->num_rows()>0){
|
|
|
$url = $query->row()->ic_url;
|
|
|
}else{
|
|
|
$url = "";
|
|
|
}
|
|
|
|
|
|
if ($url==""){$url="nourl";}
|
|
|
|
|
|
////原来读取旧信息数据
|
|
|
// SELECT ic_url,ic_url_title,ic_photo
|
|
|
// ,(select top 1 im_value from infoMetas where im_key='meta_addon_picture_mobile' and im_ic_id=ic_id) as pic2
|
|
|
// ,'2' as sortby
|
|
|
// FROM dbo.infoContents
|
|
|
// inner join infoStructures on ic_id=is_ic_id
|
|
|
// WHERE is_sitecode='ct'
|
|
|
// and ic_status=1
|
|
|
// and is_parent_id = ?
|
|
|
|
|
|
|
|
|
$sql = "
|
|
|
select * from (
|
|
|
SELECT ic_url,ic_url_title,ic_photo
|
|
|
,(select top 1 im_value from infoMetas where im_key='meta_addon_picture_mobile' and im_ic_id=ic_id) as pic2
|
|
|
,'2' as sortby , is_sort
|
|
|
FROM dbo.infoContents
|
|
|
inner join infoStructures on ic_id=is_ic_id
|
|
|
WHERE is_sitecode='ct'
|
|
|
and ic_status=1
|
|
|
and ic_url like ?
|
|
|
and is_parent_id <> ?
|
|
|
|
|
|
UNION ALL
|
|
|
|
|
|
SELECT ic_url,ic_url_title,ic_photo
|
|
|
,(select top 1 im_value from infoMetas where im_key='meta_addon_picture_mobile' and im_ic_id=ic_id) as pic2
|
|
|
,'1' as sortby ,is_sort
|
|
|
FROM dbo.infoContents
|
|
|
inner join infoStructures on ic_id=is_ic_id
|
|
|
WHERE is_sitecode='chinatravel'
|
|
|
and ic_status=1
|
|
|
and is_parent_id = ?
|
|
|
) allbt
|
|
|
order by sortby ,is_sort
|
|
|
|
|
|
";
|
|
|
|
|
|
$qurey = $this->InfoCT->query($sql,array($url."/%",$new_pid,$new_pid));
|
|
|
return $qurey->result();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @description: 获取线路的sn
|
|
|
* @param {*} $clino 线路编码
|
|
|
* @return {*}
|
|
|
* @Date Changed:
|
|
|
*/
|
|
|
function getCliSn($clino=""){
|
|
|
$sql = "select top 1 CLI_SN,CLI_PackageClass from CustomerLineInfo
|
|
|
where CLI_NO=? and CLI_State=1005004
|
|
|
AND (CLI_DEI_SN= ? )";
|
|
|
$query = $this->HT->query($sql,array($clino,$this->dei_sn));
|
|
|
if (!$query->num_rows()>0){
|
|
|
return null;
|
|
|
}else{
|
|
|
return $query->row();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* @description: 获取一日游价格列表
|
|
|
* @param {*} $pagcode
|
|
|
* @return {*}
|
|
|
* @Date Changed:
|
|
|
*/
|
|
|
function getDaytripPriceList($pagcode){
|
|
|
//1.先根据编码获取SN
|
|
|
$sql = "select top 1 PAG_SN from BIZ_PackageInfo p1
|
|
|
inner join BIZ_PackageInfo2 p2 on p1.PAG_SN = p2.PAG2_PAG_SN
|
|
|
where p1.pag_dei_sn = ?
|
|
|
and p2.PAG2_LGC = ?
|
|
|
and p1.PAG_Code = ?
|
|
|
and p2.PAG2_Check = 2
|
|
|
AND (isnull(P1.DeleteFlag,0) <>1) ";
|
|
|
$query = $this->HT->query($sql,array($this->dei_sn,$this->CTLGC,$pagcode));
|
|
|
if ($query->num_rows()>0){
|
|
|
//2.根据SN获取获取一个供应商的ID,不然所有供应商的价格都出来了。
|
|
|
$pagsn = $query->row()->PAG_SN;
|
|
|
$sql = "select top 10 PAG_DefaultVEI_SN,pkp_vei_sn ,*
|
|
|
from BIZ_PackagePrice
|
|
|
left join BIZ_PackageInfo on BIZ_PackageInfo.PAG_DefaultVEI_SN=BIZ_PackagePrice.PKP_VEI_SN
|
|
|
and BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
|
|
|
where PKP_PAG_SN =?
|
|
|
order by isnull( BIZ_PackageInfo.PAG_DefaultVEI_SN,0) desc ,PKP_InvalidDate desc";
|
|
|
$query = $this->HT->query($sql,array($pagsn));
|
|
|
if ($query->num_rows()>0){
|
|
|
$veisn = $query->row()->pkp_vei_sn;
|
|
|
if (!empty($query->row()->PAG_DefaultVEI_SN)){
|
|
|
$veisn = $query->row()->PAG_DefaultVEI_SN;
|
|
|
}
|
|
|
}else{
|
|
|
$veisn=0;
|
|
|
}
|
|
|
|
|
|
//3.根据供应商ID获取对应价格列表
|
|
|
$sql = "SELECT isnull(PKP_AdultPrice, 0) AS PKP_AdultPrice
|
|
|
,isnull(PKP_AdultSpecialPrice, 0) AS PKP_AdultSpecialPrice
|
|
|
,PKP_PersonStart
|
|
|
,PKP_PersonStop
|
|
|
FROM BIZ_PackagePrice
|
|
|
WHERE PKP_PAG_SN = ?
|
|
|
AND PKP_VEI_SN = ?
|
|
|
AND getdate() BETWEEN pkp_validdate AND pkp_invaliddate
|
|
|
and Checked=2
|
|
|
ORDER BY PKP_PersonStart ";
|
|
|
$query = $this->HT->query($sql,array($pagsn,$veisn));
|
|
|
if (!$query->num_rows()>0){
|
|
|
//如果今年没价格,获取去年的价格
|
|
|
$nowYear = date('Y');
|
|
|
for ($i=1;$i<6;$i++){
|
|
|
$price_pyears = $nowYear-$i ."-1-1";
|
|
|
$price_pyears_2 = $nowYear-$i . "-12-31";
|
|
|
$sql = "SELECT isnull(PKP_AdultPrice, 0) AS PKP_AdultPrice
|
|
|
,isnull(PKP_AdultSpecialPrice, 0) AS PKP_AdultSpecialPrice
|
|
|
,PKP_PersonStart
|
|
|
,PKP_PersonStop
|
|
|
FROM BIZ_PackagePrice
|
|
|
WHERE PKP_PAG_SN = ?
|
|
|
AND PKP_VEI_SN = ?
|
|
|
AND pkp_validdate BETWEEN '".$price_pyears."' AND '".$price_pyears_2."' ORDER BY PKP_PersonStart ";
|
|
|
$query = $this->HT->query($sql,array($pagsn,$veisn));
|
|
|
if ($query->num_rows()>0){
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if ($query->num_rows()>0){
|
|
|
//4.价格列表返回
|
|
|
return $query->result();
|
|
|
}else {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//根据图片URL判断CDN的地址
|
|
|
function getPicCdn($picurl){
|
|
|
$strCdn ="";
|
|
|
if (strpos($picurl,$this->WebUrl)!== false || strpos($picurl,$this->WebCdn)!== false || strpos($picurl,$this->imagesUrl)!== false ) {
|
|
|
$strCdn="";
|
|
|
} else if (strpos($picurl,"allpicture")!== false){
|
|
|
$strCdn = "//".$this->imagesUrl ;
|
|
|
}else if (strpos($picurl,"/album/userupload/")!== false){
|
|
|
$strCdn = "//".$this->WebCdn ;
|
|
|
}else if (strpos($picurl,"/images/")!== false) {
|
|
|
$strCdn = "//".$this->WebCdn;
|
|
|
}else{
|
|
|
$strCdn = "//".$this->imagesUrl;
|
|
|
}
|
|
|
return $strCdn;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* @description: //旧数据导入新数据
|
|
|
* @param {*} $id
|
|
|
* @param {*} $oldUrl
|
|
|
* @return {*}
|
|
|
* @Date Changed:
|
|
|
*/
|
|
|
function copyOldUrl($id,$oldUrl){
|
|
|
$sql = "UPDATE icNew
|
|
|
SET icNew.ic_content = icOld.ic_content
|
|
|
,icNew.ic_summary = icOld.ic_summary
|
|
|
,icNew.ic_title = icOld.ic_title
|
|
|
,icNew.ic_url_title = icOld.ic_url_title
|
|
|
,icNew.ic_seo_title = icOld.ic_seo_title
|
|
|
,icNew.ic_seo_description = icOld.ic_seo_description
|
|
|
,icNew.ic_seo_keywords = icOld.ic_seo_keywords
|
|
|
,icNew.ic_photo = icOld.ic_photo
|
|
|
FROM infoContents icNew
|
|
|
,infoContents icOld
|
|
|
WHERE icNew.ic_id = ?
|
|
|
AND icNew.ic_sitecode = '".$this->WebCode."'
|
|
|
AND icOld.ic_url = ?
|
|
|
AND icOld.ic_sitecode = 'ct'";
|
|
|
|
|
|
return $this->InfoCT->query($sql, array($id,$oldUrl));
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* @description: 根据信息标题获取对应的翰特包价线路内容
|
|
|
* @param {string} $pagecode
|
|
|
* @return:
|
|
|
*/
|
|
|
function get_pagdetail($pagcode)
|
|
|
{
|
|
|
if (!is_string($pagcode)){
|
|
|
$pagcode="";
|
|
|
}
|
|
|
$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
|
|
|
,PAG2_Summary
|
|
|
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=?
|
|
|
WHERE (p1.pag_dei_sn=" . $this->dei_sn . ") AND
|
|
|
(p2.PAG2_LGC = ?)
|
|
|
AND (isnull(P1.DeleteFlag,0)<>1)
|
|
|
AND (p1.PAG_Code = ?) ";
|
|
|
|
|
|
// AND (p2.PAG2_Check = 2)
|
|
|
// AND (isnull(P1.DeleteFlag,0) <>1) ";
|
|
|
if($this->CTLGC==2){
|
|
|
$cii2_lgc = 2;
|
|
|
}else{
|
|
|
$cii2_lgc = 1;
|
|
|
}
|
|
|
|
|
|
$query = $this->HT->query($sql, array($cii2_lgc,$this->CTLGC,$pagcode));
|
|
|
if ($query->num_rows() > 0) {
|
|
|
return $query->row();
|
|
|
} else {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取一日游产品的价格列表用来计算,默认读取4年的价额,前年,去年今年,明年
|
|
|
*/
|
|
|
function getDaytripPriceData($pagcode){
|
|
|
//1.先根据编码获取SN
|
|
|
$sql = "select top 1 PAG_SN from BIZ_PackageInfo p1
|
|
|
inner join BIZ_PackageInfo2 p2 on p1.PAG_SN = p2.PAG2_PAG_SN
|
|
|
where p1.pag_dei_sn = ?
|
|
|
and p2.PAG2_LGC = ?
|
|
|
and p1.PAG_Code = ?
|
|
|
--and p2.PAG2_Check = 2
|
|
|
AND (isnull(P1.DeleteFlag,0) <>1) ";
|
|
|
$query = $this->HT->query($sql,array($this->dei_sn,$this->CTLGC,$pagcode));
|
|
|
if ($query->num_rows()>0){
|
|
|
//2.根据SN获取获取一个供应商的ID,不然所有供应商的价格都出来了。
|
|
|
$pagsn = $query->row()->PAG_SN;
|
|
|
$sql = "select top 10 PAG_DefaultVEI_SN,pkp_vei_sn ,*
|
|
|
from BIZ_PackagePrice
|
|
|
left join BIZ_PackageInfo on BIZ_PackageInfo.PAG_DefaultVEI_SN=BIZ_PackagePrice.PKP_VEI_SN
|
|
|
and BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
|
|
|
where PKP_PAG_SN =?
|
|
|
order by isnull( BIZ_PackageInfo.PAG_DefaultVEI_SN,0) desc ,PKP_InvalidDate desc";
|
|
|
$query = $this->HT->query($sql,array($pagsn));
|
|
|
if ($query->num_rows()>0){
|
|
|
$veisn = $query->row()->pkp_vei_sn;
|
|
|
if (!empty($query->row()->PAG_DefaultVEI_SN)){
|
|
|
$veisn = $query->row()->PAG_DefaultVEI_SN;
|
|
|
}
|
|
|
}else{
|
|
|
$veisn=0;
|
|
|
}
|
|
|
|
|
|
//3.根据供应商ID获取对应价格列表
|
|
|
$sql = "SELECT PKP_PersonStart
|
|
|
,PKP_PersonStop
|
|
|
,'PKP_AdultPrice'=( Case When (PKP_AdultSpecialPrice>0 and PKP_AdultSpecialPrice<>PKP_AdultNetPrice) then PKP_AdultSpecialPrice else PKP_AdultNetPrice end)
|
|
|
,'PKP_ChildPrice'=( Case When (PKP_ChildSpecialPrice>0 and PKP_ChildSpecialPrice<>PKP_ChildNetPrice) then PKP_ChildSpecialPrice else PKP_ChildNetPrice end)
|
|
|
,convert(varchar(100),PKP_ValidDate,111) as PKP_ValidDate
|
|
|
,convert(varchar(100),PKP_InvalidDate,111) as PKP_InvalidDate
|
|
|
FROM BIZ_PackagePrice
|
|
|
WHERE PKP_PAG_SN = ?
|
|
|
AND PKP_VEI_SN = ?
|
|
|
AND PKP_InvalidDate>=DATEADD(YEAR,-2,GETDATE())
|
|
|
and Checked=2
|
|
|
ORDER BY PKP_PersonStart ";
|
|
|
$query = $this->HT->query($sql,array($pagsn,$veisn));
|
|
|
|
|
|
if ($query->num_rows()>0){
|
|
|
//4.价格列表返回
|
|
|
return $query->result();
|
|
|
}else {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取发布的线路详细页的所有产品对应的线路类型列表。(用于搜索页)
|
|
|
*/
|
|
|
function getLineTypeList(){
|
|
|
|
|
|
$sql = " SELECT DISTINCT CLI_LineType
|
|
|
FROM CustomerLineInfo INNER JOIN
|
|
|
CustomerLineInfo2 ON CustomerLineInfo.CLI_SN = CustomerLineInfo2.CLI2_CLI_SN
|
|
|
WHERE (CLI_DEI_SN=".$this->dei_sn.")
|
|
|
AND (CLI_State = 1005004)
|
|
|
AND (CLI2_LGC = ".$this->CTLGC.")
|
|
|
and isnull(CustomerLineInfo2.DeleteFlag,0)=0
|
|
|
and CLI_NO in ( SELECT convert(varchar(100),(
|
|
|
SELECT TOP 1 im_value
|
|
|
FROM information_ct.dbo.infoMetas
|
|
|
WHERE im_key = 'meta_ct_page_value'
|
|
|
AND im_ic_id = ic_id
|
|
|
)) AS code
|
|
|
FROM information_ct.dbo.infoContents
|
|
|
INNER JOIN information_ct.dbo.infoStructures ON ic_id = is_ic_id
|
|
|
WHERE is_sitecode ='".$this->WebCode."' AND ic_status = 1
|
|
|
and ic_id in (select im_ic_id from information_ct.dbo.infoMetas where im_key='meta_ct_page_type' and convert(varchar(100),im_value)='tourdetail')
|
|
|
|
|
|
)";
|
|
|
|
|
|
$query =$this->HT->query($sql);
|
|
|
$all_values = array();
|
|
|
|
|
|
if ($query->num_rows() > 0) {
|
|
|
foreach ($query->result_array() as $row) {
|
|
|
$column_data = $row['CLI_LineType'];
|
|
|
// 分割逗号分隔的值
|
|
|
$values = explode(',', $column_data);
|
|
|
//去掉逗号
|
|
|
$values = array_map(function($item) {
|
|
|
return trim($item, ',');
|
|
|
}, $values);
|
|
|
// 去除每个值的空白字符
|
|
|
$values = array_map('trim', $values);
|
|
|
// 合并到总数组
|
|
|
$all_values = array_merge($all_values, $values);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 去重
|
|
|
$unique_values = array_unique($all_values);
|
|
|
|
|
|
// // 重新索引数组(可选)
|
|
|
// $unique_values = array_values($unique_values);
|
|
|
|
|
|
// // 按数值大小排序(如果需要)
|
|
|
// sort($unique_values, SORT_NUMERIC);
|
|
|
|
|
|
// 合并为逗号分隔的字符串,所有类型的字符串
|
|
|
$result_string = implode(',', $unique_values);
|
|
|
$result_string = trim($result_string, ','); // 去掉首尾的逗号
|
|
|
|
|
|
//return $result_string;
|
|
|
$sql2 = " select SYC_SN, SYC2_CodeDiscribe
|
|
|
from SystemCode
|
|
|
inner join SystemCode2 on SYC_SN = SYC2_SYC_SN
|
|
|
where SYC_Type=6 and SYC2_LGC=".$this->CTLGC." and SYC2_CodeDiscribe>'' and SYC_SN in (".$result_string.") ";
|
|
|
|
|
|
|
|
|
$query = $this->HT->query($sql2);
|
|
|
if ($query->num_rows()>0){
|
|
|
return $query->result();
|
|
|
}else {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取所有录入线路的列表
|
|
|
*/
|
|
|
function getTourList(){
|
|
|
$sql = "SELECT convert(varchar(100),(
|
|
|
SELECT TOP 1 im_value
|
|
|
FROM information_ct.dbo.infoMetas
|
|
|
WHERE im_key = 'meta_ct_page_value'
|
|
|
AND im_ic_id = ic_id
|
|
|
)) AS code
|
|
|
,convert(varchar(100),(
|
|
|
SELECT TOP 1 im_value
|
|
|
FROM information_ct.dbo.infoMetas
|
|
|
WHERE im_key = 'meta_addon_picture'
|
|
|
AND im_ic_id = ic_id
|
|
|
)) AS pcPic
|
|
|
,convert(varchar(100),(
|
|
|
SELECT TOP 1 im_value
|
|
|
FROM information_ct.dbo.infoMetas
|
|
|
WHERE im_key = 'meta_addon_picture_mobile'
|
|
|
AND im_ic_id = ic_id
|
|
|
)) AS mobilePic
|
|
|
,ic_photo,ic_url,ic_url_title
|
|
|
FROM information_ct.dbo.infoContents
|
|
|
INNER JOIN information_ct.dbo.infoStructures ON ic_id = is_ic_id
|
|
|
WHERE is_sitecode ='".$this->WebCode."' AND ic_status = 1
|
|
|
and ic_id in (select im_ic_id from information_ct.dbo.infoMetas where im_key='meta_ct_page_type' and convert(varchar(100),im_value)='tourdetail')
|
|
|
order by is_sort "; //信息平台开放的线路列表
|
|
|
|
|
|
$query =$this->HT->query($sql);
|
|
|
|
|
|
$resultJson = array();
|
|
|
if ($query->num_rows() > 0) {
|
|
|
foreach ($query->result_array() as $row) {
|
|
|
$tourItem = new stdClass();
|
|
|
$tourItem->code = $row["code"];
|
|
|
// 优先级:mobilePic → pcPic → ic_photo → 默认图
|
|
|
$tourItem->pic = !empty($row["mobilePic"]) ? $row["mobilePic"]
|
|
|
: (!empty($row["pcPic"]) ? $row["pcPic"]
|
|
|
: (!empty($row["ic_photo"]) ? $row["ic_photo"] : "/image/grey.gif"));
|
|
|
|
|
|
$tourItem->url = $row["ic_url"];
|
|
|
$tourItem->title = $row["ic_url_title"];
|
|
|
|
|
|
//价格
|
|
|
$price = $this->getTourPrice($row["code"]);
|
|
|
$resultPrice = 0;
|
|
|
if (isset($price->CLP_TwoToFiveAdultPrice)){
|
|
|
$resultPrice = $this->currency->calc_show_price($price->CLP_TwoToFiveAdultPrice);
|
|
|
}
|
|
|
|
|
|
// 处理价格:
|
|
|
// 1. 如果是 null,设为空字符串 ""
|
|
|
// 2. 如果是数字(如 100.0000),转为整数(100)
|
|
|
$tourItem->price = ($resultPrice === null)
|
|
|
? ""
|
|
|
: (string)(int)floatval($resultPrice);
|
|
|
|
|
|
|
|
|
//类别信息
|
|
|
$tourDetail = $this->getTourDetail($row["code"]);
|
|
|
if (isset($tourDetail->CLI_LineType)){
|
|
|
$tourItem->linetype = strval($tourDetail->CLI_LineType);
|
|
|
}else{
|
|
|
$tourItem->linetype = "";
|
|
|
}
|
|
|
//城市
|
|
|
if (isset($tourDetail->CLI2_PassCity)){
|
|
|
$tourItem->PassCity = $tourDetail->CLI2_PassCity;
|
|
|
}else{
|
|
|
$tourItem->PassCity = "";
|
|
|
}
|
|
|
//天数
|
|
|
if (isset($tourDetail->CLI_Days)){
|
|
|
$tourItem->Days = $tourDetail->CLI_Days;
|
|
|
}else{
|
|
|
$tourItem->Days = 0;
|
|
|
}
|
|
|
|
|
|
|
|
|
$resultJson[] = $tourItem;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return $resultJson;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取对应编码的线路信息
|
|
|
*/
|
|
|
function getTourDetail($clino){
|
|
|
$sql = " SELECT top 1 CLI_LineType ,CLI_PackageClass,CLI_SN,CLI2_PassCity,CLI_Days
|
|
|
FROM CustomerLineInfo INNER JOIN
|
|
|
CustomerLineInfo2 ON CustomerLineInfo.CLI_SN = CustomerLineInfo2.CLI2_CLI_SN
|
|
|
WHERE (CLI_DEI_SN=".$this->dei_sn.")
|
|
|
AND (CLI_State = 1005004)
|
|
|
AND (CLI2_LGC = ".$this->CTLGC.")
|
|
|
and isnull(CustomerLineInfo2.DeleteFlag,0)=0
|
|
|
and CLI_NO = ? ";
|
|
|
$query =$this->HT->query($sql,array($clino));
|
|
|
|
|
|
if ($query->num_rows() > 0) {
|
|
|
return $query->row();
|
|
|
}else{
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取发布的一日游详细页的所有产品对应的类型列表,扩展类型列表。(用于搜索页)
|
|
|
*/
|
|
|
function getPagTypeList(){
|
|
|
$sql = " SELECT DISTINCT PAG_Type ,PAG_ExtendType
|
|
|
FROM dbo.BIZ_PackageInfo P1 INNER JOIN
|
|
|
dbo.BIZ_PackageInfo2 p2 ON P1.PAG_SN = p2.PAG2_PAG_SN
|
|
|
WHERE (pag_dei_sn= ".$this->dei_sn.")
|
|
|
AND (p2.PAG2_Check = 2)
|
|
|
AND (PAG2_LGC = ".$this->CTLGC.")
|
|
|
and PAG_Code in ( SELECT convert(varchar(100),(
|
|
|
SELECT TOP 1 im_value
|
|
|
FROM information_ct.dbo.infoMetas
|
|
|
WHERE im_key = 'meta_ct_page_value'
|
|
|
AND im_ic_id = ic_id
|
|
|
)) AS code
|
|
|
FROM information_ct.dbo.infoContents
|
|
|
INNER JOIN information_ct.dbo.infoStructures ON ic_id = is_ic_id
|
|
|
WHERE is_sitecode ='".$this->WebCode."' AND ic_status = 1
|
|
|
and ic_id in (select im_ic_id from information_ct.dbo.infoMetas where im_key='meta_ct_page_type' and convert(varchar(100),im_value)='daytripdetail')
|
|
|
) ";
|
|
|
|
|
|
$query =$this->HT->query($sql);
|
|
|
$type_values = array(); //类型
|
|
|
$extendType_values = array(); //扩展类型
|
|
|
|
|
|
if ($query->num_rows() > 0) {
|
|
|
foreach ($query->result_array() as $row) {
|
|
|
$column_data = $row['PAG_Type'];
|
|
|
// 分割逗号分隔的值
|
|
|
$values = explode(',', $column_data);
|
|
|
// 去除每个值的空白字符
|
|
|
$values = array_map('trim', $values);
|
|
|
// 合并到总数组
|
|
|
$type_values = array_merge($type_values, $values);
|
|
|
|
|
|
$column_data2 = $row['PAG_ExtendType'];
|
|
|
// 分割逗号分隔的值
|
|
|
$values2 = explode(',', $column_data2);
|
|
|
// 去除每个值的空白字符
|
|
|
$values2 = array_map('trim', $values2);
|
|
|
// 合并到总数组
|
|
|
$extendType_values = array_merge($extendType_values, $values2);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 去重
|
|
|
$unique_values = array_unique($type_values);
|
|
|
$unique_values2 = array_unique($extendType_values);
|
|
|
|
|
|
// 合并为逗号分隔的字符串,所有类型的字符串
|
|
|
$type_string = implode(',', $unique_values);
|
|
|
$type_string = trim($type_string, ','); // 去掉首尾的逗号
|
|
|
$extendType_string = implode(',', $unique_values2);
|
|
|
$extendType_string = trim($extendType_string, ','); // 去掉首尾的逗号
|
|
|
|
|
|
$resultClass = new stdClass();
|
|
|
|
|
|
$sql2 = " select SYC_SN, SYC2_CodeDiscribe
|
|
|
from SystemCode
|
|
|
inner join SystemCode2 on SYC_SN = SYC2_SYC_SN
|
|
|
where SYC_Type=35 and SYC2_LGC=".$this->CTLGC." and SYC2_CodeDiscribe>'' and SYC_SN in (".$type_string.") ";
|
|
|
|
|
|
|
|
|
$query = $this->HT->query($sql2);
|
|
|
if ($query->num_rows()>0){
|
|
|
$resultClass->type = $query->result();
|
|
|
}else {
|
|
|
$resultClass->type = [];
|
|
|
}
|
|
|
|
|
|
$sql3 = " select SYC_SN, SYC2_CodeDiscribe
|
|
|
from SystemCode
|
|
|
inner join SystemCode2 on SYC_SN = SYC2_SYC_SN
|
|
|
where SYC_Type=39 and SYC2_LGC=".$this->CTLGC." and SYC2_CodeDiscribe>'' and SYC_SN in (".$extendType_string.") ";
|
|
|
|
|
|
$query = $this->HT->query($sql3);
|
|
|
if ($query->num_rows()>0){
|
|
|
$resultClass->extendType = $query->result();
|
|
|
}else {
|
|
|
$resultClass->extendType = [];
|
|
|
}
|
|
|
|
|
|
return $resultClass;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取所有录入一日游的列表(搜索页)
|
|
|
*/
|
|
|
function getSearchDaytripList(){
|
|
|
$sql = "SELECT convert(varchar(100),(
|
|
|
SELECT TOP 1 im_value
|
|
|
FROM information_ct.dbo.infoMetas
|
|
|
WHERE im_key = 'meta_ct_page_value'
|
|
|
AND im_ic_id = ic_id
|
|
|
)) AS code
|
|
|
,convert(varchar(100),(
|
|
|
SELECT TOP 1 im_value
|
|
|
FROM information_ct.dbo.infoMetas
|
|
|
WHERE im_key = 'meta_addon_picture'
|
|
|
AND im_ic_id = ic_id
|
|
|
)) AS pcPic
|
|
|
,convert(varchar(100),(
|
|
|
SELECT TOP 1 im_value
|
|
|
FROM information_ct.dbo.infoMetas
|
|
|
WHERE im_key = 'meta_addon_picture_mobile'
|
|
|
AND im_ic_id = ic_id
|
|
|
)) AS mobilePic
|
|
|
,ic_photo,ic_url,ic_url_title
|
|
|
FROM information_ct.dbo.infoContents
|
|
|
INNER JOIN information_ct.dbo.infoStructures ON ic_id = is_ic_id
|
|
|
WHERE is_sitecode ='".$this->WebCode."' AND ic_status = 1
|
|
|
and ic_id in (select im_ic_id from information_ct.dbo.infoMetas where im_key='meta_ct_page_type' and convert(varchar(100),im_value)='daytripdetail')
|
|
|
order by is_sort "; //信息平台开放的一日游列表
|
|
|
|
|
|
$query =$this->HT->query($sql);
|
|
|
|
|
|
$resultJson = array();
|
|
|
if ($query->num_rows() > 0) {
|
|
|
foreach ($query->result_array() as $row) {
|
|
|
$tourItem = new stdClass();
|
|
|
$tourItem->code = $row["code"];
|
|
|
// 优先级:mobilePic → pcPic → ic_photo → 默认图
|
|
|
$tourItem->pic = !empty($row["mobilePic"]) ? $row["mobilePic"]
|
|
|
: (!empty($row["pcPic"]) ? $row["pcPic"]
|
|
|
: (!empty($row["ic_photo"]) ? $row["ic_photo"] : "/image/grey.gif"));
|
|
|
|
|
|
$tourItem->url = $row["ic_url"];
|
|
|
$tourItem->title = $row["ic_url_title"];
|
|
|
|
|
|
//价格
|
|
|
$resultPrice = 0;
|
|
|
$price = $this->getDaytripsPrice($row["code"],2);
|
|
|
$PKP_AdultSpecialPrice = isset($price->PKP_AdultSpecialPrice)?$price->PKP_AdultSpecialPrice:0;
|
|
|
$PKP_AdultPrice = isset($price->PKP_AdultPrice)?$price->PKP_AdultPrice:0;
|
|
|
if ($PKP_AdultPrice!=$PKP_AdultSpecialPrice && $PKP_AdultSpecialPrice>0){
|
|
|
$resultPrice = $this->currency->convert_moneny_by_char($PKP_AdultSpecialPrice,"USD");
|
|
|
}else{
|
|
|
$resultPrice = $this->currency->convert_moneny_by_char($PKP_AdultPrice,"USD");
|
|
|
}
|
|
|
// 处理价格:
|
|
|
// 1. 如果是 null,设为空字符串 ""
|
|
|
// 2. 如果是数字(如 100.0000),转为整数(100)
|
|
|
$tourItem->price = ($resultPrice === null)
|
|
|
? ""
|
|
|
: (string)(int)floatval($resultPrice);
|
|
|
|
|
|
|
|
|
//类别信息
|
|
|
$dayTripDetail = $this->getSearchDaytripDetail($row["code"]);
|
|
|
if (isset($dayTripDetail->PAG_Type)){
|
|
|
$tourItem->type = strval($dayTripDetail->PAG_Type);
|
|
|
}else{
|
|
|
$tourItem->type = "";
|
|
|
}
|
|
|
//扩展类别
|
|
|
if (isset($dayTripDetail->PAG_ExtendType)){
|
|
|
$tourItem->extendType = $dayTripDetail->PAG_ExtendType;
|
|
|
}else{
|
|
|
$tourItem->extendType = "";
|
|
|
}
|
|
|
//时间
|
|
|
if (isset($dayTripDetail->PAG_NeedTime)){
|
|
|
$tourItem->needTime = $dayTripDetail->PAG_NeedTime;
|
|
|
}else{
|
|
|
$tourItem->needTime = 0;
|
|
|
}
|
|
|
|
|
|
|
|
|
$resultJson[] = $tourItem;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return $resultJson;
|
|
|
|
|
|
}
|
|
|
|
|
|
/***
|
|
|
* 根据一日游编码获取录入一日游的详细信息(搜索页)
|
|
|
*/
|
|
|
function getSearchDaytripDetail($pagcode){
|
|
|
$sql = " SELECT top 1 p2.PAG2_Name, p2.PAG2_Intro, P1.PAG_NeedTime,P1.PAG_SN, P1.PAG_Code, CItyInfo2.CII2_Name
|
|
|
,P1.PAG_Type ,P1.PAG_ExtendType
|
|
|
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 (p2.PAG2_LGC =".$this->CTLGC.") AND (p1.pag_dei_sn=".$this->dei_sn.") AND
|
|
|
(p2.PAG2_Check = 2) and (PAG_Code='".$pagcode."')";
|
|
|
$query =$this->HT->query($sql);
|
|
|
|
|
|
if ($query->num_rows() > 0) {
|
|
|
return $query->row();
|
|
|
}else{
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/* End of file Api_model.php */
|