Trend.php 770 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\admin\controller\apilog;
  3. use app\common\controller\Backend;
  4. use addons\apilog\model\Apilog;
  5. class Trend extends Backend
  6. {
  7. //趋势数据
  8. public function index()
  9. {
  10. if (IS_AJAX) {
  11. $count_m = Apilog::getRequestCountLine(0);
  12. $count_h = Apilog::getRequestCountLine(1);
  13. $count_d = Apilog::getRequestCountLine(2);
  14. $time_m = Apilog::getDoTimeLine(0);
  15. $time_h = Apilog::getDoTimeLine(1);
  16. return json([
  17. 'count_m' => $count_m,
  18. 'count_h' => $count_h,
  19. 'count_d' => $count_d,
  20. 'time_m' => $time_m,
  21. 'time_h' => $time_h
  22. ]);
  23. }
  24. return $this->view->fetch();
  25. }
  26. }