feat: harden phase one workflows
This commit is contained in:
@@ -4,11 +4,21 @@ function listCategories() {
|
||||
return request({ url: '/api/mini/product-categories' })
|
||||
}
|
||||
|
||||
function listProducts(categoryId) {
|
||||
function listProducts(categoryId, keyword) {
|
||||
return request({
|
||||
url: '/api/mini/products',
|
||||
data: categoryId ? { categoryId } : {}
|
||||
})
|
||||
url: '/api/mini/products/page',
|
||||
data: buildProductQuery(categoryId, keyword)
|
||||
}).then((page) => page && page.records ? page.records : [])
|
||||
}
|
||||
|
||||
function buildProductQuery(categoryId, keyword) {
|
||||
const data = {
|
||||
pageNo: 1,
|
||||
pageSize: 20
|
||||
}
|
||||
if (categoryId) data.categoryId = categoryId
|
||||
if (keyword) data.keyword = keyword
|
||||
return data
|
||||
}
|
||||
|
||||
function getProductDetail(id) {
|
||||
@@ -26,6 +36,7 @@ function createGoodsOrder(data) {
|
||||
module.exports = {
|
||||
listCategories,
|
||||
listProducts,
|
||||
buildProductQuery,
|
||||
getProductDetail,
|
||||
createGoodsOrder
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user