Merge branch 'master' of github.com:hainatravel/information-system

hotfix/paypal-note
CandiceSong 4 years ago
commit 35eaf9c51c

@ -239,6 +239,65 @@ class Api extends CI_Controller {
echo json_encode($result);
}
/**
* @description: 一日游价格表
* @param {*}
* @return {*}
* @Date Changed:
*/
public function getDaytripPriceList(){
if (isset($_GET["param"])){
$param = str_replace("'","''",$_GET["param"]);
$list = $this->api_model->getDaytripPriceList($param);
if (!empty($list)){
if (count($list)==1){
//echo "1";
foreach ($list as $row) {
$PKP_AdultPrice = $row->PKP_AdultPrice;
$PKP_AdultSpecialPrice = $row->PKP_AdultSpecialPrice;
if ($PKP_AdultPrice!=$PKP_AdultSpecialPrice && $PKP_AdultSpecialPrice>0){
$PKP_AdultPrice=$PKP_AdultSpecialPrice;
}
$PKP_AdultPrice = $this->currency->convert_moneny_by_char($PKP_AdultPrice,"USD");
echo '<table border="0" align="center" cellpadding="10" cellspacing="1" class="pricetable"><tr><th>>1 Person</th></tr><tr><td><strong class="orange"> $'.$PKP_AdultPrice.'</strong></td></tr></table>';
}
}else{
//echo "2";
$str_th="";
$str_td="";
foreach ($list as $row) {
$PKP_AdultPrice = $row->PKP_AdultPrice;
$PKP_AdultSpecialPrice = $row->PKP_AdultSpecialPrice;
if ($PKP_AdultPrice!=$PKP_AdultSpecialPrice && $PKP_AdultSpecialPrice>0){
$PKP_AdultPrice=$PKP_AdultSpecialPrice;
}
$PKP_AdultPrice = $this->currency->convert_moneny_by_char($PKP_AdultPrice,"USD");
$PKP_PersonStart = $row->PKP_PersonStart;
$PKP_PersonStop = $row->PKP_PersonStop;
//'根据数据生成显示内容
if ($PKP_PersonStart == $PKP_PersonStop){
$str_th .= "<th> ".$PKP_PersonStart." Person</th>";
}
else if ($PKP_PersonStop=="1000") {
$str_th .= "<th> >".$PKP_PersonStart." Person</th>";
}
else{
$str_th .= "<th> ".$PKP_PersonStart." - ".$PKP_PersonStop." Person</th>";
}
$str_td .="<td><strong class='orange'> $ ".$PKP_AdultPrice."</strong></td>";
}
echo '<table border="0" align="center" cellpadding="10" cellspacing="1" class="pricetable"><tr>'.$str_th.'</tr><tr>'.$str_td.'</tr></table>';
}
}
}else{
echo "";
}
}
}
/* End of file Api.php */

@ -299,6 +299,88 @@ class Api_model extends CI_Model {
}
}
/**
* @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."' ";
$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;
}
}
}
/* End of file Api_model.php */

Loading…
Cancel
Save