diff --git a/application/controllers/information.php b/application/controllers/information.php index 0870a2a5..d03255c2 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -997,23 +997,23 @@ class Information extends CI_Controller public function test_price() { - $price_rule = '
#ah-8,st,2#
'; + $price_rule = '
#ah-8,st,2#
#ah-8,st,2#
'; $price_tag_list = $this->parse_price_tag($price_rule); var_dump($price_tag_list); } /*! * 页面中有价格标签,查出价格并替换内容 - * @author LYT - * @date 2017-07-14 + * @author LiaoYijun + * @date 2023-05-12 * @param string $price_content 包含价格标签的内容 - * @return string 可读的价格字符串 + * @return array 包含价格与占位符的数组 */ public function parse_price_tag($price_content) { $price_item_array = $this->price_pregmatch($price_content); $price_tag_list = []; - if ( ! empty($price_item_array)) { + if (!empty($price_item_array)) { foreach ($price_item_array as $price_item) { $price_date = !empty($price_item->price_date) ? $price_item->price_date : date('Y-m-d', time() + 86400 * 7); //当前时间7天后的价格 $price_number = ''; @@ -1101,14 +1101,13 @@ class Information extends CI_Controller if (!empty($price_number)) { $price_tag = [ 'placeholder' => $price_item->placeholder, - 'price_number' => $price_item->price_number, + 'price_number' => $price_number, ]; $price_tag_list[] = $price_tag; - //$price_content = str_replace($price_item->placeholder, $price_number, $price_content); } } } - return $price_content; + return $price_tag_list; } //使用正则匹配出价格标签,返回一个价格数组 diff --git a/application/models/PrimeLinePrice_model.php b/application/models/PrimeLinePrice_model.php index 7408a4d7..18fd518b 100644 --- a/application/models/PrimeLinePrice_model.php +++ b/application/models/PrimeLinePrice_model.php @@ -25,7 +25,7 @@ class PrimeLinePrice_model extends CI_Model { $this->orderby = ' ORDER BY plp.PLP_Level ASC,plp.PLP_IsWeekPrice DESC,plp.PLP_AdultUnitPrice DESC '; } - public function search($cli_no, $topnum = false, $cli_grade = false, $person_size = false, $price_date = false) { + public function search($cli_no, $topnum = false, $cli_grade = false, $person_size = false, $price_date = false, $DEI_SN = 28) { $this->init(); $this->cli_no = $cli_no; $this->topnum = empty($topnum) ? false : $topnum; @@ -41,6 +41,7 @@ class PrimeLinePrice_model extends CI_Model { ) "; } + $this->DEI_SN = $DEI_SN; return $this->get_list(); } @@ -93,7 +94,7 @@ class PrimeLinePrice_model extends CI_Model { $this->cli_grade ? $sql.=$this->cli_grade : false; $this->orderby ? $sql.=$this->orderby : false; - $query = $this->HT->query($sql,array($this->$DEI_SN,$this->cli_no)); + $query = $this->HT->query($sql,array($this->DEI_SN,$this->cli_no)); if ($this->topnum === 1) { if ($query->num_rows() > 0) { $row = $query->row();