Files
esun3d/app/code/Esun/CustomerMessage/ViewModel/OrderUnread.php
T
2026-09-15 10:35:56 +08:00

30 lines
724 B
PHP

<?php
declare(strict_types=1);
namespace Esun\CustomerMessage\ViewModel;
use Esun\CustomerMessage\Model\ConversationService;
use Magento\Customer\Model\Session;
use Magento\Framework\View\Element\Block\ArgumentInterface;
class OrderUnread implements ArgumentInterface
{
public function __construct(
private readonly Session $session,
private readonly ConversationService $conversations
) {
}
/**
* @param int[] $orderIds
* @return array<int, int>
*/
public function getUnreadCounts(array $orderIds): array
{
return $this->conversations->getCustomerUnreadByOrderIds(
(int)$this->session->getCustomerId(),
$orderIds
);
}
}