ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
namespace JR\NetSuite\Controller\Adminhtml\RmaQueue;
|
||||
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
use JR\NetSuite\Cron\RmaSyncCron;
|
||||
|
||||
/**
|
||||
* Class ClearHistory from controller
|
||||
*/
|
||||
class Import extends \Magento\Backend\App\Action
|
||||
{
|
||||
const MENU_ID = 'JR_NetSuite::rmaqueue';
|
||||
|
||||
/**
|
||||
* @var PageFactory
|
||||
*/
|
||||
protected $resultPageFactory;
|
||||
|
||||
/**
|
||||
* @var RmaSyncCron
|
||||
*/
|
||||
protected $rmaSyncCron;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\ResourceConnection
|
||||
*/
|
||||
protected $_resource;
|
||||
|
||||
public function __construct(
|
||||
\Magento\Backend\App\Action\Context $context,
|
||||
\Magento\Framework\App\ResourceConnection $resource,
|
||||
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
|
||||
RmaSyncCron $rmaSyncCron
|
||||
) {
|
||||
$this->_resource = $resource;
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
$this->rmaSyncCron = $rmaSyncCron;
|
||||
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
try {
|
||||
$processed = 0;
|
||||
// do {
|
||||
$count = $this->rmaSyncCron->processQueueItems();
|
||||
if ($count) {
|
||||
$processed += $count;
|
||||
}
|
||||
// } while ($count);
|
||||
$this->messageManager->addSuccessMessage(__('A total of %1 rmas imported.', $processed));
|
||||
} catch (\Exception $e) {
|
||||
$this->messageManager->addErrorMessage($e->getMessage());
|
||||
}
|
||||
$this->_redirect('jr_netsuite/rmaqueue/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function _isAllowed()
|
||||
{
|
||||
return $this->_authorization->isAllowed(static::MENU_ID);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user