fix(pickup): remove mocked fine-slot reservation preview
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 43s

This commit is contained in:
2026-02-19 18:21:06 +08:00
parent 7ecf069efd
commit 787ebe6b73

View File

@@ -390,6 +390,7 @@ public sealed class StorePickupController(
int minAdvanceHours)
{
var now = DateTime.Now;
var normalizedCapacity = Math.Max(0, slotCapacity);
var results = new List<PickupPreviewSlotDto>();
for (var minutes = startMinutes; minutes <= endMinutes; minutes += intervalMinutes)
{
@@ -397,18 +398,8 @@ public sealed class StorePickupController(
var slotMinute = minutes % 60;
var slotTime = new TimeSpan(slotHour, slotMinute, 0);
var slotDateTime = date.Date.Add(slotTime);
var hash = GetStableHash($"{StoreApiHelpers.ToDateOnly(date)}|{slotHour:00}:{slotMinute:00}");
var booked = hash % (slotCapacity + 1);
if (hash % 7 == 0)
{
booked = slotCapacity;
}
else if (hash % 5 == 0)
{
booked = Math.Max(0, slotCapacity - 1);
}
var remaining = Math.Max(0, slotCapacity - booked);
// 当前阶段仅做规则预览,不再伪造预约占用数据。
var remaining = normalizedCapacity;
var status = slotDateTime <= now.AddHours(minAdvanceHours)
? "expired"
: remaining == 0
@@ -428,17 +419,6 @@ public sealed class StorePickupController(
return results;
}
private static int GetStableHash(string value)
{
var hash = 0;
foreach (var ch in value)
{
hash = (hash * 31 + ch) & int.MaxValue;
}
return hash;
}
private static string GetWeekdayLabel(int dayOfWeek)
{
return dayOfWeek switch