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