diff --git a/apps/base/models.py b/apps/base/models.py index 5a5d99dde..61fe96bec 100644 --- a/apps/base/models.py +++ b/apps/base/models.py @@ -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