(
code: str, check: bool = True
)
| 198 | |
| 199 | |
| 200 | async def get_code_file_by_code( |
| 201 | code: str, check: bool = True |
| 202 | ) -> Tuple[bool, Union[FileCodes, str]]: |
| 203 | normalized_code = normalize_share_code(code) |
| 204 | if not normalized_code: |
| 205 | return False, "文件不存在" |
| 206 | file_code = await FileCodes.filter(code=normalized_code).first() |
| 207 | if not file_code: |
| 208 | return False, "文件不存在" |
| 209 | if await file_code.is_expired() and check: |
| 210 | return False, "文件已过期" |
| 211 | return True, file_code |
| 212 | |
| 213 | |
| 214 | async def update_file_usage(file_code: FileCodes) -> None: |
no test coverage detected