def delete_one(id): '''删除某商品''' # tmp = 0 # a = 1 / tmp id = IDMustBePositiveInt().validate_for_api().id.data # pass return Success(error_code=2)
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)
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 })
def get_pre_order(): '''获取预订单''' id = IDMustBePositiveInt().validate_for_api().id.data pass
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)
def get_one(id): id = IDMustBePositiveInt().validate_for_api().id.data product = Product.get_product_detail(id=id) return Success(product)
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)
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='删除成功')
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)
def delete_product(id): '''删除某商品''' id = IDMustBePositiveInt().validate_for_api().id.data Product.delete_by_id(id) return Success(error_code=2)
def delivery(): '''订单发货''' order_id = IDMustBePositiveInt().validate_for_api().id.data result = OrderService.delivery(order_id) Success(result)
def get_detail(id): '''订单详情''' id = IDMustBePositiveInt().validate_for_api().id.data order = OrderModel.query.get_or_404(id).hide('prepay_id') return Success(order)
def get_pre_order(): '''获取预订单''' order_id = IDMustBePositiveInt().validate_for_api().id.data pay_service = PayService(order_id) pay_service.pay() Success()
def delete_theme(id): '''删除某主题''' id = IDMustBePositiveInt().validate_for_api().id.data return Success(error_code=2)
def update_product(id): '''更新商品信息''' id = IDMustBePositiveInt().validate_for_api().id.data return Success(error_code=1)