更新若干代码

This commit is contained in:
2025-05-19 15:33:43 +08:00
parent a7b82e1e26
commit 3f7b87cdb5
36 changed files with 1590 additions and 673 deletions
@@ -1,4 +1,4 @@
<?php /*a:2:{s:57:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\log\login.php";i:1747615358;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
<?php /*a:2:{s:57:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\log\login.php";i:1747639417;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
<!DOCTYPE html>
<html>
<head>
@@ -141,18 +141,6 @@
</div>
</div>
<script type="text/html" id="tableToolbar">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="clearAll">
<i class="layui-icon layui-icon-delete"></i> 清空日志
</button>
</div>
</script>
<script type="text/html" id="tableBar">
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
</script>
<script src="/static/layui/layui.js"></script>
<script>
layui.use(['table', 'form', 'laydate'], function(){
@@ -172,7 +160,6 @@
elem: '#loginLogTable',
url: '<?php echo url("log/login"); ?>',
method: 'post',
toolbar: '#tableToolbar',
defaultToolbar: ['filter', 'exports', 'print'],
parseData: function(res) {
return {
@@ -183,20 +170,19 @@
};
},
cols: [[
{field: 'id', title: 'ID', width: 80, sort: true},
{field: 'username', title: '用户名', width: 120},
{field: 'ip_address', title: 'IP地址', width: 130},
{field: 'location', title: '登录地点', width: 120},
{field: 'device_type', title: '设备类型', width: 100},
{field: 'user_agent', title: '浏览器', width: 200},
{field: 'login_status', title: '状态', width: 100, templet: function(d){
{field: 'id', title: 'ID', width: 80, sort: true, align: 'center'},
{field: 'username', title: '用户名', align: 'center'},
{field: 'ip_address', title: 'IP地址', width: 130, align: 'center'},
{field: 'location', title: '登录地点', width: 120, align: 'center'},
{field: 'device_type', title: '设备类型', width: 100, align: 'center'},
{field: 'user_agent', title: '浏览器', width: 200, align: 'center'},
{field: 'login_status', title: '状态', width: 100, align: 'center', templet: function(d){
return d.login_status == 1 ?
'<span class="layui-badge layui-bg-green">成功</span>' :
'<span class="layui-badge layui-bg-red">失败</span>';
}},
{field: 'failure_reason', title: '失败原因', width: 150},
{field: 'login_time', title: '登录时间', width: 180, sort: true},
{title: '操作', toolbar: '#tableBar', width: 80, fixed: 'right'}
{field: 'failure_reason', title: '失败原因', width: 150, align: 'center'},
{field: 'login_time', title: '登录时间', width: 180, sort: true, align: 'center'}
]],
page: true,
limit: 10,
@@ -219,41 +205,6 @@
});
return false;
});
// 监听工具条
table.on('tool(loginLogTable)', function(obj){
var data = obj.data;
if(obj.event === 'del'){
layer.confirm('确定删除这条日志吗?', function(index){
$.post('<?php echo url("log/deleteLogin"); ?>', {id: data.id}, function(res){
if(res.code === 0){
layer.msg(res.msg, {icon: 1});
obj.del();
}else{
layer.msg(res.msg, {icon: 2});
}
});
layer.close(index);
});
}
});
// 监听头工具栏事件
table.on('toolbar(loginLogTable)', function(obj){
if(obj.event === 'clearAll'){
layer.confirm('确定要清空所有登录日志吗?', function(index){
$.post('<?php echo url("log/clearLogin"); ?>', function(res){
if(res.code === 0){
layer.msg(res.msg, {icon: 1});
table.reload('loginLogTable');
}else{
layer.msg(res.msg, {icon: 2});
}
});
layer.close(index);
});
}
});
});
</script>
</body>