{include file='public/meta'}
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
	<span class="c-gray en">&gt;</span>
	后台首页
	<span class="c-gray en">&gt;</span>
	操作日志
	<a class="btn btn-success radius r btn-refresh" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
	<!--search -->
	<form  method='get'  action="<?php echo url('admin/logs/index');?>"  > 
		<div class="text-c"> 日期范围：
			<input type="text" onclick="laydate({ istime: true, format: 'YYYY-MM-DD','min':laydate.now() })" name="start" class="input-text Wdate" style="width:120px;" value="<?php echo $start;?>">
			-
			<input type="text" onclick="laydate({ istime: true, format: 'YYYY-MM-DD','min':laydate.now() })" name="end" class="input-text Wdate" style="width:120px;" value="<?php echo $end;?>" >
			<input type="text" class="input-text" style="width:250px" placeholder="关键字" name="keywords" value="<?php echo $keywords;?>">
			<button type="submit" class="btn btn-success" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
		</div>
	</form>
	<!-- end search -->
	<div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l">
			<a class="btn btn-danger size-S radius" onclick="delmul()" href="javascript:;">删除</a>
			<a href="javascript:;" onclick="deldaysbefore(30)" class="btn btn-danger radius size-S"> 删除30天前</a>
		</span>
		
	</div>
	<div class="mt-20">
		<table class="table table-border table-bordered table-hover table-bg">
			<thead>
				<tr class="text-c">
					<th width="25"><input type="checkbox" class='checkbox' ></th>
					<th>ID</th>
					<th>用户名</th>
					<th>操作类型</th>
					<th>IP</th>
					<th>行为</th>
					<th>时间</th>
				</tr>
			</thead>
			<tbody>
				{volist name="rows" id="value"}
				<tr class="text-c">
					<td><input type="checkbox" value="<?php echo $value['id'];?>" name="ids"></td>
					<td><?php echo $value['id'];?></td>
					<td><?php echo $value['uname'];?></td>
					<td><?php echo $types[$value['type']];?></td>
					<td><?php echo $value['ip'];?></td>
					<td><?php echo $value['info'];?></td>
					<td><?php echo date('Y-m-d',$value['ctime']);?></td>
				</tr>
				{/volist}
			</tbody>
		</table>
		<div><?php echo $rows->render();?></div>
	</div>
</div>
{include file='public/footer'}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__LIB__/laydate/laydate.js"></script>
<script type="text/javascript" src="__LIB__/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript">
/*系统-栏目-删除*/
function del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$.post(
			"<?php echo url('admin/menu/delete');?>",
			{"id":id},
			function(data){
				layer.msg(data.msg,{icon:1,time:1000});
				if(0==data.error){
					$(obj).parents("tr").remove();
				}
			},'json'
		)
	});
}


function delmul(obj,id){
	var vals= getCheckVals('ids');
	if(vals.length==0){
		layer.msg('请选择数据');
		return false;
	}
	layer.confirm('确认要删除吗？',function(index){
		$.post(
			"<?php echo url('admin/logs/delete');?>",
			{"ids":vals},
			function(data){
				layer.msg(data.msg,{icon:1,time:1000});
				if(0==data.error){
					setTimeout(function(){
						location.reload();
					},1000)
				}
			},'json'
		)
	});
}

function deldaysbefore(days){
	layer.confirm('确认要删除'+days+'天前记录吗？',function(index){
		$.post(
			"<?php echo url('admin/logs/deletebeforday');?>",
			{"days":days},
			function(data){
				layer.msg(data.msg,{icon:1,time:1000});
				if(0==data.error){
					setTimeout(function(){
						location.reload();
					},1000)
				}
			},'json'
		)
	});
}
</script>
</body>
</html>