def management_admin_account(admin_name, quit_management_account, log_file=None): while not quit_management_account: admin_database = user_info['admin_bank'] if not admin_database.get(admin_name): break print("""中国建都银行 管理中心 [%s]已登陆 =========================================== 添加管理账号(1) 删除管理账号(2) 更改账号权限(3) 更改账号信息(4) 修改管理员密码(5) 返回(b) 退出(q) =========================================== """ % admin_name) wait_choose = str(input("请选择操作:")).strip() if wait_choose == "1": get_database = add_admin_account(admin_database, admin_name, is_admin=True, log_file=log_file) if type(get_database) == dict: user_info['admin_bank'] = get_database # 更新数据库信息 update_info(user_info) elif wait_choose == "2": get_database = delete_account(admin_database, admin_name, is_admin=True, log_file=log_file) if type(get_database) == dict: user_info['admin_bank'] = get_database # 更新数据库信息 update_info(user_info) elif wait_choose == "3": get_database = change_admin_permission(admin_database, admin_name, log_file=log_file) if type(get_database) == dict: user_info['admin_bank'] = get_database # 更新数据库信息 update_info(user_info) elif wait_choose == "4": get_database = modify_admin_account_info(admin_database, admin_name, is_admin=True, log_file=log_file) if type(get_database) == dict: user_info['admin_bank'] = get_database # 更新数据库信息 update_info(user_info) elif wait_choose == "5": get_database = change_admin_password(admin_database, admin_name, log_file=log_file) if type(get_database) == dict: user_info['admin_bank'] = get_database # 更新数据库信息 update_info(user_info) elif str(wait_choose).lower() in ['q', 'quit', ]: quit_management_account = True Logger(log_file).write_log(user=admin_name, status=True, event="管理员退出") print("谢谢使用,再见 !") break elif str(wait_choose).lower() in ['b', 'back', ]: break else: print("操作有误 !!!") return quit_management_account
def management_admin_account(admin_name, quit_management_account, log_file=None): while not quit_management_account: admin_database = user_info['admin_bank'] if not admin_database.get(admin_name): break print("""中国建都银行 管理中心 [%s]已登陆 =========================================== 添加管理账号(1) 删除管理账号(2) 更改账号权限(3) 更改账号信息(4) 修改管理员密码(5) 返回(b) 退出(q) =========================================== """ % admin_name) wait_choose = str(input("请选择操作:")).strip() if wait_choose == "1": get_database = add_admin_account(admin_database, admin_name, is_admin=True, log_file=log_file) if type(get_database) == dict: user_info['admin_bank'] = get_database # 更新数据库信息 update_info(user_info) elif wait_choose == "2": get_database = delete_account(admin_database, admin_name, is_admin=True, log_file=log_file) if type(get_database) == dict: user_info['admin_bank'] = get_database # 更新数据库信息 update_info(user_info) elif wait_choose == "3": get_database = change_admin_permission(admin_database, admin_name, log_file=log_file) if type(get_database) == dict: user_info['admin_bank'] = get_database # 更新数据库信息 update_info(user_info) elif wait_choose == "4": get_database = modify_admin_account_info(admin_database, admin_name, is_admin=True, log_file=log_file) if type(get_database) == dict: user_info['admin_bank'] = get_database # 更新数据库信息 update_info(user_info) elif wait_choose == "5": get_database = change_admin_password(admin_database, admin_name, log_file=log_file) if type(get_database) == dict: user_info['admin_bank'] = get_database # 更新数据库信息 update_info(user_info) elif str(wait_choose).lower() in [ 'q', 'quit', ]: quit_management_account = True Logger(log_file).write_log(user=admin_name, status=True, event="管理员退出") print("谢谢使用,再见 !") break elif str(wait_choose).lower() in [ 'b', 'back', ]: break else: print("操作有误 !!!") return quit_management_account
def admin_management(admin_name, quit_admin_management=False, log_file=None): # 管理员登陆成功后的账号操作 while not quit_admin_management: try: user_database = user_info["user_bank"] except KeyError: user_info["user_bank"] = {} user_database = user_info["user_bank"] if not user_info["admin_bank"].get(admin_name): break print("""中国建都银行 管理中心 [%s]已登陆 =========================================== 开户(1) 修改密码(2) 查询账户(s) 存钱(3) 取钱(4) 额度(5) 解锁(6) 挂失(7) 销户(8) 管理员帐户管理(9) 注销(b) 退出(q) =========================================== """ % admin_name) wait_choose = str(input("请选择操作:")).strip() if wait_choose == "1": get_database = register_account(user_database, log_file=log_file) if type(get_database) == dict: user_info["user_bank"] = get_database update_info(user_info) elif wait_choose == "2": get_database = for_super_admin_change_password(user_database, admin_name, log_file=log_file) if type(get_database) == dict: user_info["user_bank"] = get_database update_info(user_info) elif wait_choose == "3": print("该功能暂未开放") elif wait_choose == "4": print("该功能暂未开放") elif wait_choose.lower() == "s": show_account_info(user_database, admin_name, is_admin=True, log_file=log_file) elif wait_choose == "5": get_database = change_user_credit_line(user_database, admin_name, log_file=log_file) if type(get_database) == dict: user_info['user_bank'] = get_database # 更新数据库信息 update_info(user_info) elif wait_choose == "6": get_database = for_admin_unlock_account(user_database, admin_name, log_file=log_file) if type(get_database) == dict: user_info["user_bank"] = get_database update_info(user_info) elif wait_choose == "7": get_database = for_admin_lock_account(user_database, admin_name, log_file=log_file) if type(get_database) == dict: user_info["user_bank"] = get_database update_info(user_info) elif wait_choose == "8": get_database = delete_account(user_database, admin_name, is_admin=False, log_file=log_file) if type(get_database) == dict: user_info['user_bank'] = get_database # 更新数据库信息 update_info(user_info) elif wait_choose == "9": quit_admin_management = management_admin_account( admin_name, quit_admin_management, log_file=log_file) # 对管理员账号进行操作 elif str(wait_choose).lower() in ['q', 'quit', ]: quit_admin_management = True Logger(log_file).write_log(user=admin_name, status=True, event="管理员退出") print("谢谢使用,再见 !") break elif str(wait_choose).lower() in ['b', 'back', ]: Logger(log_file).write_log(user=admin_name, status=True, event="管理员注销") break else: print("操作有误 !!!") return quit_admin_management
def admin_management(admin_name, quit_admin_management=False, log_file=None): # 管理员登陆成功后的账号操作 while not quit_admin_management: try: user_database = user_info["user_bank"] except KeyError: user_info["user_bank"] = {} user_database = user_info["user_bank"] if not user_info["admin_bank"].get(admin_name): break print("""中国建都银行 管理中心 [%s]已登陆 =========================================== 开户(1) 修改密码(2) 查询账户(s) 存钱(3) 取钱(4) 额度(5) 解锁(6) 挂失(7) 销户(8) 管理员帐户管理(9) 注销(b) 退出(q) =========================================== """ % admin_name) wait_choose = str(input("请选择操作:")).strip() if wait_choose == "1": get_database = register_account(user_database, log_file=log_file) if type(get_database) == dict: user_info["user_bank"] = get_database update_info(user_info) elif wait_choose == "2": get_database = for_super_admin_change_password(user_database, admin_name, log_file=log_file) if type(get_database) == dict: user_info["user_bank"] = get_database update_info(user_info) elif wait_choose == "3": print("该功能暂未开放") elif wait_choose == "4": print("该功能暂未开放") elif wait_choose.lower() == "s": show_account_info(user_database, admin_name, is_admin=True, log_file=log_file) elif wait_choose == "5": get_database = change_user_credit_line(user_database, admin_name, log_file=log_file) if type(get_database) == dict: user_info['user_bank'] = get_database # 更新数据库信息 update_info(user_info) elif wait_choose == "6": get_database = for_admin_unlock_account(user_database, admin_name, log_file=log_file) if type(get_database) == dict: user_info["user_bank"] = get_database update_info(user_info) elif wait_choose == "7": get_database = for_admin_lock_account(user_database, admin_name, log_file=log_file) if type(get_database) == dict: user_info["user_bank"] = get_database update_info(user_info) elif wait_choose == "8": get_database = delete_account(user_database, admin_name, is_admin=False, log_file=log_file) if type(get_database) == dict: user_info['user_bank'] = get_database # 更新数据库信息 update_info(user_info) elif wait_choose == "9": quit_admin_management = management_admin_account( admin_name, quit_admin_management, log_file=log_file) # 对管理员账号进行操作 elif str(wait_choose).lower() in [ 'q', 'quit', ]: quit_admin_management = True Logger(log_file).write_log(user=admin_name, status=True, event="管理员退出") print("谢谢使用,再见 !") break elif str(wait_choose).lower() in [ 'b', 'back', ]: Logger(log_file).write_log(user=admin_name, status=True, event="管理员注销") break else: print("操作有误 !!!") return quit_admin_management