32 lines
817 B
Python
32 lines
817 B
Python
|
|
#!/usr/bin/env python
|
||
|
|
# -*- coding: utf-8 -*-
|
||
|
|
import sys
|
||
|
|
sys.path.insert(0, 'ruoyi-fastapi-backend')
|
||
|
|
|
||
|
|
from datetime import datetime
|
||
|
|
from fastapi.encoders import jsonable_encoder
|
||
|
|
|
||
|
|
# 测试 datetime.now()
|
||
|
|
now = datetime.now()
|
||
|
|
print(f"datetime.now(): {now}")
|
||
|
|
print(f"Type: {type(now)}")
|
||
|
|
print(f"Has tzinfo: {now.tzinfo}")
|
||
|
|
|
||
|
|
try:
|
||
|
|
result = jsonable_encoder({'time': now})
|
||
|
|
print(f"[OK] jsonable_encoder: {result}")
|
||
|
|
except Exception as e:
|
||
|
|
import traceback
|
||
|
|
print(f"[ERR] jsonable_encoder: {e}")
|
||
|
|
traceback.print_exc()
|
||
|
|
|
||
|
|
# 测试 ResponseUtil
|
||
|
|
from utils.response_util import ResponseUtil
|
||
|
|
try:
|
||
|
|
response = ResponseUtil.success(data={'test': 'value'})
|
||
|
|
print(f"[OK] ResponseUtil.success")
|
||
|
|
except Exception as e:
|
||
|
|
import traceback
|
||
|
|
print(f"[ERR] ResponseUtil.success: {e}")
|
||
|
|
traceback.print_exc()
|