更新数据截止日2025.12.14
This commit is contained in:
12
app.py
12
app.py
@@ -1,7 +1,4 @@
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
import requests
|
|
||||||
from flask import Flask, jsonify, request, render_template
|
from flask import Flask, jsonify, request, render_template
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
@@ -853,11 +850,12 @@ def create_qa():
|
|||||||
answer_ids = data.get('answer', [])
|
answer_ids = data.get('answer', [])
|
||||||
conn = db_manager.get_connection()
|
conn = db_manager.get_connection()
|
||||||
cursor = conn.cursor()
|
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('''
|
cursor.execute('''
|
||||||
INSERT INTO qa (groupId, question, answer, start_time, end_time)
|
INSERT INTO qa ("id", "groupId", "question", "answer", "start_time", "end_time")
|
||||||
VALUES (?, ?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, ?, ?)
|
||||||
''', (group_id, json.dumps(question_ids), json.dumps(answer_ids),
|
''', (index_id, group_id, json.dumps(question_ids), json.dumps(answer_ids),
|
||||||
data.get('start_time', ''), data.get('end_time', '')))
|
data.get('start_time', ''), data.get('end_time', '')))
|
||||||
|
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
mammoth
|
mammoth
|
||||||
pytz
|
pytz
|
||||||
|
flask
|
||||||
12
script.py
12
script.py
@@ -62,7 +62,7 @@ def update_user_group_info():
|
|||||||
conn = dm.get_connection()
|
conn = dm.get_connection()
|
||||||
cursor = conn.cursor()
|
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 =[]
|
group_list =[]
|
||||||
for gid in m:
|
for gid in m:
|
||||||
gid = gid[0]
|
gid = gid[0]
|
||||||
@@ -97,16 +97,16 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
chat_session = ChatSessionManager(db_manager)
|
chat_session = ChatSessionManager(db_manager)
|
||||||
month = 12
|
month = 12
|
||||||
day_start = 8
|
day_start = 11
|
||||||
day_end = 9
|
day_end = 14
|
||||||
for day in range(day_start, day_end):
|
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.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")
|
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
|
# upload db
|
||||||
|
|
||||||
db_manager.upload_db()
|
db_manager.upload_db()
|
||||||
|
|
||||||
# update user group info
|
|
||||||
#update_user_group_info()
|
|
||||||
1
tools.py
1
tools.py
@@ -19,6 +19,7 @@ class DatabaseManager:
|
|||||||
def upload_db(self):
|
def upload_db(self):
|
||||||
file = self.lfm.get_file("data")
|
file = self.lfm.get_file("data")
|
||||||
self.obj.upload_file(self.online_db_uri, file)
|
self.obj.upload_file(self.online_db_uri, file)
|
||||||
|
print("DB upload success")
|
||||||
|
|
||||||
def download_db(self):
|
def download_db(self):
|
||||||
file = self.obj.get_file(self.online_db_uri)
|
file = self.obj.get_file(self.online_db_uri)
|
||||||
|
|||||||
Reference in New Issue
Block a user