fix: 按时间过期问题
This commit is contained in:
+3
-1
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user