Compare commits

...

2 Commits

Author SHA1 Message Date
Karson f764bc98c7 修复管理员登出时日志未记录管理员ID的问题
优化日志记录忽略的URL
2025-06-07 16:00:14 +08:00
Karson dd8f2363fb 优化分页大小保存 2025-06-06 23:57:40 +08:00
3 changed files with 14 additions and 3 deletions

View File

@ -77,6 +77,8 @@ class Index extends Backend
//保持会话有效时长,单位:小时
$keeyloginhours = 24;
if ($this->request->isPost()) {
AdminLog::setTitle(__('Login'));
$username = $this->request->post('username');
$password = $this->request->post('password', '', null);
$keeplogin = $this->request->post('keeplogin');
@ -132,6 +134,13 @@ class Index extends Backend
public function logout()
{
if ($this->request->isPost()) {
$user_id = $this->auth->id;
$username = $this->auth->username;
AdminLog::event('before_insert', function ($row) use ($user_id, $username) {
$row->admin_id = $user_id;
$row->username = $username;
});
AdminLog::setTitle(__('Logout'));
$this->auth->logout();
Hook::listen("admin_logout_after", $this->request);
$this->success(__('Logout successful'), 'index/login');

View File

@ -20,8 +20,8 @@ class AdminLog extends Model
protected static $content = '';
//忽略的链接正则列表
protected static $ignoreRegex = [
'/^(.*)\/(selectpage|index)$/i',
'/^(.*)\/addon\/get_table_list$/i',
'/^(.*)\/(selectpage|index|get_table_list|get_fields_list)$/i',
'/^(.*)\/auth\/group\/roletree$/i',
];
public static function setTitle($title)

View File

@ -154,7 +154,9 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
var _onPageListChange = $.fn.bootstrapTable.Constructor.prototype.onPageListChange;
$.fn.bootstrapTable.Constructor.prototype.onPageListChange = function () {
_onPageListChange.apply(this, Array.prototype.slice.apply(arguments));
localStorage.setItem('pagesize', this.options.pageSize);
if (!isNaN(this.options.pageSize)) {
localStorage.setItem('pagesize', this.options.pageSize);
}
return false;
};
// 写入bootstrap-table默认配置