更新word文档

master
Hhhhzh 2 years ago
parent 54b548fc1f
commit 0f7a9f0952

@ -11,9 +11,6 @@ class Admin(object):
def __init__(self,admin,password): def __init__(self,admin,password):
self.admin = admin self.admin = admin
self.password = password self.password = password
# 管理员界面 # 管理员界面
def window(self): def window(self):
print("*-------------------------------------------------------------*") print("*-------------------------------------------------------------*")
@ -26,7 +23,6 @@ class Admin(object):
print("*-------------------------------------------------------------*") print("*-------------------------------------------------------------*")
time.sleep(1) time.sleep(1)
return return
#管理员登录界面 #管理员登录界面
def login(self): def login(self):
print("*------------------------------------*") print("*------------------------------------*")
@ -46,7 +42,6 @@ class Admin(object):
del check del check
time.sleep(3) time.sleep(3)
return return
# 管理员注销界面 # 管理员注销界面
def logout(self): def logout(self):
print("*-------------------------------------------------------------------------------*") print("*-------------------------------------------------------------------------------*")
@ -61,15 +56,12 @@ class Admin(object):
checkt = Check() checkt = Check()
if not check.isSure('注销'): if not check.isSure('注销'):
return False return False
checkt.userName(self.admin,self.password) checkt.userName(self.admin,self.password)
print("*-------------注销成功---------------*") print("*-------------注销成功---------------*")
print(" 正在关闭系统,请稍候... ") print(" 正在关闭系统,请稍候... ")
del check del check
time.sleep(3) time.sleep(3)
return True return True
#系统功能界面 #系统功能界面
''' '''
系统功能开户,查询,取款,存储,转账,销户,挂失,解锁,改密,退出 系统功能开户,查询,取款,存储,转账,销户,挂失,解锁,改密,退出

@ -20,6 +20,8 @@ class ATM(object):
def newAccount(self): def newAccount(self):
# 输入身份证号和手机号 # 输入身份证号和手机号
if not check.isSure("是否开户\n"):
return
pnum = check.phoneNumInput() pnum = check.phoneNumInput()
iden = check.identifyInput() iden = check.identifyInput()
print("正在执行开户程序,请稍候...") print("正在执行开户程序,请稍候...")
@ -35,7 +37,7 @@ class ATM(object):
# 初始化卡号密码,卡里的钱,卡的锁定状态 # 初始化卡号密码,卡里的钱,卡的锁定状态
card = Card(cardN, '000000', 0, iden, pnum, 'False') card = Card(cardN, '000000', 0, iden, pnum, 'False')
self.appendCard.append(card) self.appendCard.append(card)
print("开户成功,您的卡号为%s,密码为%s,卡余额为%d" % (cardN, '888888', 0)) print("开户成功,您的卡号为%s,密码为%s,卡余额为%d" % (cardN, '000000', 0))
print("请牢记密码,不要把密码泄露给他人。") print("请牢记密码,不要把密码泄露给他人。")
# 更新卡号列表 # 更新卡号列表
self.cards = self.readCard.read() self.cards = self.readCard.read()
@ -43,6 +45,8 @@ class ATM(object):
# 查询 # 查询
def checkMoney(self): def checkMoney(self):
if not check.isSure("是否查询\n"):
return
card = check.isCardExist(self.cards) card = check.isCardExist(self.cards)
if check.isCardLock(self.cards, card.cardN): if check.isCardLock(self.cards, card.cardN):
return return
@ -52,6 +56,8 @@ class ATM(object):
# 存储 # 存储
def saveMoney(self): def saveMoney(self):
if not check.isSure("是否存储\n"):
return
card = check.isCardExist(self.cards) card = check.isCardExist(self.cards)
if check.isCardLock(self.cards, card.cardN): if check.isCardLock(self.cards, card.cardN):
return return
@ -66,6 +72,8 @@ class ATM(object):
# 取款 # 取款
def getMoney(self): def getMoney(self):
if not check.isSure("是否取款\n"):
return
card = check.isCardExist(self.cards) card = check.isCardExist(self.cards)
if check.isCardLock(self.cards, card.cardN): if check.isCardLock(self.cards, card.cardN):
return return
@ -80,10 +88,11 @@ class ATM(object):
print("取款成功!你卡上的余额为%d元!" % self.cards[index].cardMoney) print("取款成功!你卡上的余额为%d元!" % self.cards[index].cardMoney)
time.sleep(1) time.sleep(1)
pass
# 转账 # 转账
def inMoney(self): def inMoney(self):
if not check.isSure("是否转帐\n"):
return
card = check.isCardExist(self.cards) card = check.isCardExist(self.cards)
if check.isCardLock(self.cards, card.cardN): if check.isCardLock(self.cards, card.cardN):
return return
@ -117,10 +126,11 @@ class ATM(object):
self.writeCard() self.writeCard()
print("转账成功!你卡上的余额为%d元!" % self.cards[index].cardMoney) print("转账成功!你卡上的余额为%d元!" % self.cards[index].cardMoney)
time.sleep(1) time.sleep(1)
pass
# 销户 # 销户
def DAccount(self): def DAccount(self):
if not check.isSure("是否销户\n"):
return
card = check.isCardInfoSure(self.cards) card = check.isCardInfoSure(self.cards)
if card: if card:
self.cards.remove(card) self.cards.remove(card)
@ -128,10 +138,10 @@ class ATM(object):
print("销户成功!") print("销户成功!")
time.sleep(1) time.sleep(1)
pass
# 挂失 # 挂失
def hangOutAccount(self): def hangOutAccount(self):
if not check.isSure("是否挂失\n"):
return
card = check.isCardInfoSure(self.cards) card = check.isCardInfoSure(self.cards)
if check.isCardLock(self.cards, card.cardN): if check.isCardLock(self.cards, card.cardN):
return return
@ -142,10 +152,11 @@ class ATM(object):
print("挂失成功!") print("挂失成功!")
time.sleep(1) time.sleep(1)
pass
# 解锁 # 解锁
def unlockAccount(self): def unlockAccount(self):
if not check.isSure("是否解锁\n"):
return
card = check.isCardInfoSure(self.cards) card = check.isCardInfoSure(self.cards)
index = self.cards.index(card) index = self.cards.index(card)
self.cards[index].cardLock = "False" self.cards[index].cardLock = "False"
@ -153,23 +164,21 @@ class ATM(object):
print("解锁成功!") print("解锁成功!")
time.sleep(1) time.sleep(1)
pass
# 改密 # 改密
def changePassword(self): def changePassword(self):
if not check.isSure("是否改密\n"):
return
card = check.isCardInfoSure(self.cards) card = check.isCardInfoSure(self.cards)
if check.isCardLock(self.cards, card.cardN): if check.isCardLock(self.cards, card.cardN):
return return
newpassword = input("请输入新密码") newpassword = input("请输入新密码")
index = self.cards.index(card) index = self.cards.index(card)
self.cards[index].cardPassword = newpassword self.cards[index].cardPassword = newpassword
self.writeCard() self.writeCard()
print("改密成功!") print("改密成功!")
time.sleep(1) time.sleep(1)
pass
# 写入文件 # 写入文件
def writeCard(self): def writeCard(self):
self.appendCard.append('', mode='w') self.appendCard.append('', mode='w')

@ -1,3 +1,3 @@
{"cardN": "510146", "cardPassword": "000000", "cardMoney": 0, "identityId": "370105", "phoneNum": "19580768517", "cardLock": "False"} {"cardN": "507229", "cardPassword": "123456", "cardMoney": 200, "identityId": "370105", "phoneNum": "15564160506", "cardLock": "False"}
{"cardN": "507229", "cardPassword": "000000", "cardMoney": 0, "identityId": "370105", "phoneNum": "15564160506", "cardLock": "False"}
{"cardN": "5488800", "cardPassword": "000000", "cardMoney": 0, "identityId": "370102", "phoneNum": "13278888439", "cardLock": "False"} {"cardN": "5488800", "cardPassword": "000000", "cardMoney": 0, "identityId": "370102", "phoneNum": "13278888439", "cardLock": "False"}
{"cardN": "8267762", "cardPassword": "000000", "cardMoney": 300, "identityId": "123", "phoneNum": "12312312312", "cardLock": "False"}

@ -13,7 +13,7 @@ def isCardNExist(cards, cardN):
def isSure(operate): def isSure(operate):
while True: while True:
res = input("是否确认%s?【yes/no】" % operate) res = input("是否确认%s[yes/no]" % operate)
if res not in ['yes', 'no']: if res not in ['yes', 'no']:
print("输入有误,请重新输入!") print("输入有误,请重新输入!")
continue continue
@ -28,7 +28,7 @@ def isPhoneNum(phonenum):
print("输入的手机号开头不为1请重新输入") print("输入的手机号开头不为1请重新输入")
return False return False
elif len(phonenum) != 11: elif len(phonenum) != 11:
print("输入的手机号长度不对【11位】,请重新输入!") print("输入的手机号长度不对[11位],请重新输入!")
return False return False
elif not phonenum.isdigit(): elif not phonenum.isdigit():
print("输入的手机号必须全部是数字,请重新输入!") print("输入的手机号必须全部是数字,请重新输入!")
@ -50,20 +50,21 @@ def identifyInput():
def isCardExist(cards): def isCardExist(cards):
cardN = input("请输入账号:") cardN = input("请输入账号:")
password = input("请输入密码:") password = input("请输入密码:")
while True: while True:
for card in cards: for card in cards:
if cardN == card.carN: if cardN == card.cardN:
if password == card.cardPassword: if password == card.cardPassword:
return card return card
else: else:
password = input("密码有误,请重新输入密码:") password = input("密码有误,请重新输入密码:")
break break
else: else:
cardN = input("账号不存在,请重新输入账号:") cardN = input("账号不存在请重新输入账号或者返回返回请输入t")
if cardN == 't':
return
password = input("请输入密码:") password = input("请输入密码:")

@ -38,27 +38,3 @@ class AppendCard(Card):
with open("cardinfo.txt", "a", encoding="utf-8") as fa: with open("cardinfo.txt", "a", encoding="utf-8") as fa:
json.dump(card, fa, default=self.card2Dict) json.dump(card, fa, default=self.card2Dict)
fa.write('\n') fa.write('\n')
# 删
class Del(object):
def __init__(self):
pass
def del_(self, cardN):
readcard = ReadCard()
cards = readcard.read()
for card in cards:
if cardN == card.cardN:
cards.remove(card)
break
else:
print("卡号不存在,请重新输入!")
return False
appendcard = AppendCard()
appendcard.append('', mode='w')
for card in cards:
appendcard.append(card)
return True

Binary file not shown.
Loading…
Cancel
Save