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']