AdminLog.php 725 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * +
  4. * | 后台中间件验证权限
  5. */
  6. namespace app\admin\middleware;
  7. use app\admin\model\AuthRule;
  8. use think\facade\Db;
  9. use think\facade\Session;
  10. use think\facade\Request;
  11. use think\Response;
  12. use think\exception\HttpResponseException;
  13. class AdminLog
  14. {
  15. public function handle($request, \Closure $next)
  16. {
  17. //进行操作日志的记录
  18. \app\admin\model\AdminLog::record();
  19. //中间件handle方法的返回值必须是一个Response对象。
  20. return $next($request);
  21. }
  22. //中间件支持定义请求结束前的回调机制,你只需要在中间件类中添加end方法。
  23. public function end(\think\Response $response)
  24. {
  25. // 回调行为
  26. }
  27. }