优化静态发布页面的速度

hotfix/paypal-note
尹诚诚 4 years ago
parent c83bd0cace
commit 781c5522fb

@ -410,12 +410,14 @@ class Information extends CI_Controller
} else if (strcasecmp($site_code, "ch") == 0 && !empty($auto_update_cache)) {
//读取模板生成PC和移动优先文件
$information_new = $this->Information_model->Detail($this->input->post('is_id'));
//$this->benchmark->mark('000');
$recommand_information = $this->recommand_information($information);
//$this->benchmark->mark('111');
$this->make_www_cache('mobile', $information_new, $recommand_information);
//$this->benchmark->mark('222');
$this->make_www_cache('pc', $information_new, $recommand_information);
//echo $this->benchmark->elapsed_time('111', '222');
//echo ' |000~111: '.$this->benchmark->elapsed_time('000', '111');
//echo ' |111~222: '.$this->benchmark->elapsed_time('111', '222');
} else if (strcasecmp($site_code, "ah") == 0 && !empty($auto_update_cache)) {
//读取模板生成PC和移动优先文件
$information_new = $this->Information_model->Detail($this->input->post('is_id'));
@ -873,7 +875,6 @@ class Information extends CI_Controller
$template = $this->html_optimize_lib->set_image_size($template);
}
// /travelguide/chinese-zodiac/monthly-fortune-for-dog.htm
$this->benchmark->mark('10');
$html_path = $this->config->item('cache')[$this->config->item('site_code')]['cache_path'] . $information->ic_url;
$html_path = str_replace("\\", "/", $html_path);
if (substr($html_path, -1, 1) == '/') {
@ -1401,7 +1402,7 @@ class Information extends CI_Controller
$data = $this->Information_model->random(1, $root_information->is_path, $exclude_ids);
break;
case 'rule_this_node_random'://指定节点下随机
$ir_pointer = $this->Information_model->Detail($recommand->ir_pointer_is_id);
$ir_pointer = $this->Information_model->Detail($recommand->ir_pointer_is_id,'is_path');
if (!empty($ir_pointer)) {
$data = $this->Information_model->random(1, $ir_pointer->is_path, $exclude_ids);
}
@ -1450,7 +1451,6 @@ class Information extends CI_Controller
$root_recommands = $this->recommends_and_tips_model->recommends_list($root_detail->is_id);//节点下所有的推荐规则
$exclude_ids = array($information->is_id);//需要排除的is_id防止通过页面显示相同内容默认排除本身每个推荐内容都需要排除已经推荐过的
foreach ($root_recommands as $item) {
$result = $this->recommand_information_rule($information, $root_detail, $item, $exclude_ids);
if (!empty($result)) {

@ -117,7 +117,7 @@ class Information_model extends CI_Model {
$exclude_ids_string=implode(',',$exclude_ids);
$this->search .= " AND ic_status=1 AND is_id NOT in ($exclude_ids_string,0)";
$this->orderBy = " ORDER BY NewID() ";
return $this->GetList();
return $this->GetList('ic_id, is_id, ic_url,ic_url_title,ic_title,is_path,is_level,ic_status,ic.ic_photo');
}
//根据url搜索信息
@ -237,7 +237,7 @@ class Information_model extends CI_Model {
}
function Detail($ic_url_is_id) {
function Detail($ic_url_is_id,$filed='') {
if (empty($ic_url_is_id)) {
return false;
}
@ -303,7 +303,8 @@ class Information_model extends CI_Model {
$sql.=" $filed ";
}
//添加查询AMP发布状态
$sql.=",isnull((select top 1 CONVERT(varchar, im_value) from infoMetas where im_ic_id=ic_id and im_key='AMP_STATUS'),0) as amp_status ";
//$sql.=",isnull((select top 1 CONVERT(varchar, im_value) from infoMetas where im_ic_id=ic_id and im_key='AMP_STATUS'),0) as amp_status ";
$sql.=",0 as amp_status ";
$sql.="FROM infoStructures is1 \n"
. " INNER JOIN infoContents ic ON ic.ic_id = is1.is_ic_id \n"
. " AND ic.ic_sitecode = is1.is_sitecode \n"

Loading…
Cancel
Save