<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<meta charset="utf-8">
	<title>错误日志</title>
	<meta name="generator" content="Bootply" />
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link href="/css/bootstrap.min.css" rel="stylesheet">
	<!--[if lt IE 9]>
	<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->
	<link href="/css/styles.css" rel="stylesheet">
	<script src="/js/jquery.js"></script>
	<script src="/js/bootstrap-datetimepicker.min.js"></script>
	<script src="/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="/js/My97DatePicker/WdatePicker.js"></script> 
</head>
<body>
{{include "head.html"}}
<!-- Main -->
<div class="container-fluid">
	<!-- upper section -->
	<div class="row">
		<div class="col-sm-3">
			<!-- left -->
			<h3><i class="glyphicon glyphicon-briefcase"></i> 工具栏</h3>
			<hr>
			<div class="panel panel-default">
			<div class="panel-heading"><b><h4 id="h4name"></h4></b></div>
			<div class="panel-body">
				<div class="col-sm-6" style="padding:5px"><span>今请求数：</span><span id="todayRequest"></span></div>
				<div class="col-sm-6" style="padding:5px"><span>今下载量：</span><span id="todayDowncount"></span></div>
				<div class="col-sm-6" style="padding:5px"><span>昨请求数：</span><span id="yestoDayRequest"></span></div>
				<div class="col-sm-6" style="padding:5px"><span>昨下载量：</span><span id="yestoDayDowncount"></span></div>
				<div class="col-sm-6" style="padding:5px"><span>末下载量：</span><span id="lastDowncount"></div>
				<div class="col-sm-6" style="padding:5px"><span>末错误数：</span><span id="errorNum"></span></div>
				<div class="col-sm-12" style="padding:5px"><span>末启动时间：</span><span id="lastExecTime"></span></div>
			</div>
			</div>
			<div class="panel panel-default">
			<div class="panel-heading"><b><h4>参数设置</h4></b></div>
				<div class="panel-body">
					<form class="form-horizontal">
						<div class="form-group text-center">
							<div class="input-group" style="padding:5px">
							<span class="input-group-addon">最后发布时间</span>
							<input class="form-control" id="lastpubtime" type="text" value="{{.T.lastpubtime}}"  onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/> 
							</div>
							<div class="input-group" style="padding:5px">
								<span class="input-group-addon">区间上限</span>
								<input type="number" id="uplimit" class="form-control" placeholder="请输入上限" /> 
							</div>
							<div class="input-group" style="padding:5px">
								<span class="input-group-addon">区间下限</span>
								<input type="number" id="lowlimit"   class="form-control" placeholder="请输入下限" />  
							</div>
							<div class="col-sm-12" style="padding:10px">
								<a href="javascript:void(0)" class="btn btn-success" onclick="updatelimit()">提交</a>
								<a href="javascript:void(0)" class="btn btn-default" onclick='$(".panel.panel-default form")[0].reset()'>取消</a>
							</div>
						</div>
					</form>
				</div>
			</div>         
		</div><!-- /span-3 -->	
		<div class="col-sm-9">
			<h3><i class="glyphicon glyphicon-dashboard"></i> 控制台</h3>       
			<hr>
			<div id="errdetail" style="position:absolute; height:480px; overflow:auto">
			</div>
		</div>
	</div>
</div>
<div style="height:280px;"></div>
{{include "bottom.html"}}
<script>
var code={{.T.code}};
$(function() {
	$.ajax({
		url:"/front/viewErrDetail",
		method:"post",
		data:{code:code},
		success:function(ret){
			var infos=""
			$.each(ret["list"],function(n,v) {
				infos+="第"+(n+1)+"条:"+v.comeintime+" "+v.url+" "+v.content+"<br/>";
			});
			if(infos.length<1){
				infos="没有错误信息";
			}
			$("#errdetail").html(infos);
			$("#h4name").html(ret["name"]);
			$("#errorNum").html(ret["errorNum"]);
			$("#lastDowncount").html(ret["lastDowncount"]);
			$("#lastExecTime").html(ret["lastExecTime"]);
			$("#todayRequest").html(ret["todayRequest"]);
			$("#todayDowncount").html(ret["todayDowncount"]);
			$("#yestoDayRequest").html(ret["yestoDayRequest"]);
			$("#yestoDayDowncount").html(ret["yestoDayDowncount"]);
			$("#uplimit").val(ret["uplimit"]);
			$("#lowlimit").val(ret["lowlimit"]);
		},
		error:function(){
			alert("服务器无响应");
		}
	});
});

function updatelimit(){
	var uplimit=$("#uplimit").val();
	var lowlimit=$("#lowlimit").val();
	var lastpubtime=$("#lastpubtime").val();
	$.ajax({
		url:"/front/updateDownLimit",
		method:"post",
		data:{code:code,uplimit:uplimit,lowlimit:lowlimit,"lastpubtime":lastpubtime},
		success:function(res){
			if(res){
				alert("修改成功！");
			}else{
				alert("修改失败！");
			}
		},
		error:function(){
			alert("服务器无响应");
		}
	});
}

$(".form_datetime").datetimepicker({format: 'yyyy-mm-dd hh:ii:ss'});  
</script>
</body>
</html>