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.
git/scr/miniprogram-2/services/good/fetchGoodsDetailsComments.js

38 lines
1.1 KiB

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');
});
}