fix(pickup): remove mocked fine-slot reservation preview
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 43s
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 43s
This commit is contained in:
@@ -390,6 +390,7 @@ public sealed class StorePickupController(
|
|||||||
int minAdvanceHours)
|
int minAdvanceHours)
|
||||||
{
|
{
|
||||||
var now = DateTime.Now;
|
var now = DateTime.Now;
|
||||||
|
var normalizedCapacity = Math.Max(0, slotCapacity);
|
||||||
var results = new List<PickupPreviewSlotDto>();
|
var results = new List<PickupPreviewSlotDto>();
|
||||||
for (var minutes = startMinutes; minutes <= endMinutes; minutes += intervalMinutes)
|
for (var minutes = startMinutes; minutes <= endMinutes; minutes += intervalMinutes)
|
||||||
{
|
{
|
||||||
@@ -397,18 +398,8 @@ public sealed class StorePickupController(
|
|||||||
var slotMinute = minutes % 60;
|
var slotMinute = minutes % 60;
|
||||||
var slotTime = new TimeSpan(slotHour, slotMinute, 0);
|
var slotTime = new TimeSpan(slotHour, slotMinute, 0);
|
||||||
var slotDateTime = date.Date.Add(slotTime);
|
var slotDateTime = date.Date.Add(slotTime);
|
||||||
var hash = GetStableHash($"{StoreApiHelpers.ToDateOnly(date)}|{slotHour:00}:{slotMinute:00}");
|
// 当前阶段仅做规则预览,不再伪造预约占用数据。
|
||||||
var booked = hash % (slotCapacity + 1);
|
var remaining = normalizedCapacity;
|
||||||
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 status = slotDateTime <= now.AddHours(minAdvanceHours)
|
var status = slotDateTime <= now.AddHours(minAdvanceHours)
|
||||||
? "expired"
|
? "expired"
|
||||||
: remaining == 0
|
: remaining == 0
|
||||||
@@ -428,17 +419,6 @@ public sealed class StorePickupController(
|
|||||||
return results;
|
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)
|
private static string GetWeekdayLabel(int dayOfWeek)
|
||||||
{
|
{
|
||||||
return dayOfWeek switch
|
return dayOfWeek switch
|
||||||
|
|||||||
Reference in New Issue
Block a user