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/cache/update.php

227 lines
8.0 KiB
PHTML

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>更新静态页-v1.0a</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="//int.mycht.cn/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<script type="text/javascript" src="//int.mycht.cn/js/jquery.js"></script>
<script type="text/javascript" src="//int.mycht.cn/bootstrap/js/bootstrap.min.js"></script>
<style type="text/css">
.show-grid {
padding: 15px;
background: #efefef;
border-radius: 5px;
}
.mr10 {
margin-right: 10px;
}
.nav {
margin-bottom: 5px;
}
.pic {
display: none;
}
.msg {
color: #07c;
}
.mt12 {
margin-top: 12px;
}
.msg_wait {
color: #999;
}
.none {
display: none;
}
.form-search {
display: inline-block;
margin: 0 0 0 5px !important;
}
.input-medium.search-query {
width: 250px;
}
#search,
#insert,
#update {
margin-top: 2px;
float: right;
}
</style>
<script type="text/javascript">
2 years ago
$(function () {
//更新静态页,异步请求队列(setp_set个)
var setp_set = 8;
2 years ago
$('#update').on('click', function () {
var $data = $('.data');
for (var i = 0; i < setp_set; i++) {
dg_ajax($data, i, setp_set);
}
});
//下拉选站点
2 years ago
$('a.sss').on('click', function () {
var site = $(this).html();
location.href = '/info.php/login/change_site/' + site + '/?url=/cache/update/';
});
//递归ajax
function dg_ajax(dom, star, step) {
var current = dom.eq(star);
if (current.length) {
var file = current.find('.file').attr('title');
//file = encodeURI(file);
current.find('.msg_wait').css('color', 'red').html('更新中');
$.ajax({
url: '<?php echo ($cache_api); ?>',
dataType: 'json',
type: 'POST',
data: {
'<?php echo ($post_para); ?>': file
},
2 years ago
success: function (data) {
star = star + step;
current.find('.msg_wait').css('color', 'blue').html('成功');
count_num(num_zero);
//console.log(star+''+file);
dg_ajax(dom, star, step);
},
2 years ago
error: function () {
current.find('.msg_wait').css('color', 'red').html('重试');
dg_ajax(dom, star, step);
}
});
}
}
//计数显示
var num_zero = 1;
function count_num(num) {
$('#count_num').html('已更新' + num + '个页面 进度' + (Math.ceil(num * 100 / <?php echo (count($file)); ?>)) + '% ').show();
num_zero++;
}
});
</script>
</head>
<body>
<div class="container">
<div class="row show-grid">
<ul class="nav nav-pills">
<li class="active dropdown mr10">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
2 years ago
站点:
<?php echo ($this->config->item('site_code')); ?>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li>
<a class="sss">jp</a>
</li>
<li>
<a class="sss">gm</a>
</li>
<li>
<a class="sss">vc</a>
</li>
<li>
<a class="sss">vac</a>
</li>
<li>
<a class="sss">ru</a>
</li>
<li>
<a class="sss">it</a>
</li>
2 years ago
<li>
<a class="sss">gh_jp</a>
</li>
<li>
<a class="sss">gh_gm</a>
</li>
<li>
<a class="sss">gh_vc</a>
</li>
<li>
<a class="sss">gh_vac</a>
</li>
<li>
<a class="sss">gh_ru</a>
</li>
<li>
<a class="sss">gh_it</a>
</li>
</ul>
</li>
2 years ago
<span class="mt12 label label-success">缓存目录
<?php echo (count($path)); ?>
</span>
<span class="mt12 label label-info">含文件
<?php echo (count($file)); ?>
</span>
<span class="mt12 label label-important none" id="count_num">已更新0个页面 进度0%</span>
<form class="form-search" id="path_search" action="#" method="post">
<input type="text" placeholder="输入路径删选,例如:/tours/。" value="<?php if (isset($_POST['p'])) {
2 years ago
echo ($_POST['p']);
1 year ago
} ?>" class="input-medium search-query" name="p" />
<button type="submit" class="btn">筛选</button>
</form>
<a id="update" class="btn mr10 btn-info">更新</a>
</ul>
</div>
<div class="row">
<table class="table table-hover">
<thead>
<tr>
<th>#SN</th>
<th>文件名</th>
<th>更新日期</th>
<th>更新状态</th>
</tr>
</thead>
<tbody class="data_group">
<?php foreach ($file as $key => $it) {
1 year ago
// $encode = mb_detect_encoding($it, array('ASCII', 'GBK', 'ISO-8859-1', 'UTF-8'));
// $_it = mb_convert_encoding($it, 'UTF8', $encode);
1 year ago
$_it = preg_replace('/#(.*)$/i', '', $it);
2 years ago
?>
<tr class="data">
2 years ago
<td>
<?php echo ($key + 1); ?>
</td>
<?php if (strlen($_it) > 100) { ?>
2 years ago
<td class="file" title="<?php echo ($_it); ?>">
<?php echo (substr($_it, 0, 40)); ?>..........
<?php echo (substr($_it, -35)); ?>
</td>
<?php } else { ?>
2 years ago
<td class="file" title="<?php echo ($_it); ?>">
<?php echo ($_it); ?>
</td>
<?php } ?>
2 years ago
<td>
1 year ago
<?php echo (isset($file_time[$it]) ? $file_time[$it] : 'bad file'); ?>
2 years ago
</td>
<td class="msg_wait">无操作</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</body>
</html>