bin
start.py
1 import os 2 import sys 3 4 # 添加环境变量 5 sys.path.append(os.path.dirname(os.path.dirname(__file__))) 6 7 # 导模块 8 from core import src 9 10 # 自运行 11 if __name__ == '__main__': 12 src.run()
conf
settings.py
1 import os 2 3 4 BEST_PATH = os.path.dirname(os.path.dirname(__file__)) 5 DB_PATH = os.path.join(BEST_PATH, 'db') 6 7 # 日志 8 import logging.config # 配置,布局 9 """ 10 知识点1:日志输出的格式 11 """ 12 # 定义三种日志输出的格式 # 开始 13 # standart 标准格式 14 standart_format = '[%(asctime)s][%(threadName)s:%(thread)d][task_id:%(name)s][%(filename)s:%(lineno)d]' 15 '[%(levelname)s][%(message)s]' # name 为getlogger 指定的名字 16 # simple 简单格式 17 simple_format = '[%(levelname)s][%(asctime)s][%(filename)s:%(lineno)d]%(message)s' 18 # 定义日志输出的格式 # 结束 19 20 """ 21 # 知识点2 22 下面的两个变量对应的值 需要你手动修改 23 """ 24 # # log文件的目录 25 logfile_dir = os.path.dirname(os.path.dirname(__file__)) 26 # log文件名 27 logfile_name = 'log.log' 28 29 30 """ 31 # 知识点3 32 # 如果不存在定义的日志目录就创建一个 33 """ 34 # os.path.isdir 判断指定路径是否存在 35 if not os.path.isdir(logfile_dir): 36 # os.mkdir 创建新文件 37 os.mkdir(logfile_dir) 38 """ 39 知识点4 40 log文件的全路径 41 """ 42 # 把指定路径拼接到名字中 43 logfile_path = os.path.join(logfile_dir,f'{logfile_dir}/{logfile_name}.log') 44 45 """ 46 知识点5 47 log配置文件 48 """ 49 LOGGING_DIC = { 50 'version': 1, # version版本 51 'disable_existing_loggers': False, # disable_existing_loggers 禁用现有记录器 52 'formatters': { 53 'standard': { 54 'format': standart_format 55 }, # format 格式 56 'simple': { 57 'format': simple_format 58 }, 59 }, 60 'filters': {}, # 过滤日志 61 'handlers': { 62 #打印到终端的日志 63 'console': { 64 'level': 'DEBUG', 65 'class': 'logging.StreamHandler', # 打印到屏幕 66 'formatter': 'simple' 67 }, 68 #打印到文件的日志,收集info及以上的日志 69 'default': { 70 'level': 'DEBUG', 71 'class': 'logging.handlers.RotatingFileHandler', # 保存到文件 72 'formatter': 'standard', 73 'filename': logfile_path, # 日志文件 74 'maxBytes': 1024*1024*5, # 日志大小 5M 75 'backupCount': 5, 76 'encoding': 'utf-8', # 日志文件的编码,再也不用担心中文log乱码了 77 }, 78 }, 79 'loggers': { 80 #logging.getLogger(__name__)拿到的logger配置 81 '': { 82 'handlers': ['default', 'console'], # 这里把上面定义的两个handler都加上,即log数据既写入文件又打印到屏幕 83 'level': 'DEBUG', 84 'propagate': True, # 向上(更高level的logger)传递 85 }, # 当键不存在的情况下 默认都会使用该k:v配置 86 }, 87 }
core
src.py
1 from interface import user_interface,bank_interface,admin_interface,shop_interface 2 from lib import common 3 # 用户保存登录状态 4 user_info = { 5 'name':None, 6 } 7 # 管理员保存登录状态 8 admin_info ={ 9 'name':None, 10 } 11 # 商城列表 12 shop_list = [ 13 ['电动车', 1500], 14 ['快餐', 18], 15 ['特步', 299], 16 ['绝味', 50], 17 ['夏季套装', 699], 18 ] 19 # 功能 20 # 1.注册 21 def register(): 22 while True: 23 name = input('please input your name>>>:').strip() 24 # 调用查询接口 25 flag = user_interface.register_check(name) 26 if flag: 27 print('账户已存在,请重新输入') 28 continue 29 pwd = input('please input your pwd>>>:').strip() 30 re_pwd = input('please agin input your pwd>>>:').strip() 31 if re_pwd == pwd: 32 # 调用接口层 33 msg = user_interface.register_interface(name,common.get_md5(pwd)) 34 if msg: 35 print(msg) 36 break 37 else: 38 print('注册失败') 39 else: 40 print('两次密码不一致') 41 # 2.登录 42 def login(): 43 while True: 44 name = input('please input your name>>>:').strip() 45 # 调用查询接口 46 flag = user_interface.register_check(name) 47 if flag: 48 pwd = input('please input your pwd>>>:').strip() 49 50 # 调用接口层 51 flag,msg = user_interface.login_interface(name,pwd) 52 if flag: 53 print(msg) 54 user_info['name'] = name 55 break 56 else: 57 print(msg) 58 else: 59 print('账户不存在,请重新输入') 60 continue 61 # 3.查看余额 62 @common.auth 63 def show_money(): 64 print('查询余额!!!') 65 name = user_info['name'] 66 money = bank_interface.select_money_interface(name) 67 print(f'{name}余额>>>:',money) 68 69 70 # 4.提现 71 @common.auth 72 def pop_money(): 73 print('提现功能!!!') 74 pop_name_money = input('请输入提现金额>>>:').strip() 75 if pop_name_money.isdigit(): 76 pop_name_money = int(pop_name_money) 77 else: 78 print('必须输入数字') 79 name = user_info['name'] 80 msg = bank_interface.pop_money_interface(name,pop_name_money) 81 if msg: 82 print(msg) 83 else: 84 print(msg) 85 86 # 5.还款 87 @common.auth 88 def add_money(): 89 print('还款功能!!!') 90 add_name_money = input('请输入还款金额>>>:').strip() 91 if add_name_money.isdigit(): 92 add_name_money = int(add_name_money) 93 else: 94 print('必须输入数字') 95 name = user_info['name'] 96 msg = bank_interface.add_money_interface(name, add_name_money) 97 if msg: 98 print(msg) 99 else: 100 print(msg) 101 # 6.转账 102 @common.auth 103 def move_money(): 104 print('转账功能!!!') 105 user = input('请输入转账目标>>>:').strip() 106 # 确认账号是否存在 107 flag = user_interface.register_check(user) 108 if flag: 109 move_name_money = input('请输入转账金额>>>:').strip() 110 if move_name_money.isdigit(): 111 move_name_money = int(move_name_money) 112 else: 113 print('必须输入数字') 114 name = user_info['name'] 115 msg = bank_interface.move_money_interface(name,user,move_name_money) 116 if msg: 117 print(msg) 118 else: 119 print(msg) 120 else: 121 print(f'{user}账号不存在') 122 # 7.查看流水 123 @common.auth 124 def select_log(): 125 print('查看流水功能') 126 name = user_info['name'] 127 msg = bank_interface.select_log_interface(name) 128 print(msg) 129 # 8.购物车功能 130 @common.auth 131 def go_shopping(): 132 # 商城列表 133 shop_list = [ 134 ['电动车', 1500], 135 ['快餐', 18], 136 ['特步', 299], 137 ['绝味', 50], 138 ['夏季套装', 699], 139 ] 140 # 查询下账户余额 141 name = user_info['name'] 142 money = bank_interface.select_money_interface(name) 143 # 定义一个购物车 144 shop_cart = {} 145 # 定义一个消费总金额 146 cost = 0 147 while True: 148 # 打印一个商城列表 149 for shop,price in enumerate(shop_list,start=1): 150 print(shop,price) 151 # 选择索引作为商品编号 152 choose = input('choose(choose = q "退出购物车,进入支付页面")>>>:').strip() 153 if choose.isdigit(): 154 choose = int(choose) 155 if choose in range(1,len(shop_list)+1): 156 shop = shop_list[choose-1][0] 157 price = shop_list[choose-1][1] 158 if money >= price: 159 # 添加购物车 160 if shop in shop_cart: 161 shop_cart[shop] += 1 162 else: 163 shop_cart[shop] = 1 164 # 计算出消费金额 165 cost += price 166 else: 167 print(f'{name}余额不足') 168 else: 169 print('超出范围,请重新输入') 170 elif choose == 'q': 171 for k,v in shop_cart.items(): 172 print(k,v) 173 is_buy = input('is_buy(y/n)(q.quit)>>>:').strip() 174 if is_buy == 'y': 175 # 调用商城支付功能,并调用银行支付接口 176 msg = shop_interface.go_shopping_interface(name,cost) 177 cost = 0 178 if msg: 179 print(msg) 180 else: 181 print(msg) 182 elif is_buy == 'n': 183 # 调用添加购物接口 184 msg = shop_interface.go_shop_cart_interface(name,shop_cart) 185 if msg: 186 print(msg) 187 else: 188 print(msg) 189 elif is_buy == 'q': 190 print('退出') 191 break 192 else: 193 print('输入错误,只能输入(y/n)') 194 else: 195 print('必须输入数字') 196 197 198 199 200 201 # 9.查看购物车 202 @common.auth 203 def select_go_shop(): 204 name = user_info['name'] 205 msg = shop_interface.select_shop_cart_interface(name) 206 print(msg) 207 # 10.注销 208 @common.auth 209 def go_quit(): 210 name = user_info['name'] 211 msg = user_interface.go_quit_interface(name) 212 print(msg) 213 214 # 管理员功能 215 # 1.登录 216 def admin_login(): 217 while True: 218 name = input('please input your name>>>:').strip() 219 pwd = input('please input your pwd>>>:').strip() 220 if name == 'gly' and pwd == '123': 221 admin_info['name'] = name 222 print('登陆成功') 223 break 224 else: 225 print('登录失败') 226 # 2.冻结账户 227 @common.outter 228 def admin_lock(): 229 name = input('name>>>:').strip() 230 # 查看账户是否存在 231 flag = user_interface.register_check(name) 232 if flag: 233 print('账户存在') 234 msg = admin_interface.admin_interface_true(name) 235 print(msg) 236 else: 237 print('账号不存在') 238 # 3.解冻账户 239 @common.outter 240 def admin_flase(): 241 name = input('name>>>:').strip() 242 # 查看账户是否存在 243 flag = user_interface.register_check(name) 244 if flag: 245 print('账号输入正确') 246 msg = admin_interface.admin_interface_false(name) 247 print(msg) 248 else: 249 print('账号不存在') 250 # 4.修改额度 251 @common.outter 252 def admin_update_money(): 253 name = input('name>>>:').strip() 254 # 查看账户是否存在 255 flag = user_interface.register_check(name) 256 if flag: 257 print('账户输入正确') 258 money = input('money>>>:').strip() 259 # 调修额度口 260 msg = admin_interface.update_money_interface(name,money) 261 print(msg) 262 else: 263 print('无此账号,请重新输入') 264 # 注销 265 @common.outter 266 def go_logout(): 267 name = admin_info['name'] 268 msg = admin_interface.go_logout_interface(name) 269 print(msg) 270 func_admin_dic = { 271 '1':admin_login, 272 '2':admin_lock, 273 '3':admin_flase, 274 '4':admin_update_money, 275 } 276 # 12.管理员功能 277 def admin(): 278 print('欢迎进入管理员功能') 279 while True: 280 print(""" 1.登录 2.冻结账户 3.解冻账户 4.修改额度 q.quit """) 281 choose = input('please input your choose>>>:').strip() 282 if choose == 'q': 283 print('quit!!!') 284 break 285 elif choose in func_admin_dic: 286 func_admin_dic[choose]() 287 # func_dic.get("choose") 288 else: 289 print('input False , please again input!!!') 290 # 映射 291 func_dic = { 292 '1':register, 293 '2':login, 294 '3':show_money, 295 '4':pop_money, 296 '5':add_money, 297 '6':move_money, 298 '7':select_log, 299 '8':go_shopping, 300 '9':select_go_shop, 301 '10':go_quit, 302 '11':admin, 303 304 } 305 # 主函数 306 def run(): 307 print('欢迎光临ATM--购物车!!!') 308 while True: 309 print(""" 1.注册 2.登录 3.查看余额 4.提现 5.还款 6.转账 7.查看流水 8.购物车功能 9.查看购物车 10.注销 11.管理员功能 q.退出 """) 310 choose = input('please input your choose>>>:').strip() 311 if choose == 'q': 312 print('quit!!!') 313 break 314 elif choose in func_dic: 315 func_dic[choose]() 316 # func_dic.get("choose") 317 else: 318 print('input False , please again input!!!') 319 # continue
db
db_handler.py
l
1 import os 2 import json 3 from conf import settings 4 # 查询 5 def select(name): 6 user_path = f'{settings.DB_PATH}/{name}.json' 7 if os.path.exists(user_path): 8 with open(user_path, 'r', encoding='utf-8')as f: 9 user_dic = json.load(f) 10 f.flush() 11 return user_dic 12 # 存储信息导数据库--db 13 def save(user_dic): 14 user_path = f'{settings.DB_PATH}/{user_dic.get("name")}.json' 15 with open(user_path, 'w', encoding='utf-8')as f: 16 json.dump(user_dic, f) 17 f.flush() 18 return f'{user_dic.get("name")}用户注册成功'
interface
admin_interface.py
1 from db import db_handler 2 from lib import common 3 # 管理员功能-冻结 4 def admin_interface_true(name): 5 user_dic = db_handler.select(name) 6 user_dic['lock'] = True 7 msg = f'{name}账号已被管理员冻结' 8 common.get_log('').debug(msg) 9 user_dic['flow'].append(msg) 10 db_handler.save(user_dic) 11 return msg 12 # 管理员功能--解冻 13 def admin_interface_false(name): 14 user_dic = db_handler.select(name) 15 user_dic['lock'] = False 16 msg = f'{name}账号已被管理员解冻' 17 common.get_log('').debug(msg) 18 user_dic['flow'].append(msg) 19 db_handler.save(user_dic) 20 return msg 21 # 修改额度 22 def update_money_interface(name,money): 23 user_dic = db_handler.select(name) 24 user_dic['money'] = money 25 msg = f'{name}修改账户余额为[{user_dic["money"]}]元' 26 user_dic['flow'].append(msg) 27 common.get_log('').debug(msg) 28 db_handler.save(user_dic) 29 return msg 30 # 注销 31 def go_logout_interface(name): 32 from core import src 33 user_dic = db_handler.select(name) 34 src.admin_info['name'] = None 35 msg = f'{name}账户已注销' 36 user_dic['flow'].append(msg) 37 common.get_log('').debug(msg) 38 return msg
bank_interface.py
1 from db import db_handler 2 from lib import common 3 # 查询余额接口 4 def select_money_interface(name): 5 user_dic = db_handler.select(name) 6 # money = user_dic['money'] 7 return user_dic['money'] 8 9 # 提现接口 10 def pop_money_interface(name,pop_name_money): 11 user_dic = db_handler.select(name) 12 if user_dic['lock']: 13 msg = f'{name}账号已被冻结' 14 else: 15 money = user_dic['money'] 16 if money >= pop_name_money * 1.05: 17 user_dic['money'] -= pop_name_money * 1.05 18 msg = f'{name}取现f[{pop_name_money}]成功' 19 20 else: 21 msg = f'{name}余额不足' 22 user_dic['flow'].append(msg) 23 db_handler.save(user_dic) 24 common.get_log('').debug(msg) 25 return msg 26 27 28 # 还款接口 29 def add_money_interface(name,add_name_money): 30 user_dic = db_handler.select(name) 31 if user_dic['lock']: 32 msg = f'{name}账号已被冻结' 33 else: 34 user_dic['money'] += add_name_money 35 msg = f'{name}还款f[{add_name_money}]成功' 36 user_dic['flow'].append(msg) 37 db_handler.save(user_dic) 38 common.get_log('').debug(msg) 39 return msg 40 # 转账接口 41 def move_money_interface(name,user,move_name_money): 42 user_dic = db_handler.select(name) 43 if user_dic['lock']: 44 msg = f'{name}账号已被冻结' 45 else: 46 money = user_dic['money'] 47 if money >= move_name_money: 48 user_dic['money'] -= move_name_money 49 db_handler.save(user_dic) 50 # 收钱人 51 user_dic = db_handler.select(user) 52 user_dic['money'] += move_name_money 53 msg = f'{name}转账给f[{user}]f[{move_name_money}]成功' 54 else: 55 msg = f'{name}余额不足' 56 user_dic['flow'].append(msg) 57 db_handler.save(user_dic) 58 common.get_log('').debug(msg) 59 return msg 60 61 # 查看流水接口 62 def select_log_interface(name): 63 user_dic = db_handler.select(name) 64 return user_dic['flow'] 65 66 # 银行支付接口 67 def cost_money_interface(name,cost): 68 user_dic = db_handler.select(name) 69 if user_dic['money'] >= cost: 70 user_dic['money'] -= cost 71 msg = f'{name}支付[{cost}],剩余金额[{user_dic["money"]}]' 72 else: 73 msg = f'{name}余额不足' 74 common.get_log('').debug(msg) 75 user_dic['flow'].append(msg) 76 db_handler.save(user_dic) 77 return msg
shop_interface.py
1 from db import db_handler 2 from interface import bank_interface 3 from lib import common 4 # 查看流水接口 5 def select_log_interface(name): 6 user_dic = db_handler.select(name) 7 return user_dic['flow'] 8 # 商城结账接口 9 def go_shopping_interface(name,cost): 10 flag = bank_interface.cost_money_interface(name,cost) 11 if flag: 12 print(flag) 13 else: 14 print(flag) 15 # 调用添加购物车接口 16 def go_shop_cart_interface(name,shop_cart): 17 user_dic = db_handler.select(name) 18 old_cart = user_dic['shop_cart'] 19 # 查看shop 在旧购物车中中是否存在 20 # 打印新购物车的shop 21 for shop in shop_cart: 22 print(shop) 23 # 获取产品在当前购物车的数量 24 number = shop_cart[shop] 25 if shop in old_cart: 26 # 给就购物车做增值运算 27 old_cart[shop] += number 28 msg = f'{name}购物车中原先就存在商品[{shop}],新增[{number}]' 29 else: 30 # 给就购物车做增值运算 31 old_cart[shop] = number 32 msg = f'{name}购物车中原先没有商品[{shop}],添加[{number}]' 33 common.get_log('').debug(msg) 34 user_dic['flow'].append(msg) 35 user_dic['shop_cart'].update(old_cart) 36 db_handler.save(user_dic) 37 return msg 38 # 查看购物车接口 39 def select_shop_cart_interface(name): 40 user_dic = db_handler.select(name) 41 return user_dic['shop_cart']
user_interface.py
1 from db import db_handler 2 from lib import common 3 # 查询接口 4 def register_check(name): 5 user_dic = db_handler.select(name) 6 if user_dic: 7 # 账号已存在 8 return True 9 # 注册接口 10 def register_interface(name,pwd,money=20000): 11 user_dic = { 12 'name': name, 13 'pwd': pwd, 14 'money': money, 15 'flow':[], 16 'shop_cart':{}, 17 'lock':False 18 } 19 # 保存信息到数据库 20 db_handler.save(user_dic) 21 msg = f'{user_dic.get("name")}用户注册成功' 22 user_dic['flow'].append(msg) 23 common.get_log('').debug(msg) 24 # 给用户层返回注册结构 25 return msg 26 # 登录接口 27 def login_interface(name,pwd): 28 user_dic = db_handler.select(name) 29 re_pwd = user_dic.get("pwd") 30 if common.get_md5(pwd) == re_pwd: 31 msg = f'{user_dic.get("name")}用户登录成功' 32 user_dic['flow'].append(msg) 33 common.get_log('').debug(msg) 34 return True,msg 35 else: 36 msg = f'{user_dic.get("name")}密码登录错误' 37 user_dic['flow'].append(msg) 38 common.get_log('').debug(msg) 39 return False,msg 40 # 注销接口 41 def go_quit_interface(name): 42 from core import src 43 user_dic = db_handler.select(name) 44 src.user_info['name'] = None 45 msg = f'{name}账户已注销,欢迎下次光临' 46 user_dic['flow'].append(msg) 47 common.get_log('').debug(msg) 48 return msg
lib
common.py
1 import hashlib 2 from functools import wraps 3 from conf import settings 4 import logging.config 5 # 加密 6 def get_md5(pwd): 7 md = hashlib.md5() 8 md.update(pwd.encode('utf-8')) 9 return md.hexdigest() 10 11 # 装饰器 12 def auth(func): 13 from core import src 14 @wraps(func) 15 def inner(*args,**kwargs): 16 # from core import src 17 if src.user_info['name']: 18 res = func(*args,**kwargs) 19 return res 20 else: 21 print('未登录自动为您跳转到登录页面') 22 src.login() 23 print('登陆成功,请重新选择') 24 return inner 25 26 27 # 管理员装饰器 28 def outter(func): 29 from core import src 30 @wraps(func) 31 def inner(*args,**kwargs): 32 if src.admin_info['name']: 33 res = func(*args,**kwargs) 34 return res 35 else: 36 print('管理员未登录,自动为您跳转到登录页面') 37 src.admin_login() 38 print('登录完成,请重新选择') 39 return inner 40 # 生成日志 41 def get_log(type_name): 42 # 自动加载字典中的配置 43 logging.config.dictConfig(settings.LOGGING_DIC) 44 # 负责生产日志 45 logger1 = logging.getLogger(type_name) 46 # 记录日志 47 return logger1
log
log.log.log
1 [2019-07-23 18:44:43,898][MainThread:80144][task_id:root][user_interface.py:22][DEBUG][llx用户注册成功] 2 [2019-07-23 18:45:03,691][MainThread:80144][task_id:root][user_interface.py:33][DEBUG][llx用户登录成功] 3 [2019-07-23 18:45:16,745][MainThread:80144][task_id:root][bank_interface.py:24][DEBUG][llx取现f[100]成功] 4 [2019-07-23 18:45:28,624][MainThread:80144][task_id:root][bank_interface.py:24][DEBUG][llx取现f[100]成功] 5 [2019-07-23 18:45:38,498][MainThread:80144][task_id:root][user_interface.py:22][DEBUG][llw用户注册成功] 6 [2019-07-23 18:45:48,940][MainThread:80144][task_id:root][bank_interface.py:58][DEBUG][llx转账给f[llw]f[100]成功] 7 [2019-07-23 18:54:06,721][MainThread:39468][task_id:root][user_interface.py:23][DEBUG][wyf用户注册成功] 8 [2019-07-23 18:54:16,672][MainThread:39468][task_id:root][user_interface.py:35][DEBUG][wyf用户登录成功] 9 [2019-07-23 18:54:33,308][MainThread:39468][task_id:root][bank_interface.py:24][DEBUG][wyf取现f[100]成功] 10 [2019-07-23 18:54:45,658][MainThread:39468][task_id:root][bank_interface.py:24][DEBUG][wyf取现f[100]成功] 11 [2019-07-23 18:54:49,116][MainThread:39468][task_id:root][bank_interface.py:24][DEBUG][wyf取现f[200]成功] 12 [2019-07-23 18:54:58,683][MainThread:39468][task_id:root][bank_interface.py:58][DEBUG][wyf转账给f[llx]f[100]成功] 13 [2019-07-23 18:56:50,304][MainThread:117472][task_id:root][user_interface.py:35][DEBUG][llx密码登录错误] 14 [2019-07-23 19:00:05,649][MainThread:85788][task_id:root][user_interface.py:38][DEBUG][llx密码登录错误] 15 [2019-07-23 19:01:35,465][MainThread:38980][task_id:root][user_interface.py:38][DEBUG][llx密码登录错误] 16 [2019-07-23 19:03:54,418][MainThread:38980][task_id:root][user_interface.py:23][DEBUG][ycx用户注册成功] 17 [2019-07-23 19:04:03,616][MainThread:38980][task_id:root][user_interface.py:38][DEBUG][ycx密码登录错误] 18 [2019-07-23 19:06:04,152][MainThread:108436][task_id:root][user_interface.py:38][DEBUG][llx密码登录错误] 19 [2019-07-23 19:10:28,119][MainThread:108436][task_id:root][user_interface.py:38][DEBUG][llx密码登录错误] 20 [2019-07-23 19:11:52,745][MainThread:37536][task_id:root][user_interface.py:23][DEBUG][gyy用户注册成功] 21 [2019-07-23 19:12:05,136][MainThread:37536][task_id:root][user_interface.py:38][DEBUG][gyy密码登录错误] 22 [2019-07-23 19:12:27,352][MainThread:37536][task_id:root][user_interface.py:33][DEBUG][llx用户登录成功] 23 [2019-07-23 19:12:53,676][MainThread:37536][task_id:root][user_interface.py:23][DEBUG][hjn用户注册成功] 24 [2019-07-23 19:13:00,709][MainThread:37536][task_id:root][user_interface.py:33][DEBUG][hjn用户登录成功] 25 [2019-07-23 19:13:05,777][MainThread:37536][task_id:root][bank_interface.py:24][DEBUG][hjn取现f[100]成功] 26 [2019-07-23 19:13:09,339][MainThread:37536][task_id:root][bank_interface.py:38][DEBUG][hjn还款f[100]成功] 27 [2019-07-23 19:13:30,386][MainThread:37536][task_id:root][bank_interface.py:58][DEBUG][hjn转账给f[llx]f[100]成功] 28 [2019-07-23 19:14:13,972][MainThread:37536][task_id:root][shop_interface.py:33][DEBUG][hjn购物车中原先没有商品[电动车],添加[1]] 29 [2019-07-23 19:14:52,513][MainThread:37536][task_id:root][bank_interface.py:74][DEBUG][hjn支付[2217],剩余金额[17678.0]] 30 [2019-07-23 19:15:11,480][MainThread:37536][task_id:root][user_interface.py:47][DEBUG][hjn账户已注销,欢迎下次光临] 31 [2019-07-23 19:15:33,664][MainThread:37536][task_id:root][admin_interface.py:8][DEBUG][llx账号已被管理员冻结] 32 [2019-07-23 19:16:49,314][MainThread:37536][task_id:root][admin_interface.py:17][DEBUG][llx账号已被管理员解冻] 33 [2019-07-23 19:17:12,592][MainThread:37536][task_id:root][admin_interface.py:27][DEBUG][llx修改账户余额为[200000]元] 34 [2019-07-23 21:28:33,379][MainThread:60284][task_id:root][user_interface.py:23][DEBUG][ly用户注册成功] 35 [2019-07-23 21:28:46,570][MainThread:60284][task_id:root][user_interface.py:33][DEBUG][ly用户登录成功] 36 [2019-07-23 21:29:14,821][MainThread:60284][task_id:root][shop_interface.py:33][DEBUG][ly购物车中原先没有商品[夏季套装],添加[1]] 37 [2019-07-23 21:30:00,841][MainThread:60284][task_id:root][user_interface.py:47][DEBUG][ly账户已注销,欢迎下次光临] 38 [2019-07-23 21:30:41,625][MainThread:83164][task_id:root][admin_interface.py:8][DEBUG][ly账号已被管理员冻结] 39 [2019-07-23 21:31:03,280][MainThread:83164][task_id:root][admin_interface.py:27][DEBUG][ly修改账户余额为[40000]元] 40 [2019-07-28 17:56:29,947][MainThread:18800][task_id:root][user_interface.py:33][DEBUG][llx用户登录成功] 41 [2019-07-28 18:02:08,375][MainThread:92852][task_id:root][user_interface.py:33][DEBUG][llx用户登录成功] 42 [2019-07-28 18:03:32,535][MainThread:50984][task_id:root][user_interface.py:33][DEBUG][llx用户登录成功] 43 [2019-07-28 18:04:30,876][MainThread:68312][task_id:root][user_interface.py:33][DEBUG][llx用户登录成功] 44 [2019-07-28 18:05:06,006][MainThread:50752][task_id:root][user_interface.py:23][DEBUG][llx用户注册成功] 45 [2019-07-28 18:05:11,055][MainThread:50752][task_id:root][user_interface.py:33][DEBUG][llx用户登录成功] 46 [2019-07-28 18:05:39,945][MainThread:50752][task_id:root][bank_interface.py:74][DEBUG][llx支付[1867],剩余金额[18133]]
readme
1 # 提取功能 2 ''' 3 - 额度 15000或自定义 -----> 注册功能 4 5 - 实现购物商城,买东西加入购物车,调用信用卡接口结账 -----> 购物、支付 6 7 - 可以提现,手续费5% -----> 提现 8 9 - 支持多账户登录 -----> 登陆 10 11 - 支持账户间转账 -----> 转账 12 13 - 记录每月日常消费流水 -----> 记录流水 14 15 - 提供还款接口 -----> 还款 16 17 - ATM记录操作日志 -----> 记录日志 18 19 - 提供管理接口,包括添加账户、用户额度,冻结账户等... -----> 管理员功能:添加用户,冻结账户 20 21 - 用户认证功能 -----> 用户认证装饰器 22 ''' 23 24 25 # 提取完后能后我们应该再分析出展示给用户的功能: 26 ''' 27 用户: 28 1.注册 29 2.登录 30 3.查看余额 31 4.提现 32 5.还款 33 6.转账 34 7.查看流水 35 8.购物车功能 36 9.查看购物车 37 10.注销 38 11.管理员功能 39 管理员: 40 1.注册 41 2.登录 42 3.添加账户 43 4.用户额度 44 5.冻结账户 45 '''