Page.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. declare (strict_types=1);
  3. namespace app\store\controller\analysis;
  4. use app\store\controller\Controller;
  5. use app\store\model\analysis\AnalysisDailyVisit;
  6. use app\store\model\analysis\AnalysisMonthlyVisit;
  7. use app\store\model\analysis\AnalysisPageVisit;
  8. use app\store\model\analysis\AnalysisWeeklyVisit;
  9. use app\common\service\Export as ExportService;
  10. /**
  11. * 页面分析
  12. *
  13. * Class Page
  14. * @package app\store\controller\analysis
  15. */
  16. class Page extends Controller
  17. {
  18. /**
  19. * 访问页面
  20. *
  21. * @return array
  22. */
  23. public function pageVisit()
  24. {
  25. $params = $this->request->param();
  26. $tables = AnalysisPageVisit::getList($params);
  27. list($start,$end) = AnalysisPageVisit::getStartEndTime($params);
  28. $data = [
  29. 'start' => date('Y-m-d', $start),
  30. 'end' => date('Y-m-d', $end),
  31. 'table' => $tables
  32. ];
  33. return $this->renderSuccess($data);
  34. }
  35. public function export()
  36. {
  37. $param = $this->request->param();
  38. $model = new AnalysisPageVisit;
  39. $data = $model->export($param);
  40. $res = ExportService::export($data['data'],$data['header'],$data['filename'],'列表','Xls');
  41. return $this->renderSuccess($res,'下载成功');
  42. }
  43. }