Data.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /*
  3. * @Description: file content
  4. * @Author: xiaoyu5062
  5. * @QQ: 170515071
  6. * @E-mail: xiaoyu5062@qq.com
  7. * @Date: 2020-07-25 10:01:48
  8. */
  9. namespace app\admin\controller\apilog;
  10. use app\common\controller\Backend;
  11. use addons\apilog\model\Apilog;
  12. class Data extends Backend
  13. {
  14. //基础数据
  15. public function index()
  16. {
  17. if (IS_AJAX) {
  18. $start = intval(input('start', strtotime(date("Y-m-d", time()))));
  19. $end = intval(input('end', $start + 86400));
  20. $baseinfo = Apilog::getBaseInfo($start, $end);
  21. $code = Apilog::getHttpCodePie($start, $end);
  22. $time = Apilog::getResponseTimePie($start, $end);
  23. $requesttop = Apilog::getMaxRequestTop($start, $end);
  24. $errortop = Apilog::getMaxErrorTop($start, $end);
  25. $fasttop = Apilog::getDoFastTop($start, $end);
  26. $slowtop = Apilog::getDoSlowTop($start, $end);
  27. $data['base'] = $baseinfo;
  28. $data['code'] = $code;
  29. $data['requesttop'] = $requesttop;
  30. $data['time'] = $time;
  31. $data['errortop'] = $errortop;
  32. $data['fasttop'] = $fasttop;
  33. $data['slowtop'] = $slowtop;
  34. return json($data);
  35. }
  36. return $this->view->fetch();
  37. }
  38. }