first commit
This commit is contained in:
24
app/common/middleware/AdminLog.php
Normal file
24
app/common/middleware/AdminLog.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\middleware;
|
||||
|
||||
use Closure;
|
||||
use Throwable;
|
||||
use think\facade\Config;
|
||||
use app\admin\model\AdminLog as AdminLogModel;
|
||||
|
||||
class AdminLog
|
||||
{
|
||||
/**
|
||||
* 写入管理日志
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$response = $next($request);
|
||||
if (($request->isPost() || $request->isDelete()) && Config::get('buildadmin.auto_write_admin_log')) {
|
||||
AdminLogModel::instance()->record();
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user