部署amp历史记录查询功能

mobile-first
cyc 6 years ago
parent 1adfb21b87
commit 6a6f99d3e8

@ -23,6 +23,14 @@ class Amplib {
if ($data['information'] == FALSE) {
show_404();
}
//查询上一次保存记录
$amp_log = $this->CI->Logs_model->get_last_edit_amp($ic_id);
if(!empty($amp_log)){
$data['last_edit_amp_id'] = $amp_log->log_id;
}else{
$data['last_edit_amp_id'] = '';
}
$this->CI->load->view('bootstrap3/header', $data);
$this->CI->load->view('amp_editor');
$this->CI->load->view('bootstrap3/footer');
@ -99,7 +107,7 @@ class Amplib {
$textarea_htmlcode = str_replace('<!--@CANONICAL@-->', $this->CI->config->item('site_url') . $data['information']->ic_url, $textarea_htmlcode);
//备份修改的代码
$this->CI->Logs_model->write('backup_amp', $ic_id, $textarea_htmlcode);
$this->CI->Logs_model->write('backup_amp', $ic_id, $textarea_htmlcode);
//AMP格式验证
if ($amp_status !== '0') {//只有发布的时候才需要验证

@ -54,7 +54,7 @@ class Logs_model extends CI_Model {
function get_all_backup_list($is_id) {
$this->init();
$this->log_res_id = " AND il.log_res_id =" . $this->HT->escape($is_id);
$this->log_action = " AND il.log_action = 'backup_info'";
$this->log_action = " AND (il.log_action = 'backup_info' or il.log_action = 'backup_amp')";
return $this->get_list();
}
@ -214,5 +214,13 @@ class Logs_model extends CI_Model {
$query = $this->HT->query($sql, array($log_res_id, $log_action));
return $query;
}
//查询上一次修改记录
function get_last_edit_amp($ic_id){
$sql = 'select top 1 log_id from infoLogs where log_res_id = ? order by log_datetime desc';
$query = $this->HT->query($sql, array($ic_id));
return $query->row();
}
}

@ -76,6 +76,12 @@
<ul class="dropdown-menu">
<li role="separator" class="divider"></li>
<li><a href="javascript(0);" onclick="meta('delete', '<?php echo $information->ic_id; ?>', 'AMP', ''); meta('delete', '<?php echo $information->ic_id; ?>', 'AMP_STATUS', '');">删除</a></li>
<?php
//默认展示上一次记录
if($last_edit_amp_id != ''){
echo '<li><a target="_blnk" href="/info.php/information/backup_content/'.$last_edit_amp_id.'">查看历史记录</a></li>';
}?>
</ul>
</div>

Loading…
Cancel
Save