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
@@ -0,0 +1,45 @@
<?php
/**
* @package Plumrocket_Base
* @copyright Copyright (c) 2021 Plumrocket Inc. (https://plumrocket.com)
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\Base\Model\Extension\Customer;
use Magento\Framework\Config\DataInterface;
/**
* Reads customer key from pr_extensions.xml
*
* @since 2.5.0
*/
class GetKey
{
/**
* @var \Magento\Framework\Config\DataInterface
*/
private $extensionsConfig;
/**
* @param \Magento\Framework\Config\DataInterface $extensionsConfig
*/
public function __construct(
DataInterface $extensionsConfig
) {
$this->extensionsConfig = $extensionsConfig;
}
/**
* Get customer key.
*
* @param string $moduleName e.g. SocialLoginFree
* @return string
*/
public function execute(string $moduleName): string
{
return (string) $this->extensionsConfig->get("$moduleName/customer/key");
}
}
@@ -0,0 +1,83 @@
<?php
/**
* @package Plumrocket_Base
* @copyright Copyright (c) 2021 Plumrocket Inc. (https://plumrocket.com)
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\Base\Model\Extension\Customer;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Plumrocket\Base\Model\Extension\GetModuleName;
/**
* Retrieve true customer key when customer had bought extension from marketplace
*
* @since 2.5.0
*/
class GetTrueCustomerKey
{
/**
* @var \Plumrocket\Base\Model\Extension\Customer\GetKey
*/
private $getKey;
/**
* @var \Plumrocket\Base\Model\Extension\Customer\IsMarketplaceKey
*/
private $isMarketplaceKey;
/**
* @var \Plumrocket\Base\Model\Extension\GetModuleName
*/
private $getModuleName;
/**
* @var \Magento\Framework\App\Config\ScopeConfigInterface
*/
private $scopeConfig;
/**
* @param \Plumrocket\Base\Model\Extension\Customer\GetKey $getKey
* @param \Plumrocket\Base\Model\Extension\Customer\IsMarketplaceKey $isMarketplaceKey
* @param \Plumrocket\Base\Model\Extension\GetModuleName $getModuleName
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
*/
public function __construct(
GetKey $getKey,
IsMarketplaceKey $isMarketplaceKey,
GetModuleName $getModuleName,
ScopeConfigInterface $scopeConfig
) {
$this->getKey = $getKey;
$this->isMarketplaceKey = $isMarketplaceKey;
$this->getModuleName = $getModuleName;
$this->scopeConfig = $scopeConfig;
}
/**
* @param string $moduleName e.g. SocialLoginFree or Plumrocket_SocialLoginFree
* @return string
*/
public function execute(string $moduleName): string
{
$moduleName = $this->getModuleName->execute($moduleName);
$customerKey = $this->getKey->execute($moduleName);
if ($this->isMarketplaceKey->execute($customerKey)) {
$customerKey = $this->getFromConfig($moduleName) ?: $customerKey;
}
return $customerKey;
}
/**
* @param string $moduleName e.g. SocialLoginFree
* @return string
*/
private function getFromConfig(string $moduleName): string
{
return (string) $this->scopeConfig->getValue("$moduleName/module/data");
}
}
@@ -0,0 +1,25 @@
<?php
/**
* @package Plumrocket_Base
* @copyright Copyright (c) 2021 Plumrocket Inc. (https://plumrocket.com)
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\Base\Model\Extension\Customer;
/**
* Check whether customer key is marketplace
*
* @since 2.5.0
*/
class IsMarketplaceKey
{
const MARKETPLACE_CUSTOMER_KEY = '532416486b540ea2a1e50c4070b671611b44f52718';
public function execute(string $customerKey): bool
{
return self::MARKETPLACE_CUSTOMER_KEY === $customerKey;
}
}