import sys
import sqlite3
import requests
from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QTableWidget, QTableWidgetItem, \
QHeaderView, QLabel, QPushButton, QHBoxLayout, QVBoxLayout, QMessageBox
from PyQt5.QtGui import QFont, QColor, QPalette, QPixmap, QPainterPath, QPainter, QIcon
from PyQt5.QtCore import Qt, QThread, pyqtSignal, QCoreApplication, QUrl, QRect
from PyQt5.QtGui import QDesktopServices
import authorize # 导入授权逻辑模块
import database_operations # 导入数据库操作模块
import browser_operations # 导入浏览器操作模块
import update
if update.is_latest_version():
# 如果是最新版本,继续运行程序
print("程序为最新版本,继续运行。")
else:
# 如果不是最新版本,运行更新器并退出程序
print("发现新版本,需要更新。")
update.run_updater()
sys.exit() # 或者使用 sys.exit(),不过需要先导入 sys 模块
QCoreApplication.setOrganizationName("YourOrganization")
QCoreApplication.setApplicationName("YourApplication")
QCoreApplication.setApplicationVersion("1.0")
QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
class SeleniumWorker(QThread):
data_loaded = pyqtSignal() # 定义信号以便在数据加载后通知主线程
def run(self):
# 调用授权逻辑
authorize.authorize_account()
# 发射信号通知主线程数据加载完成
self.data_loaded.emit()
class BrowserWorker(QThread):
def __init__(self, cookies):
super().__init__()
self.cookies = cookies
def run(self):
# 调用浏览器操作逻辑
browser_operations.open_with_cookies(self.cookies)
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
self.browser_workers = [] # 保持对 BrowserWorker 线程的引用
def initUI(self):
self.setWindowTitle('微信公众号聚合登录平台 - 云先森sir')
self.setGeometry(100, 100, 1000, 600) # 增加宽度以适应操作列
# 设置窗口图标
self.setWindowIcon(QIcon('icon.png'))
# 主要内容区
self.content_area = QVBoxLayout()
self.content_area.setContentsMargins(10, 10, 10, 10)
# 主要内容容器
content_container = QWidget()
content_container.setLayout(self.content_area)
content_container.setStyleSheet("background-color: #121212;")
# 设置主窗口的中心部件
self.setCentralWidget(content_container)
# 添加“授权账号”按钮
auth_button = QPushButton('授权账号')
auth_button.setFont(QFont('Arial', 14))
auth_button.setStyleSheet("background-color: #4CAF50; color: white;")
auth_button.setFixedHeight(50)
auth_button.clicked.connect(self.authorize_account)
self.content_area.addWidget(auth_button)
# 显示账号授权页面
self.create_table()
def create_table(self):
# 创建数据库连接并获取数据
connection = sqlite3.connect('database.db')
cursor = connection.cursor()
cursor.execute("SELECT id, avatar, nickname, original_content_count, total_users FROM wechat_users")
rows = cursor.fetchall()
# 创建表格
self.table = QTableWidget()
self.table.setRowCount(len(rows))
self.table.setColumnCount(6) # 增加一列用于操作
self.table.setHorizontalHeaderLabels(['ID', '头像', '昵称', '原创数', '总用户数', '操作'])
self.table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
self.table.setStyleSheet("background-color: #2E2E2E; color: white; font-size: 12pt;")
# 设置表头样式
header = self.table.horizontalHeader()
header.setStyleSheet("QHeaderView::section { background-color: #2E2E2E; color: white; }")
# 设置行高
row_height = 140 # 可以根据需要调整高度
self.table.verticalHeader().setDefaultSectionSize(row_height)
# 插入数据到表格
for row_idx, row_data in enumerate(rows):
for col_idx, col_data in enumerate(row_data):
if col_idx == 1: # 处理头像列
avatar_label = QLabel()
avatar_label.setFixedSize(64, 64) # 固定大小为 64x64
response = requests.get(col_data)
pixmap = QPixmap()
pixmap.loadFromData(response.content)
pixmap = pixmap.scaled(64, 64, Qt.KeepAspectRatio, Qt.SmoothTransformation)
# 创建圆形头像
rounded = QPixmap(64, 64)
rounded.fill(Qt.transparent)
painter = QPainter(rounded)
painter.setRenderHint(QPainter.Antialiasing)
path = QPainterPath()
path.addEllipse(0, 0, 64, 64)
painter.setClipPath(path)
painter.drawPixmap(0, 0, pixmap)
painter.end()
avatar_label.setPixmap(rounded)
avatar_label.setScaledContents(True)
# 创建一个带有 QVBoxLayout 和 QHBoxLayout 的容器
avatar_container = QWidget()
container_layout = QVBoxLayout()
container_layout.addStretch()
hbox = QHBoxLayout()
hbox.addStretch()
hbox.addWidget(avatar_label)
hbox.addStretch()
container_layout.addLayout(hbox)
container_layout.addStretch()
avatar_container.setLayout(container_layout)
self.table.setCellWidget(row_idx, col_idx, avatar_container)
else:
item = QTableWidgetItem(str(col_data))
item.setForeground(QColor(255, 255, 255))
item.setTextAlignment(Qt.AlignCenter)
self.table.setItem(row_idx, col_idx, item)
# 获取行 ID
row_id = row_data[0]
# 添加操作按钮
action_layout = QVBoxLayout()
panel_button = QPushButton('面板')
open_button = QPushButton('打开')
delete_button = QPushButton('删除')
panel_button.setFixedHeight(40)
open_button.setFixedHeight(40)
delete_button.setFixedHeight(40)
panel_button.setStyleSheet("background-color: #FF8C00; color: white;")
open_button.setStyleSheet("background-color: #00BFFF; color: white;")
delete_button.setStyleSheet("background-color: #FF0000; color: white;")
# 添加面板按钮的点击事件
panel_button.clicked.connect(lambda _, id=row_id: self.show_panel_message(id))
# 添加打开按钮的点击事件
open_button.clicked.connect(lambda _, id=row_id: self.open_with_cookies(id))
# 添加删除按钮的点击事件
delete_button.clicked.connect(lambda _, id=row_id: self.delete_row(id))
action_layout.addWidget(panel_button)
action_layout.addWidget(open_button)
action_layout.addWidget(delete_button)
action_widget = QWidget()
action_widget.setLayout(action_layout)
self.table.setCellWidget(row_idx, 5, action_widget)
# 隐藏表格左上角的空白单元格
self.table.verticalHeader().setVisible(False)
# 将表格添加到内容区
self.content_area.insertWidget(0, self.table) # 在“授权账号”按钮上方插入表格
# 关闭数据库连接
没有合适的资源?快使用搜索试试~ 我知道了~
基于Python开发的公众号聚合登录+源码
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共116个文件
pak:58个
dll:14个
exe:10个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 196 浏览量
2024-07-22
08:12:04
上传
评论
收藏 802.22MB ZIP 举报
温馨提示
基于Python开发的公众号聚合登录+源码
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/7Z.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 116 条
- 1
- 2
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/2c8c20c5e95b46c58afd0a0d87fe23db_huayula.jpg!1)
酷爱码
- 粉丝: 8436
- 资源: 1600
![benefits](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-1.c8e153b4.png)
下载权益
![privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-2.ec46750a.png)
C知道特权
![article](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-3.fc5e5fb6.png)
VIP文章
![course-privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-4.320a6894.png)
课程特权
![rights](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-icon.fe0226a8.png)
开通VIP
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)