def wrapper(*args, **kwargs): user_id = kwargs['id'] user_pwd = kwargs['password'] if auth_type == "user": user_data = dbtool.read_json(user_id) if user_id == user_data['id']: if user_pwd == user_data['password']: func(*args, **kwargs) return user_data else: print("error password") start_atm() else: print("the user_id is not exist,please call ATM-manager") start_atm() else: user_data = dbtool.read_manager(user_id) if user_id == user_data['id']: if user_pwd == user_data['password']: func(*args, **kwargs) return user_data else: print("error password") start_atm() else: print("error manager") start_atm()
def admin_view(*args, **kwargs): user_id = kwargs['id'] user_password = kwargs['password'] user_data = dbtool.read_manager(user_id) print(''' --------login sucess!----------------- --------Welcome to the yang's bank---- --------Welcome admin----------------- \033[31;1m 1.添加用户 2.管理用户额度 3.冻结账户 4.退出\033[0m ''') admin_choice(user_data)