9b21e1f22e
duplicate-model.ts 增加 DuplicateDetail 解析与详情分页负载解析,duplicate-api.ts 增加 fetchDuplicateDetail(GET /duplicate-check-detail)。 TDD: task-118.test.ts 8 用例先 RED 后 GREEN。
44 lines
1.6 KiB
TypeScript
44 lines
1.6 KiB
TypeScript
/** 店铺数据重复检查适配(任务 115-119):/api/admin/shop-data-crawl/duplicate-check-* 系列端点。 */
|
|
import { http } from '@/api/http'
|
|
import {
|
|
parseDuplicateDetailPage,
|
|
parseDuplicateItemsPage,
|
|
parseDuplicateOverview,
|
|
type DuplicateOverview,
|
|
} from './duplicate-model.ts'
|
|
import { toDuplicateItemsQuery, type DuplicateFilter } from './duplicate-filter.ts'
|
|
|
|
export const DUPLICATE_CHECK_ENDPOINT = '/api/admin/shop-data-crawl'
|
|
|
|
/** 加载撞款总览(可选 force=1 触发同步重扫)。 */
|
|
export async function fetchDuplicateOverview(force = false): Promise<DuplicateOverview> {
|
|
const { data } = await http.get<unknown>(`${DUPLICATE_CHECK_ENDPOINT}/duplicate-check-overview`, {
|
|
params: force ? { force: '1' } : undefined,
|
|
})
|
|
return parseDuplicateOverview(data)
|
|
}
|
|
|
|
/** 加载撞款明细分页列表:GET /duplicate-check-items。 */
|
|
export async function fetchDuplicateItems(
|
|
filter: DuplicateFilter,
|
|
page: number,
|
|
pageSize: number,
|
|
): Promise<ReturnType<typeof parseDuplicateItemsPage>> {
|
|
const { data } = await http.get<unknown>(`${DUPLICATE_CHECK_ENDPOINT}/duplicate-check-items`, {
|
|
params: toDuplicateItemsQuery(filter, page, pageSize),
|
|
})
|
|
return parseDuplicateItemsPage(data)
|
|
}
|
|
|
|
/** 加载撞款详情卡片分页:GET /duplicate-check-detail。 */
|
|
export async function fetchDuplicateDetail(
|
|
filter: DuplicateFilter,
|
|
page: number,
|
|
pageSize: number,
|
|
): Promise<ReturnType<typeof parseDuplicateDetailPage>> {
|
|
const { data } = await http.get<unknown>(`${DUPLICATE_CHECK_ENDPOINT}/duplicate-check-detail`, {
|
|
params: toDuplicateItemsQuery(filter, page, pageSize),
|
|
})
|
|
return parseDuplicateDetailPage(data)
|
|
}
|