import re, time
def users_login(x, y, z):
account = input('请您输出账号:')
password = input('请您输出明码:')
if account in x:
if x[account][0] == password:
time.sleep(0.5)
print('明码正确,登录胜利!')
while True:
operation = input('请您抉择操作(1. 会员信息 2. 购买影票 3. 购票信息 4. 影票退订 5. 批改信息 6. 退出零碎):')
if operation == '1':
time.sleep(0.5)
print('*' * 7 + '会员信息' + '*' * 7)
print('会员卡号:{}'.format(account))
print('会员昵称:{}'.format(x[account][1]))
print('会员性别:{}'.format(x[account][2]))
print('手机号码:{}'.format(x[account][3]))
print('*' * 21)
elif operation == '2':
time.sleep(0.5)
print('*' * 3 + '电影放映表' + '*' * 3)
for a, b in list(enumerate(y, 1)):
print(a, b['name'])
print('*' * 13)
buy = int(input('请您抉择电影场次:'))
time.sleep(0.5)
print('*' * 8 + '电影信息' + '*' * 8)
print('影名:{}'.format(y[buy - 1]['name']))
print('类别:{}'.format(y[buy - 1]['category']))
print('导演:{}'.format(y[buy - 1]['director']))
print('演员:{}'.format(y[buy - 1]['actor']))
print('*' * 23)
while True:
time.sleep(0.5)
print('*' * 13 + '影厅座位' + '*' * 13)
for i in y[buy - 1]['seat']:
print(' '.join(i))
print('*' * 32)
choose = input('是否持续购票(1. 持续 2. 退出):')
if choose == '2':
break
line_numbers = int(input('请您抉择影厅行号:'))
seat_numbers = int(input('请您抉择影厅座号:'))
if y[buy - 1]['seat'][line_numbers][seat_numbers] == '■':
print('不好意思,座位已选!')
else:
y[buy - 1]['seat'][line_numbers][seat_numbers] = '■'
time.sleep(0.5)
print('购票胜利,电影名:{} 座位号:{}排 {} 号'.format(y[buy - 1]['name'], line_numbers, seat_numbers))
if account in z and y[buy - 1]['name'] in z[account]:
z[account][y[buy - 1]['name']].append('{}排 {} 号'.format(line_numbers, seat_numbers))
elif account in z and y[buy - 1]['name'] not in z[account]:
z[account][y[buy - 1]['name']] = ['{}排 {} 号'.format(line_numbers, seat_numbers)]
else:
z[account] = {y[buy - 1]['name']: ['{}排 {} 号'.format(line_numbers, seat_numbers)]}
elif operation == '3':
if account in z:
for i in z[account]:
time.sleep(0.5)
print('卡号:{} 昵称:{} 影名:{} 座位:{}'.format
(account, x[account][1], i,' '.join(z[account][i])))
else:
print('未查问到购票信息')
elif operation == '4':
if account in z:
for i in z[account]:
time.sleep(0.5)
print('卡号:{} 昵称:{} 影名:{} 座位:{}'.format(account, x[account][1], i,
‘.join(zaccount)))
print('[金属期货](https://www.gendan5.com/cf/mf.html)未查问到订票信息')
while True:
unsubscribe = input('是否须要退订影票(1. 须要 2. 退出):')
if unsubscribe == '2':
break
else:
name = dict(enumerate(z[account], 1))
for i in name:
print(i, name[i])
movie_number = int(input('请您抉择须要退票电影序号:'))
number = dict(enumerate(z[account][name[movie_number]], 1))
for i in number:
print(i, number[i])
seat_number = int(input('请您抉择须要退票电影座位:'))
message = re.findall(r'\d+', number[seat_number])
for i in y:
if name[movie_number] == i['name']:
i['seat'][int(message[0])][int(message[1])] = '□'
zaccount].remove(number[seat_number])
time.sleep(0.5)
print('退票胜利!')
if not z[account][name[movie_number]]:
del z[account][name[movie_number]]
elif operation == '5':
time.sleep(0.5)
print('*' * 7 + '会员信息' + '*' * 7)
print('会员卡号:{}'.format(account))
print('会员昵称:{}'.format(x[account][1]))
print('会员性别:{}'.format(x[account][2]))
print('手机号码:{}'.format(x[account][3]))
print('*' * 21)
while True:
modify = input('是否持续批改(1. 持续 2. 退出):')
if modify == '2':
break
choose = input('请您抉择批改内容(1. 会员昵称 2. 会员性别 3. 手机号码):')
if choose == '1':
x[account][1] = input('请输出会员昵称:')
elif choose == '2':
x[account][2] = input('请输出会员性别:')
elif choose == '3':
x[account][3] = input('请输出手机号码:')
elif operation == '6':
print('零碎退出胜利,欢送下次应用!')
break
else:
print('明码谬误,登录失败!')
else:
print('账号谬误,请您核查!')