- [ORDER] Ghost 체크 로직 버그 수정.
This commit is contained in:
Hyojin Ahn 2026-04-20 13:16:41 -04:00
parent a97777385c
commit 000efdd4d4
1 changed files with 11 additions and 7 deletions

View File

@ -656,7 +656,8 @@ class DailyService extends CONF {
$ordertype = $after['d_ordertype'] ?? 'N'; $ordertype = $after['d_ordertype'] ?? 'N';
$orderdate = $after['d_orderdate'] ?? ''; $orderdate = $after['d_orderdate'] ?? '';
$visitdate = $after['d_visitdate'] ?? ''; $visitdate = $after['d_visitdate'] ?? '';
$quantity = (int)($after['d_quantity'] ?? 0); $thisQuantity= (int)($after['d_quantity'] ?? 0);
$lastQuantity= (int)($after['d_lastpickupquantity'] ?? 0);
$paystatus = $after['d_paystatus'] ?? ''; $paystatus = $after['d_paystatus'] ?? '';
$paymenttype = $after['d_paymenttype'] ?? ''; $paymenttype = $after['d_paymenttype'] ?? '';
@ -665,11 +666,11 @@ class DailyService extends CONF {
// -------------------------------------------------- // --------------------------------------------------
// 0) Ghost Check // 0) Ghost Check
// -------------------------------------------------- // --------------------------------------------------
if ($quantity < 10 && $isTop !== 'G') { if ($thisQuantity < 10 && $lastQuantity < 10 && $isTop !== 'G') {
$updateFields[] = "c_is_top = 'G'"; $updateFields[] = "c_is_top = 'G'";
} }
if ($isTop === 'G' && $quantity >= 10) { if ($isTop === 'G' && $thisQuantity >= 10) {
$updateFields[] = "c_is_top = ''"; $updateFields[] = "c_is_top = ''";
} }
@ -1054,7 +1055,7 @@ class DailyService extends CONF {
$connect = $GLOBALS['conn']; $connect = $GLOBALS['conn'];
$res = mysqli_query($connect, " $res = mysqli_query($connect, "
SELECT d_quantity SELECT d_quantity, d_lastpickupquantity
FROM tbl_daily FROM tbl_daily
WHERE d_customeruid = '{$customerUid}' WHERE d_customeruid = '{$customerUid}'
AND d_status = 'F' AND d_status = 'F'
@ -1065,18 +1066,20 @@ class DailyService extends CONF {
$row = mysqli_fetch_assoc($res); $row = mysqli_fetch_assoc($res);
if (!$row) { if (!$row) {
// 데이터 없으면 ghost 해제 // 데이터 없으면 ghost 였던 것 해제
mysqli_query($connect, " mysqli_query($connect, "
UPDATE tbl_customer UPDATE tbl_customer
SET c_is_top = '' SET c_is_top = ''
WHERE c_uid = '{$customerUid}' WHERE c_uid = '{$customerUid}'
and c_is_top = 'G'
"); ");
return; return;
} }
$qty = (int)$row['d_quantity']; $thisQuantity = (int)$row['d_quantity'];
$lastQuantity = (int)$row['d_lastpickupquantity'];
if ($qty < 10) { if ($thisQuantity < 10 && $lastQuantity < 10) {
mysqli_query($connect, " mysqli_query($connect, "
UPDATE tbl_customer UPDATE tbl_customer
SET c_is_top = 'G' SET c_is_top = 'G'
@ -1087,6 +1090,7 @@ class DailyService extends CONF {
UPDATE tbl_customer UPDATE tbl_customer
SET c_is_top = '' SET c_is_top = ''
WHERE c_uid = '{$customerUid}' WHERE c_uid = '{$customerUid}'
and c_is_top = 'G'
"); ");
} }
} }