56 lines
1.2 KiB
Python
56 lines
1.2 KiB
Python
|
|
#!/usr/bin/env python3
|
||
|
|
# -*- coding: utf-8 -*-
|
||
|
|
"""
|
||
|
|
测试生成日报后 file_path 是否正确保存
|
||
|
|
"""
|
||
|
|
import sys
|
||
|
|
sys.path.insert(0, '/workspace/projects')
|
||
|
|
|
||
|
|
import pymysql
|
||
|
|
|
||
|
|
# 数据库连接
|
||
|
|
conn = pymysql.connect(
|
||
|
|
host='haoslm2.xicp.net',
|
||
|
|
port=10216,
|
||
|
|
user='root',
|
||
|
|
password='DsideaL147258369',
|
||
|
|
database='yltcharge',
|
||
|
|
charset='utf8mb4'
|
||
|
|
)
|
||
|
|
|
||
|
|
cursor = conn.cursor()
|
||
|
|
|
||
|
|
print("=" * 60)
|
||
|
|
print("测试生成日报后 file_path 保存情况")
|
||
|
|
print("=" * 60)
|
||
|
|
|
||
|
|
# 查询最近的历史记录
|
||
|
|
cursor.execute("""
|
||
|
|
SELECT id, report_date, split_name, file_path, status, create_time
|
||
|
|
FROM t_daily_report_history
|
||
|
|
ORDER BY create_time DESC
|
||
|
|
LIMIT 5
|
||
|
|
""")
|
||
|
|
|
||
|
|
rows = cursor.fetchall()
|
||
|
|
|
||
|
|
print(f"\n最近 {len(rows)} 条历史记录:\n")
|
||
|
|
|
||
|
|
for row in rows:
|
||
|
|
id, report_date, split_name, file_path, status, create_time = row
|
||
|
|
print(f"ID: {id}")
|
||
|
|
print(f" 日期: {report_date}")
|
||
|
|
print(f" 名称: {split_name}")
|
||
|
|
print(f" file_path: {file_path}")
|
||
|
|
print(f" file_path类型: {type(file_path)}")
|
||
|
|
print(f" status: {status}")
|
||
|
|
print(f" 创建时间: {create_time}")
|
||
|
|
print()
|
||
|
|
|
||
|
|
cursor.close()
|
||
|
|
conn.close()
|
||
|
|
|
||
|
|
print("=" * 60)
|
||
|
|
print("测试完成")
|
||
|
|
print("=" * 60)
|