All.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace app\user\controller;
  3. use think\Lang;
  4. use think\Cache;
  5. class All extends UserControl
  6. {
  7. public function _initialize()
  8. {
  9. parent::_initialize();
  10. Lang::load(APP_PATH . 'user/lang/' . config('default_lang') . '/index.lang.php');
  11. }
  12. /**
  13. * 首页
  14. * @return mixed
  15. */
  16. public function index()
  17. {
  18. $userId = session('user_id');
  19. $userInfo = model('user')->getUserInfo($userId);
  20. $this->assign('userInfo', $userInfo);
  21. $userId = session('user_id');
  22. $countProduct = model('userproduct')->getProductCount($userId);
  23. $this->assign('countProduct', $countProduct);
  24. $renewProduct = model('userproduct')->getRenewProductCount($userId);
  25. $this->assign('renewProduct', $renewProduct);
  26. $setup_date = config('setup_date');
  27. $statistics['os'] = PHP_OS;
  28. $statistics['web_server'] = $_SERVER['SERVER_SOFTWARE'];
  29. $statistics['php_version'] = PHP_VERSION;
  30. $statistics['sql_version'] = $this->_mysql_version();
  31. $statistics['setup_date'] = substr($setup_date, 0, 10);
  32. $statistics['domain'] = $_SERVER['HTTP_HOST'];
  33. $statistics['ip'] = GetHostByName($_SERVER['SERVER_NAME']);
  34. $statistics['zlib'] = function_exists('gzclose') ? 'YES' : 'NO'; //zlib
  35. $statistics['safe_mode'] = (boolean)ini_get('safe_mode') ? 'YES' : 'NO'; //safe_mode = Off
  36. $statistics['timezone'] = function_exists("date_default_timezone_get") ? date_default_timezone_get() : "no_timezone";
  37. $statistics['curl'] = function_exists('curl_init') ? 'YES' : 'NO';
  38. $statistics['fileupload'] = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : 'unknown';
  39. $statistics['max_ex_time'] = @ini_get("max_execution_time") . 's'; //脚本最大执行时间
  40. $statistics['set_time_limit'] = function_exists("set_time_limit") ? true : false;
  41. $statistics['memory_limit'] = ini_get('memory_limit');
  42. $statistics['version'] = file_get_contents(APP_PATH . 'version.php');
  43. if (function_exists("gd_info")) {
  44. $gd = gd_info();
  45. $statistics['gdinfo'] = $gd['GD Version'];
  46. } else {
  47. $statistics['gdinfo'] = lang('Unknown');
  48. }
  49. $this->assign('statistics', $statistics);
  50. return $this->fetch('index');
  51. }
  52. private function _mysql_version()
  53. {
  54. $version = db()->query("select version() as ver");
  55. return $version[0]['ver'];
  56. }
  57. protected function getAdminItemList()
  58. {
  59. $menu_array = array(
  60. array(
  61. 'name' => 'index', 'text' => "欢迎界面", 'url' => url('Wlcome/index')
  62. )
  63. );
  64. return $menu_array;
  65. }
  66. }