fetchCommentsCount.js 503 B

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