更新数据截止日2025.12.14

This commit is contained in:
lychang
2025-12-15 11:48:34 +08:00
parent fdfa3300fc
commit f0ee65fc53
5 changed files with 14 additions and 14 deletions

12
app.py
View File

@@ -1,7 +1,4 @@
from datetime import datetime, timedelta
from typing import Any
import requests
from flask import Flask, jsonify, request, render_template
import json
import os
@@ -853,11 +850,12 @@ def create_qa():
answer_ids = data.get('answer', [])
conn = db_manager.get_connection()
cursor = conn.cursor()
index_id = cursor.execute_query(f"SELECT id FROM qa order by id desc limit 1", fetch_all=False)[0]
index_id += 1
cursor.execute('''
INSERT INTO qa (groupId, question, answer, start_time, end_time)
VALUES (?, ?, ?, ?, ?)
''', (group_id, json.dumps(question_ids), json.dumps(answer_ids),
INSERT INTO qa ("id", "groupId", "question", "answer", "start_time", "end_time")
VALUES (?, ?, ?, ?, ?, ?)
''', (index_id, group_id, json.dumps(question_ids), json.dumps(answer_ids),
data.get('start_time', ''), data.get('end_time', '')))
conn.commit()

BIN
db/data

Binary file not shown.

View File

@@ -1,2 +1,3 @@
mammoth
pytz
pytz
flask

View File

@@ -62,7 +62,7 @@ def update_user_group_info():
conn = dm.get_connection()
cursor = conn.cursor()
m = cursor.execute("select id from 'group' where id = name OR name = ''").fetchall()
m = cursor.execute("select id from 'group' where id = name").fetchall()
group_list =[]
for gid in m:
gid = gid[0]
@@ -97,16 +97,16 @@ if __name__ == '__main__':
chat_session = ChatSessionManager(db_manager)
month = 12
day_start = 8
day_end = 9
day_start = 11
day_end = 14
for day in range(day_start, day_end):
for hour in range(17):
for hour in range(24):
chat_session.process_chat_session(2025, month, day, hour)
chat_session.update_qa_data(f"2025-{month}-{day_start:02d} 00:00:00", f"2025-{month}-{day_end:02d} 00:00:00")
# update user group info
update_user_group_info()
# upload db
db_manager.upload_db()
# update user group info
#update_user_group_info()

View File

@@ -19,6 +19,7 @@ class DatabaseManager:
def upload_db(self):
file = self.lfm.get_file("data")
self.obj.upload_file(self.online_db_uri, file)
print("DB upload success")
def download_db(self):
file = self.obj.get_file(self.online_db_uri)