Second upload

This commit is contained in:
qi_0527 2024-10-25 03:25:06 +08:00
parent ae9fad7e14
commit 3d5daadbbe

View File

@ -39,7 +39,7 @@ public class ParkingService : BackgroundService
var _context = scope.ServiceProvider.GetRequiredService<SqlContext>();
var now = DateTime.Now;
var startTime = now.AddHours(-12); // 獲取最近 12 小時進入的車輛
var startTime = now.AddHours(-15); // 獲取最近 15 小時進入的車輛
var inCars = await _context.yuntech_in_car_table
.Where(car => car.in_time >= startTime)
.ToListAsync(stoppingToken);
@ -70,9 +70,21 @@ public class ParkingService : BackgroundService
}
else
{
temporarycar++;
if (temporarycar % 2 == 1)
{
temporarycar++;
}
else
{
temporarycar--;
}
}
}
//絕對值
monthlycar = Math.Abs(monthlycar);
temporarycar = Math.Abs(temporarycar);
_logger.LogInformation($"月租車位數量: {monthlycar}");
_logger.LogInformation($"臨停車位數量: {temporarycar}");