完成一日游列表

ct-mobile-first
赵鹏 4 years ago
parent 783b1b4a6b
commit 61a92f6f9c

@ -777,7 +777,7 @@ class Information extends CI_Controller
/* 详细内容 */
$ic_content = $information->ic_content;
// /**替换详细内容里面的价格
/* 直接使用fetch来动态获取价格,这样不用替换标签,直接录标签
/* 直接使用fetch来动态获取价格这样不用替换标签直接录标签
// * // 一日游价格标签, "<!--@DayTripPrice:XASIC-41@-->" 或者<!--@DayTripPrice:XASIC-41,2@--> 逗号后面是人数
// * //精华线路标签"<!--@TourPrice:ct-1@-->"
// */
@ -792,7 +792,7 @@ class Information extends CI_Controller
// return '<span class="js_getTourPrice" data="'.$matchItem.'"></span>';;
// },$ic_content);
$ic_content = '<div class="container-details details-content">'.$ic_content.'</div>'; //兼容拷贝过来的内容样式
//$ic_content = '<div class="container-details details-content">'.$ic_content.'</div>'; //兼容拷贝过来的内容样式
$data["CUSTOMCONENT"]=$ic_content;
@ -889,6 +889,11 @@ class Information extends CI_Controller
$addonJs .= '<script src="/js/mobile-first/getprice.js"></script>';
}
//列表js
if ($meta_ct_page_type=="daytripindex" || $meta_ct_page_type=="tourindex"){
$addonJs .= '<script src="/js/mobile-first/getlist.js"></script>';
}
$data["ADDONJS"]=$addonJs;
//社媒分享图片
$data["OGIMAGE"]="";
@ -904,6 +909,17 @@ class Information extends CI_Controller
$data["ConstructionCode"]=$meta_construction_code;
}
//页面传递参数
$passParam = "";
if ($meta_ct_page_type=="daytripindex" || $meta_ct_page_type=="tourindex"){
//产品首页
$meta_ct_page_value = get_meta($information->ic_id,'meta_ct_page_value');
$passParam .= '<input type="hidden" name="param_city" id="param_city" value="'.$meta_ct_page_value.'"/>';
//加信息平台的is_id
$passParam .= '<input type="hidden" name="param_parentId" id="param_parentId" value="'.$information->is_id.'"/>';
}
$data["passParam"] = $passParam;

@ -84,6 +84,82 @@ class Api extends CI_Controller {
}
}
/**
* @description: 获取HT及信息平台的一日游列表数据
* @param {*}
* @return {*}
* @Date Changed:
*/
public function getDaytripList(){
//先处理传递过来的参数逗号隔开两个参数的格式城市名称父ID
$whereHT="";
$whereInfo="";
if (isset($_GET["param"])){
$param = str_replace("'","''",$_GET["param"]);
if (strpos($param,",")!== false){
$city = explode(",",$param)[0];
$whereHT = " and (CII2_Name ='".$city."') ";
$parentid = explode(",",$param)[1];
$whereInfo = " and is_parent_id = '".$parentid."'";
}else{
$whereHT = " and (CII2_Name ='".$param."') ";
$whereInfo = "";
}
}
$list = $this->api_model->getDaytripList($whereHT,$whereInfo);
foreach ($list as $row) {
//获取价格
$price = $this->api_model->getDaytripsPrice($row->code,2);
if ($price!=null){
$PKP_AdultSpecialPrice = $price->PKP_AdultSpecialPrice;
$PKP_AdultPrice = $price->PKP_AdultPrice;
if ($PKP_AdultPrice!=$PKP_AdultSpecialPrice && $PKP_AdultSpecialPrice>0){
$addPrice = $this->currency->convert_moneny_by_char($PKP_AdultSpecialPrice,"USD");
}else{
$addPrice= $this->currency->convert_moneny_by_char($PKP_AdultPrice,"USD");
}
}else{
$addPrice=0;
}
//URL
if (empty($row->url)){
$str_Url = "/china-day-trips/".strtolower($row->code).".htm";
$row->url = $str_Url; //更新url
}
//图片
$imageCdn = "//images.chinatravel.com";//有些HT绑定图片需要加cdn
if (!empty($row->pic1)){
if (strpos($row->pic1,"chinatravel.com")!== false){
$picurl=$row->pic1;
}else{
$picurl = $imageCdn.$row->pic1;
}
}else if(!empty($row->pic2)){
if (strpos($row->pic2,"chinatravel.com")!== false){
$picurl=$row->pic2;
}else{
$picurl = $imageCdn.$row->pic2;
}
}else{
$picurl="//data.chinatravel.com/images/loading2.gif";
}
$row->price = $addPrice; //新增价格属性
$row->pic =$picurl; //图片地址
}
echo json_encode($list);
}
}
/* End of file Api.php */

@ -148,6 +148,129 @@ class Api_model extends CI_Model {
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 (p2.PAG2_LGC = 104)
AND (p1.pag_dei_sn = 17)
AND (p2.PAG2_Check = 2)
AND (isnull(P1.DeleteFlag,0) <>1) ".$whereHT."
) Tmp
UNION ALL
SELECT * from (
select ic_url_title as title
,(select top 1 im_value from 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 infoMetas where im_key='meta_addon_picture_mobile' and im_ic_id=ic_id) as pic2
,'1' as sortby
FROM dbo.infoContents
inner join infoStructures on ic_id=is_ic_id
WHERE is_sitecode='chinatravel' ".$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} $parentid父类的Id
* @return:
* @Date Changed:
*/
function getGuideList($parentid){
if ($parentid < 0 ) {
return null;
}
$sql = "
SELECT is_sort,ic_url,ic_url_title,ic_title, substring(convert(nvarchar(2000),ic_content),0,1000) as ic_summary,ic_photo
,(select top 1 im_value from infoMetas where im_key='meta_addon_picture' and im_ic_id=ic_id) as pic2
FROM dbo.infoContents
inner join infoStructures on ic_id=is_ic_id
WHERE is_sitecode='chinatravel'
and is_parent_id = ?
";
//and ic_status=1
$qurey = $this->HT->query($sql,array($parentid));
return $qurey->result();
}
}
/* End of file Api_model.php */

Loading…
Cancel
Save