fix market ranking display fallbacks

This commit is contained in:
clz
2026-07-27 10:31:22 +08:00
parent af0025ce38
commit 5af37bfa51
4 changed files with 35 additions and 6 deletions
+11 -3
View File
@@ -47,16 +47,24 @@
逐项验证涨幅、跌幅、1/5/10/15 分钟涨速和跌速、成交额、日增仓 Tab。预期每个 Tab 的 `sortid`
排序方向、第三列字段和值均正确,不出现整列 `--` 或排序方向相反。
### 2. 基准价计算
### 2. 基准价计算(高风险)
`applyStandardPriceToTableData` 已接入,但需要确认传入的 `fieldIds` 是否包含宿主实现要求的全部字段,
特别是 `DATA_ID_ZD``DATA_ID_MARKET_OLD` 以及昨收、今开、昨结字段。
`MarketRankingHqRequestClient` 已接入 `applyStandardPriceToTableData`,但当前传入的 `fieldIds`
与仓库内 `FirstPageSelfStockRequestClient` 的基准价必需字段存在差异。市场排名当前未包含
`DATA_ID_ZD``DATA_ID_MARKET_OLD`,并且昨收、今开、昨结使用本地 `TableConstants` 字段,
没有使用 `StandardPriceTypeHelper.FIELD_ZUO_SHOU``FIELD_JIN_KAI``FIELD_ZUO_JIE`
在无法查看宿主 `biz_quote``@b2c/lib_baseui` 实现的情况下,尚不能确认这些字段是否等价或可省略。
如果宿主实现依赖上述完整字段,用户切换基准价后可能出现涨跌幅未更新、计算口径错误或整列显示 `--`
因此该项应按高风险处理,在字段要求得到确认并完成宿主验证前,不应认定市场排名的基准价功能可发布。
分别选择昨收、今开、昨结作为基准价,验证:
- 最新价不变,涨跌幅按当前基准价重新计算。
- 页面隐藏后修改基准价,再返回首页会重新订阅并更新。
- 首包和后续实时推送采用相同计算口径。
- 对照 `FirstPageSelfStockRequestClient` 确认必需字段集合,并优先复用宿主
`TableConstants` / `StandardPriceTypeHelper`,避免维护重复字段 ID。
### 3. HTTP 推荐合约接口
@@ -488,7 +488,8 @@ export struct MarketRankingNodeComponent {
.height(30)
.linearGradient({
angle: 90,
colors: [['#00FFFFFF', 0], [$r('app.color.surface_layer1_foreground'), 1]],
colors: [[$r('app.color.transparent_white'), 0],
[$r('app.color.surface_layer1_foreground'), 1]],
})
.hitTestBehavior(HitTestMode.None)
}
@@ -26,18 +26,21 @@ class MarketRankingTableRequestClient extends TableRequestClient {
private requestParams: string;
private fieldIds: number[];
private sortId: number;
private fallbackNames: Map<string, string>;
private listener: MarketRankingCardDataListener;
constructor(
requestParams: string,
fieldIds: number[],
sortId: number,
fallbackNames: Map<string, string>,
listener: MarketRankingCardDataListener,
) {
super(FRAME_ID, PAGE_ID, [], null, undefined);
this.requestParams = requestParams;
this.fieldIds = fieldIds;
this.sortId = sortId;
this.fallbackNames = fallbackNames;
this.listener = listener;
this.setSubscribeIds(fieldIds);
}
@@ -67,7 +70,7 @@ class MarketRankingTableRequestClient extends TableRequestClient {
const item: RankItem = {
code: `${codeValue}`,
market: `${marketValue}`,
name: this.getString(row, TableConstants.DATA_ID_NAME),
name: this.getContractName(row, `${codeValue}`, `${marketValue}`),
};
item.price = this.getNumber(row, TableConstants.DATA_ID_PRICE);
item.price_chg = this.getNumber(row, TableConstants.DATA_ID_ZF);
@@ -90,6 +93,14 @@ class MarketRankingTableRequestClient extends TableRequestClient {
return value === undefined ? '' : `${value}`;
}
private getContractName(row: RowData, code: string, market: string): string {
const hqName: string = this.getString(row, TableConstants.DATA_ID_NAME);
if (hqName !== '' && hqName !== '--') {
return hqName;
}
return this.fallbackNames.get(`${market}_${code}`) ?? '';
}
private getNumber(row: RowData, fieldId: number): number | undefined {
const value = row.originalData.get(fieldId);
if (typeof value === 'number') {
@@ -145,10 +156,15 @@ export class MarketRankingHqRequestClient {
const requestParams: string =
this.buildRequestParams(contracts, primaryIdx, sortId, fieldIds);
const fallbackNames: Map<string, string> = new Map();
contracts.forEach((contract: RecommendFuturesItem): void => {
fallbackNames.set(`${contract.market}_${contract.contract_code}`, contract.contract_name);
});
const requestClient = new MarketRankingTableRequestClient(
requestParams,
fieldIds,
sortId,
fallbackNames,
listener,
);
requestClient.request(0, contracts.length);
+5 -1
View File
@@ -48,6 +48,10 @@
"name": "color_73ffffff",
"value": "#73FFFFFF"
},
{
"name": "transparent_white",
"value": "#00FFFFFF"
},
{
"name": "color_333333",
"value": "#333333"
@@ -120,4 +124,4 @@
"value": "#b341d9"
}
]
}
}