]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
отладка пути
authorAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Fri, 28 Mar 2025 08:27:49 +0000 (11:27 +0300)
committerAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Fri, 28 Mar 2025 08:27:49 +0000 (11:27 +0300)
erp24/media/controllers/NotificationController.php

index 3b9cf8e3e90490ad2c88fa13faa5fb3700e0cf90..65c5e94e182150247a9061d8372f8d6a3cac9ab7 100644 (file)
@@ -27,6 +27,11 @@ class NotificationController extends Controller
         //"/www/media/notification";
         "/var/www/erp24/media/notification";
 
+    private static function getPathNotification()
+    {
+        return self::getPath() . "/notification";
+    }
+
     private static function getPath()
     {
         return dirname(__DIR__, 1);
@@ -90,11 +95,11 @@ class NotificationController extends Controller
         */
 
         $rawBody = Yii::$app->request->getRawBody();
-        if (!is_dir(self::OUT_DIR)) {
-            mkdir(self::OUT_DIR, 0777, true);
+        if (!is_dir(self::getPathNotification())) {
+            mkdir(self::getPathNotification(), 0777, true);
         }
         file_put_contents(
-            self::OUT_DIR . '/notifications.txt',
+            self::getPathNotification() . '/notifications.txt',
             PHP_EOL . date('Y-m-d H:i:s') . ' ' . $rawBody,
             FILE_APPEND
         );
@@ -104,7 +109,7 @@ class NotificationController extends Controller
             Yii::error("Ошибка декодирования JSON: " . $e->getMessage());
             Yii::$app->response->statusCode = 400;
             file_put_contents(
-                self::getPath() . '/notification_error.txt',
+                self::getPathNotification() . '/notification_error.txt',
                 PHP_EOL . date("d.m.Y H:i:s", time()) . " " . $e->getMessage() . $e->getLine(),
                 FILE_APPEND
             );
@@ -323,7 +328,7 @@ class NotificationController extends Controller
                         } catch (\Exception $e) {
                             Yii::$app->response->statusCode = 400;
                             file_put_contents(
-                                self::OUT_DIR . '/notification_error.txt',
+                                self::getPathNotification() . '/notification_error.txt',
                                 PHP_EOL . date("d.m.Y H:i:s", time()) . $e->getMessage() . $e->getLine(),
                                 FILE_APPEND
                             );
@@ -382,7 +387,7 @@ class NotificationController extends Controller
                 default:
                     Yii::info("Неизвестный тип события: {$eventType}");
                     file_put_contents(
-                        self::OUT_DIR . '/notification_error.txt',
+                        self::getPathNotification() . '/notification_error.txt',
                         PHP_EOL . date("d.m.Y H:i:s", time()) . " Неизвестный тип события: {$eventType}",
                         FILE_APPEND
                     );
@@ -394,7 +399,7 @@ class NotificationController extends Controller
         } catch (\Exception $e) {
             Yii::error("Error processing event {$eventType}: " . $e->getMessage());
             file_put_contents(
-                self::OUT_DIR . '/notification_error.txt',
+                self::getPathNotification() . '/notification_error.txt',
                 PHP_EOL . date("d.m.Y H:i:s", time()) . $e->getMessage() . $e->getLine(),
                 FILE_APPEND
             );