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

144 lines
5.6 KiB
PHP

<!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">
$(function() {
//更新静态页,异步请求队列(setp_set个)
var setp_set = 6;
$('#update').on('click', function() {
var $data = $('.data');
for(var i=0; i<setp_set; i++) {
dg_ajax($data, i, setp_set);
}
});
//下拉选站点
$('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},
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);
},
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="#">
站点:<?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>
</ul>
</li>
<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'])) {echo($_POST['p']);}?>" 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) { ?>
<tr class="data">
<td><?php echo($key+1);?></td>
<?php if (strlen($it)>100) { ?>
<td class="file" title="<?php echo($it);?>"><?php echo(substr($it, 0, 40));?>..........<?php echo(substr($it, -35));?></td>
<?php } else { ?>
<td class="file" title="<?php echo($it);?>"><?php echo($it);?></td>
<?php } ?>
<td><?php echo($file_time[$it]); ?></td>
<td class="msg_wait">无操作</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</body>
</html>