From ddb076cf31d4ee06381c942b59ed5f98e6958909 Mon Sep 17 00:00:00 2001 From: Chenx221 Date: Mon, 22 Apr 2024 18:55:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E7=94=A8=E6=88=B7=E5=90=8E=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E8=BF=87=E7=9A=84=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=97=B6=E5=87=BA=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98=20*?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E6=98=AF=E5=90=8E=E5=8A=A0=E7=9A=84XX=20day?= =?UTF-8?q?=20ago=E5=8A=9F=E8=83=BD=E5=AF=BC=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- views/admin/user_view.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/views/admin/user_view.php b/views/admin/user_view.php index 32e28c2..f64249a 100644 --- a/views/admin/user_view.php +++ b/views/admin/user_view.php @@ -86,7 +86,10 @@ $this->registerCssFile('@web/css/admin-userv.css'); }], ['attribute' => 'last_login', 'label' => '最后登录时间', 'value' => function ($model) { // 日期时间 (xx天前) - return $model->last_login . ' (' . Yii::$app->formatter->asRelativeTime(new DateTime($model->last_login, new DateTimeZone('GMT+8'))) . ')'; + if($model->last_login !== null){ + return $model->last_login . ' (' . Yii::$app->formatter->asRelativeTime(new DateTime($model->last_login, new DateTimeZone('GMT+8'))) . ')'; + } + return $model->last_login; }], ['attribute' => 'last_login_ip', 'label' => '上次登录IP', 'value' => function ($model) use ($IPLocation) { if (Yii::$app->params['enableIpInfo']) {