You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
information-system/application/views/bootstrap3/refresh_mobile_first_urls.php

100 lines
3.5 KiB
PHTML

<script language="javascript">
function batch_update_amp(index) {
var ic_id = $('#cache_ic_id_' + index).val();
var msg_obj = "#cache" + index;
var amp_code = '';
$(msg_obj).html("\u7a0d\u7b49...");
$.ajax({
type: "get",
dataType: "json",
url: "<?php echo site_url('information/update_www_cache/') ?>/" + ic_id,
success: function (result, textStatus) {
//当result为空的时候跳过
if (result.length == 0 || result == '' || undefined || null) {
$(msg_obj).html("<a href='javascript:void(0);' onclick='create_amp_data(" + index + ");' >发生错误,请重试</a>");
create_amp_data(++index);
return;
}
if (result.name === 'no') {
$(msg_obj).html("更新失败: " + result.data);
} else {
$(msg_obj).html("更新成功!");
}
create_amp_data(++index);
},
error: function () {
$(msg_obj).html("<a href='javascript:void(0);' onclick='create_amp_data(" + index + ");' >发生错误,请重试</a>");
create_amp_data(++index);
}
});
}
function create_amp_data(index) {
if ($('#cache_url' + index).length > 0) {
setTimeout("batch_update_amp(" + index + ")", 100);
}
}
</script>
<div class="container-fluid">
<div class="row">
<div class="col-sm-4">
</div>
<div class="col-sm-12">
<table class="table table-striped">
<thead>
<tr>
<th class="col-sm-2">#</th>
<th class="col-sm-14">URL</th>
<th class="col-sm-4">更新进度</th>
<th class="col-sm-4">网前预览</th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
foreach ($all_information as $key => $info) {
if ($info->ic_status == 1 && !empty($info->ic_url)) {
$i++;
?>
<tr>
<td><?php echo $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; ?>"></td>
<input type="hidden" id="cache_ic_id_<?php echo $i; ?>"
value="<?php echo $info->ic_id; ?>"/>
<td>
<a href="<?php echo $this->config->item('site_url').$info->ic_url ?>" name="goto_page_button" target="_blank" title="查看">
<i class="glyphicon glyphtext-muted glyphicon glyphicon-eye-open text-muted"></i></a>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<div class="col-sm-4">
<a href="javascript:void(0);" class="btn btn-danger" onclick="create_amp_data(1);">开始更新</a>
</div>
</div>
</div>