コード例 #1
0
def delete_one(id):
	'''删除某商品'''
	# tmp = 0
	# a = 1 / tmp
	id = IDMustBePositiveInt().validate_for_api().id.data
	# pass
	return Success(error_code=2)
コード例 #2
0
ファイル: theme.py プロジェクト: Vinhui007/mini-shop-server
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)
コード例 #3
0
ファイル: product.py プロジェクト: G-MIng/mini-shop-server
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
    })
コード例 #4
0
def get_pre_order():
    '''获取预订单'''
    id = IDMustBePositiveInt().validate_for_api().id.data
    pass
コード例 #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)
コード例 #6
0
def get_one(id):
	id = IDMustBePositiveInt().validate_for_api().id.data
	product = Product.get_product_detail(id=id)
	return Success(product)
コード例 #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)
コード例 #8
0
ファイル: product.py プロジェクト: yunsite/mini-shop-server
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='删除成功')
コード例 #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)
コード例 #10
0
ファイル: product.py プロジェクト: G-MIng/mini-shop-server
def delete_product(id):
    '''删除某商品'''
    id = IDMustBePositiveInt().validate_for_api().id.data
    Product.delete_by_id(id)
    return Success(error_code=2)
コード例 #11
0
ファイル: order.py プロジェクト: G-MIng/mini-shop-server
def delivery():
    '''订单发货'''
    order_id = IDMustBePositiveInt().validate_for_api().id.data
    result = OrderService.delivery(order_id)
    Success(result)
コード例 #12
0
ファイル: order.py プロジェクト: G-MIng/mini-shop-server
def get_detail(id):
    '''订单详情'''
    id = IDMustBePositiveInt().validate_for_api().id.data
    order = OrderModel.query.get_or_404(id).hide('prepay_id')
    return Success(order)
コード例 #13
0
ファイル: pay.py プロジェクト: G-MIng/mini-shop-server
def get_pre_order():
    '''获取预订单'''
    order_id = IDMustBePositiveInt().validate_for_api().id.data
    pay_service = PayService(order_id)
    pay_service.pay()
    Success()
コード例 #14
0
ファイル: theme.py プロジェクト: kayoon/mini-shop-server
def delete_theme(id):
    '''删除某主题'''
    id = IDMustBePositiveInt().validate_for_api().id.data
    return Success(error_code=2)
コード例 #15
0
def update_product(id):
    '''更新商品信息'''
    id = IDMustBePositiveInt().validate_for_api().id.data
    return Success(error_code=1)