def nomal(): while True: welcome() raw = input('1 额度查询\n2 转账\n3 取款\n4 存款\n5 账单查询\n6 退出\n请输入您要办理的业务: ').strip() #额度查询 if raw == '1': print('您的额度为:%s\n'%(handle.amount(i_name))) #print('您的额度为:%s\n'%(handle.q_amount('6272121765319008'))) continue #转账 elif raw == '2': n = True while n: transfer_accounts = input('请输入对方银行卡号: ').strip() #transfer_amount = int(input('请输入转出金额: ').strip()) #transfer_accounts = '6224407126081192' #transfer_amount = 100 #根据卡号取出用户名信息 to_name = handle.account(transfer_accounts) #如果能得到目的用户的用户名那么就执行下一步 while to_name != False : transfer_amount = int(input('请输入转出金额: ').strip()) #转账分两部分,原用户减钱,目的用户增加钱 new_amount_from = handle.amount(i_name) - transfer_amount if new_amount_from >= 0: new_amount_to = handle.amount(to_name) + transfer_amount handle.update_amount(i_name,new_amount_from) handle.update_amount(to_name,new_amount_to) print('您的当前额度为:%s'%(handle.amount(i_name))) welcome() msg = '%s 转出 %s .' % (i_name,transfer_amount) log(i_name,msg) n = False break else: print('余额不足,请重新输入...') else: print('卡号错误,请重新输入...') #取款 elif raw == '3': while True: #print('取多少钱') raw = int(input('您要取多少: ').strip()) #raw = 100 new_amount = handle.amount(i_name) - raw if new_amount >= 0: handle.update_amount(i_name,new_amount) print('系统处理中,请稍后...') time.sleep(3) print('您的当前余额为:%s'%handle.amount(i_name)) welcome() msg = '%s 取现 %s.'% (i_name,raw) log(i_name,msg) break else: print("余额不足,请重新输入!") #存款 elif raw == '4': raw = int(input('您要存多少: ').strip()) #raw = int(input('我放了100块,你们都看到了啊!!!').strip()) #raw = random.randint(0,99999999) #raw = 100 print('系统处理中,请稍后...') time.sleep(3) new_amount = handle.amount(i_name) + raw handle.update_amount(i_name,new_amount) print('\n您的当前余额为:%s \n'%handle.amount(i_name)) welcome() msg = '%s 存款 %s .' % (i_name,raw) log(i_name,msg) continue #操作日志 elif raw == '5': print('您的账单信息:') time.sleep(1) handle.select_log(i_name) #退出 else: print('即将退出...') time.sleep(3) exit()
while i < 3: i_name = input('请输入用户名: ').strip() i_passwd = input('请输入密码: ').strip() if handle.active(i_name) is False: time.sleep(0) msg = '%s 该账户已经被锁定,请联系客服工作人员!' % i_name print(msg) #log(i_name,msg) exit() #如果选择登录后支付,判断银行卡号登录 elif handle.login(i_name,i_passwd) is True: msg = '%s 登录成功!' % i_name print(msg) #登录成功后,查询用户余额是否大于cost #查询商城银行账户,增加cost u_account = handle.account(i_name)[0] u_amount = atm.q_amount(u_account)[0] shop_account = '6224407126081192' shop_amount = atm.q_amount(shop_account)[0] new_u_amount = u_amount - cost #如果大于则扣款 if new_u_amount >= 0: new_shop_amount = shop_amount + cost atm.up_amount(u_account,new_u_amount) atm.up_amount(shop_account,new_shop_amount) #print('客户当前账户余额%s'%new_u_amount) #print('商城当前账户余额%s'%new_shop_amount) print('\n交易正在处理中,请稍后...') welcome('支付成功') exit() else: