Second upload
This commit is contained in:
parent
ae9fad7e14
commit
3d5daadbbe
@ -39,7 +39,7 @@ public class ParkingService : BackgroundService
|
|||||||
var _context = scope.ServiceProvider.GetRequiredService<SqlContext>();
|
var _context = scope.ServiceProvider.GetRequiredService<SqlContext>();
|
||||||
|
|
||||||
var now = DateTime.Now;
|
var now = DateTime.Now;
|
||||||
var startTime = now.AddHours(-12); // 獲取最近 12 小時進入的車輛
|
var startTime = now.AddHours(-15); // 獲取最近 15 小時進入的車輛
|
||||||
var inCars = await _context.yuntech_in_car_table
|
var inCars = await _context.yuntech_in_car_table
|
||||||
.Where(car => car.in_time >= startTime)
|
.Where(car => car.in_time >= startTime)
|
||||||
.ToListAsync(stoppingToken);
|
.ToListAsync(stoppingToken);
|
||||||
@ -69,10 +69,22 @@ public class ParkingService : BackgroundService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
if (temporarycar % 2 == 1)
|
||||||
{
|
{
|
||||||
temporarycar++;
|
temporarycar++;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
temporarycar--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//絕對值
|
||||||
|
monthlycar = Math.Abs(monthlycar);
|
||||||
|
temporarycar = Math.Abs(temporarycar);
|
||||||
|
|
||||||
_logger.LogInformation($"月租車位數量: {monthlycar}");
|
_logger.LogInformation($"月租車位數量: {monthlycar}");
|
||||||
_logger.LogInformation($"臨停車位數量: {temporarycar}");
|
_logger.LogInformation($"臨停車位數量: {temporarycar}");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user