fix: 按时间过期问题
This commit is contained in:
1 parent
ec0f4c0829
commit
c6e0d3282a
1 file changed
+3
-1
+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