Merge pull request #77 from iyzoer/v2.2

Fix session for api methods
This commit is contained in:
Alex Lushpai 2018-02-28 17:27:25 +03:00 committed by GitHub
commit 43656e4004
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 6 deletions

View File

@ -1,3 +1,7 @@
## v.2.0.4
* Улучшена механика выгрузки изменений из RetailCRM
* Улучшена механика выборки и настройки способов доставки
## v.2.0.3 ## v.2.0.3
* Улучшена механика выгрузки изменений из RetailCRM * Улучшена механика выгрузки изменений из RetailCRM
* Улучшена механика выборки и настройки способов доставки * Улучшена механика выборки и настройки способов доставки

View File

@ -124,17 +124,17 @@ class ControllerApiRetailcrm extends Controller
private function auth() private function auth()
{ {
if (version_compare(VERSION, '2.1.0', '>=')) { if (version_compare(VERSION, '2.1.0', '>=')) {
if (!isset($this->request->get['token']) if (!isset($this->request->get['key'])
|| !$this->request->get['token'] || !$this->request->get['key']
) { ) {
return array('error' => 'Not found api key'); return array('error' => 'Not found api key');
} }
if (isset($this->request->get['token']) if (isset($this->request->get['key'])
&& !empty($this->request->get['token']) && !empty($this->request->get['key'])
) { ) {
$this->load->model('account/api'); $this->load->model('account/api');
$api = $this->model_account_api->getApiByKey($this->request->get['token']); $api = $this->model_account_api->getApiByKey($this->request->get['key']);
if (!empty($api)) { if (!empty($api)) {
return $api; return $api;

View File

@ -44,7 +44,7 @@ class OpencartApiClient {
$opencartStoreInfo = $this->model_setting_store->getStore($this->opencartStoreId); $opencartStoreInfo = $this->model_setting_store->getStore($this->opencartStoreId);
if (version_compare(VERSION, '2.1.0', '>=') && !empty($this->apiToken)) { if (version_compare(VERSION, '2.1.0', '>=') && !empty($this->apiToken)) {
$getParams['token'] = $this->apiToken; $getParams['key'] = $this->apiToken;
} elseif (is_array($this->apiToken) && isset($this->apiToken['username'])) { } elseif (is_array($this->apiToken) && isset($this->apiToken['username'])) {
$getParams = $this->apiToken; $getParams = $this->apiToken;
} }