fix(frontend): 支持请求级自定义超时并将接单模板初始化与批量回填超时延长至5分钟

- 在 http 客户端封装中增加可选 RequestOptions 参数透传,允许对耗时较长的数据初始化/大批量回填接口单独配置超时
- 将 applyAdminTemplateProductBootstrap、syncAdminAffiliateDashCostSnapshots、backfillAdminProductMappings 及 backfillAdminNormalizedQuantities 客户端超时由 50 秒延长至 300 秒(5分钟)
- 彻底解决生产全量订单数据规模下接单模板初始化触发 50 秒网络超时提示的问题
- 验证方式:npm --prefix apps/frontend run typecheck 通过,生产镜像构建运行正常
This commit is contained in:
yml2213
2026-10-25 17:29:58 +08:00
parent 12f370de15
commit eaffae4af0
2 changed files with 16 additions and 9 deletions
+12 -6
View File
@@ -182,40 +182,46 @@ function request<T>(config: Parameters<typeof http.request<ApiEnvelope<T>>>[0])
return http.request<ApiEnvelope<T>, ApiEnvelope<T>>(config)
}
export function apiGet<T>(url: string, params?: Record<string, unknown>) {
return request<T>({ method: 'GET', url, params })
type RequestOptions = Partial<Parameters<typeof http.request>[0]>
export function apiGet<T>(url: string, params?: Record<string, unknown>, options?: RequestOptions) {
return request<T>({ method: 'GET', url, params, ...options })
}
export function apiGetBlob(url: string, params?: Record<string, unknown>) {
export function apiGetBlob(url: string, params?: Record<string, unknown>, options?: RequestOptions) {
return http.request<Blob, Blob>({
method: 'GET',
url,
params,
responseType: 'blob',
...options,
})
}
export function apiPost<T>(url: string, data?: unknown) {
export function apiPost<T>(url: string, data?: unknown, options?: RequestOptions) {
return request<T>({
method: 'POST',
url,
data: data as Record<string, unknown>,
...options,
})
}
export function apiPut<T>(url: string, data?: unknown) {
export function apiPut<T>(url: string, data?: unknown, options?: RequestOptions) {
return request<T>({
method: 'PUT',
url,
data: data as Record<string, unknown>,
...options,
})
}
export function apiPatch<T>(url: string, data?: unknown) {
export function apiPatch<T>(url: string, data?: unknown, options?: RequestOptions) {
return request<T>({
method: 'PATCH',
url,
data: data as Record<string, unknown>,
...options,
})
}