feat(user): display last visit date if offline too long time
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2023-01-16 17:08:15 +08:00
parent 0d3bbf82c3
commit fde7fd0cb0
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -143,9 +143,8 @@
<?php endif ?> <?php endif ?>
</ul> </ul>
<div class="card-footer bg-transparent"> <div class="card-footer bg-transparent">
<?php $last_visit_time = strtotime($user['last_visit_time']) ?> <?php $last_visit_time = UOJTime::str2time($user['last_visit_time']) ?>
<?php if (time() - $last_visit_time < 60 * 15) : // 15 mins <?php if ((clone UOJTime::$time_now)->modify('- 15 mins') <= $last_visit_time) : ?>
?>
<span class="text-success"> <span class="text-success">
<i class="bi bi-circle-fill me-1"></i> <i class="bi bi-circle-fill me-1"></i>
<?= UOJLocale::get('user::online') ?> <?= UOJLocale::get('user::online') ?>
@ -158,7 +157,11 @@
<?php if ($last_visit_time > 0) : ?> <?php if ($last_visit_time > 0) : ?>
<span class="text-muted small"> <span class="text-muted small">
(<?= UOJLocale::get('user::last active at') ?> (<?= UOJLocale::get('user::last active at') ?>
<?= HTML::relative_time_str($last_visit_time, 0) ?>) <?php if ((clone UOJTime::$time_now)->modify('- 1 day') <= $last_visit_time) : ?>
<?= HTML::relative_time_str($last_visit_time, 0) ?>)
<?php else : ?>
<?= $last_visit_time->format('Y-m-d') ?>)
<?php endif ?>
</span> </span>
<?php endif ?> <?php endif ?>
<?php endif ?> <?php endif ?>