Esempio n. 1
0
def transfer():
    '''
    1.接收用户输入的 转账目标用户
    2.接收用户输入的 转账金额
    :return:
    '''
    while True:

        # 1)让用户输入转账用户与金额
        to_user = input('请输入转账目标用户: ').strip()
        money = input('请输入转账金额: ').strip()

        # 2)判断用户输入的金额是否是数字或 > 0
        if not money.isdigit():
            print('请输入正确的金额!')
            continue

        money = int(money)

        if money > 0:
            # 3) 调用转账接口
            flag, msg = bank_interface.transfer_interface(
                # 当前用户,目标用户,转账金额
                login_user, to_user, money
            )
            if flag:
                print(msg)
                break
            else:
                print(msg)

        else:
            print('请输入正确的金额!')
Esempio n. 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)
Esempio n. 3
0
def transfer():
    t_username = input('请输入转账账户:\n>>>').strip()
    num = input('请输入转账金额:\n>>>').strip()
    if num.isdigit():
        num = float(num)
        flag, msg = bank_interface.transfer_interface(login_user, t_username,
                                                      num)
        if flag: print(msg)
        else: print(msg)
    else: print('请输入数字!')
Esempio n. 4
0
def transfer():
    while True:
        dst_user = input("请输入转账目标用户:").strip()
        money = input("请输入转账金额:").strip()
        if money.isdigit():
            money = int(money)
        flag, msg = bank_interface.transfer_interface(user_info["name"], dst_user, money)
        if flag:
            print(msg)
            break
        else:
            print(msg)
Esempio n. 5
0
def transfer():
    print('欢迎来到转账功能')
    while True:
        to_user= input('请输入目标用户:')
        money = input('请输入转账金额').strip()
        if not money.isdigit():
            print('必须输入数字')
            continue
        money = int(money)
        flag, msg = bank_interface.transfer_interface(user_info.get('username'),to_user, money)
        if flag:
            print(msg)
            break
        else:
            print(msg)
Esempio n. 6
0
def transfer():
    while True:
        input_money = input('请输入转账金额:').strip()
        input_to_user = input('请转入用户:').strip()
        if not input_money.isdigit():
            print('请输入数字')
            continue
        input_money = int(input_money)
        if input_money > 0:
            flag, msg = bank_interface.transfer_interface(login_user, input_to_user, input_money)
            if flag:
                print(msg)
                break
            else:
                print(msg)
Esempio n. 7
0
def transfer():
    while True:
        out_money = input('请输入您要转账的金额>>>:')
        to_user = input('请输入您要转入的用户:')
        if not out_money.isdigit():
            print('请重新输入')
            continue
        out_money = int(out_money)
        if out_money > 0:
            flag, msg = bank_interface.transfer_interface(
                login_user, to_user, out_money)
            if flag:
                print(msg)
                break
            else:
                print(msg)
Esempio n. 8
0
File: src.py Progetto: mtccvip/atm
def transfer():
    while True:
        transfer_account=input('请输入要转账的账户名:').strip()
        transfer_money=input('请输入转账金额:').strip()
        if not transfer_money.isdigit():
            print('请输入正确的转账金额')
            continue
        transfer_money=int(transfer_money)
        if transfer_money<=0:
            print('转账金额必须大于0')
        else:
            flag,msg=bank_interface.transfer_interface(login_user,transfer_account,transfer_money)
            if flag:
                print(msg)
                break
            else:
                print(msg)
Esempio n. 9
0
def transfer():
    while True:
        to_user = input('请输入目标账户:').strip()
        money = input('请输入转账金额:').strip()
        if not money.isdigit():
            print('请输入正确的金额!')
            continue
        money = int(money)

        if money > 0:
            flag, msg = bank_interface.transfer_interface(
                login_user, to_user, money)
            if flag:
                print(msg)
                break
            else:
                print(msg)
        else:
            print('转账金额不能小于零!')
Esempio n. 10
0
def transfer():
    while True:
        to_user = input('请输入要转账的用户:').strip()
        flag = user_interface.register_interface_select(to_user)
        if not flag:
            print('转账的用户不存在')
            continue
        money = input('请输入转账的金额:').strip()
        # 判断输入是否为数字
        if not money.isdigit():
            print('请输入数字')
            continue
        flag, msg = bank_interface.transfer_interface(to_user,
                                                      user_info['user'], money)
        if flag:
            print(msg)
            break
        else:
            print(msg)
Esempio n. 11
0
def transfer():
    while True:
        to_user = input('请输入对方账号:')
        money = input('请输入转账金额:')
        try:
            money = float(money)
        except ValueError:
            print('请输入正确金额:')
            continue
        if money > 0:
            flag, msg = bank_interface.transfer_interface(
                login_user, to_user, money)
            if flag:
                print(msg)
                break
            else:
                print(msg)
        else:
            print('输入金额不能小于0。')
Esempio n. 12
0
def transfer():
    while True:
        # 1.输入转账目标用户
        to_user = input('请输入转账目标用户:').strip()

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

        money = int(money)

        # 3.调用转账接口
        flag, msg = bank_interface.transfer_interface(user_info.get('user'), to_user, money)
        if flag:
            print(msg)
            break

        else:
            print(msg)
Esempio n. 13
0
def transfer():
    print('欢迎来到转账界面')
    while True:
        to_user = input('请输入目标用户名字')
        money = input('请输入转账金额')
        if to_user == user_inf.get('user'):
            print('不能转账给自己!')
            continue
        if money.isdigit():
            money = int(money)
            flag, msg = bank_interface.transfer_interface(
                user_inf.get('user'), to_user, money)
            if flag:
                print(msg)
                break

            else:
                print(msg)

        else:
            print('转账金额必须是数字')
Esempio n. 14
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
Esempio n. 15
0
def transfer():
    while True:
        to_user = input('请输入接收人账号:')
        input_money = input('请输入转账金额:')

        if not input_money.isdigit():
            print('请输入正确的金额!')
            continue

        input_money = int(input_money)

        if input_money > 0:
            flag, msg = bank_interface.transfer_interface(
                login_user, to_user, input_money
            )

            if flag:
                print(msg)
                break
            else:
                print(msg)
        else:
            print('请输入正确的金额!')
Esempio n. 16
0
def transfer():
    while True:
        # 1. 输入 金额
        # 2. 输入 转账目标用户
        money = input('请输入转账金额: ').strip()
        to_user = input('请输入需要转出的用户: ').strip()

        # 判断用户输入金额为数字和大于0
        if not money.isdigit():
            print('请输入数字!')
            continue
        money = int(money)

        if money > 0:
            flag, msg = bank_interface.transfer_interface(
                login_user, to_user, money)
            if flag:
                print(msg)
                break
            else:
                print(msg)
        else:
            print('您的输入有误,请重新输入!')