Exemplo n.º 1
0
def clear_base():
    query = Goods.delete().where(Goods.id != 1)
    query.execute()
    query = Goods.update({Goods.amount: 0}).where(Goods.id == 0)
    query.execute()
    query = Orders_Info.delete().where(Orders_Info.id > 0)
    query.execute()
    query = Orders_Content.delete().where(Orders_Content.id > 0)
    query.execute()
Exemplo n.º 2
0
def erase_item_order_by_ids(id_, order_id):
    query = Orders_Info.update({
        Orders_Info.time: time.time()
    }).where(Orders_Info.id == order_id)
    query.execute()
    item = Orders_Content.select().where(Orders_Content.item_id == id_).where(
        Orders_Content.order_id == order_id)
    amount = item[0].amount
    update_amount(id_, amount)
    query = Orders_Content.delete().where(Orders_Content.item_id == id_).where(
        Orders_Content.order_id == order_id)
    query.execute()
    return amount