]> gitweb.erp-flowers.ru Git - yii-erp24/.git/commitdiff
amo get token
authorAlexander Smirnov <fredeom@mail.ru>
Sat, 27 Apr 2024 13:23:55 +0000 (16:23 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Sat, 27 Apr 2024 13:23:55 +0000 (16:23 +0300)
erp24/api1/actions/cron/CallbackAction.php [new file with mode: 0644]
erp24/api1/controllers/CronController.php
erp24/api1/views/cron/callback.php [new file with mode: 0644]
erp24/api1/views/cron/get-token.php
erp24/inc/amo/amo_inc.php [changed mode: 0644->0755]
erp24/inc/amo/amo_sync_crm.php [changed mode: 0644->0755]
erp24/inc/amo/callback.php [changed mode: 0644->0755]
erp24/inc/amo/get_token.php [changed mode: 0644->0755]

diff --git a/erp24/api1/actions/cron/CallbackAction.php b/erp24/api1/actions/cron/CallbackAction.php
new file mode 100644 (file)
index 0000000..0fc0d30
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+namespace app\actions\cron;
+
+use yii\base\Action;
+
+class CallbackAction extends Action
+{
+    public function run() {
+        return $this->controller->renderPartial('callback');
+    }
+}
\ No newline at end of file
index daad9bba2ba6630b4ed11647dbf901a156c4de5d..12276c038ac09f82d09d646ad52fc58617fd2295 100644 (file)
@@ -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 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
index 5f9fd7069dc441b50854459a7cff583d44a3fcc8..eee6abd4a794f541e44db8f86b82d9088d3586f0 100644 (file)
@@ -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));
 
 
 
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)