2026-05-18 09:46:11 +08:00
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
2026-04-01 15:18:35 +08:00
|
|
|
const request = require('../utils/request')
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
2026-05-23 18:45:41 +08:00
|
|
|
/**
|
|
|
|
|
* Purpose: likeProduct supports product-like.js by holding or executing the like product 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.
|
|
|
|
|
*/
|
2026-04-01 15:18:35 +08:00
|
|
|
likeProduct(productId) {
|
|
|
|
|
return request({
|
|
|
|
|
url: `/product-like/like/${productId}`,
|
|
|
|
|
method: 'POST'
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
2026-05-23 18:45:41 +08:00
|
|
|
/**
|
|
|
|
|
* Purpose: unlikeProduct supports product-like.js by holding or executing the unlike product 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.
|
|
|
|
|
*/
|
2026-04-01 15:18:35 +08:00
|
|
|
unlikeProduct(productId) {
|
|
|
|
|
return request({
|
|
|
|
|
url: `/product-like/unlike/${productId}`,
|
|
|
|
|
method: 'POST'
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
2026-05-23 18:45:41 +08:00
|
|
|
/**
|
|
|
|
|
* Purpose: checkLikeStatus supports product-like.js by holding or executing the check like status 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.
|
|
|
|
|
*/
|
2026-04-01 15:18:35 +08:00
|
|
|
checkLikeStatus(productId) {
|
|
|
|
|
return request({
|
|
|
|
|
url: `/product-like/check/${productId}`
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|