Exemplo n.º 1
0
def delete_one(id):
	'''删除某商品'''
	# tmp = 0
	# a = 1 / tmp
	id = IDMustBePositiveInt().validate_for_api().id.data
	# pass
	return Success(error_code=2)
Exemplo n.º 2
0
def get_complex_one(id):
    '''专题(Theme)详情接口
	:param id: 专题theme的id
	:return: 专题theme的详情
	'''
    id = IDMustBePositiveInt().validate_for_api().id.data
    theme_detail = Theme.get_theme_detail(id=id)
    return Success(theme_detail)
Exemplo n.º 3
0
def get_list_by_category():
    '''获取商品列表(分页&基于categoryID)'''
    id = IDMustBePositiveInt().validate_for_api().id.data
    page_validator = PaginateValidator().validate_for_api()
    page = page_validator.page.data
    size = page_validator.size.data

    paginator = Product.query.filter_by(category_id=id).paginate(
        page=page, per_page=size, error_out=False)
    return Success({
        'total': paginator.total,
        'current_page': paginator.page,
        'items': paginator.items
    })
Exemplo n.º 4
0
def get_pre_order():
    '''获取预订单'''
    id = IDMustBePositiveInt().validate_for_api().id.data
    pass
Exemplo n.º 5
0
def get_banner(id):
    '''获取「首页轮播图」'''
    id = IDMustBePositiveInt().validate_for_api().id.data
    banner = Banner.get_banner_by_id(id=id)
    # banner.hide('description') # 临时隐藏
    return Success(banner)
Exemplo n.º 6
0
def get_one(id):
	id = IDMustBePositiveInt().validate_for_api().id.data
	product = Product.get_product_detail(id=id)
	return Success(product)
Exemplo n.º 7
0
def get_all_in_category():
	'''所有 category_id 类的商品'''
	id = IDMustBePositiveInt().validate_for_api().id.data
	products = Product.get_product_by_category_id(id=id)
	return Success(products)
Exemplo n.º 8
0
def delete_one(id):
	id = IDMustBePositiveInt().validate_for_api().id.data
	product = Product.get_product_detail(id=id)
	return Success(code=202, error_code=2, msg='删除成功')
Exemplo n.º 9
0
def get_all_in_category():
    form = IDMustBePositiveInt().validate_for_api()
    products = Product.get_product_by_category_id(form.id.data,
                                                  form.count.data,
                                                  form.page.data)
    return jsonify(products)
Exemplo n.º 10
0
def delete_product(id):
    '''删除某商品'''
    id = IDMustBePositiveInt().validate_for_api().id.data
    Product.delete_by_id(id)
    return Success(error_code=2)
Exemplo n.º 11
0
def delivery():
    '''订单发货'''
    order_id = IDMustBePositiveInt().validate_for_api().id.data
    result = OrderService.delivery(order_id)
    Success(result)
Exemplo n.º 12
0
def get_detail(id):
    '''订单详情'''
    id = IDMustBePositiveInt().validate_for_api().id.data
    order = OrderModel.query.get_or_404(id).hide('prepay_id')
    return Success(order)
Exemplo n.º 13
0
def get_pre_order():
    '''获取预订单'''
    order_id = IDMustBePositiveInt().validate_for_api().id.data
    pay_service = PayService(order_id)
    pay_service.pay()
    Success()
Exemplo n.º 14
0
def delete_theme(id):
    '''删除某主题'''
    id = IDMustBePositiveInt().validate_for_api().id.data
    return Success(error_code=2)
Exemplo n.º 15
0
def update_product(id):
    '''更新商品信息'''
    id = IDMustBePositiveInt().validate_for_api().id.data
    return Success(error_code=1)