|
|
@@ -259,9 +259,11 @@ class Deli extends ResourceController
|
|
|
$db->transBegin();
|
|
|
$updatedCount = 0;
|
|
|
$errors = [];
|
|
|
+ $debugLogs = []; // 디버깅 로그 수집용
|
|
|
|
|
|
try {
|
|
|
log_message('info', '벤더 배송정보 업데이트 요청: ' . json_encode($request));
|
|
|
+ $debugLogs[] = '벤더 배송정보 업데이트 요청: ' . json_encode($request);
|
|
|
|
|
|
foreach ($deliveryUpdates as $update) {
|
|
|
$buyerName = $update['buyerName'] ?? '';
|
|
|
@@ -269,7 +271,9 @@ class Deli extends ResourceController
|
|
|
$deliComp = $update['deliComp'] ?? '';
|
|
|
$deliNumb = $update['deliNumb'] ?? '';
|
|
|
|
|
|
- log_message('info', "배송정보 업데이트 시도: {$buyerName}({$phone}) - 배송업체: {$deliComp}, 송장번호: {$deliNumb}");
|
|
|
+ $logMessage = "배송정보 업데이트 시도: {$buyerName}({$phone}) - 배송업체: {$deliComp}, 송장번호: {$deliNumb}";
|
|
|
+ log_message('info', $logMessage);
|
|
|
+ $debugLogs[] = $logMessage;
|
|
|
|
|
|
if (!$buyerName || !$phone) {
|
|
|
$errors[] = "구매자명과 연락처는 필수입니다.";
|
|
|
@@ -303,20 +307,41 @@ class Deli extends ResourceController
|
|
|
->get()
|
|
|
->getRowArray();
|
|
|
|
|
|
- log_message('info', '업데이트 조건: ITEM_SEQ=' . $itemSeq . ', BUYER_NAME=' . $buyerName . ', PHONE=' . $phone);
|
|
|
- log_message('info', '기존 주문 존재 여부: ' . ($existingOrder ? 'YES' : 'NO'));
|
|
|
+ $conditionLog = '업데이트 조건: ITEM_SEQ=' . $itemSeq . ', BUYER_NAME=' . $buyerName . ', PHONE=' . $phone;
|
|
|
+ log_message('info', $conditionLog);
|
|
|
+ $debugLogs[] = $conditionLog;
|
|
|
+
|
|
|
+ $existsLog = '기존 주문 존재 여부: ' . ($existingOrder ? 'YES' : 'NO');
|
|
|
+ log_message('info', $existsLog);
|
|
|
+ $debugLogs[] = $existsLog;
|
|
|
+
|
|
|
if ($existingOrder) {
|
|
|
- log_message('info', '기존 주문 데이터: ' . json_encode($existingOrder));
|
|
|
+ $existingLog = '기존 주문 데이터: ' . json_encode($existingOrder);
|
|
|
+ log_message('info', $existingLog);
|
|
|
+ $debugLogs[] = $existingLog;
|
|
|
}
|
|
|
- log_message('info', '업데이트 데이터: ' . json_encode($updateData));
|
|
|
|
|
|
- $result = $db->table('ITEM_ORDER_LIST')
|
|
|
+ $updateLog = '업데이트 데이터: ' . json_encode($updateData);
|
|
|
+ log_message('info', $updateLog);
|
|
|
+ $debugLogs[] = $updateLog;
|
|
|
+
|
|
|
+ // SQL 쿼리 로깅을 위해 쿼리 빌더 분리
|
|
|
+ $builder = $db->table('ITEM_ORDER_LIST')
|
|
|
->where('ITEM_SEQ', $itemSeq)
|
|
|
->where('BUYER_NAME', $buyerName)
|
|
|
- ->where('PHONE', $phone)
|
|
|
- ->update($updateData);
|
|
|
+ ->where('PHONE', $phone);
|
|
|
+
|
|
|
+ // 실행될 SQL 쿼리 로그
|
|
|
+ $sql = $builder->getCompiledUpdate($updateData);
|
|
|
+ $sqlLog = '실행될 SQL 쿼리: ' . $sql;
|
|
|
+ log_message('info', $sqlLog);
|
|
|
+ $debugLogs[] = $sqlLog;
|
|
|
+
|
|
|
+ $result = $builder->update($updateData);
|
|
|
|
|
|
- log_message('info', '업데이트 결과: ' . ($result ? 'SUCCESS' : 'FAILED') . ' (affected rows: ' . $result . ')');
|
|
|
+ $resultLog = '업데이트 결과: ' . ($result ? 'SUCCESS' : 'FAILED') . ' (affected rows: ' . $result . ')';
|
|
|
+ log_message('info', $resultLog);
|
|
|
+ $debugLogs[] = $resultLog;
|
|
|
|
|
|
if ($result) {
|
|
|
$updatedCount++;
|