diff --git a/21412030129-钟帅-python课设报告.doc b/21412030129-钟帅-python课设报告.doc new file mode 100644 index 0000000..bc260bb Binary files /dev/null and b/21412030129-钟帅-python课设报告.doc differ diff --git a/Python程序设计课程设计报告 2024年.doc b/Python程序设计课程设计报告 2024年.doc deleted file mode 100644 index d929280..0000000 Binary files a/Python程序设计课程设计报告 2024年.doc and /dev/null differ diff --git a/pythonProject/user_data.txt b/pythonProject/user_data.txt index 1b5d237..5ff4803 100644 --- a/pythonProject/user_data.txt +++ b/pythonProject/user_data.txt @@ -1,2 +1 @@ - zs,zs diff --git a/pythonProject/zs1.py b/pythonProject/zs1.py index c61df69..ef97362 100644 --- a/pythonProject/zs1.py +++ b/pythonProject/zs1.py @@ -1,45 +1,5 @@ import tkinter as tk from tkinter import messagebox -import pymysql - -# 数据库连接配置 -host = 'localhost' -user = 'root' -password = '123456' -db = 'sys' - -try: - # 尝试连接数据库 - conn = pymysql.connect(host=host, user=user, password=password, db=db) - print("数据库连接成功") - - # 创建一个Cursor对象 - cursor = conn.cursor() - - # 定义创建用户表的SQL语句 - create_table_sql = """ - CREATE TABLE IF NOT EXISTS users ( - user_id INT AUTO_INCREMENT PRIMARY KEY, - username VARCHAR(255) NOT NULL UNIQUE, - password VARCHAR(255) NOT NULL - ) - """ - - # 执行SQL语句创建表 - cursor.execute(create_table_sql) - print("用户表创建成功") - - # 提交事务 - conn.commit() - -except pymysql.MySQLError as e: - print(f"数据库操作出错: {e}") -finally: - # 关闭Cursor和Connection - if cursor: - cursor.close() - if conn: - conn.close() class FootSpaManagementSystem: def __init__(self,order_info=""): @@ -183,9 +143,9 @@ class FootSpaManagementSystem: if username and password: with open(self.user_data_file, "a") as file: file.write(f"{username},{password}\n") - messagebox.showinfo("注册成功", "用户注册成功!") # 显示注册成功信息 + messagebox.showinfo("注册成功", "用户注册成功!") # 显示注册成功消息 else: - messagebox.showerror("注册失败", "请输入用户名和密码。") # 显示注册失败信息 + messagebox.showerror("注册失败", "请输入用户名和密码。") #用户登录函数 def login_user(self):