✨ 新增回收站审计与八位取件码

This commit is contained in:
orion committed 2026-08-07 10:28:22 +08:00
1 parent c25c495657
commit 4ee06e2d29
15 files changed
+534 -132

No files matched your search

+11 -14
View File
@@ -8,29 +8,26 @@ import hmac
import os
import re
import secrets
import string
import time
from core.settings import settings
async def get_random_num():
"""
获取随机数
:return:
"""
return secrets.randbelow(90000) + 10000
async def get_random_num(length: int = 8):
"""返回指定长度的纯数字取件码。"""
normalized_length = max(1, int(length or 8))
lower = 10 ** (normalized_length - 1)
return str(secrets.randbelow(9 * lower) + lower)
r_s = string.ascii_uppercase + string.digits
# 排除 0/O、1/I/L,避免人工输入取件码时混淆。
r_s = "ABCDEFGHJKMNPQRSTUVWXYZ23456789"
async def get_random_string():
"""
获取随机字符串
:return:
"""
return "".join(secrets.choice(r_s) for _ in range(5))
async def get_random_string(length: int = 8):
"""返回指定长度、无易混淆字符的取件码。"""
normalized_length = max(1, int(length or 8))
return "".join(secrets.choice(r_s) for _ in range(normalized_length))
async def get_now():