snack-mall/web-snack/src/api/product.js

45 lines
961 B
JavaScript

import { request } from '@/utils/request';
/**
* 商品详情(用户端)
* GET /api/product/{id}
*/
export function getProductDetailApi(id) {
return request({
url: `/api/product/${id}`,
method: 'GET'
});
}
/**
* 热门商品
* GET /api/product/hot
*/
export function getHotProductsApi(limit = 10) {
return request({
url: '/api/product/hot',
method: 'GET',
params: { limit }
});
}
/**
* 新品上市
* GET /api/product/new
*/
export function getNewProductsApi(limit = 10) {
return request({
url: '/api/product/new',
method: 'GET',
params: { limit }
});
}
/**
* 分类下商品列表
* GET /api/product/list
*/
export function getProductsByCategoryApi(categoryIds, orderBy, limit = 20) {
return request({
url: '/api/product/list',
method: 'GET',
params: { categoryIds, orderBy, limit }
});
}
//# sourceMappingURL=product.js.map