列表联调

This commit is contained in:
李瑞
2025-09-07 18:54:36 +08:00
parent 2d0d728969
commit 6feb7057af
28 changed files with 1225 additions and 740 deletions

View File

@@ -16,35 +16,36 @@ interface ApiResponse<T> {
* @param params 查询参数
* @returns Promise<TennisMatch[]>
*/
export const getGamesList = async (params?: {
page?: number;
pageSize?: number;
location?: string;
skillLevel?: string;
}) => {
export const getGamesList = async (params?: Record<string, any>) => {
try {
return httpService.post('/games/list', params, { showLoading: false })
/**
* 判断请求哪个接口
* 筛选智能排序:/games/integrate_list
* 常规搜索:/games/list
*/
// const isIntegrate = params?.order === '0';
// const fetchApi = isIntegrate ? '/games/integrate_list' : '/games/list'
return httpService.post('/games/list', params, { showLoading: true })
} catch (error) {
console.error("列表数据获取失败:", error);
throw error;
}
};
export const getGamesIntegrateList = async (params?: {
page?: number;
pageSize?: number;
location?: string;
skillLevel?: string;
}) => {
/**
* 获取列表
* @param params 查询参数
* @returns Promise<TennisMatch[]>
*/
export const getGamesIntegrateList = async (params?: Record<string, any>) => {
try {
return httpService.post('/games/integrate_list', params, { showLoading: false })
return httpService.post('/games/integrate_list', params, { showLoading: true })
} catch (error) {
console.error("列表数据获取失败:", error);
throw error;
}
};
/**
* 获取搜索历史记录的异步函数
* @param {Object} params - 查询参数对象
@@ -53,7 +54,7 @@ export const getGamesIntegrateList = async (params?: {
export const getSearchHistory = async (params) => {
try {
// 调用HTTP服务获取搜索历史记录
return httpService.get('/games/search_history', params)
return httpService.post('/games/search_history', params, { showLoading: true })
} catch (error) {
// 捕获并打印错误信息
console.error("历史记录获取失败:", error);
@@ -66,10 +67,10 @@ export const getSearchHistory = async (params) => {
* @description 清除搜索历史
* @returns
*/
export const clearHistory = async () => {
export const clearHistory = async (params) => {
try {
// 调用HTTP服务清除搜索历史记录
return httpService.post('/search_history/delete_all')
return httpService.post('/games/search_history/delete_all', params, { showLoading: true })
} catch (error) {
// 捕获并打印错误信息
console.error("清除历史记录失败:", error);
@@ -86,7 +87,7 @@ export const clearHistory = async () => {
export const searchSuggestion = async (params) => {
try {
// 调用HTTP服务获取搜索建议
return httpService.get('/games/search_recommendations', params)
return httpService.post('/games/search_recommendations', params)
} catch (error) {
// 捕获并打印错误信息
console.error("搜索建议获取失败:", error);