Files
JayuCloud/WeChatProgram/api/product.js
T

62 lines
2.1 KiB
JavaScript

/**
* Mini program API wrapper for this module.
* Call guide: require this module in a page, then invoke the matching method from page event handlers or lifecycle hooks.
*/
const request = require('../utils/request')
module.exports = {
/**
* Purpose: getProductPage supports product.js by holding or executing the get product page page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
getProductPage(params) {
return request({
url: '/product/list/page',
params
})
},
/**
* Purpose: getAllProducts supports product.js by holding or executing the get all products page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
getAllProducts() {
return request({
url: '/product/list/all'
})
},
/**
* Purpose: getProductById supports product.js by holding or executing the get product by id page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
getProductById(id) {
return request({
url: `/product/get/${id}`
})
},
/**
* Purpose: getProductsByTag supports product.js by holding or executing the get products by tag page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
getProductsByTag(tag) {
return request({
url: `/product/list/tag/${encodeURIComponent(tag)}`
})
},
/**
* Purpose: searchProducts supports product.js by holding or executing the search products page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
searchProducts(keyword) {
return request({
url: '/product/list/search',
params: {
keyword
}
})
}
}