|
|
|
@ -997,23 +997,23 @@ class Information extends CI_Controller
|
|
|
|
|
|
|
|
|
|
public function test_price()
|
|
|
|
|
{
|
|
|
|
|
$price_rule = '<div style="color: red;">#ah-8,st,2#</div>';
|
|
|
|
|
$price_rule = '<div style="color: red;">#ah-8,st,2#</div><div style="color: red;">#ah-8,st,2#</div>';
|
|
|
|
|
$price_tag_list = $this->parse_price_tag($price_rule);
|
|
|
|
|
var_dump($price_tag_list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* 页面中有价格标签,查出价格并替换内容
|
|
|
|
|
* @author LYT <lyt@hainatravel.com>
|
|
|
|
|
* @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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//使用正则匹配出价格标签,返回一个价格数组
|
|
|
|
|