Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def delete_cart_product(id):
"""删除购物车商品
"""
cart_product = CartProduct.query.filter(CartProduct.id == id).first()
if cart_product is None:
return json_response(ResponseCode.NOT_FOUND)
session.delete(cart_product)
session.commit()
return json_response(cart_product=CartProductSchema().dump(cart_product))
def delete_order_product(order_id, product_id):
order_product = OrderProduct.query.filter(and_(
OrderProduct.order_id == order_id, OrderProduct.product_id == product_id)).first()
if order_product is None:
return json_response(ResponseCode.NOT_FOUND)
session.delete(order_product)
session.commit()
return json_response(order_product=OrderProductSchema().dump(order_product))
def product_info(id):
"""查询商品
"""
product = Product.query.get(id)
if product is None:
return json_response(ResponseCode.NOT_FOUND)
return json_response(product=ProductSchema().dump(product))
def address_info(id):
"""查询地址
"""
address = Address.query.get(id)
if address is None:
return json_response(ResponseCode.NOT_FOUND)
return json_response(address=AddressSchema().dump(address))