更新ios
This commit is contained in:
@@ -355,17 +355,20 @@ export const stockDetailService = {
|
|||||||
/**
|
/**
|
||||||
* 搜索股票
|
* 搜索股票
|
||||||
* @param {string} keyword - 搜索关键词(代码或名称)
|
* @param {string} keyword - 搜索关键词(代码或名称)
|
||||||
|
* @param {number} limit - 返回结果数量限制(默认20)
|
||||||
* @returns {Promise<object>} { success: true, data: [...stocks] }
|
* @returns {Promise<object>} { success: true, data: [...stocks] }
|
||||||
*/
|
*/
|
||||||
searchStocks: async (keyword) => {
|
searchStocks: async (keyword, limit = 20) => {
|
||||||
try {
|
try {
|
||||||
if (!keyword || keyword.trim().length < 1) {
|
if (!keyword || keyword.trim().length < 1) {
|
||||||
return { success: true, data: [] };
|
return { success: true, data: [] };
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('[StockDetailService] 搜索股票:', keyword);
|
console.log('[StockDetailService] 搜索股票:', keyword, 'limit:', limit);
|
||||||
|
|
||||||
const response = await apiRequest(`/api/stock/search?q=${encodeURIComponent(keyword)}`);
|
const response = await apiRequest(
|
||||||
|
`/api/stocks/search?q=${encodeURIComponent(keyword)}&limit=${limit}`
|
||||||
|
);
|
||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
console.log('[StockDetailService] 搜索结果:', response.data?.length || 0);
|
console.log('[StockDetailService] 搜索结果:', response.data?.length || 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user