* [perf story #59898] Adjust buildMessageList function for ajaxgetdropmenu.html.php.

This commit is contained in:
wangyidong
2024-07-24 14:48:19 +08:00
committed by 孙广明
parent c787240135
commit e8fb117a49
2 changed files with 7 additions and 0 deletions
@@ -28,6 +28,12 @@ $buildMessageList = function($messageGroup) use ($lang)
{
$isUnread = $message->status != 'read';
$dotColor = $isUnread ? 'danger' : 'gray';
$secondDiff = time() - strtotime($message->createdDate);
if($secondDiff < 60) $time = sprintf($lang->message->timeLabel['minute'], 1);
if($secondDiff >= 60) $time = sprintf($lang->message->timeLabel['minute'], ceil($secondDiff / 60));
if($secondDiff >= 3600) $time = $lang->message->timeLabel['hour'];
if($secondDiff > 5400) $time = substr($message->createdDate, 5, 11);
$itemList[] = h::li
(
setClass('message-item border rounded-lg p-2 mt-2' . ($isUnread ? ' unread' : '')),