From 04dd930bfb3a70ab9060c4c8fa0f08d912e55725 Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Fri, 15 Aug 2025 18:03:47 +0300 Subject: [PATCH] =?utf8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D1=81?= =?utf8?q?=D1=82=D0=B0=D1=82=D1=83=D1=81=D0=BE=D0=B2=20=D0=B8=20=D0=BB?= =?utf8?q?=D0=BE=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/api2/controllers/DataController.php | 30 ++++++++++++++--------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/erp24/api2/controllers/DataController.php b/erp24/api2/controllers/DataController.php index 90fa8e7c..fe9a5c83 100644 --- a/erp24/api2/controllers/DataController.php +++ b/erp24/api2/controllers/DataController.php @@ -953,18 +953,24 @@ class DataController extends BaseController // file_put_contents(self::OUT_DIR . '/a2_upload_in.json', PHP_EOL . date('Y-m-d H:i:s') . ' ', FILE_APPEND | LOCK_EX); Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; - $request = Yii::$app->request; - $result = $request->getBodyParams(); - if (empty($result)) { - $raw = $request->getRawBody(); - try { - $result = Json::decode($raw); - } catch (Exception $ex) { - return $this->asJson(['error' => ['code' => 400, 'message' => 'Json body invalid']]); - } - } - + $request = Yii::$app->request->getRawBody(); + $raw = Yii::$app->request->getRawBody(); + $hdrs = Yii::$app->request->headers; + + Yii::warning([ + 'method' => Yii::$app->request->method, + 'contentType' => (string)$hdrs->get('content-type'), + 'contentLength' => (string)$hdrs->get('content-length'), + 'encoding' => (string)$hdrs->get('content-encoding'), + 'rawLen' => strlen($raw), + 'sha1' => sha1($raw), + ], 'upload.debug'); + try { + $result = Json::decode($request); + } catch (Exception $ex) { + return $this->asJson(['error' => ['code' => 400, 'message' => 'Json body invalid']]); + } if (empty($result)) { file_put_contents(self::OUT_DIR . '/error_upload.txt', PHP_EOL . 'result empty', FILE_APPEND); @@ -980,7 +986,7 @@ class DataController extends BaseController } //InfoLogService::setInfoLog(__FILE__, __LINE__, 'upload_' . $fl . '.json' , 'info_id_25_1'); - file_put_contents(self::OUT_DIR . '/upload_' . $fl . '.json', PHP_EOL . $request->getRawBody()); + file_put_contents(self::OUT_DIR . '/upload_' . $fl . '.json', PHP_EOL . $request); try { $mess = []; -- 2.39.5