checkToken.php 723 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. declare (strict_types = 1);
  3. namespace app\admin\middleware;
  4. use think\facade\Db;
  5. class checkToken
  6. {
  7. /**
  8. * 处理请求
  9. *
  10. * @param \think\Request $request
  11. * @param \Closure $next
  12. * @return Response
  13. */
  14. public function handle($request, \Closure $next)
  15. {
  16. if ($request->isOptions()) {
  17. return json();
  18. }
  19. $data=[
  20. "info"=>"",
  21. "action"=>"",
  22. "url"=>$request->server()['REQUEST_URI'],
  23. "param"=>json_encode($request->param(),JSON_UNESCAPED_UNICODE),
  24. "name"=>'',
  25. "addtime"=>date("Y-m-d H:i:s")
  26. ];
  27. Db::name("system_log")->insert($data);
  28. return $next($request);
  29. }
  30. }