From b0ec75ae565328050c38ad9949e67f83ef60cac9 Mon Sep 17 00:00:00 2001 From: jjstyle Date: Wed, 8 Apr 2026 20:13:25 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8A=B8=EB=9E=9C=EC=A0=9D=EC=85=98=20?= =?UTF-8?q?=EC=8B=A4=ED=8C=A8=EC=8B=9C=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/Handlers/TypeSHandler.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/app/Services/Handlers/TypeSHandler.php b/app/Services/Handlers/TypeSHandler.php index 52f2292..9493fb9 100644 --- a/app/Services/Handlers/TypeSHandler.php +++ b/app/Services/Handlers/TypeSHandler.php @@ -39,17 +39,26 @@ class TypeSHandler public function handle(string $articleNumber, array $rawData, array $payload): int { CLI::write(CLI::color('🟒 Type S 처리 μ‹œμž‘ :: ' . $articleNumber, 'green')); - + + // CI νŠΈλžœμž­μ…˜ strict λͺ¨λ“œμ—μ„œλŠ” 이전 μ‹€νŒ¨ μƒνƒœκ°€ λˆ„μ λ  수 μžˆμœΌλ―€λ‘œ μ‹œμž‘ 전에 μ΄ˆκΈ°ν™” + if (method_exists($this->db, 'resetTransStatus')) { + $this->db->resetTransStatus(); + } + $this->db->transBegin(); try { // 1. Receipt 데이터 μ €μž₯ $receiptData = $this->parameterMapper->mapReceipt($articleNumber, $rawData, $payload); - + write_custom_log("Result Insert 데이터: " . json_encode($receiptData, JSON_UNESCAPED_UNICODE), 'INFO', 'service'); if (!$this->receiptModel->insert($receiptData)) { + $lastQuery = (string)$this->receiptModel->getLastQuery(); + $errors = json_encode($this->receiptModel->errors()); + write_custom_log("Receipt Insert μ‹€νŒ¨ | SQL: $lastQuery | Errors: $errors", 'ERROR', 'service'); throw new Exception("Receipt Insert μ‹€νŒ¨: " . json_encode($this->receiptModel->errors())); } $rcptSq = $this->receiptModel->getInsertID(); + $receiptInsertSql = (string)$this->receiptModel->getLastQuery(); // Receipt SQL 캑처 CLI::write(CLI::color("βœ… Receipt μ €μž₯ 성곡 (ID: $rcptSq)", 'blue')); @@ -71,7 +80,16 @@ class TypeSHandler // 3. νŠΈλžœμž­μ…˜ 컀밋 $this->db->transComplete(); if ($this->db->transStatus() === false) { - write_custom_log("Type S DB νŠΈλžœμž­μ…˜ μ΅œμ’… μ‹€νŒ¨", 'ERROR', 'service'); + $dbError = $this->db->error(); + $errorJson = json_encode($dbError, JSON_UNESCAPED_UNICODE); + $receiptLastQuery = (string)$this->receiptModel->getLastQuery(); + $resultLastQuery = (string)$this->resultModel->getLastQuery(); + + write_custom_log( + "Type S DB νŠΈλžœμž­μ…˜ μ΅œμ’… μ‹€νŒ¨ | DB Error: {$errorJson} | ReceiptLastQuery: {$receiptLastQuery} | ResultLastQuery: {$resultLastQuery}", + 'ERROR', + 'service' + ); throw new Exception("Type S DB νŠΈλžœμž­μ…˜ μ΅œμ’… μ‹€νŒ¨"); }