Добавлена передача версий модуля, php и cms в get-запросах к CRM

This commit is contained in:
anton 2024-10-14 12:39:45 +06:00
parent 11248f5309
commit 8d0fc9161e
4 changed files with 18 additions and 5 deletions

View file

@ -1,3 +1,6 @@
## v3.6.12
* Добавлена передача версий модуля, php и cms в get-запросах к CRM
## v3.6.11
* Добавлены подсказки в настройках модуля

View file

@ -1 +1 @@
3.6.11
3.6.12

View file

@ -43,6 +43,7 @@ class RetailcrmHttpClient
protected $url;
protected $defaultParameters;
protected $versionData;
/**
* Client constructor.
@ -61,7 +62,13 @@ class RetailcrmHttpClient
}
$this->url = $url;
$this->defaultParameters = $defaultParameters;
$this->defaultParameters = $defaultParameters;
$this->versionData = [
'php_version' => function_exists('phpversion') ? phpversion() : '',
'cms_source' => 'PrestaShop',
'module_version' => RetailCRM::VERSION,
'cms_version' => _PS_VERSION_
];
}
/**
@ -106,7 +113,11 @@ class RetailcrmHttpClient
);
}
$parameters = array_merge($this->defaultParameters, $parameters);
if (self::METHOD_GET === $method) {
$parameters = array_merge($this->defaultParameters, $parameters, $this->versionData);
} else {
$parameters = array_merge($this->defaultParameters, $parameters);
}
$url = $this->url . $path;

View file

@ -48,8 +48,7 @@ require_once dirname(__FILE__) . '/bootstrap.php';
class RetailCRM extends Module
{
const VERSION = '3.6.11';
const VERSION = '3.6.12';
const API_URL = 'RETAILCRM_ADDRESS';
const API_KEY = 'RETAILCRM_API_TOKEN';
const DELIVERY = 'RETAILCRM_API_DELIVERY';