shop_xcx/services/good/fetchGoodsDetailsComments.js
2023-05-30 20:21:16 +08:00

38 lines
1.1 KiB
JavaScript

import { config } from '../../config/index';
/** 获取商品详情页评论数 */
function mockFetchGoodDetailsCommentsCount(spuId = 0) {
const { delay } = require('../_utils/delay');
const {
getGoodsDetailsCommentsCount,
} = require('../../model/detailsComments');
return delay().then(() => getGoodsDetailsCommentsCount(spuId));
}
/** 获取商品详情页评论数 */
export function getGoodsDetailsCommentsCount(spuId = 0) {
if (config.useMock) {
return mockFetchGoodDetailsCommentsCount(spuId);
}
return new Promise((resolve) => {
resolve('real api');
});
}
/** 获取商品详情页评论 */
function mockFetchGoodDetailsCommentList(spuId = 0) {
const { delay } = require('../_utils/delay');
const { getGoodsDetailsComments } = require('../../model/detailsComments');
return delay().then(() => getGoodsDetailsComments(spuId));
}
/** 获取商品详情页评论 */
export function getGoodsDetailsCommentList(spuId = 0) {
if (config.useMock) {
return mockFetchGoodDetailsCommentList(spuId);
}
return new Promise((resolve) => {
resolve('real api');
});
}