diff --git a/views/admin/login_log.php b/views/admin/login_log.php index cc5df1d..78f1fcf 100644 --- a/views/admin/login_log.php +++ b/views/admin/login_log.php @@ -41,7 +41,7 @@ $this->title = '登录日志'; 'format' => 'html', 'enableSorting' => false, 'value' => function ($model) { - return nl2br($model->login_time . "\n(" . Yii::$app->formatter->asRelativeTime($model->login_time) . ")"); + return nl2br($model->login_time . "\n(" . Yii::$app->formatter->asRelativeTime(new DateTime($model->login_time, new DateTimeZone('GMT+8'))) . ")"); }, ], [ diff --git a/views/admin/user_view.php b/views/admin/user_view.php index a5ae9ae..ad2153a 100644 --- a/views/admin/user_view.php +++ b/views/admin/user_view.php @@ -83,11 +83,11 @@ $this->registerCssFile('@web/css/admin-userv.css'); }], ['attribute' => 'created_at', 'label' => '创建时间', 'value' => function ($model) { // 日期时间 (xx天前) - return $model->created_at . ' (' . Yii::$app->formatter->asRelativeTime($model->created_at) . ')'; + return $model->created_at . ' (' . Yii::$app->formatter->asRelativeTime(new DateTime($model->created_at, new DateTimeZone('GMT+8'))) . ')'; }], ['attribute' => 'last_login', 'label' => '最后登录时间', 'value' => function ($model) { // 日期时间 (xx天前) - return $model->last_login . ' (' . Yii::$app->formatter->asRelativeTime($model->last_login) . ')'; + return $model->last_login . ' (' . Yii::$app->formatter->asRelativeTime(new DateTime($model->last_login, new DateTimeZone('GMT+8'))) . ')'; }], ['attribute' => 'last_login_ip', 'label' => '上次登录IP', 'value' => function ($model) use ($IPLocation) { if (Yii::$app->params['enableIpInfo']) {