Revert "重构板块资金流向:行业/概念改用独立 path,后端排序,前端不缓存直接请求"
This reverts commit eea2ce86d0.
This commit is contained in:
+4
-12
@@ -460,23 +460,15 @@ export interface SectorResponse {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取东方财富板块列表
|
||||
* 行业/概念走不同 path(/industry、/concept),避免上游反代按 path 缓存忽略 query 导致数据串味
|
||||
* 获取东方财富板块列表(按主力净流入排序)
|
||||
* @param type industry=行业板块, concept=概念板块
|
||||
* @param sort mainNetInflow=资金流入, changePercent=涨幅%
|
||||
* @param order asc=升序, desc=降序
|
||||
*/
|
||||
export async function fetchSectors(
|
||||
type: SectorType,
|
||||
opts?: { sort?: "mainNetInflow" | "changePercent"; order?: "asc" | "desc"; signal?: AbortSignal },
|
||||
): Promise<SectorItem[]> {
|
||||
export async function fetchSectors(type: SectorType, signal?: AbortSignal): Promise<SectorItem[]> {
|
||||
const baseUrl = getApiBaseUrl();
|
||||
const sort = opts?.sort ?? "mainNetInflow";
|
||||
const order = opts?.order ?? "desc";
|
||||
const url = `${baseUrl}/api/sectors/${type}?sort=${sort}&order=${order}`;
|
||||
const url = `${baseUrl}/api/sectors?type=${type}`;
|
||||
|
||||
try {
|
||||
const resp = await fetch(url, { method: "GET", signal: opts?.signal, cache: "no-store" });
|
||||
const resp = await fetch(url, { method: "GET", signal, cache: "no-store" });
|
||||
if (!resp.ok) return [];
|
||||
const result: SectorResponse = await resp.json();
|
||||
return result.data || [];
|
||||
|
||||
Reference in New Issue
Block a user