logic_batch_task_detail.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. from datetime import datetime
  2. from common.sql_lite import get_global_db_connection
  3. from db.batch_msg import batch_msg_get_list, batch_msg_status, batch_msg_type
  4. from ui.batch_task.ui_batch_task_detail import WinGUIBatchTaskDetail
  5. class WinBatchTaskDetail(WinGUIBatchTaskDetail):
  6. def __init__(self):
  7. super().__init__()
  8. self.label_list = ["全部"]
  9. self.label_map = {
  10. "全部": 0
  11. }
  12. self.contacts = []
  13. def open_batch_task_detail_win(task_id: int, task_info: tuple):
  14. # 创建窗口对象
  15. win_batch_task_detail = WinBatchTaskDetail()
  16. win_batch_task_detail.tk_label_frame_content.tk_text_content.insert(1.0, task_info[4])
  17. win_batch_task_detail.tk_label_frame_content.tk_text_content.config(state='disabled')
  18. connection = get_global_db_connection()
  19. cursor = connection.cursor()
  20. try:
  21. results = batch_msg_get_list(cursor, task_id)
  22. finally:
  23. cursor.close()
  24. for result in results:
  25. updated_at = datetime.fromtimestamp(result["updated_at"]).strftime("%Y-%m-%d %H:%M:%S") if result["updated_at"] is not None else ""
  26. status = batch_msg_status[result["status"]]
  27. type = batch_msg_type[result["type"]]
  28. win_batch_task_detail.tk_label_frame_contact.tk_table_contact_list.insert('', "end", values=(result["wxid"], type, result["nickname"], updated_at, status))
  29. win_batch_task_detail.mainloop()