From baa34206be0a76c6c5450b9d44f1da6c5f1e393a Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Sat, 27 Apr 2024 16:23:55 +0300 Subject: [PATCH] amo get token --- erp24/api1/actions/cron/CallbackAction.php | 12 ++++++++++++ erp24/api1/controllers/CronController.php | 1 + erp24/api1/views/cron/callback.php | 1 + erp24/api1/views/cron/get-token.php | 6 +++--- erp24/inc/amo/amo_inc.php | 0 erp24/inc/amo/amo_sync_crm.php | 0 erp24/inc/amo/callback.php | 0 erp24/inc/amo/get_token.php | 0 8 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 erp24/api1/actions/cron/CallbackAction.php create mode 100644 erp24/api1/views/cron/callback.php mode change 100644 => 100755 erp24/inc/amo/amo_inc.php mode change 100644 => 100755 erp24/inc/amo/amo_sync_crm.php mode change 100644 => 100755 erp24/inc/amo/callback.php mode change 100644 => 100755 erp24/inc/amo/get_token.php diff --git a/erp24/api1/actions/cron/CallbackAction.php b/erp24/api1/actions/cron/CallbackAction.php new file mode 100644 index 00000000..0fc0d302 --- /dev/null +++ b/erp24/api1/actions/cron/CallbackAction.php @@ -0,0 +1,12 @@ +controller->renderPartial('callback'); + } +} \ No newline at end of file diff --git a/erp24/api1/controllers/CronController.php b/erp24/api1/controllers/CronController.php index daad9bba..12276c03 100644 --- a/erp24/api1/controllers/CronController.php +++ b/erp24/api1/controllers/CronController.php @@ -22,6 +22,7 @@ class CronController extends BaseController 'bonus-users-sale-update' => \app\actions\cron\BonusUsersSaleUpdateAction::class, // '1c-check-1day' => \app\actions\cron\OneCCheckOneDayAction::class, 'get-token' => \app\actions\cron\GetTokenAction::class, + 'callback' => \app\actions\cron\CallbackAction::class, ]; } } diff --git a/erp24/api1/views/cron/callback.php b/erp24/api1/views/cron/callback.php new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/erp24/api1/views/cron/callback.php @@ -0,0 +1 @@ + diff --git a/erp24/api1/views/cron/get-token.php b/erp24/api1/views/cron/get-token.php index 5f9fd706..eee6abd4 100644 --- a/erp24/api1/views/cron/get-token.php +++ b/erp24/api1/views/cron/get-token.php @@ -40,7 +40,7 @@ if (SECRET_PHRASE != $_GET['secret_phrase']) { exit('Incorrect secret phrase'); } -chmod(SECRET_FILE, 0740); +chmod(__DIR__ . "/../../../inc/amo/" . SECRET_FILE, 0740); if (!empty($_GET['grant_type']) && $_GET['grant_type'] == 'refresh_token') { @@ -48,7 +48,7 @@ if (!empty($_GET['grant_type']) && $_GET['grant_type'] == 'refresh_token') { $method = 'refresh_token'; - $values = json_decode(file_get_contents(SECRET_FILE), true); + $values = json_decode(file_get_contents(__DIR__ . "/../../../inc/amo/" . SECRET_FILE), true); $value = $values['refresh_token']; @@ -106,7 +106,7 @@ $arr_token['expires'] = time() + $arr_token['expires_in']; $response = json_encode($arr_token, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); -var_dump(file_put_contents(SECRET_FILE, $response)); +var_dump(file_put_contents(__DIR__ . "/../../../inc/amo/" . SECRET_FILE, $response)); diff --git a/erp24/inc/amo/amo_inc.php b/erp24/inc/amo/amo_inc.php old mode 100644 new mode 100755 diff --git a/erp24/inc/amo/amo_sync_crm.php b/erp24/inc/amo/amo_sync_crm.php old mode 100644 new mode 100755 diff --git a/erp24/inc/amo/callback.php b/erp24/inc/amo/callback.php old mode 100644 new mode 100755 diff --git a/erp24/inc/amo/get_token.php b/erp24/inc/amo/get_token.php old mode 100644 new mode 100755 -- 2.39.5