Wlcome.php 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. namespace app\admin\controller;
  3. use think\Lang;
  4. use think\Cache;
  5. class Wlcome extends AdminControl
  6. {
  7. public function _initialize()
  8. {
  9. parent::_initialize();
  10. Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/index.lang.php');
  11. }
  12. /**
  13. * 首页
  14. * @return mixed
  15. */
  16. public function index()
  17. {
  18. $rechargeModel = Model('Recharge');
  19. $rechargeCount = $rechargeModel->countRecharge(['recharge_status'=>2]);
  20. $this->assign('rechargeCount', $rechargeCount);
  21. $orderModel = Model('Order');
  22. $nowDate = date('Y-m-d');
  23. $todayOrderWhere['order_buyTime'] = array('between', array($nowDate, $nowDate));
  24. $todayOrderCount = $orderModel->countOrder($todayOrderWhere);
  25. $this->assign('todayOrderCount', $todayOrderCount);
  26. $nowMonth = date('Y-m-01');
  27. $monthOrderWhere['order_buyTime'] = array('between', array($nowMonth, $nowDate));
  28. $monthOrderCount = $orderModel->countOrder($monthOrderWhere);
  29. $this->assign('monthOrderCount', $monthOrderCount);
  30. $orderCount = $orderModel->countOrder('');
  31. $this->assign('orderCount', $orderCount);
  32. $productModel = Model('Product');
  33. $fartherProductCount = $productModel->countProduct(['product_pid'=>0]);
  34. $this->assign('fartherProductCount', $fartherProductCount);
  35. $allProductCount = $productModel->countProduct('');
  36. $this->assign('productCount', $allProductCount - $fartherProductCount);
  37. $setup_date = config('setup_date');
  38. $statistics['os'] = PHP_OS;
  39. $statistics['web_server'] = $_SERVER['SERVER_SOFTWARE'];
  40. $statistics['php_version'] = PHP_VERSION;
  41. $statistics['sql_version'] = $this->_mysql_version();
  42. $statistics['setup_date'] = substr($setup_date, 0, 10);
  43. $statistics['domain'] = $_SERVER['HTTP_HOST'];
  44. $statistics['ip'] = GetHostByName($_SERVER['SERVER_NAME']);
  45. $statistics['zlib'] = function_exists('gzclose') ? 'YES' : 'NO'; //zlib
  46. $statistics['safe_mode'] = (boolean)ini_get('safe_mode') ? 'YES' : 'NO'; //safe_mode = Off
  47. $statistics['timezone'] = function_exists("date_default_timezone_get") ? date_default_timezone_get() : "no_timezone";
  48. $statistics['curl'] = function_exists('curl_init') ? 'YES' : 'NO';
  49. $statistics['fileupload'] = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : 'unknown';
  50. $statistics['max_ex_time'] = @ini_get("max_execution_time") . 's'; //脚本最大执行时间
  51. $statistics['set_time_limit'] = function_exists("set_time_limit") ? true : false;
  52. $statistics['memory_limit'] = ini_get('memory_limit');
  53. $statistics['version'] = file_get_contents(APP_PATH . 'version.php');
  54. if (function_exists("gd_info")) {
  55. $gd = gd_info();
  56. $statistics['gdinfo'] = $gd['GD Version'];
  57. } else {
  58. $statistics['gdinfo'] = lang('Unknown');
  59. }
  60. $this->assign('statistics', $statistics);
  61. return $this->fetch('index');
  62. }
  63. private function _mysql_version()
  64. {
  65. $version = db()->query("select version() as ver");
  66. return $version[0]['ver'];
  67. }
  68. protected function getAdminItemList()
  69. {
  70. $menu_array = array(
  71. array(
  72. 'name' => 'index', 'text' => "欢迎界面", 'url' => url('Wlcome/index')
  73. )
  74. );
  75. return $menu_array;
  76. }
  77. }