feat(浏览器扩展): 改用新店铺名称精确匹配店铺接口

This commit is contained in:
2026-08-27 14:14:19 +08:00
parent bf602ed4b2
commit b3c77c08b1
18 changed files with 61 additions and 133 deletions
@@ -1,24 +1,16 @@
import type { PddChannelShop } from '@/api/open/pddShop';
import { listPddChannelShops } from '@/api/open/pddShop';
import { matchPddChannelShopByMallName } from '@/api/open/pddShop';
/**
* 用页面店铺名匹配 BI channelShop:仅接受 mallName 完全一致。
* 接口 filters 可能是模糊搜,结果里再做精确过滤。
* 用页面店铺名匹配 BI channelShop:后端按 mallName trim 后精确匹配。
*/
export async function matchChannelShopByMallName(
mallName: string,
): Promise<PddChannelShop | null> {
const name = mallName.trim();
if (!name) return null;
const result = await listPddChannelShops({
page: 1,
pageSize: 50,
filters: { mallName: name },
});
const records = result.records ?? [];
const exact = records.find((shop) => (shop.mallName ?? '').trim() === name);
return exact ?? null;
const shop = await matchPddChannelShopByMallName(name);
return shop ?? null;
}
export function shopAuthorizeHint(mallName: string): string {