lot_manager/delete_lot_data_3_days.py

18 lines
443 B
Python
Raw Normal View History

2023-12-11 17:47:45 +08:00
# 删除lot_data.db 保留三天的数据
import datetime
from db.repository import delete_kb_detail_by_time
def delete_data_3_days_ago():
try:
# 计算3天前的日期并转化为数据库格式
end_time = int((datetime.datetime.now() - datetime.timedelta(days=3)).timestamp())
2023-12-11 17:48:09 +08:00
delete_kb_detail_by_time(end_time)
2023-12-11 17:47:45 +08:00
except Exception as e:
pass
if __name__ == '__main__':
delete_data_3_days_ago()