From 476dd4974baef511afb8d059c74c8bc7f1007b17 Mon Sep 17 00:00:00 2001 From: Chenx221 Date: Wed, 3 Apr 2024 16:04:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=99=BB=E5=BD=95=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=9F=A5=E7=9C=8B=20*=E5=89=8D=E7=AB=AF=E9=83=A8?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- views/admin/login_log.php | 69 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 views/admin/login_log.php diff --git a/views/admin/login_log.php b/views/admin/login_log.php new file mode 100644 index 0000000..cc5df1d --- /dev/null +++ b/views/admin/login_log.php @@ -0,0 +1,69 @@ +title = '登录日志'; +?> +
+

title) ?>

+
+ + $dataProvider, + 'columns' => [ + [ + 'attribute' => 'user_id', + 'label' => '试图登录的账户', + 'format' => 'html', // 设置格式为 HTML + 'value' => function ($model) { + return nl2br($model->user_id ? $model->user->username."\n(ID:".$model->user_id.')' : '不存在的用户'); + }, + ], + [ + 'attribute' => 'ip_address', + 'label' => 'IP地址', + 'format' => 'raw', + 'value' => function ($model) { + return Html::a($model->ip_address, 'https://ipinfo.io/'.$model->ip_address, ['target' => '_blank']); + }, + ], + [ + 'attribute' => 'login_time', + 'label' => '登录时间', + 'format' => 'html', + 'enableSorting' => false, + 'value' => function ($model) { + return nl2br($model->login_time . "\n(" . Yii::$app->formatter->asRelativeTime($model->login_time) . ")"); + }, + ], + [ + 'attribute' => 'user_agent', + 'label' => 'User Agent', + ], + [ + 'attribute' => 'status', + 'label' => '登录状态', + 'format' => 'html', // 设置格式为 HTML + 'value' => function ($model) { + return $model->status === 1 ? '成功' : '失败'; + }, + ], + ], + 'pager' => [ + 'class' => LinkPager::class, + ], + ]); + + ?> + + + +
\ No newline at end of file