Skip to content

Commit

Permalink
解决多次解密导致的数据重复问题
Browse files Browse the repository at this point in the history
  • Loading branch information
LC044 committed Dec 13, 2023
1 parent 4c6ec0e commit 9ca75c7
Show file tree
Hide file tree
Showing 29 changed files with 2,294 additions and 19 deletions.
14 changes: 1 addition & 13 deletions app/DataBase/msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def get_messages(self, username_):
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID,BytesExtra,CompressContent
from MSG
where StrTalker=?
group by MsgSvrID
order by CreateTime
'''
try:
Expand All @@ -79,7 +78,6 @@ def get_messages_all(self):
sql = '''
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID,BytesExtra,StrTalker,Reserved1,CompressContent
from MSG
group by MsgSvrID
order by CreateTime
'''
if not self.open_flag:
Expand Down Expand Up @@ -116,7 +114,6 @@ def get_message_by_num(self, username_, local_id):
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID,BytesExtra,CompressContent
from MSG
where StrTalker = ? and localId < ?
group by MsgSvrID
order by CreateTime desc
limit 20
'''
Expand All @@ -142,15 +139,13 @@ def get_messages_by_type(self, username_, type_, is_Annual_report_=False, year_=
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID,BytesExtra,CompressContent
from MSG
where StrTalker=? and Type=? and strftime('%Y',CreateTime,'unixepoch','localtime') = ?
group by MsgSvrID
order by CreateTime
'''
else:
sql = '''
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID,BytesExtra,CompressContent
from MSG
where StrTalker=? and Type=?
group by MsgSvrID
order by CreateTime
'''
try:
Expand All @@ -171,7 +166,6 @@ def get_messages_by_keyword(self, username_, keyword, num=5, max_len=10):
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID,BytesExtra
from MSG
where StrTalker=? and Type=1 and LENGTH(StrContent)<? and StrContent like ?
group by MsgSvrID
order by CreateTime desc
'''
temp = []
Expand All @@ -192,7 +186,6 @@ def get_messages_by_keyword(self, username_, keyword, num=5, max_len=10):
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID
from MSG
where localId > ? and StrTalker=? and Type=1 and IsSender=?
group by MsgSvrID
limit 1
'''
self.cursor.execute(sql, [local_id, username_, 1 - is_send])
Expand All @@ -213,6 +206,7 @@ def get_messages_by_keyword(self, username_, keyword, num=5, max_len=10):
('', '', ['', ''], ''),
('', '', '', '')
))
print(keyword,res)
return res

def get_messages_by_days(self, username_, is_Annual_report_=False, year_='2023'):
Expand All @@ -223,7 +217,6 @@ def get_messages_by_days(self, username_, is_Annual_report_=False, year_='2023')
SELECT MsgSvrID, CreateTime
FROM MSG
WHERE StrTalker = ? AND strftime('%Y', CreateTime, 'unixepoch', 'localtime') = ?
GROUP BY MsgSvrID
)
group by days
'''
Expand All @@ -234,7 +227,6 @@ def get_messages_by_days(self, username_, is_Annual_report_=False, year_='2023')
SELECT MsgSvrID, CreateTime
FROM MSG
WHERE StrTalker = ?
GROUP BY MsgSvrID
)
group by days
'''
Expand All @@ -260,7 +252,6 @@ def get_messages_by_month(self, username_, is_Annual_report_=False, year_='2023'
SELECT MsgSvrID, CreateTime
FROM MSG
WHERE StrTalker = ? AND strftime('%Y', CreateTime, 'unixepoch', 'localtime') = ?
GROUP BY MsgSvrID
)
group by days
'''
Expand All @@ -271,7 +262,6 @@ def get_messages_by_month(self, username_, is_Annual_report_=False, year_='2023'
SELECT MsgSvrID, CreateTime
FROM MSG
WHERE StrTalker = ?
GROUP BY MsgSvrID
)
group by days
'''
Expand Down Expand Up @@ -300,7 +290,6 @@ def get_messages_by_hour(self, username_, is_Annual_report_=False, year_='2023')
SELECT MsgSvrID, CreateTime
FROM MSG
where StrTalker = ? and strftime('%Y',CreateTime,'unixepoch','localtime') = ?
GROUP BY MsgSvrID
)
group by hours
'''
Expand All @@ -311,7 +300,6 @@ def get_messages_by_hour(self, username_, is_Annual_report_=False, year_='2023')
SELECT MsgSvrID, CreateTime
FROM MSG
where StrTalker = ?
GROUP BY MsgSvrID
)
group by hours
'''
Expand Down
2 changes: 1 addition & 1 deletion app/DataBase/output_pc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .package_msg import PackageMsg
from ..DataBase import hard_link_db
from ..DataBase import media_msg_db
from ..person_pc import MePC
from ..person import MePC
from ..util import path
import shutil

Expand Down
File renamed without changes.
28 changes: 28 additions & 0 deletions app/ui/Icon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from PyQt5.QtGui import QIcon

from app.resources import resource_rc

var = resource_rc.qt_resource_name


class Icon:
Default_avatar_path = ':/icons/icons/default_avatar.svg'
Default_image_path = ':/icons/icons/404.png'
MainWindow_Icon = QIcon(':/icons/icons/logo.svg')
Default_avatar = QIcon(Default_avatar_path)
Output = QIcon(':/icons/icons/output.svg')
Back = QIcon(':/icons/icons/back.svg')
ToDocx = QIcon(':/icons/icons/word.svg')
ToCSV = QIcon(':/icons/icons/csv.svg')
ToHTML = QIcon(':/icons/icons/html.svg')
ToTXT = QIcon(':/icons/icons/txt.svg')
Chat_Icon = QIcon(':/icons/icons/chat.svg')
Contact_Icon = QIcon(':/icons/icons/contact.svg')
MyInfo_Icon = QIcon(':/icons/icons/myinfo.svg')
Annual_Report_Icon = QIcon(':/icons/icons/annual_report.svg')
Analysis_Icon = QIcon(':/icons/icons/analysis.svg')
Emotion_Icon = QIcon(':/icons/icons/emotion.svg')
Search_Icon = QIcon(':/icons/icons/search.svg')
Tool_Icon = QIcon(':/icons/icons/tool.svg')
Home_Icon = QIcon(':/icons/icons/home.svg')
Help_Icon = QIcon(':/icons/icons/help.svg')
Empty file added app/ui/__init__.py
Empty file.
1 change: 1 addition & 0 deletions app/ui/chat/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .chat_window import ChatWindow
48 changes: 48 additions & 0 deletions app/ui/chat/chatInfoUi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'chatInfoUi.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtWidgets


class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
self.verticalLayout = QtWidgets.QVBoxLayout(Form)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setSpacing(0)
self.verticalLayout.setObjectName("verticalLayout")
self.frame = QtWidgets.QFrame(Form)
self.frame.setFrameShape(QtWidgets.QFrame.NoFrame)
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame.setObjectName("frame")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.frame)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.label_reamrk = QtWidgets.QLabel(self.frame)
self.label_reamrk.setObjectName("label_reamrk")
self.horizontalLayout_2.addWidget(self.label_reamrk)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem)
self.toolButton = QtWidgets.QToolButton(self.frame)
self.toolButton.setObjectName("toolButton")
self.horizontalLayout_2.addWidget(self.toolButton)
self.verticalLayout_2.addLayout(self.horizontalLayout_2)

self.verticalLayout.addWidget(self.frame)

self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)

def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.label_reamrk.setText(_translate("Form", "TextLabel"))
self.toolButton.setText(_translate("Form", "..."))
74 changes: 74 additions & 0 deletions app/ui/chat/chatUi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'chatUi.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtWidgets


class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(840, 752)
Form.setStyleSheet("background: rgb(240, 240, 240);")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(Form)
self.horizontalLayout_2.setSpacing(6)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
self.verticalLayout_2.setSpacing(6)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label = QtWidgets.QLabel(Form)
self.label.setText("")
self.label.setObjectName("label")
self.horizontalLayout.addWidget(self.label)
self.lineEdit = QtWidgets.QLineEdit(Form)
self.lineEdit.setMinimumSize(QtCore.QSize(200, 30))
self.lineEdit.setMaximumSize(QtCore.QSize(200, 16777215))
self.lineEdit.setStyleSheet("background:transparent;\n"
"border-radius:5px;\n"
"border-top: 0px solid #b2e281;\n"
"border-bottom: 0px solid #b2e281;\n"
"border-right: 0px solid #b2e281;\n"
"border-left: 0px solid #b2e281;\n"
"border-style:outset;\n"
"background-color:rgb(226,226,226);\n"
" ")
self.lineEdit.setCursorMoveStyle(QtCore.Qt.VisualMoveStyle)
self.lineEdit.setObjectName("lineEdit")
self.horizontalLayout.addWidget(self.lineEdit)
self.label_2 = QtWidgets.QLabel(Form)
self.label_2.setMinimumSize(QtCore.QSize(30, 0))
self.label_2.setText("")
self.label_2.setObjectName("label_2")
self.horizontalLayout.addWidget(self.label_2)
self.verticalLayout.addLayout(self.horizontalLayout)
self.verticalLayout_2.addLayout(self.verticalLayout)
self.listWidget = QtWidgets.QListWidget(Form)
self.listWidget.setMinimumSize(QtCore.QSize(250, 0))
self.listWidget.setMaximumSize(QtCore.QSize(250, 16777215))
self.listWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.listWidget.setObjectName("listWidget")
self.verticalLayout_2.addWidget(self.listWidget)
self.verticalLayout_2.setStretch(1, 1)
self.horizontalLayout_2.addLayout(self.verticalLayout_2)
self.stackedWidget = QtWidgets.QStackedWidget(Form)
self.stackedWidget.setObjectName("stackedWidget")
self.horizontalLayout_2.addWidget(self.stackedWidget)
self.horizontalLayout_2.setStretch(1, 1)

self.retranslateUi(Form)
self.stackedWidget.setCurrentIndex(-1)
QtCore.QMetaObject.connectSlotsByName(Form)

def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
Loading

0 comments on commit 9ca75c7

Please sign in to comment.