def show(): print u"\n\n\n +++++++++++++你已经进入流水相关服务 : +++++++++++++" cardNo = sql.readLoginCardNo() if not cardNo: print u"请先登录..." login.loginStart() cardNo = sql.readLoginCardNo() while True: utils.printTable(flowService) num = raw_input(u"请选择对应服务 或者 输入q退出 :") if num == 'q': break regex = re.compile(r"\d+") if (not regex.match(num)) or ( int(num) >= len(flowService)): print u"请输入正确服务号码" continue num = int(num) break result = flowService[num].values().pop()() if not result : print u"无任何记录" return True for t in result: tmpDict = {'type':t.get('type'),'money':t.get('money')} tmpDict['time'] = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(t.get('time'))) print tmpDict return True
def readFlow(): """ 读取流水记录 """ cardNo = sql.readLoginCardNo() if not cardNo: print u"请先登录..." login.loginStart() cardNo = sql.readLoginCardNo() result = sql.readFlow(cardNo) if not result:return [] return result
def getMoney(): """ 存款 """ print u"\n\n\n +++++++++++++你已经进入取款相关服务 :+++++++++++++ " cardNo = sql.readLoginCardNo() if not cardNo: print u"请先登录..." login.loginStart() cardNo = sql.readLoginCardNo() money = inputMoney() if not money:return False sql.updateMoney(cardNo,'-'+money)
def getMoney(): """ 存款 """ print u"\n\n\n +++++++++++++你已经进入取款相关服务 :+++++++++++++ " cardNo = sql.readLoginCardNo() if not cardNo: print u"请先登录..." login.loginStart() cardNo = sql.readLoginCardNo() money = inputMoney() if not money: return False sql.updateMoney(cardNo, '-' + money)
def readFlowByCondition(): """ 根据时间段读取流水记录 """ cardNo = sql.readLoginCardNo() if not cardNo: print u"请先登录..." login.loginStart() cardNo = sql.readLoginCardNo() print u"请输入查询开始时间:" beginTime = readTime() if not beginTime:return False print u"请输入查询结束时间:" endTime = readTime() if not endTime:return False beginTime = int(time.mktime(time.strptime(beginTime,'%Y-%m-%d %H:%M:%S'))) endTime = int(time.mktime(time.strptime(endTime,'%Y-%m-%d %H:%M:%S'))) result = sql.readFlow(cardNo,beginTime,endTime) if not result:return [] return result
def resetPwd(): """ 重置密码 """ print u"\n\n\n +++++++++++++你已经进入重置密码相关服务 :+++++++++++++ " if not login.loginStart(): print (u"登录失败,不能重置密码") return False try: print (u"---------------重置密码-----------------") passwd = register.readPasswd() #输入新密码 passwd = utils.encrypt(passwd) cardNo = sql.readLoginCardNo() sql.updateData(cardNo,{'password':passwd}) #更新数据 except MyException,e: print e return False