Пример #1
0
def login():
    while True:
        user = input('请输入用户名: ').strip()

        flag = user_interface.check_user_interface(user)

        if not flag:
            print('用户不存在,请重新输入')
            continue

        pwd = input('请输入密码: ').strip()

        # (True, f'{user}登陆成功!') = user_interface.login_interface(user, pwd)
        # 调用登陆接口

        flag, msg = user_interface.login_interface(user, pwd)

        if flag:
            print(msg)

            # 登陆成功后做一个记录
            user_info['user'] = user

            break

        else:
            print(msg)
Пример #2
0
def transfer():
    while True:

        to_user = input('请输入转账目标用户:').strip()
        # 判断目标用户是否存在
        flag = user_interface.check_user_interface(to_user)

        if not flag:
            print('目标用户不存在!')
            continue

        # 输入转账金额
        money = input('请输入转账金额:').strip()
        if not money.isdigit():
            print('请输入数字!')
            continue

        money = int(money)

        flag, msg = bank_interface.transfer_interface(to_user,
                                                      user_info['user'], money)

        if flag:
            print(msg)
            break

        else:
            print(msg)
Пример #3
0
def register():
    print('注册功能...')
    while True:
        user = input('请输入用户名: ').strip()

        # 调用接口判断用户是否存在
        flag = user_interface.check_user_interface(user)

        # 若存在,则让用户重新输入
        if flag:

            print('用户已存在, 请重新输入!')

            continue

        pwd = input('请输入密码: ').strip()
        re_pwd = input('请确认密码: ').strip()

        if pwd == re_pwd:

            # 业务逻辑
            # 调用接口层注册接口保存用户信息
            msg = user_interface.register_interface(user, pwd)
            if msg:
                print(msg)
                break
            else:
                print('注册失败!')
        else:
            print('密码不一致.')
Пример #4
0
def lock_user():
    print('冻结用户...')
    user = input('请输入需要冻结的用户: ').strip()

    flag = user_interface.check_user_interface(user)

    if flag:

        # 调用冻结接口
        msg = admin_interface.lock_interface(user)
        print(msg)

    else:
        print('用户不存在!')
Пример #5
0
def register():
    while True:
        print('---注册---')
        user_name = input('请输入用户名:').strip()
        passwd = input('请输入密码:').strip()
        passwd_d = input('确认密码:').strip()
        # 接口
        flat = user_interface.check_user_interface(user_name)
        if flat:
            print('用户已存在,重新输入!')
            continue
        elif passwd == passwd_d:
            # 接口
            user_interface.register_interface(user_name, passwd)
            print('注册成功!')
            break
Пример #6
0
def change_limit():
    print('修改用户额度')
    user = input('请输入需要修改额度的用户: ').strip()

    flag = user_interface.check_user_interface(user)
    if not flag:
        print('用户不存在!')
        return

    limit = input('请输入修改额度').strip()

    if limit.isdigit():
        limit = int(limit)

        # 调用修改额度接口
        msg = admin_interface.change_limit_interface(user, limit)
        print(msg)

    else:
        print('请输入数字')
Пример #7
0
def transfer():
    while True:
        print('---转账---')
        to_name = input('输入转账目标用户:').strip()
        to_user = user_interface.check_user_interface(to_name)
        if to_user:
            money = input('请输入转账金额:').strip()
            if money.isdigit():
                money = int(money)
                flaw, msg = bank_interface.transfer_interface(to_name, money, user_info['user'])
                if flaw:
                    print(msg)
                    break
                else:
                    print(msg)
                    break
            else:
                print('输入不正确!!')
                continue
        else:
            print('用户不存在,重新输入!')
            continue