init
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Stemcell\Customer\Controller\Avatr;
|
||||
|
||||
use Magento\Framework\App\Action\HttpGetActionInterface;
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Stemcell\Customer\Helper\Deepblue\Caller;
|
||||
use Stemcell\Customer\Helper\Deepblue\CluePost;
|
||||
use Magento\Framework\Controller\Result\JsonFactory;
|
||||
|
||||
class Test implements HttpGetActionInterface
|
||||
{
|
||||
private CluePost $cluePostHelper;
|
||||
private array $config = [
|
||||
'host' => 'http://47.108.118.7:5782',
|
||||
'app_key' => '1a7723f050144299822bf2b0223912dd',
|
||||
'app_secret' => '32385b2c5d24263cc08487d659bd273c',
|
||||
'pubKey' => 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1TizFpjDxJ30ygJRqVMi7tIm7PkiJQWkhv5yf2GI7oqbPZLkvLeKFy8um68EHRAJeSnsj3r6xMaL5aCD6hhu8j8LdMrAIXMOh6/VkNR4TiPYXHwArZ/ykwELPNMSOr9OJspZvXq3Np9imgyhyhAYZw7pcO/C/csnYEm3OqZnRQuayMQOtpukyWWkACvwYX1ZUq3rrXhSgn6qoMOOTg5YkBKKhehYRbyt5Bm4gzok
|
||||
Zi9QhhqtrJpErxxjuryNH1mDeosebsYEN5w6iv5x30lYA7sK3FLxGWeMZ3AVW5DYt59hwZjZx9utlHIYJzv8gCGavr9IhOaQ2rH/Tdjm4N+QjQIDAQAB',
|
||||
];
|
||||
private JsonFactory $jsonFactory;
|
||||
private LoggerInterface $logger;
|
||||
private \Magento\Framework\App\RequestInterface $request;
|
||||
|
||||
public function __construct(
|
||||
CluePost $cluePostHelper,
|
||||
JsonFactory $jsonFactory,
|
||||
LoggerInterface $logger,
|
||||
\Magento\Framework\App\RequestInterface $request
|
||||
) {
|
||||
$this->cluePostHelper = $cluePostHelper;
|
||||
$this->jsonFactory = $jsonFactory;
|
||||
$this->logger = $logger;
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
if ($this->request->getParam('env')=='dev') {
|
||||
$this->cluePostHelper->setConfig($this->config);
|
||||
}
|
||||
$result = ['error' => ''];
|
||||
$result['response'] = $this->cluePostHelper->setRequestData([
|
||||
'customerPhoneNo' => '13333333333',
|
||||
'outwardOriginId' => 'bbycm-'.time(),
|
||||
'city' => '420100',
|
||||
'province' => '420000',
|
||||
])->post();
|
||||
|
||||
return $this->jsonFactory->create()->setData(['result' => $result, 'request_data'=>$this->cluePostHelper->getRequestData()]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user