64 lines
2.6 KiB
PHP
64 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace Stemcell\Customer\Helper;
|
|
|
|
use Magento\Framework\Exception\LocalizedException;
|
|
use Stemcell\Customer\Helper\Deepblue\CluePost;
|
|
|
|
class CarSeriesClueFactory
|
|
{
|
|
private \Magento\Framework\ObjectManagerInterface $objectManager;
|
|
|
|
public function __construct(
|
|
\Magento\Framework\ObjectManagerInterface $objectManager
|
|
) {
|
|
$this->objectManager = $objectManager;
|
|
}
|
|
|
|
/**
|
|
* @throws LocalizedException
|
|
*/
|
|
public function create(string $series, $isDev = true) : CarSeriesClueInterface
|
|
{
|
|
switch ($series) {
|
|
case '阿维塔11':
|
|
case '阿维塔12':
|
|
/* @var $clue CarSeriesClueInterface */
|
|
$clue = $this->objectManager->create(Avatr::class);
|
|
if ($isDev) {
|
|
$clue->setConfig([
|
|
'media_id' => 6110,
|
|
'media_name' => 'SHANGHAILIQI',
|
|
'ak' => 6110,
|
|
'sk' => 'lMe31rTYgo1i',
|
|
'aes_key' => '87UaSvn4LyCL6KspJECNfvpXeloujQRK',
|
|
'aes_iv' => '4VSqolaKO1Z6FPiS',
|
|
'host' => 'https://sl-api-amstp.stg.avatr.com'
|
|
]);
|
|
}
|
|
return $clue;
|
|
case '启源':
|
|
case '深蓝':
|
|
/* @var $clue CarSeriesClueInterface */
|
|
$clue = $this->objectManager->create(CluePost::class);
|
|
if ($isDev) {
|
|
$clue->setConfig([
|
|
'host' => 'http://47.108.118.7:5782',
|
|
'app_key' => '1a7723f050144299822bf2b0223912dd',
|
|
'app_secret' => '32385b2c5d24263cc08487d659bd273c',
|
|
'pubKey' => 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1TizFpjDxJ30ygJRqVMi7tIm7PkiJQWkhv5yf2GI7oqbPZLkvLeKFy8um68EHRAJeSnsj3r6xMaL5aCD6hhu8j8LdMrAIXMOh6/VkNR4TiPYXHwArZ/ykwELPNMSOr9OJspZvXq3Np9imgyhyhAYZw7pcO/C/csnYEm3OqZnRQuayMQOtpukyWWkACvwYX1ZUq3rrXhSgn6qoMOOTg5YkBKKhehYRbyt5Bm4gzok
|
|
Zi9QhhqtrJpErxxjuryNH1mDeosebsYEN5w6iv5x30lYA7sK3FLxGWeMZ3AVW5DYt59hwZjZx9utlHIYJzv8gCGavr9IhOaQ2rH/Tdjm4N+QjQIDAQAB',
|
|
]);
|
|
}
|
|
return $clue;
|
|
default:
|
|
if (str_contains($series, '领克')){
|
|
/* @var $clue CarSeriesClueInterface */
|
|
$clue = $this->objectManager->create(Lynkco\CluePost::class);
|
|
return $clue;
|
|
}
|
|
throw new LocalizedException(__('invalid param series: %1', $series));
|
|
}
|
|
}
|
|
}
|