This commit is contained in:
ekazak
2022-06-17 15:55:04 +03:00
parent 2eaad2ba79
commit 6d11d006ec
3 changed files with 8 additions and 4 deletions

1
.gitignore vendored
View File

@@ -28,5 +28,6 @@ htdocs/wp-content/themes/*
!htdocs/wp-content/themes/index.php
!htdocs/wp-content/plugins/wp-rest-api-event
!htdocs/wp-content/plugins/subscribe-to-lc
vendor/

View File

@@ -11,3 +11,4 @@ define('LAWCARTA_SUBDOMAIN', 'app');
define('LAWCARTA_PORT', '');
define('LAWCARTA_WP_REST_API_URL', 'http://app.livecarta.loc/v1');
define('LAWCARTA_WP_REST_API_EVENT_LOG_URL', 'http://app.livecarta.loc/v1/event/add');

View File

@@ -59,10 +59,12 @@ class HttpClient
]);
$sysLogId = null;
/** @var \WP_HTTP_Requests_Response $httpResponse */
$httpResponse = $response['http_response'];
if ($httpResponse->get_status() == 200) {
$body = isset($response['body']) ? json_decode($response['body'], true) : null;
$sysLogId = $body['sysLogId'] ?? null;
if(!empty($response['http_response'])){
$httpResponse = $response['http_response'];
if ($httpResponse->get_status() == 200) {
$body = isset($response['body']) ? json_decode($response['body'], true) : null;
$sysLogId = $body['sysLogId'] ?? null;
}
}
return $sysLogId;