Dashboard.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace app\admin\controller;
  3. use app\common\controller\Backend;
  4. use think\Config;
  5. /**
  6. * 控制台
  7. *
  8. * @icon fa fa-dashboard
  9. * @remark 用于展示当前系统中的统计数据、统计报表及重要实时数据
  10. */
  11. class Dashboard extends Backend
  12. {
  13. /**
  14. * 查看
  15. */
  16. public function index()
  17. {
  18. $seventtime = \fast\Date::unixtime('day', -7);
  19. $paylist = $createlist = [];
  20. for ($i = 0; $i < 7; $i++)
  21. {
  22. $day = date("Y-m-d", $seventtime + ($i * 86400));
  23. $createlist[$day] = mt_rand(20, 200);
  24. $paylist[$day] = mt_rand(1, mt_rand(1, $createlist[$day]));
  25. }
  26. $hooks = config('addons.hooks');
  27. $uploadmode = isset($hooks['upload_config_init']) && $hooks['upload_config_init'] ? implode(',', $hooks['upload_config_init']) : 'local';
  28. $addonComposerCfg = ROOT_PATH . '/vendor/karsonzhang/fastadmin-addons/composer.json';
  29. Config::parse($addonComposerCfg, "json", "composer");
  30. $config = Config::get("composer");
  31. $addonVersion = isset($config['version']) ? $config['version'] : __('Unknown');
  32. $this->view->assign([
  33. 'totaluser' => 35200,
  34. 'totalviews' => 219390,
  35. 'totalorder' => 32143,
  36. 'totalorderamount' => 174800,
  37. 'todayuserlogin' => 321,
  38. 'todayusersignup' => 430,
  39. 'todayorder' => 2324,
  40. 'unsettleorder' => 132,
  41. 'sevendnu' => '80%',
  42. 'sevendau' => '32%',
  43. 'paylist' => $paylist,
  44. 'createlist' => $createlist,
  45. 'addonversion' => $addonVersion,
  46. 'uploadmode' => $uploadmode
  47. ]);
  48. return $this->view->fetch();
  49. }
  50. }