From 97c4c848ebf6b38a8646683f77272c3f09fc549f Mon Sep 17 00:00:00 2001
From: 123456789zs <2660653849@qq.com>
Date: Mon, 3 Jun 2024 23:36:15 +0800
Subject: [PATCH] commit_0603
---
pythonProject/.idea/dataSources.xml | 12 ++++++++
pythonProject/foot_spa.db | Bin 0 -> 12288 bytes
pythonProject/user_data.txt | 1 -
pythonProject/zs1.py | 41 +++++++++++++++++++++++++++-
4 files changed, 52 insertions(+), 2 deletions(-)
create mode 100644 pythonProject/.idea/dataSources.xml
create mode 100644 pythonProject/foot_spa.db
diff --git a/pythonProject/.idea/dataSources.xml b/pythonProject/.idea/dataSources.xml
new file mode 100644
index 0000000..208626a
--- /dev/null
+++ b/pythonProject/.idea/dataSources.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ mysql.8
+ true
+ com.mysql.cj.jdbc.Driver
+ jdbc:mysql://localhost:3306/sys
+ $ProjectFileDir$
+
+
+
\ No newline at end of file
diff --git a/pythonProject/foot_spa.db b/pythonProject/foot_spa.db
new file mode 100644
index 0000000000000000000000000000000000000000..f5c647b8adf8ebf438eb14e16dc4f3b9eb8b1e44
GIT binary patch
literal 12288
zcmeI%%}T>S5C`zxv``Q<(o5(;oMQu`w4McH*_L43>NbKsNi-26ww0vnx%yPTi4WmJ
zxY@R7A>O=L{sWm^CX0DjRi-G@`
z|2D0#{qg&zK5K2=Gh6C}fB*y_009U<00Izz00bZafi)MHMOMveH2B-jG`e|6CRvLwmXNZ`b*<)>_tD#r|La^hZDd0uX=z1Rwwb2tWV=5P$##Ah5;)U*d~-
A3IG5A
literal 0
HcmV?d00001
diff --git a/pythonProject/user_data.txt b/pythonProject/user_data.txt
index a4352ff..1b5d237 100644
--- a/pythonProject/user_data.txt
+++ b/pythonProject/user_data.txt
@@ -1,3 +1,2 @@
zs,zs
-
diff --git a/pythonProject/zs1.py b/pythonProject/zs1.py
index f896557..c61df69 100644
--- a/pythonProject/zs1.py
+++ b/pythonProject/zs1.py
@@ -1,6 +1,45 @@
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=""):