fix: 按时间过期问题

This commit is contained in:
lan
2024-01-11 17:27:30 +08:00
parent ec0f4c0829
commit c6e0d3282a
+3 -1
View File
@@ -28,8 +28,10 @@ class FileCodes(Model):
created_at: Optional[datetime] = fields.DatetimeField(auto_now_add=True, description='创建时间')
async def is_expired(self):
if self.expired_at and (self.expired_count == -1 or self.expired_count > 0):
# 按时间
if self.expired_at and self.expired_count < 0:
return self.expired_at < await get_now()
# 按次数
else:
return self.expired_count != -1 and self.expired_count == 0