task-75(ASIN 数据中心): 实现最低价 ASIN 列表和筛选
GET /api/admin/skip-price-asins 列表解析(SkipPriceAsinPageVo, 每店铺 5 国家 ASIN+最低价) + 分组/店铺名/ASIN/国家/最低价区间筛选 snake 序列化, 新增共享国家字典, 9 个契约测试。
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/** ASIN 数据中心共享国家字典(任务 75):支持国家码与中文标签,纯逻辑。 */
|
||||
|
||||
export const ASIN_COUNTRY_CODES = ['DE', 'UK', 'FR', 'IT', 'ES'] as const
|
||||
export type AsinCountryCode = (typeof ASIN_COUNTRY_CODES)[number]
|
||||
|
||||
export const ASIN_COUNTRY_LABELS: Record<AsinCountryCode, string> = {
|
||||
DE: '德国',
|
||||
UK: '英国',
|
||||
FR: '法国',
|
||||
IT: '意大利',
|
||||
ES: '西班牙',
|
||||
}
|
||||
|
||||
/** 国家码 → 中文标签;不属白名单原样返回。 */
|
||||
export function asinCountryLabel(country: string): string {
|
||||
return ASIN_COUNTRY_LABELS[country as AsinCountryCode] || country
|
||||
}
|
||||
|
||||
/** 国家码归一:大小写不敏感;不属白名单时返回空串。 */
|
||||
export function normalizeAsinCountry(value: string): string {
|
||||
const upper = (value || '').trim().toUpperCase()
|
||||
return ASIN_COUNTRY_CODES.includes(upper as AsinCountryCode) ? upper : ''
|
||||
}
|
||||
Reference in New Issue
Block a user