批量AMP更新,保存AMP检查语法错误,信息保存是自动更新AMP

hotfix/远程访问多媒体中心
尹诚诚 7 years ago
parent 0325457ce4
commit 47fb16be6c

@ -11,6 +11,7 @@ class Amp extends CI_Controller {
//$this->output->enable_profiler(TRUE);
$this->load->model('Information_model');
$this->load->model('InfoMetas_model');
$this->load->library('Amplib');
}
public function index() {
@ -20,101 +21,15 @@ class Amp extends CI_Controller {
}
public function edit($ic_id) {
$data = array();
$data['information'] = $this->Information_model->detail_by_ic_id($ic_id);
if ($data['information'] == FALSE) {
show_404();
}
$this->load->view('bootstrap3/header', $data);
$this->load->view('amp_editor');
$this->load->view('bootstrap3/footer');
$this->amplib->edit($ic_id);
}
public function auto_create($ic_id) {
$data = array();
$data['information'] = $this->Information_model->detail_by_ic_id($ic_id);
if ($data['information'] == FALSE) {
echo json_encode(array('result' => 'no', 'data' => '找不到这个页面'));
}
//144.76.185.44:8029
//根据站点不同,配置不同参数
$site_code = strtolower($this->config->item('site_code'));
switch ($site_code) {
case 'ah':
//websitehost是表示资源下载的域名在网页代码中有/css/xxx.css之类的路径程序需要添加域名组成完整URL去下载文件一般是data域名或者www域名
$websitehost = 'https://data.asiahighlights.com';
$html_source_url = 'https://www.asiahighlights.com/index.php/information/detail/?no_cache=true&static_html_url=' . $data['information']->ic_url;
break;
case 'cht':
$websitehost = 'https://data.chinahighlights.com';
$html_source_url = 'http://192.155.224.195:2222' . $data['information']->ic_url;
break;
case 'gm':
$websitehost = 'https://data.chinarundreisen.com';
$html_source_url = 'http://144.76.185.44:8029' . $data['information']->ic_url;
break;
case 'ct':
$websitehost = 'https://data.chinatravel.com';
$html_source_url = 'http://158.85.210.78:2222' . $data['information']->ic_url;
break;
default:
$websitehost = $this->config->item('site_url');
$html_source_url = $this->config->item('site_url') . $data['information']->ic_url;
}
//获取网页当前源码,然后发送到信息平台
$html_source = GET_HTTP($html_source_url);
if (!empty($html_source)) {
$post_data = array('websitehost' => $websitehost, 'template_name' => $site_code, 'create_amp' => 'true', 'htmlsource' => $html_source);
echo GET_HTTP(site_url('/apps/htmlcompressor/index/optimize'), $post_data, 'POST');
return;
}
echo json_encode(array('result' => 'no', 'data' => '不知道哪里错了,看代码'));
echo $this->amplib->auto_create($ic_id);
}
public function edit_save() {
$data = array();
$ic_id = $this->input->post('ic_id');
$textarea_htmlcode = $this->input->post('textarea_htmlcode');
$amp_status = $this->input->post('amp_status');
$data['information'] = $this->Information_model->detail_by_ic_id($ic_id);
if ($data['information'] == FALSE) {
show_404();
}
//CH的页面没有canonical内容在这里帮补上
$textarea_htmlcode = str_replace('<!--@CANONICAL@-->', $this->config->item('site_url') . $data['information']->ic_url, $textarea_htmlcode);
//AMP格式验证
//把AMP网页内容到purifycss处理内置了AMP-Validator
$purifycss_server = 'http://184.172.113.216:33033/';
if ($this->config->item('site_code' == 'gm')) {//德语站点使用自己的css处理服务器
$purifycss_server = 'http://158.177.67.52:33033/';
}
$validator_result = GET_HTTP($purifycss_server, 'amp_source=' . urlencode($textarea_htmlcode), 'POST');
$validator_result = json_decode($validator_result);
if ($validator_result->status == 'FAIL') {
echo json_encode(array('name' => 'no', 'value' => $validator_result->errors));
return;
}
$amp = $this->InfoMetas_model->get($ic_id, 'AMP');
if ($amp === false) {
$this->InfoMetas_model->add($ic_id, 'AMP', $textarea_htmlcode);
} else {
$this->InfoMetas_model->update($ic_id, 'AMP', $textarea_htmlcode);
}
$amp_status_value = $this->InfoMetas_model->get($ic_id, 'AMP_STATUS');
if ($amp_status_value === false) {
$this->InfoMetas_model->add($ic_id, 'AMP_STATUS', $amp_status);
} else {
$this->InfoMetas_model->update($ic_id, 'AMP_STATUS', $amp_status);
}
$data[] = array('name' => 'ok', 'value' => $this->lang->line('form_info_success'));
echo json_encode($data);
echo $this->amplib->edit_save();
}
}

@ -18,13 +18,8 @@ class Information extends CI_Controller {
$this->load->model('Logs_model');
$this->load->model('InfoMetas_model');
$this->load->model('Infoauthors_model');
$this->load->model('InfoKeywordsanalytics_model', 'analytics_model');
$this->load->model('InfoSMS_model');
if (is_series_site()) {
//$this->load->model('InfoTags_model');
}
$this->load->library('Amplib'); //加载AMP处理类
$this->load->library('Accesscheck');
$this->accesscheck->check_access();
}
@ -280,12 +275,9 @@ class Information extends CI_Controller {
//$this->InfoTags_model->ic_id = $data['information']->ic_id;
//$data['my_tags'] = $this->InfoTags_model->list_tag();
//差集
foreach ($data['all_tags'] as &$it)
{
foreach ($data['my_tags'] as $it2)
{
if ($it->it_id == $it2->icit_it_id)
{
foreach ($data['all_tags'] as &$it) {
foreach ($data['my_tags'] as $it2) {
if ($it->it_id == $it2->icit_it_id) {
$it = null;
break;
}
@ -396,26 +388,31 @@ class Information extends CI_Controller {
} else {
$this->InfoContents_model->Update($information->is_ic_id, $this->input->post('ic_url'), $this->input->post('ic_url_title'), $this->input->post('ic_type'), $this->input->post('ic_title'), $this->input->post('ic_content'), $this->input->post('ic_summary'), $this->input->post('ic_seo_title'), $this->input->post('ic_seo_description'), $this->input->post('ic_seo_keywords'), $this->input->post('ic_show_bread_crumbs'), $this->input->post('ic_status'), $this->input->post('ic_template'), $this->input->post('ic_photo'), $this->input->post('ic_photo_width'), $this->input->post('ic_photo_height'), $this->input->post('ic_recommend_tours'), $this->input->post('ic_recommend_packages'), $this->input->post('ic_ht_area_id'), $this->input->post('ic_ht_area_type'), $this->input->post('ic_ht_product_id'), $this->input->post('ic_ht_product_type'), $this->input->post('ic_author'));
//收录查询,只在发布上线并且url不为空的时候检查
$embody_url = $this->input->post('ic_url');
$embody_url = trim($embody_url);
if ($this->input->post('ic_status') == 1 && $embody_url != '') {
$embody = $this->InfoMetas_model->get($information->is_ic_id, 'meta_embody');
if (empty($embody)) {
$times = date('Y-m-d H:i:s');
$this->InfoMetas_model->add($information->is_ic_id, 'meta_embody', $times);
//AMP更新和生成 beign
$auto_update_amp = $this->input->get_post('auto_update_amp');
if (!empty($auto_update_amp) && $auto_update_amp == 'true' && $this->input->post('ic_status') == 1) {
$amp_result=$this->amplib->auto_create($information->ic_id);
if (!empty($amp_result)) {
$amp_result = json_decode($amp_result);
if($amp_result->result=='ok'){
$amp_save_result= $this->amplib->edit_save($information->ic_id,$amp_result->data->amp,'1');
if(!empty($amp_save_result)){
$amp_save_result = json_decode($amp_save_result);
if($amp_save_result->name=='no'){
echo json_encode(array('name' => 'no', 'value' => 'AMP转换语法错误请重新进入AMP编辑器检查'));
return;
}
}
}
}
}
//AMP更新和生成 end
//为新闻添加默认发布时间
//if($information->ic_ht_area_type=='s' || $information->ic_type=='c_article')
//{
$meta_news_createdate = get_meta($information->ic_id, 'meta_news_createdate');
if (empty($meta_news_createdate)) {
add_meta($information->ic_id, 'meta_news_createdate', date('m/d/Y', time()));
}
//}
// if (is_series_site()) {
//如果URL有修改也删除静态文件
if ($this->input->post('ic_url') != $information->ic_url) {
$this->update_cache($information->ic_url, true);
@ -426,11 +423,11 @@ class Information extends CI_Controller {
$this->update_cache($this->input->post('ic_url'), true);
}
//德语站FAQ版块需要删除原来的文件才能更新静态
$site_code = $this->config->item('site_code');
$ic_url = $this->input->post('ic_url');
$auto_update_cache = $this->input->get_post('auto_update_cache_checkbox');
if (strcasecmp($site_code, "gm") == 0 && !empty($auto_update_cache)) {
$update_info_log = $this->update_cache($ic_url, true);
} else if (strcasecmp($site_code, "cht") == 0 && !empty($auto_update_cache)) {
@ -579,10 +576,6 @@ class Information extends CI_Controller {
break;
}
//关闭错误提示防止file_get_contents请求特殊字符的时候会报错或者404、500,特殊字符需要用urlencode编码第一个/后面的url
//error_reporting(NULL);
//ini_set('display_errors', 'Off');
$content = GET_HTTP($url);
if ($content === false) {
$data[] = array('name' => 'no', 'value' => sprintf($this->lang->line('update_cache_failed'), $url));
@ -593,9 +586,9 @@ class Information extends CI_Controller {
if ($this->input->post('updatecdn') == 1) {
$notice = $this->update_cdn();
if ($notice == 200) {
$msg.=$this->lang->line('update_cdn_success');
$msg .= $this->lang->line('update_cdn_success');
} else {
$msg.=$this->lang->line('update_cdn_failed') . '<br>' . $notice;
$msg .= $this->lang->line('update_cdn_failed') . '<br>' . $notice;
}
}
$data[] = array('name' => 'ok', 'value' => $msg, 'url' => $url);
@ -672,40 +665,6 @@ class Information extends CI_Controller {
$this->load->view('bootstrap/footer');
}
//增加新景点到景点概述下
//先找到当前城市的景点概述根节点,然后新增加
//$lsi_sn 翰特景点id
function add_landscape($area_id, $lsi_sn) {
//获取景点概述节点
$root_landscape = $this->Information_model->get_type_detail('c_attraction', 'c', $area_id);
if ($root_landscape == FALSE) {
$data[] = array('name' => 'no', 'value' => $this->lang->line('root_landscape_notfound'));
echo json_encode($data);
return false;
}
//获取景点详细内容
$Landscape = $this->Landscape_model->get_detail($lsi_sn);
if ($root_landscape == FALSE) {
$data[] = array('name' => 'no', 'value' => $this->lang->line('landscape_notfound'));
echo json_encode($data);
return false;
}
//添加空内容
$this->InfoContents_model->Add($Landscape->LSI2_Name, $Landscape->LSI2_Name, '', $Landscape->LSI2_Name, $Landscape->LSI2_ShortIntro, '', '', '', '', 0, 0, '', '', 0, 0, '', '', $area_id, 'c', $lsi_sn, 't', '');
if ($this->InfoStructures_model->Add($root_landscape->is_id, $this->InfoContents_model->insert_id)) {
$data[] = array('name' => 'ok', 'value' => site_url('information/edit/' . $this->InfoStructures_model->insert_id));
} else {
$data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error'));
}
echo json_encode($data);
$this->Logs_model->add($this->InfoStructures_model->insert_id);
return true;
}
//保存自定义配置
function save_meta() {
$im_ic_id = $this->input->post('im_ic_id');

@ -0,0 +1,122 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
/*
* AMP的相关方法
*/
class Amplib {
var $CI;
public function __construct() {
$this->CI = & get_instance();
$this->CI->load->model('Information_model');
$this->CI->load->model('InfoMetas_model');
}
public function edit($ic_id) {
$data = array();
$data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id);
if ($data['information'] == FALSE) {
show_404();
}
$this->CI->load->view('bootstrap3/header', $data);
$this->CI->load->view('amp_editor');
$this->CI->load->view('bootstrap3/footer');
}
public function auto_create($ic_id) {
$data = array();
$data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id);
if ($data['information'] == FALSE) {
return json_encode(array('result' => 'no', 'data' => '找不到这个页面'));
}
//144.76.185.44:8029
//根据站点不同,配置不同参数
$site_code = strtolower($this->CI->config->item('site_code'));
switch ($site_code) {
case 'ah':
//websitehost是表示资源下载的域名在网页代码中有/css/xxx.css之类的路径程序需要添加域名组成完整URL去下载文件一般是data域名或者www域名
$websitehost = 'https://data.asiahighlights.com';
$html_source_url = 'https://www.asiahighlights.com/index.php/information/detail/?no_cache=true&static_html_url=' . $data['information']->ic_url;
break;
case 'cht':
$websitehost = 'https://data.chinahighlights.com';
$html_source_url = 'http://192.155.224.195:2222' . $data['information']->ic_url;
break;
case 'gm':
$websitehost = 'https://data.chinarundreisen.com';
$html_source_url = 'http://144.76.185.44:8029' . $data['information']->ic_url;
break;
case 'ct':
$websitehost = 'https://data.chinatravel.com';
$html_source_url = 'http://158.85.210.78:2222' . $data['information']->ic_url;
break;
default:
$websitehost = $this->CI->config->item('site_url');
$html_source_url = $this->CI->config->item('site_url') . $data['information']->ic_url;
}
//获取网页当前源码,然后发送到信息平台
$html_source = GET_HTTP($html_source_url);
if (!empty($html_source)) {
$post_data = array('websitehost' => $websitehost, 'template_name' => $site_code, 'create_amp' => 'true', 'htmlsource' => $html_source);
return GET_HTTP(site_url('/apps/htmlcompressor/index/optimize'), $post_data, 'POST');
}
return json_encode(array('result' => 'no', 'data' => '不知道哪里错了,看代码'));
}
public function edit_save($ic_id = false, $textarea_htmlcode = false, $amp_status = false) {
$data = array();
if ($ic_id === false) {
$ic_id = $this->CI->input->post('ic_id');
}
if ($textarea_htmlcode === false) {
$textarea_htmlcode = $this->CI->input->post('textarea_htmlcode');
}
if ($amp_status === false) {
$amp_status = $this->CI->input->post('amp_status');
}
$data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id);
if ($data['information'] == FALSE) {
show_404();
}
//CH的页面没有canonical内容在这里帮补上
$textarea_htmlcode = str_replace('<!--@CANONICAL@-->', $this->CI->config->item('site_url') . $data['information']->ic_url, $textarea_htmlcode);
//AMP格式验证
if ($amp_status !== '0') {//只有发布的时候才需要验证
//把AMP网页内容到purifycss处理内置了AMP-Validator
$purifycss_server = 'http://184.172.113.216:33033/';
if ($this->CI->config->item('site_code' == 'gm')) {//德语站点使用自己的css处理服务器
$purifycss_server = 'http://158.177.67.52:33033/';
}
$validator_result = GET_HTTP($purifycss_server, 'amp_source=' . urlencode($textarea_htmlcode), 'POST');
$validator_result = json_decode($validator_result);
if ($validator_result->status == 'FAIL') {
return json_encode(array('name' => 'no', 'value' => $validator_result->errors));
}
}
$amp = $this->CI->InfoMetas_model->get($ic_id, 'AMP');
if ($amp === false) {
$this->CI->InfoMetas_model->add($ic_id, 'AMP', $textarea_htmlcode);
} else {
$this->CI->InfoMetas_model->update($ic_id, 'AMP', $textarea_htmlcode);
}
$amp_status_value = $this->CI->InfoMetas_model->get($ic_id, 'AMP_STATUS');
if ($amp_status_value === false) {
$this->CI->InfoMetas_model->add($ic_id, 'AMP_STATUS', $amp_status);
} else {
$this->CI->InfoMetas_model->update($ic_id, 'AMP_STATUS', $amp_status);
}
return json_encode(array('name' => 'ok', 'value' => $this->CI->lang->line('form_info_success')));
}
}

@ -169,7 +169,7 @@ 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' and CONVERT(varchar, im_value) = '1'),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.="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"

@ -34,6 +34,8 @@
<a href="http://tool.oschina.net/jscompress" target="_blank">CSS压缩</a>
|
<a href="http://tool.oschina.net/codeformat/css" target="_blank">CSS格式化</a>
|
<a href="<?php echo site_url('apps/htmlcompressor'); ?>" target="_blank">调试</a>
</div>
<div class="col-sm-3">
<button type="button" class="btn btn-info" onclick="auto_create_amp(this);">
@ -48,22 +50,36 @@
<option value="1" <?php echo get_meta($information->ic_id, 'AMP_STATUS') === '1' ? 'selected' : FALSE; ?> >
发布
</option>
<option value="2" <?php echo get_meta($information->ic_id, 'AMP_STATUS') === '2' ? 'selected' : FALSE; ?> >
发布-手动管理
</option>
</select>
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-primary" onclick="submit_amp_editor();">保存</button>
<div class="btn-group">
<button type="button" class="btn btn-primary" onclick="submit_amp_editor();">保存</button>
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<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>
</ul>
</div>
<?php if ($this->config->item('site_code') == 'cht') { ?>
<a href="http://192.155.224.195:8080/guide-use.php/amp_loader/test/?info_url=<?php echo $information->ic_url ?>"
<a href="http://192.155.224.195:8080/guide-use.php/amp_loader/test/?info_url=<?php echo $information->ic_url ?>" class="btn btn-primary"
target="_blank">看看</a>
<?php } ?>
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-default"
onclick="meta('delete', '<?php echo $information->ic_id; ?>', 'AMP', ''); meta('delete', '<?php echo $information->ic_id; ?>', 'AMP_STATUS', '');">
删除
</button>
<button type="button" class="btn btn-primary" onclick="show_cache_refresh_modal('<?php echo $information->ic_url ?>');">更新静态页面</button>
</div>
</div>
</form>
@ -149,6 +165,8 @@
});
}
</script>

@ -350,32 +350,6 @@
return true;
}
//添加绑定景点
function add_landscape(area_id, lsi_sn) {
var urlReQuery = "<?php echo site_url('information/add_landscape/'); ?>";
$.ajax({
type: "get",
url: urlReQuery + '/' + area_id + '/' + lsi_sn,
success: function(data, textStatus) {
var dataArray = $.parseJSON(data);//JSON.parse(data);
for (var key in dataArray) {
if (dataArray[key].name == 'ok') {
window.location.href = dataArray[key].value;
return true;
} else if (dataArray[key].name == 'no') {
$.modaldialog.error(dataArray[key].value);
return false;
}
}
},
error: function() {
$.modaldialog.error('发生错误请联系YCC');
return false;
}
});
}
//跳转到前台页面
function goto_page() {
var site_url = '<?php echo $this->config->item('site_url') ?>';
@ -1000,7 +974,7 @@
<div class="clearfix"></div>
<?php if (is_series_site()) { ?>
<label class="span12">系列站会自动更新静态页面</label>
<label class="span12">自动更新静态页面</label>
<?php } else { ?>
<label class="checkbox inline span12">
<input type="checkbox" name="auto_update_cache_checkbox" id="auto_update_cache_checkbox" onclick="get_update_cache_url();" value="<?php echo $information->ic_url; ?>" />静态更新
@ -1059,22 +1033,3 @@
</div>
<!-- Modal -->
<div id="myModal" class="modal hide fade" style="width:90%;left:25%;" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<div id="myModalLabel" style="line-height:30px;">
<h3 class="span5 pull-left">页面访问量明细表</h3>
<form style="margin-bottom:0px;" id="get-analytic-form" method="post" action="<?php echo site_url('keyworlds/get_analytics_by_date'); ?>">
<input class="span2 pull-left" style="margin-bottom:0;" size="16" id="startdate" name="startdate" type="text" value="开始时间">
<input class="span2 pull-left" style="margin-bottom:0;" size="16" id="enddate" name="enddate" type="text" placeholder="结束时间">
<input type="hidden" name="pagepath" value="<?php echo $information->ic_url; ?>">
<button type="button" class="btn" onClick="get_analytics_ajax('get-analytic-form', 'analytics-content', '0');">查询</button>
</form>
</div>
</div>
<div class="modal-body" id="analytics-content">
</div>
</div>

@ -15,7 +15,7 @@
<div class="modal-content" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 style="margin:0;">静态化更新-系列站专用</h3>
<h3 style="margin:0;">静态化更新</h3>
</div>
<div class="modal-body">
<label>需要更新的页面</label>

@ -448,20 +448,11 @@
change_seo_count('ic_seo_title');
change_seo_count('ic_seo_description');
//ajax获取获取google分析数据的日期设置
$("#startdate,#enddate").datepicker({
showButtonPanel: true
});
$("#total-analytics>a").trigger("click");
init_recommend_popover("#meta_recommend_info", ".meta_recommend_info_box");
init_recommend_popover("#meta_related_info", ".meta_related_info_box");
init_recommend_popover("#meta_bread_info", ".meta_bread_info_box");
//自动读取google网页性能评分
setTimeout(function () {
mobile_friendly(), 1000
});
});
var editor;
@ -1259,22 +1250,19 @@
<input type="checkbox" name="ignore_url_check" id="ignore_url_check" />忽略URL重复
</label>
<div class="clearfix"></div>
<?php if (is_series_site() || ($this->config->item('site_code') == 'ah')) { ?>
<label class="col-xs-24">本站会自动更新静态页面</label>
<?php } else { ?>
<?php if ($this->config->item('site_code') == 'cht') { ?>
<label class="checkbox col-xs-24" style="font-weight: normal;margin-top:0;padding-left: 21px;">
<input type="checkbox" name="auto_update_cache_checkbox" id="auto_update_cache_checkbox" onclick="get_update_cache_url();" value="<?php echo $information->ic_url; ?>" />静态更新
</label>
<?php } ?>
<?php } ?>
<?php if (in_array($this->config->item('site_code'),array('cht','ah','gn'))) { ?>
<label class="checkbox col-xs-24" style="font-weight: normal;margin-top:0;padding-left: 21px;">
<input type="checkbox" name="auto_update_amp" id="auto_update_amp" value="true" />AMP更新
</label>
<?php } ?>
<div class="clearfix"></div>
<p class="col-xs-24 nopadding">
<button type="button" id="btn-mobile-friendly" class="btn btn-sm" onclick="$('#btn-mobile-friendly').button('loading');
$('#mobile_friendly_status').html('');
mobile_friendly(true);">网页性能检测: </button>
<span id="mobile_friendly_status"></span>
<!-- <a href="javascript:void();" class="btn btn-sm" id="goto_validator_button" target="_blank" onclick="goto_validator();" >HTML规范验证</a> -->
</p>
<div class="btn-group col-xs-24 nopadding pull-right <?php
if ($is_writeable == 0) {

@ -57,10 +57,14 @@
function create_amp_data(index) {
if ($('#cache_url' + index).length > 0) {
if ($('#cache' + index).html() !== '\u0041\u004d\u0050\u66f4\u65b0\u6210\u529f\u0021') {
if ($('#cache' + index).html() == '手动管理,不会自动更新') { //手动更新的项目跳过
create_amp_data(++index);
} else {
batch_update_amp(index);
}
}
}
}
</script>
@ -91,9 +95,12 @@
?>
<tr>
<td><a href="<?php echo site_url('amp/edit/'.$info->ic_id); ?>" target="_blank"><?php echo $i; ?></a></td>
<td><?php if($info->amp_status==='1'){echo '<i class="glyphicon glyphicon-flash"></i>'; } ?></td>
<td>
<?php if($info->amp_status==='1'){echo '<i class="glyphicon glyphicon-flash"></i>'; } ?>
<?php if($info->amp_status==='2'){echo '<i class="glyphicon glyphicon-hand-up" title="手动管理,不会自动更新"></i>'; } ?>
</td>
<td id="cache_url<?php echo $i; ?>" name="cache_url<?php echo $i; ?>" class="cache_url"><a href="<?php echo site_url('information/edit/'.$info->is_id) ?>" target="_blank"><?php echo $info->ic_url; ?></a></td>
<td id="cache<?php echo $i; ?>" name="cache<?php echo $i; ?>"><i class="icon-refresh"></i></td>
<td id="cache<?php echo $i; ?>" name="cache<?php echo $i; ?>"><?php if($info->amp_status==='2'){echo '手动管理,不会自动更新'; } ?></td>
<input type="hidden" id="cache_ic_id_<?php echo $i; ?>" value="<?php echo $info->ic_id; ?>" />
</tr>
<?php
@ -105,7 +112,7 @@
</div>
<div class="col-sm-4">
<a href="javascript:void(0);" class="btn btn-danger" onclick="batch_update_amp(1);">开始更新</a>
<a href="javascript:void(0);" class="btn btn-danger" onclick="create_amp_data(1);">开始更新</a>
</div>

@ -528,6 +528,12 @@ if (json.result == 'ok'){
});
}
//弹出静态化更新窗口,并自动点击更新
function show_cache_refresh_modal(url){
$('#static_html_url').val(url);
updateCache($('#static_html_url').val(), 'cache_refresh_modal_msg');
$('#cache_refresh_modal').modal('show');
}
$(document).ready(function() {

Loading…
Cancel
Save