修改订单号规则,增加支付统计列表用户信息展示

This commit is contained in:
2026-06-11 14:26:56 +08:00
parent 28232e62a7
commit debc09877d
4 changed files with 16 additions and 8 deletions
+9 -4
View File
@@ -1,5 +1,7 @@
import time
import random
from datetime import datetime
import uuid
def generate_id() -> str:
@@ -10,7 +12,10 @@ def generate_id() -> str:
def generate_order_no() -> str:
"""Generate a human-readable order number."""
timestamp = int(time.time())
randomness = random.randint(1000, 9999)
return f"VG{timestamp}{randomness}"
"""Generate a human-readable order number with yyyymmddhhmmss format."""
# 格式化为 yyyymmddhhmmss 格式的时间戳
now = datetime.now()
timestamp = now.strftime("%Y%m%d%H%M%S")
# 使用 UUID 的部分值来生成更可靠的随机数,防止并发冲突
random_part = uuid.uuid4().hex[:8].upper()
return f"MZZC{timestamp}{random_part}"