diff --git a/application/controllers/information.php b/application/controllers/information.php
index 644a1c3f..a6c54c06 100644
--- a/application/controllers/information.php
+++ b/application/controllers/information.php
@@ -773,8 +773,30 @@ class Information extends CI_Controller
$data["DESCRIPTION"] = $information->ic_seo_description;
$data["KEYWORDS"] = $information->ic_seo_keywords;
$data["CANONICAL"] = $this->config->item('site_url') . $information->ic_url;
- //详细内容
- $data["CUSTOMCONENT"]=$information->ic_content;
+
+ /* 详细内容 */
+ $ic_content = $information->ic_content;
+ /**替换详细内容里面的价格
+ * // 一日游价格标签, "" 或者 逗号后面是人数
+ * //精华线路标签""
+ */
+ $ic_content = preg_replace_callback('//i',function($match){
+ //处理一日游每次配备
+ $matchItem = $match[1];
+ return '';;
+ },$ic_content);
+ $ic_content = preg_replace_callback('//i',function($match){
+ //处理精华线路每次配备
+ $matchItem = $match[1];
+ return '';;
+ },$ic_content);
+
+ $data["CUSTOMCONENT"]=$ic_content;
+
+
+
+
+
//非产品页面
$data["PRODUCTJS"]="";
if (empty(get_meta($information->ic_id, 'meta_product_code'))) {
diff --git a/application/third_party/ctmobilefirst/controllers/api.php b/application/third_party/ctmobilefirst/controllers/api.php
new file mode 100644
index 00000000..43df2094
--- /dev/null
+++ b/application/third_party/ctmobilefirst/controllers/api.php
@@ -0,0 +1,61 @@
+load->model('api_model');
+
+ }
+
+ public function index()
+ {
+ echo("<1>api");
+
+ }
+
+ /**
+ * @description: 返回一日游价格
+ * @param {*} $returntype
+ * @return {*}
+ * @Date Changed:
+ */
+ public function getDaytripsPrice(){
+ $pagecode = $_GET["pagecode"];
+ if (isset($_GET["personnum"])){
+ $personnum=$_GET["personnum"];
+ }else{
+ $personnum=2;
+ }
+
+ $result = $this->api_model->getDaytripsPrice($pagecode,$personnum);
+
+ echo json_encode($result);
+
+ }
+
+
+ /**
+ * @description: 获取精华线路价格(2人等)
+ * @param {*}
+ * @return {*}
+ * @Date Changed:
+ */
+ public function getTourPrice(){
+ if (isset($_GET["param"])){
+ $param = $_GET["param"];
+ $result["status"]="ok";
+ $result["price"] = $this->api_model->getTourPrice($param);
+ echo json_encode($result);
+ }else{
+ $result["status"]="no param";
+ echo json_encode($result);
+ }
+ }
+
+}
+
+/* End of file Api.php */
diff --git a/application/third_party/ctmobilefirst/libraries/Currency.php b/application/third_party/ctmobilefirst/libraries/Currency.php
new file mode 100644
index 00000000..ee25607a
--- /dev/null
+++ b/application/third_party/ctmobilefirst/libraries/Currency.php
@@ -0,0 +1,204 @@
+CI = & get_instance();
+ log_message('debug', "Language Tags Class Initialized");
+ $this->GetCurrencyRate();
+ }
+
+ function GetCurrencyRate() {
+ $this->HT = $this->CI->load->database('HT', TRUE);
+ $sql = "SELECT CRI_BuyIn / 100.00 AS tmpExRate, \n"
+ . " CRI_Code \n"
+ . "FROM tourmanager.dbo.CurrencyRateInfo \n"
+ . "WHERE CRI_Code IN ('USD', 'EUR', 'RUB') \n"
+ . " AND GETDATE() BETWEEN CRI_Start AND CRI_Stop";
+ $query = $this->HT->query($sql);
+ foreach ($query->result() as $item) {
+ switch ($item->CRI_Code) {
+ case 'USD':
+ $this->USD_Rate = $item->tmpExRate;
+ break;
+ case 'EUR':
+ $this->EUR_Rate = $item->tmpExRate;
+ break;
+ case 'RUB':
+ $this->RUB_Rate = $item->tmpExRate;
+ break;
+ }
+ }
+// echo $this->USD_Rate . '
';
+// echo $this->EUR_Rate . '
';
+// echo $this->RUB_Rate . '
';
+ return $query->result();
+ }
+
+ //根据人民币转换成站点对应的货币
+ public function GetSiteMoney($RMB) {
+ if (!is_numeric($RMB))
+ {
+ return $RMB;
+ }
+
+ $result = $RMB;
+ if (is_numeric($RMB)) {
+ switch (CONST_SITE_CURRENCY) {
+ case 'USD':
+ $result = $RMB / $this->USD_Rate;
+ break;
+ case 'EUR':
+ $result = $RMB / $this->EUR_Rate;
+ break;
+ case 'RUB':
+ $result = $RMB / $this->RUB_Rate;
+ break;
+ }
+ }
+ return ceil($result);
+ }
+
+ //把美金转换为人民币
+ public function get_USD_RMB_SUM($USD) {
+
+ if (!is_numeric($USD))return $USD;
+ $result = $USD;
+ $result = $USD * $this->USD_Rate;
+ return ceil($result);
+ }
+
+ /**
+ * 返回站点的汇率。
+ *
+ * @author lmr
+ */
+ public function get_site_currencyrate() {
+ switch (CONST_SITE_CURRENCY) {
+ case 'USD':
+ return $this->USD_Rate;
+ case 'EUR':
+ return $this->EUR_Rate;
+ case 'RUB':
+ return $this->RUB_Rate;
+ default:
+ return 1;
+ }
+ }
+
+ /**
+ * 返回带money_char的价格。
+ *
+ * @param $money Int 价格.
+ * @return String 带货币符号的价格。
+ */
+ public function get_money_char($money='') {
+
+ switch (CONST_SITE_CODE) {
+ case 'JP':
+ return $money.'元';
+ case 'GM':
+ return '€'.$money;
+ case 'VC':
+ return $money.'€';
+ case 'VAC':
+ return '$'.$money;
+ case 'RU':
+ return '$'.$money;
+ case 'IT':
+ return '€'.$money;
+ case 'SHT':
+ return '$'.$money;
+ default:
+ return '$'.$money;
+ }
+ }
+
+ /**
+ * 返回带money_char的价格。
+ *
+ * @param $money Int 价格.
+ * @return String 带货币符号的价格。
+ */
+ public function get_site_money_with_char($money='') {
+ return $this->get_money_char($this->GetSiteMoney($money));
+ }
+
+
+ /**
+ * RMB换算成指定货币。
+ * @param int money RMB
+ * @param string char 货币代号:usd,eur
+ * @return int 换算价格
+ */
+ public function convert_moneny_by_char($money,$char='')
+ {
+ switch (strtolower($char))
+ {
+ case 'usd':
+ return ceil($money/$this->USD_Rate);
+ case 'eur':
+ return ceil($money/$this->EUR_Rate);
+ }
+ return $money;
+ }
+
+ /**
+ * 尾数取"9"的定价规则
+ * 在正负误差值小于或等于16的前提下,
+ * 保证展示价格的个位数和十位数统一取"99"
+ * 当展示价格的个位数和十位数取"99"的正负误差大于16时,
+ * 通过四舍五入加价实现个位数取"9"
+ * 详细规则见GitLab issue #12 统一网前展示价格的标准
+ */
+ public function calc_show_price($value=0) {
+ if (empty($value)) return 0;
+ if (!is_numeric($value)) return $value;
+
+ $val_len = strlen($value);
+
+ if ($val_len == 1) return 9;
+
+ $discount = 16;
+ $val_pow = pow(10, $val_len - 1);
+
+ $min_val = $val_pow - 1;
+ $max_val = $min_val + $val_pow;
+ $max_diff = abs($value - $max_val);
+ $min_diff = abs($value - $min_val);
+
+ if (min($max_diff, $min_diff) > $discount) {
+ $calc_val = floor($value / 10) * 10 + 9;
+ } else {
+ $calc_val = $max_diff > $min_diff ? $min_val : $max_val;
+ }
+ return $calc_val;
+ }
+
+ /**
+ * 获取设置的信用卡卡费
+ */
+ public function cardfee(){
+ $sql = "SELECT TOP 1 * FROM dbo.SystemSettingInfo WHERE (SSI_Code = 1021001)";
+
+ $this->HT = $this->CI->load->database('HT', TRUE);
+ $query = $this->HT->query($sql);
+ $row = $query->row();
+ if (isset($row)){
+ return $row->SSI_UserValue;
+ }else{
+ return 0;
+ }
+
+ }
+}
diff --git a/application/third_party/ctmobilefirst/models/api_model.php b/application/third_party/ctmobilefirst/models/api_model.php
new file mode 100644
index 00000000..d6fce623
--- /dev/null
+++ b/application/third_party/ctmobilefirst/models/api_model.php
@@ -0,0 +1,153 @@
+HT = $this->load->database('HT', TRUE);
+
+ }
+
+ var $dei_sn = 17; //组别ID
+ var $CTLGC = 104; //语种
+
+ /**
+ * @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 ";
+ 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
+ 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 CLI2_LGC=? and (CLP_Area=1 or CLP_Area=2)
+ 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()->CLP_TwoToFiveAdultPrice;
+ }
+
+ }
+ }
+
+ return $reust;
+ }
+
+}
+
+/* End of file Api_model.php */