From 5c9aa649abae23e4b080db40900af885fc4473c7 Mon Sep 17 00:00:00 2001 From: marina Date: Tue, 13 Aug 2024 10:30:23 +0300 Subject: [PATCH] =?utf8?q?ERP-85=20=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7?= =?utf8?q?=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D0=BE=D0=B1=D0=BC=D0=B5=D0=BD?= =?utf8?q?=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D1=81=201=D0=A1=20?= =?utf8?q?=D0=91=D1=83=D1=85=D0=B3=D0=B0=D0=BB=D1=82=D0=B5=D1=80=D0=B8?= =?utf8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/api2/controllers/DataBuhController.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/erp24/api2/controllers/DataBuhController.php b/erp24/api2/controllers/DataBuhController.php index df2ff81a..27525f7b 100644 --- a/erp24/api2/controllers/DataBuhController.php +++ b/erp24/api2/controllers/DataBuhController.php @@ -10,6 +10,11 @@ use yii_app\records\ApiCronBuh; class DataBuhController extends BaseController { + const OUT_DIR = +// __DIR__ . "/../json"; + "/var/www/erp24/api2/json"; +// "/var/www/www-root/data/www/api.bazacvetov24.ru/data/json"; + public function actionRequest() { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; @@ -58,7 +63,6 @@ class DataBuhController extends BaseController public function actionUpload() { set_time_limit(600); Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; - $request = Yii::$app->request->getRawBody(); try { @@ -67,6 +71,16 @@ class DataBuhController extends BaseController return $this->asJson(['error' => ['code' => 400, 'message' => 'Json body invalid']]); } + $result['ver'] = $result['ver'] ?? ''; + + file_put_contents(self::OUT_DIR . '/a1_request_buh.json', PHP_EOL . date('Y-m-d H:i:s') . ' ' . $result["ver"], FILE_APPEND | LOCK_EX); + + if (empty($result['ver']) || round($result['ver'], 2) < 1.1) { + file_put_contents(self::OUT_DIR . '/request_exit_buh.json', PHP_EOL . $result["ver"], FILE_APPEND | LOCK_EX); + + return $this->asJson(["error_id" => 1, "error" => "minimal version is 1.1"]); + } + $requestId = ''; if (!empty($result["request_id"])) { $requestId = $result["request_id"]; -- 2.39.5