atm-interface-shopping

from db import db_handler
from interface import bank

def shopping_interface(name, cost, shoppingcart):
flag,msg = bank.consume_interface(name,cost)
if flag:
dic = db_handler.select(name)
dic['shoppingcart'] = shoppingcart
db_handler.save(dic)
return True, '购买成功'
else:
print(msg)


def check_shoppingcart(name):
dic = db_handler.select(name)
return dic['shoppingcart']
posted @ 2018-06-24 21:13  Elton丶  阅读(71)  评论(0编辑  收藏  举报