ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Lts\Inventory\Block\Index;
|
||||
|
||||
use Lts\Inventory\Api\SourceCustomerInterface;
|
||||
use Lts\Inventory\Api\SourceCustomerRepositoryInterface;
|
||||
use Magento\Customer\Model\Session;
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
|
||||
class Index extends \Magento\Framework\View\Element\Template
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Magento\Framework\View\Element\Template\Context $context
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\View\Element\Template\Context $context,
|
||||
Session $customerSession,
|
||||
SourceCustomerRepositoryInterface $sourceCustomerRepository,
|
||||
array $data = []
|
||||
) {
|
||||
$this->customerSession = $customerSession;
|
||||
$this->sourceCustomerRepository = $sourceCustomerRepository;
|
||||
parent::__construct($context, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Lts\Inventory\Api\Data\SourceCustomerInterface[]
|
||||
* @throws LocalizedException
|
||||
*/
|
||||
public function getInventorySources() {
|
||||
return $this->sourceCustomerRepository->getList((string)$this->customerSession->getCustomerId())->getItems();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user