diff --git a/Coding_Face_to_Object___banksystem.docx b/Coding_Face_to_Object___banksystem.docx deleted file mode 100644 index 568fda2..0000000 Binary files a/Coding_Face_to_Object___banksystem.docx and /dev/null differ diff --git a/banksystem/__pycache__/admin.cpython-38.pyc b/banksystem/__pycache__/admin.cpython-38.pyc index a8e356a..9a09fbd 100644 Binary files a/banksystem/__pycache__/admin.cpython-38.pyc and b/banksystem/__pycache__/admin.cpython-38.pyc differ diff --git a/banksystem/__pycache__/atm.cpython-38.pyc b/banksystem/__pycache__/atm.cpython-38.pyc index 0ea6794..6bcdb9e 100644 Binary files a/banksystem/__pycache__/atm.cpython-38.pyc and b/banksystem/__pycache__/atm.cpython-38.pyc differ diff --git a/banksystem/__pycache__/check.cpython-38.pyc b/banksystem/__pycache__/check.cpython-38.pyc index dcf99b6..100f87e 100644 Binary files a/banksystem/__pycache__/check.cpython-38.pyc and b/banksystem/__pycache__/check.cpython-38.pyc differ diff --git a/banksystem/__pycache__/readAppendCard.cpython-38.pyc b/banksystem/__pycache__/readAppendCard.cpython-38.pyc index a84c9fb..a81e276 100644 Binary files a/banksystem/__pycache__/readAppendCard.cpython-38.pyc and b/banksystem/__pycache__/readAppendCard.cpython-38.pyc differ diff --git a/banksystem/admin.py b/banksystem/admin.py index 1d8e302..f9d507e 100644 --- a/banksystem/admin.py +++ b/banksystem/admin.py @@ -11,9 +11,6 @@ class Admin(object): def __init__(self,admin,password): self.admin = admin self.password = password - - - # 管理员界面 def window(self): print("*-------------------------------------------------------------*") @@ -26,7 +23,6 @@ class Admin(object): print("*-------------------------------------------------------------*") time.sleep(1) return - #管理员登录界面 def login(self): print("*------------------------------------*") @@ -46,7 +42,6 @@ class Admin(object): del check time.sleep(3) return - # 管理员注销界面 def logout(self): print("*-------------------------------------------------------------------------------*") @@ -61,15 +56,12 @@ class Admin(object): checkt = Check() if not check.isSure('注销'): return False - checkt.userName(self.admin,self.password) print("*-------------注销成功---------------*") print(" 正在关闭系统,请稍候... ") del check time.sleep(3) - return True - #系统功能界面 ''' 系统功能:开户,查询,取款,存储,转账,销户,挂失,解锁,改密,退出 diff --git a/banksystem/atm.py b/banksystem/atm.py index 23071b3..a16ac93 100644 --- a/banksystem/atm.py +++ b/banksystem/atm.py @@ -20,6 +20,8 @@ class ATM(object): def newAccount(self): # 输入身份证号和手机号 + if not check.isSure("是否开户\n"): + return pnum = check.phoneNumInput() iden = check.identifyInput() print("正在执行开户程序,请稍候...") @@ -35,7 +37,7 @@ class ATM(object): # 初始化卡号密码,卡里的钱,卡的锁定状态 card = Card(cardN, '000000', 0, iden, pnum, 'False') self.appendCard.append(card) - print("开户成功,您的卡号为%s,密码为%s,卡余额为%d。" % (cardN, '888888', 0)) + print("开户成功,您的卡号为%s,密码为%s,卡余额为%d。" % (cardN, '000000', 0)) print("请牢记密码,不要把密码泄露给他人。") # 更新卡号列表 self.cards = self.readCard.read() @@ -43,6 +45,8 @@ class ATM(object): # 查询 def checkMoney(self): + if not check.isSure("是否查询\n"): + return card = check.isCardExist(self.cards) if check.isCardLock(self.cards, card.cardN): return @@ -52,6 +56,8 @@ class ATM(object): # 存储 def saveMoney(self): + if not check.isSure("是否存储\n"): + return card = check.isCardExist(self.cards) if check.isCardLock(self.cards, card.cardN): return @@ -66,6 +72,8 @@ class ATM(object): # 取款 def getMoney(self): + if not check.isSure("是否取款\n"): + return card = check.isCardExist(self.cards) if check.isCardLock(self.cards, card.cardN): return @@ -80,10 +88,11 @@ class ATM(object): print("取款成功!你卡上的余额为%d元!" % self.cards[index].cardMoney) time.sleep(1) - pass # 转账 def inMoney(self): + if not check.isSure("是否转帐\n"): + return card = check.isCardExist(self.cards) if check.isCardLock(self.cards, card.cardN): return @@ -117,10 +126,11 @@ class ATM(object): self.writeCard() print("转账成功!你卡上的余额为%d元!" % self.cards[index].cardMoney) time.sleep(1) - pass # 销户 def DAccount(self): + if not check.isSure("是否销户\n"): + return card = check.isCardInfoSure(self.cards) if card: self.cards.remove(card) @@ -128,10 +138,10 @@ class ATM(object): print("销户成功!") time.sleep(1) - pass - # 挂失 def hangOutAccount(self): + if not check.isSure("是否挂失\n"): + return card = check.isCardInfoSure(self.cards) if check.isCardLock(self.cards, card.cardN): return @@ -142,10 +152,11 @@ class ATM(object): print("挂失成功!") time.sleep(1) - pass # 解锁 def unlockAccount(self): + if not check.isSure("是否解锁\n"): + return card = check.isCardInfoSure(self.cards) index = self.cards.index(card) self.cards[index].cardLock = "False" @@ -153,23 +164,21 @@ class ATM(object): print("解锁成功!") time.sleep(1) - pass # 改密 def changePassword(self): + if not check.isSure("是否改密\n"): + return card = check.isCardInfoSure(self.cards) if check.isCardLock(self.cards, card.cardN): return - newpassword = input("请输入新密码") + newpassword = input("请输入新密码:") index = self.cards.index(card) self.cards[index].cardPassword = newpassword self.writeCard() print("改密成功!") time.sleep(1) - - pass - # 写入文件 def writeCard(self): self.appendCard.append('', mode='w') diff --git a/banksystem/cardinfo.txt b/banksystem/cardinfo.txt index 7c53d41..a25608c 100644 --- a/banksystem/cardinfo.txt +++ b/banksystem/cardinfo.txt @@ -1,3 +1,3 @@ -{"cardN": "510146", "cardPassword": "000000", "cardMoney": 0, "identityId": "370105", "phoneNum": "19580768517", "cardLock": "False"} -{"cardN": "507229", "cardPassword": "000000", "cardMoney": 0, "identityId": "370105", "phoneNum": "15564160506", "cardLock": "False"} +{"cardN": "507229", "cardPassword": "123456", "cardMoney": 200, "identityId": "370105", "phoneNum": "15564160506", "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"} diff --git a/banksystem/check.py b/banksystem/check.py index 6996d0d..8e8030e 100644 --- a/banksystem/check.py +++ b/banksystem/check.py @@ -13,7 +13,7 @@ def isCardNExist(cards, cardN): def isSure(operate): while True: - res = input("是否确认%s?【yes/no】" % operate) + res = input("是否确认%s[yes/no]" % operate) if res not in ['yes', 'no']: print("输入有误,请重新输入!") continue @@ -28,7 +28,7 @@ def isPhoneNum(phonenum): print("输入的手机号开头不为1,请重新输入!") return False elif len(phonenum) != 11: - print("输入的手机号长度不对【11位】,请重新输入!") + print("输入的手机号长度不对[11位],请重新输入!") return False elif not phonenum.isdigit(): print("输入的手机号必须全部是数字,请重新输入!") @@ -50,20 +50,21 @@ def identifyInput(): def isCardExist(cards): - cardN = input("请输入账号:") password = input("请输入密码:") while True: for card in cards: - if cardN == card.carN: + if cardN == card.cardN: if password == card.cardPassword: return card else: password = input("密码有误,请重新输入密码:") break else: - cardN = input("账号不存在,请重新输入账号:") + cardN = input("账号不存在,请重新输入账号或者返回,返回请输入t:") + if cardN == 't': + return password = input("请输入密码:") diff --git a/banksystem/readAppendCard.py b/banksystem/readAppendCard.py index 4b9c87b..bb2d691 100644 --- a/banksystem/readAppendCard.py +++ b/banksystem/readAppendCard.py @@ -38,27 +38,3 @@ class AppendCard(Card): with open("cardinfo.txt", "a", encoding="utf-8") as fa: json.dump(card, fa, default=self.card2Dict) 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 - diff --git a/fileWord.docx b/fileWord.docx new file mode 100644 index 0000000..9635b79 Binary files /dev/null and b/fileWord.docx differ