forked from kuafuRace/phprap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHomeController.php
More file actions
34 lines (29 loc) · 977 Bytes
/
Copy pathHomeController.php
File metadata and controls
34 lines (29 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
namespace app\controllers\admin;
use Yii;
use yii\helpers\Url;
use app\models\Project;
use app\models\Tongji;
class HomeController extends PublicController
{
/**
* 后台主页
* @return string|\yii\web\Response
* @throws \yii\db\Exception
*/
public function actionIndex()
{
if(Yii::$app->user->isGuest){
return $this->redirect(['home/account/login', 'callback' => Url::current()]);
}
// 系统信息
$system['installed_at'] = Project::findModel()->getInstallTime();
$system['app_os'] = PHP_OS;
$system['app_version'] = Yii::$app->params['app_version'];
$system['php_version'] = PHP_VERSION;
$system['mysql_version'] = Yii::$app->db->createCommand('select version()')->queryScalar();
// 统计信息
$tongji = new Tongji();
return $this->display('index', ['system' => array2object($system), 'tongji' => $tongji]);
}
}