Example #1
0
def bank_login():
	centerclass.bank.Print()
	flag = 0
	while flag <= 3:
		creditId = raw_input("请输入你的信用卡号 :").strip()
		creditPass = raw_input(u"请输入你的信用卡密码:").strip()
		#判断输入的字符串是否为纯数字
		if creditId.isdigit():
			ifBankId(creditId,creditPass,flag)
		else:
			print "你输入的信用卡号类型不正确,请重新输入!"
			flag += 1
	print "你输入的错误次数已达3次,程序将退出!"
	main.welcome()
Example #2
0
def accept_telnet_connect(telnet_server):
 global last_client_socket
 if last_client_socket:
  uos.dupterm(None)
  last_client_socket.close()
 last_client_socket,remote_addr=telnet_server.accept()
 #print("Telnet connection from:",remote_addr)
 log_connection(remote_addr)
 last_client_socket.setblocking(False)
 last_client_socket.setsockopt(socket.SOL_SOCKET,20,uos.dupterm_notify)
 last_client_socket.sendall(bytes([255,252,34]))
 last_client_socket.sendall(bytes([255,251,1]))
 uos.dupterm(TelnetWrapper(last_client_socket))
 from main import welcome
 welcome()
 del welcome
Example #3
0
def LoginShopSucess(userId):
    flag = 0
    while flag <= 5:
        print '''
\t=========欢迎用户%s登录到二手数码产品中心=========
\t1.iphone 6s手机 4500元 	\t\t2.华为荣耀6plus 2200元
\t3.TP-Link无线路由 120元	\t\t4.联想笔记本 2500元
\t5.小米平板 200元       	\t\t6.战神鼠标 100元
\t7.超神机械键盘 200元   	\t\t8.查看购物车
\t9.结算                    \t\t10.退出
''' % userId
        choiceshop = raw_input('请选择指令:').strip()
        if len(choiceshop) == 0:
            flag += 1
            print "指令不能为空,请重新输入![1-10]"
        else:
            choiceshop = int(choiceshop)
            if choiceshop >= 1 and choiceshop <= 10:
                if choiceshop >= 1 and choiceshop <= 7:
                    shopmanage.shopping(choiceshop)
                # if choiceshop == 2:
                # 	print '2'
                # if choiceshop == 3:
                # 	print '3'
                # if choiceshop == 4:
                # 	print '4'
                # if choiceshop == 5:
                # 	print '5'
                # if choiceshop == 6:
                # 	print '6'
                # if choiceshop == 7:
                # 	print '7'
                if choiceshop == 8:  #查看购物车
                    shopmanage.showshopping()
                if choiceshop == 9:  #结算
                    shopmanage.buyshopping()
                if choiceshop == 10:  #退出购物中心
                    print '程序即将退出二手数码产品中心,欢迎下次光临!'
                    shopmanage.clearshopping()
                    time.sleep(1)
                    main.welcome()
            else:
                flag += 1
                print "你输入的指令不在规定范围内,请重新输入![1-10]"
    print "你输入的错误次数已达5次!系统将退出!"
    time.sleep(1)
    shop_login()
Example #4
0
def LoginShopSucess(userId):
	flag = 0
	while flag <= 5:
		print '''
\t=========欢迎用户%s登录到二手数码产品中心=========
\t1.iphone 6s手机 4500元 	\t\t2.华为荣耀6plus 2200元
\t3.TP-Link无线路由 120元	\t\t4.联想笔记本 2500元
\t5.小米平板 200元       	\t\t6.战神鼠标 100元
\t7.超神机械键盘 200元   	\t\t8.查看购物车
\t9.结算                    \t\t10.退出
''' % userId
		choiceshop = raw_input('请选择指令:').strip()
		if len(choiceshop) == 0:
			flag += 1
			print "指令不能为空,请重新输入![1-10]"
		else:
			choiceshop = int(choiceshop)
			if choiceshop >= 1 and choiceshop <= 10:
				if choiceshop >= 1 and choiceshop <= 7:
					shopmanage.shopping(choiceshop)
				# if choiceshop == 2:
				# 	print '2'
				# if choiceshop == 3:
				# 	print '3'
				# if choiceshop == 4: 
				# 	print '4'
				# if choiceshop == 5:
				# 	print '5'
				# if choiceshop == 6:
				# 	print '6'
				# if choiceshop == 7:	
				# 	print '7'
				if choiceshop == 8:		#查看购物车
					shopmanage.showshopping()
				if choiceshop == 9:		#结算
					shopmanage.buyshopping()
				if choiceshop == 10:	#退出购物中心
					print '程序即将退出二手数码产品中心,欢迎下次光临!'
					shopmanage.clearshopping()
					time.sleep(1)
					main.welcome()
			else:
				flag += 1
				print "你输入的指令不在规定范围内,请重新输入![1-10]"
	print "你输入的错误次数已达5次!系统将退出!"
	time.sleep(1)
	shop_login()
Example #5
0
def ifShopId(userId, userPass, flag):
    if userdict['User'] == userId:
        if userdict['Pass'] == userPass:
            LoginShopSucess(userId)
        else:
            flag += 1
            print "你输入的密码错误,请重新输入!"
    else:
        if userId == 'quit':
            print "系统即将退出!"
            time.sleep(1)
            main.welcome()
        else:
            flag += 1
            print "你输入的用户名有误,请重新输入!"
        flag += 1
        print "你输入的用户名有误,请重新输入!"
Example #6
0
def shop_login():
    centerclass.shop.Print()
    flag = 0
    while flag <= 3:
        userId = raw_input("请输入你的账号:").strip()
        userPass = raw_input(u"请输入你的密码:").strip()
        if len(userId) != 0:
            if re.match('^[0-9a-zA-Z]+$', userId):
                ifShopId(userId, userPass, flag)
            else:
                print "你输入的账户类型不正确,请重新输入!"
                flag += 1
        else:
            flag += 1
            print "用户名不能为空,请重新输入!"
    print "你输入的错误次数已达3次,程序将退出!"
    main.welcome()
Example #7
0
def ifShopId(userId,userPass,flag):
	if userdict['User'] == userId:
		if userdict['Pass'] == userPass:
			LoginShopSucess(userId)
		else:
			flag += 1
			print "你输入的密码错误,请重新输入!"
	else:
		if userId == 'quit':
			print "系统即将退出!"
			time.sleep(1)
			main.welcome()
		else:
			flag += 1
			print "你输入的用户名有误,请重新输入!"
		flag += 1
		print "你输入的用户名有误,请重新输入!"
Example #8
0
def shop_login():
	centerclass.shop.Print()
	flag = 0
	while flag <= 3:
		userId = raw_input("请输入你的账号:").strip()
		userPass = raw_input(u"请输入你的密码:").strip()
		if len(userId) != 0:
			if  re.match('^[0-9a-zA-Z]+$',userId):
				ifShopId(userId, userPass, flag)
			else:
				print "你输入的账户类型不正确,请重新输入!"
				flag += 1
		else:
			flag += 1
			print "用户名不能为空,请重新输入!"
	print "你输入的错误次数已达3次,程序将退出!"
	main.welcome()
Example #9
0
def LoginBankSucess(creditId):
	flag = 0
	while flag <= 5:
		print '''
\t=========欢迎用户%s登录到信用卡中心=========
\t\t1.取现\t\t2.查询\t\t
\t\t3.还款\t\t4.转账\t\t
\t\t5.购物\t\t6.退出\t\t
''' % creditId
		choicebank = raw_input('''请选择指令:''').strip()
		if len(choicebank) == 0:
			flag += 1
			print "指令不能为空,请重新输入![1-6]"
		else:
			choicebank = int(choicebank)
			if choicebank >= 1 and choicebank <= 6:
				if choicebank == 1:
					bankmanage.draw()
				if choicebank == 2:
					bankmanage.check()
				if choicebank == 3:
					bankmanage.repayment()
				if choicebank == 4: 
					bankmanage.transfer()
				if choicebank == 5:
					bankmanage.shoppay()
				if choicebank == 6:
					print '程序即将退出信用卡中心,欢迎下次使用!'
					time.sleep(1)
					main.welcome()
			else:
				flag += 1
				print "你输入的指令不在规定范围内,请重新输入![1-6]"		
	print "你输入的错误次数已达5次!系统将退出!"
	time.sleep(1)
	bank_login()
Example #10
0
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 11 03:03:04 2019

@author: Brothers
"""
from main import welcome
import time

if __name__ == "__main__":
    welcome()
else:
    pass
time.sleep(300000)
Example #11
0
File: atm.py Project: 5iFish/ATM
# Author:ZT

import os
#获取了相对路径
print(__file__)
#动态获取绝对路径 os.path.abspath
#获取目录名不要文件名:os.path.dirname()
BASE_ATM = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
#设置环境变量
BASE_ATM_CONF = BASE_ATM + '\\conf'
BASE_ATM_CORE = BASE_ATM + '\\core'
import sys
sys.path.append(BASE_ATM_CORE)
import main
while True:
    user_choose = main.welcome()
    if user_choose in ['1', '2', '3', '4', '5']:
        menu = {
            '1': main.draw,
            '2': main.repay,
            '3': main.transfer,
            '4': main.show_bal,
            '5': main.show_bill
        }
        menu[user_choose]()
        cont = input('是否继续操作(y/n):')
        if (cont == 'n'):
            break
        elif (cont == 'y'):
            pass
        else:
Example #12
0
def root_api():
    return welcome()