Initial commit

This commit is contained in:
易焱
2021-03-13 18:42:01 +08:00
commit d9a3c376d5
3243 changed files with 627198 additions and 0 deletions
@@ -0,0 +1,144 @@
<include file="Inc:header"/>
<style>
.table-bordered .icon-ok{ color:#468847}
.table-bordered .icon-remove{ color:#ff0000}
</style>
<div class="container-fluid">
<div class="main_head">
<div class="main_tab" style="width:30%; margin-top:10px;">
<a class="btn" onclick="set_optimize()">优化表</a>
<a class="btn" onclick="set_repair()">修复表</a>
<a class="btn" onclick="set_bake()">立即备份</a>
</div>
<div class="main_add" style="width:70%;">
<a class="btn btn-inverse {:check_user_node('Database/recovery')?'':'none'}" href="{:U('Database/recovery')}" style="margin-left:10px;">数据恢复</a>
</div>
</div>
<div style="text-align:right; float:right"></div>
<div class="row-fluid">
<div class="span12">
<div class="widget-box">
<div class="widget-content nopadding">
<form method="post" action="__SELF__" onsubmit="return save_form2(this);" class="modelIndex">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th width="5%"> <input type="checkbox" value="0" class="checkall" /></th>
<th width="40%" style="text-align:left;">表名</th>
<th width="10%" style="text-align:left;">数据量</th>
<th width="10%" style="text-align:left;">数据大小</th>
<th width="10%">类型</th>
<th width="10%">编码</th>
<th width="20%">备注</th>
</tr>
</thead>
<tbody>
<foreach name="data" item="v" >
<tr>
<td style="text-align: center;"><input type="checkbox" name="tables[]" class="chekboxs" value="{$v.name}"/></td>
<td class="tab-title"><a href="{:U('show_field',array('table'=>$v[name]))}" class="iframe2" target="_blank">{$v.name}</a></td>
<td>{$v.rows}</td>
<td>{$v.data_length|format_bytes}</td>
<td class="center">{$v.engine}</td>
<td class="center">{$v.collation}</td>
<td class="center">{$v[comment]?$v[comment]:"-"}</td>
</tr>
</foreach>
</tbody>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
<include file="Inc/footer"/>
<script>
//优化表
function set_optimize(){
$("form").attr("action","{:U('optimize')}");
save_form($("form"),function(){
layer.msg("优化表成功!");
});
}
//修复表
function set_repair(){
$("form").attr("action","{:U('optimize')}");
save_form($("form"),function(){
layer.msg("修复表成功!");
});
}
//备份表
function set_bake(){
if(confirm("在数据备份的时候不能刷新或者关闭浏览器,否则备份的数据不完整")==true){
$("form").attr("action","{:U('Start_DoBak')}");
save_form($("form"),function(data){
//开始备份
$("form").attr("action","{:U('Ebak_BakExe')}");
//进度条初始化
var progress='<div class="bakeing"><div class="progress progress-striped active"><div class="bar" id="database_bar" style="width:1%;">1%</div></div></div>';
$("body").append(progress);
$(".bakeing").show();
$("body").css("overflow","hidden");
window.onbeforeunload = function(){ return "正在备份数据库,请不要关闭!" }
//初始化成功,下面开始备份数据
var param={
"s":0,
"p":0,
"t":0,
};
setTimeout
backup(param);
});
}
}
//
function backup(param){
$.get($("form").attr("action"), param, function(result){
if(result.status){
var data=result.info;
//备份进度
$("#database_bar").html(data.progress+"%");
$("#database_bar").css("width",data.progress+"%");
//
if(data.bake_end==1){
layer.msg("备份完成,正在前往查看的路上...",function(){
location.href="{:U('recovery')}";
});
window.onbeforeunload = function(){ return null }
return;
}else{
backup(data);
}
}
}, "json");
}
$(function(){
//分类窗口
$(".iframe2").click(function(){
var url=$(this).attr("href");
var index=layer.open({
type: 2,
area: ["70%","80%"],
fixed: false, //不固定
maxmin: true,
content: [url]
});
return false;
});
})
</script>
@@ -0,0 +1,114 @@
<include file="Inc:header"/>
<style>
.table-bordered .icon-ok{ color:#468847}
.table-bordered .icon-remove{ color:#ff0000}
/*备份样式*/
.bakeing{ width: 100%; background: rgba(0,0,0,0.7); position:fixed; height: 100%; top:0px; left:0px; z-index: 9999; display: none;}
.bakeing .progress{ margin-top: 300px; width: 60%; margin-left: auto; margin-right:auto; }
.progress{ height: 40px; border-radius:20px;}
.progress .bar{font-size:20px;line-height: 40px;}
</style>
<div class="container-fluid">
<div class="main_head">
<div class="main_h1"><h1>{$pagetitle}</h1></div>
<div class="main_add">
<a class="btn btn-inverse" href="{:U('Database/index')}" style="margin-left:10px;">返回列表</a>
</div>
</div>
<div style="text-align:right; float:right"></div>
<div class="row-fluid">
<div class="span12">
<div class="widget-box">
<div class="widget-content nopadding">
<form method="post" action="__SELF__" onsubmit="return save_form2(this);" class="modelIndex">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th width="30%">备份名称</th>
<th width="10%">卷数</th>
<th width="10%">数据大小</th>
<th width="10%">是否备份成功</th>
<th width="10%">备注</th>
</tr>
</thead>
<tbody>
<foreach name="data" item="v" >
<tr>
<td class="center">{$v.name}</td>
<td class="center">{$v.file_num}</td>
<td class="center">{$v.file_size|format_bytes}</td>
<td class="center">
<if condition="$v.file_size gt 1 ">
<span class="label label-success">备份成功</span>
<else />
<span class="label">备份失败</span>
</if>
</td>
<td class="center">
<a onclick="set_recovery('{$v.name}')" class="btn btn-primary btn-mini">恢复</a>
<a href="{:U('delete',array("name"=>$v['name']))}" class="btn btn-danger btn-mini ajax_del">删除</a>
</td>
</tr>
</foreach>
</tbody>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
<include file="Inc/footer"/>
<script>
function set_recovery(name){
if(confirm("在恢复数据的时候不能刷新或者关闭浏览器,否则会造成数据丢失!")==true){
//初始化
var progress='<div class="bakeing"><div class="progress progress-striped active"><div class="bar" id="database_bar" style="width:1%;">1%</div></div></div>';
$("body").append(progress);
$(".bakeing").show();
$("body").css("overflow","hidden");
window.onbeforeunload = function(){ return "正在恢复数据库,请不要关闭!" }
//
var param={
"name":name,
"table_index":0,
"p":1,
};
rebake(param);
return false;
}
}
//正式恢复数据
function rebake(param){
$.get("{:U('import')}",param, function(result){
if(result.status){
var data=result.info;
$("#database_bar").html(data.progress+"%");
$("#database_bar").css("width",data.progress+"%");
if(data.progress==100){
layer.alert("数据完成");
window.onbeforeunload = function(){ return null }
layer.msg("数据恢复成功",function(){
history.go(0);
});
return;
}else{
rebake(data);
}
}else{
alert(result.info);
}
},"json");
}
</script>
@@ -0,0 +1,40 @@
<include file="Inc:head"/>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class="widget-box">
<div class="widget-content nopadding">
<form method="post" action="__SELF__" onsubmit="return save_form(this,function(){window.history.go(0)});" class="modelIndex">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th width="10%">字段名</th>
<th width="30%">字段类型</th>
<th width="10%">字段属性</th>
<th width="10%">默认值</th>
<th width="20%">附加属性</th>
</tr>
</thead>
<tbody>
<foreach name="data" item="v" >
<tr>
<td style="text-align: center;"><b>{$v.field}</b></td>
<td style="text-align: center;">{$v.type}</td>
<td style="text-align: center;">{$v.key}</td>
<td style="text-align: center;">{$v.default}</td>
<td style="text-align: center;">{$v.extra}</td>
</tr>
</foreach>
</tbody>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
<include file="Inc/foot" noiframeauto="true" noautotitle="{$title}"/>