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/fetchSearchHistory.js

36 lines
869 B

import { config } from '../../config/index';
/** 获取搜索历史 */
function mockSearchHistory() {
const { delay } = require('../_utils/delay');
const { getSearchHistory } = require('../../model/search');
return delay().then(() => getSearchHistory());
}
/** 获取搜索历史 */
export function getSearchHistory() {
if (config.useMock) {
return mockSearchHistory();
}
return new Promise((resolve) => {
resolve('real api');
});
}
/** 获取搜索历史 */
function mockSearchPopular() {
const { delay } = require('../_utils/delay');
const { getSearchPopular } = require('../../model/search');
return delay().then(() => getSearchPopular());
}
/** 获取搜索历史 */
export function getSearchPopular() {
if (config.useMock) {
return mockSearchPopular();
}
return new Promise((resolve) => {
resolve('real api');
});
}