checkToken.php 716 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. declare (strict_types = 1);
  3. namespace app\admin\middleware;
  4. use app\admin\model\SystemLog;
  5. class checkToken
  6. {
  7. /**
  8. * 处理请求
  9. *
  10. * @param \think\Request $request
  11. * @param \Closure $next
  12. * @return
  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. SystemLog::create($data);
  28. return $next($request);
  29. }
  30. }