...
|
...
|
@@ -259,34 +259,16 @@ const getAllBrandNames = () => { |
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取猜你想找
|
|
|
**/
|
|
|
const getWantSearch = (uid) => {
|
|
|
* 搜索主页
|
|
|
*/
|
|
|
const getSearchIndex = (uid) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.search.getSomeTerms',
|
|
|
method: 'app.search.getTerms',
|
|
|
uid: uid
|
|
|
}, {
|
|
|
cache: true
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return result.data;
|
|
|
} else {
|
|
|
logger.error('Hot Search return code is not 200');
|
|
|
return {};
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取热门搜索
|
|
|
**/
|
|
|
const getHotSearch = () => {
|
|
|
return api.get('', {
|
|
|
method: 'app.search.getTerms'
|
|
|
}, {
|
|
|
cache: true
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
if (result.data.hotTerms && result.data.hotTerms.length > 10) {
|
|
|
result.data.hotTerms = result.data.hotTerms.slice(0, 10);
|
|
|
}
|
...
|
...
|
@@ -299,18 +281,6 @@ const getHotSearch = () => { |
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 搜索主页
|
|
|
*/
|
|
|
const getSearchIndex = (uid) => {
|
|
|
return Promise.all([getHotSearch(), getWantSearch(uid)]).then((result) => {
|
|
|
return {
|
|
|
hotTerms: result[0],
|
|
|
wantTerms: result[1]
|
|
|
};
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取联想词
|
|
|
* @param params
|
|
|
* @returns {*|Promise.<TResult>}
|
...
|
...
|
|