ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
+81
View File
@@ -0,0 +1,81 @@
<?php
/**
* Copyright © JR All rights reserved.
* See COPYING.txt for license details.
*/
namespace JR\ReportIntegration\Model;
use \JR\ReportIntegration\Api\Service\RequestServiceInterface;
use \JR\ReportIntegration\Api\Model\ConfirmManagementInterface;
use \Magento\Customer\Api\CustomerRepositoryInterface;
use \JR\ReportIntegration\Model\ChangeQuoteControl;
class ConfirmManagement implements ConfirmManagementInterface
{
/**
* @var RequestServiceInterface
*/
private $requestService;
/**
* @var CustomerRepositoryInterface
*/
private $customerRepository;
/**
* @var ChangeQuoteControl
*/
protected $changeQuoteControl;
/**
* @param RequestServiceInterface
* @param CustomerRepositoryInterface
*
* @return void
*/
public function __construct(
RequestServiceInterface $requestService,
CustomerRepositoryInterface $customerRepository,
ChangeQuoteControl $changeQuoteControl
) {
$this->requestService = $requestService;
$this->customerRepository = $customerRepository;
$this->changeQuoteControl = $changeQuoteControl;
}
/**
* {@inheritdoc}
*/
public function postConfirm($email, $secret, $id, $sales_rep)
{
return $this->requestService->post(
$email,
$secret,
[$this, 'confirm'],
['id' => $id, 'sales_rep' => $sales_rep]
);
}
/**
* {@inheritdoc}
*/
public function confirm($id, $sales_rep)
{
$result = [];
try {
$customer = $this->customerRepository->getById($id);
$customer->setCustomAttribute('sales_rep', $sales_rep);
$customer->setGroupId(2);
$customer->setConfirmation(null);
$this->changeQuoteControl->forceIsAllowed(true);
$this->customerRepository->save($customer);
$result[] = array('account' => $customer->getEmail(), 'error' => NULL);
} catch (\Exception $e) {
$result[] = array('account' => isset($customer) ? $customer->getEmail() : $id, 'error' => $e->getMessage());
}
return $result;
}
}