You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mall-admin/src/api/flashProductRelation.js

89 lines
3.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// 导入封装的 HTTP 请求工具,用于与后端 API 进行通信
import request from '@/utils/request'
/**
* fetchList - 获取限时购商品关联列表
*
* 该函数通过 GET 请求获取限时购活动与商品的关联列表,
* 支持通过查询参数进行筛选和分页。
*
* @param {Object} params - 查询参数,例如分页和过滤条件。
* 示例:{ flashId: 1, pageNum: 1, pageSize: 10 }
* @returns {Promise} - 返回一个 Promise 对象,包含接口返回的数据。
*
* 用法示例:
* fetchList({ flashId: 1, pageNum: 1, pageSize: 10 }).then(response => {
* console.log(response);
* });
*/
export function fetchList(params) {
return request({
url: '/flashProductRelation/list', // 接口URL获取关联列表
method: 'get', // 请求方法GET
params: params // 查询参数,通过 URL 传递
})
}
/**
* createFlashProductRelation - 创建新的限时购商品关联
*
* 该函数通过 POST 请求提交限时购活动与商品的关联数据。
*
* @param {Object} data - 关联数据,例如 { flashId: 1, productId: 100, sort: 1 }
* @returns {Promise} - 返回一个 Promise 对象,包含操作结果。
*
* 用法示例:
* createFlashProductRelation({ flashId: 1, productId: 100, sort: 1 }).then(response => {
* console.log(response);
* });
*/
export function createFlashProductRelation(data) {
return request({
url: '/flashProductRelation/create', // 接口URL创建关联
method: 'post', // 请求方法POST
data: data // 请求体,包含关联数据
})
}
/**
* deleteFlashProductRelation - 删除指定的限时购商品关联
*
* 该函数通过 POST 请求删除指定 ID 的限时购商品关联数据。
*
* @param {number|string} id - 限时购商品关联的唯一标识 ID。
* @returns {Promise} - 返回一个 Promise 对象,包含操作结果。
*
* 用法示例:
* deleteFlashProductRelation(1).then(response => {
* console.log(response);
* });
*/
export function deleteFlashProductRelation(id) {
return request({
url: '/flashProductRelation/delete/' + id, // 接口URL删除关联
method: 'post' // 请求方法POST
})
}
/**
* updateFlashProductRelation - 更新指定的限时购商品关联数据
*
* 该函数通过 POST 请求提交更新后的限时购商品关联数据。
*
* @param {number|string} id - 限时购商品关联的唯一标识 ID。
* @param {Object} data - 更新后的关联数据,例如 { sort: 2 }
* @returns {Promise} - 返回一个 Promise 对象,包含操作结果。
*
* 用法示例:
* updateFlashProductRelation(1, { sort: 2 }).then(response => {
* console.log(response);
* });
*/
export function updateFlashProductRelation(id, data) {
return request({
url: '/flashProductRelation/update/' + id, // 接口URL更新关联
method: 'post', // 请求方法POST
data: data // 请求体,包含更新数据
})
}