You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
975 B
30 lines
975 B
from tkinter.messagebox import *
|
|
|
|
from dao.UserDao import UserDao
|
|
|
|
|
|
class UserService:
|
|
|
|
@staticmethod
|
|
def login_dispose(user_name, password):
|
|
user = UserDao.query_user(user_name)
|
|
if user is None:
|
|
showwarning(title="警告", message="不存在当前用户!\n请先注册!")
|
|
return
|
|
if password != user[2]:
|
|
showwarning(title="警告", message="密码错误!")
|
|
return
|
|
showinfo(title="提示", message="登录成功!")
|
|
return True
|
|
|
|
@staticmethod
|
|
def register_dispose(user_name, password):
|
|
user = UserDao.query_user(user_name)
|
|
if user is not None:
|
|
showwarning(title="警告", message="该用户名已使用!")
|
|
return
|
|
sql = "INSERT INTO t_user(user_name,user_password) VALUES (%s,%s);"
|
|
UserDao.update_user(sql, user_name, password)
|
|
showinfo(title="提示", message="注册成功!")
|
|
return True
|