litian
2024-03-05 42cc31916c043f681c271efeb73394260e7d77aa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { config } from '../../config/index';
 
/** 获取商品评论数 */
function mockFetchCommentsCount(ID = 0) {
  const { delay } = require('../_utils/delay');
  const { getGoodsCommentsCount } = require('../../model/comments');
  return delay().then(() => getGoodsCommentsCount(ID));
}
 
/** 获取商品评论数 */
export function fetchCommentsCount(ID = 0) {
  if (config.useMock) {
    return mockFetchCommentsCount(ID);
  }
  return new Promise((resolve) => {
    resolve('real api');
  });
}