test/custom-admin-ui #3

Merged
orion merged 673 commits from test/custom-admin-ui into master 2026-06-05 17:20:58 +08:00
Showing only changes of commit 87fb5ae7da - Show all commits
+3 -1
View File
@@ -28,8 +28,10 @@ class FileCodes(Model):
created_at: Optional[datetime] = fields.DatetimeField(auto_now_add=True, description='创建时间') created_at: Optional[datetime] = fields.DatetimeField(auto_now_add=True, description='创建时间')
async def is_expired(self): 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() return self.expired_at < await get_now()
# 按次数
else: else:
return self.expired_count != -1 and self.expired_count == 0 return self.expired_count != -1 and self.expired_count == 0