更新缓存使用8个并发

ct-mobile-first
LMR 5 years ago
parent 80a208e707
commit c3a2b84ed3

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>更新静态页-v1.0a</title> <title>更新静态页-v1.0a</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@ -7,23 +8,61 @@
<script type="text/javascript" src="//int.mycht.cn/js/jquery.js"></script> <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> <script type="text/javascript" src="//int.mycht.cn/bootstrap/js/bootstrap.min.js"></script>
<style type="text/css"> <style type="text/css">
.show-grid {padding: 15px; background: #efefef; border-radius: 5px;} .show-grid {
.mr10 {margin-right: 10px;} padding: 15px;
.nav {margin-bottom: 5px;} background: #efefef;
.pic {display: none;} border-radius: 5px;
.msg {color: #07c;} }
.mt12 {margin-top: 12px;}
.msg_wait {color: #999;} .mr10 {
.none {display: none;} margin-right: 10px;
.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;} .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> </style>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
//更新静态页,异步请求队列(setp_set个) //更新静态页,异步请求队列(setp_set个)
var setp_set = 6; var setp_set = 8;
$('#update').on('click', function() { $('#update').on('click', function() {
var $data = $('.data'); var $data = $('.data');
for (var i = 0; i < setp_set; i++) { for (var i = 0; i < setp_set; i++) {
@ -48,7 +87,9 @@ $(function() {
url: '<?php echo ($cache_api); ?>', url: '<?php echo ($cache_api); ?>',
dataType: 'json', dataType: 'json',
type: 'POST', type: 'POST',
data : {'<?php echo($post_para);?>':file}, data: {
'<?php echo ($post_para); ?>': file
},
success: function(data) { success: function(data) {
star = star + step; star = star + step;
current.find('.msg_wait').css('color', 'blue').html('成功'); current.find('.msg_wait').css('color', 'blue').html('成功');
@ -66,6 +107,7 @@ $(function() {
//计数显示 //计数显示
var num_zero = 1; var num_zero = 1;
function count_num(num) { function count_num(num) {
$('#count_num').html('已更新' + num + '个页面 进度' + (Math.ceil(num * 100 / <?php echo (count($file)); ?>)) + '% ').show(); $('#count_num').html('已更新' + num + '个页面 进度' + (Math.ceil(num * 100 / <?php echo (count($file)); ?>)) + '% ').show();
num_zero++; num_zero++;
@ -73,6 +115,7 @@ $(function() {
}); });
</script> </script>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<div class="row show-grid"> <div class="row show-grid">
@ -107,7 +150,9 @@ $(function() {
<span class="mt12 label label-info">含文件<?php echo (count($file)); ?></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> <span class="mt12 label label-important none" id="count_num">已更新0个页面 进度0%</span>
<form class="form-search" id="path_search" action="#" method="post"> <form class="form-search" id="path_search" action="#" method="post">
<input type="text" placeholder="输入路径删选,例如:/tours/。" value="<?php if(isset($_POST['p'])) {echo($_POST['p']);}?>" class="input-medium search-query" name="p"/> <input type="text" placeholder="输入路径删选,例如:/tours/。" value="<?php if (isset($_POST['p'])) {
echo ($_POST['p']);
} ?>" class="input-medium search-query" name="p" />
<button type="submit" class="btn">筛选</button> <button type="submit" class="btn">筛选</button>
</form> </form>
<a id="update" class="btn mr10 btn-info">更新</a> <a id="update" class="btn mr10 btn-info">更新</a>
@ -144,4 +189,5 @@ $(function() {
</div> </div>
</div> </div>
</body> </body>
</html> </html>
Loading…
Cancel
Save