feat(order-service): 重构分类资料收集与订单状态链路
This commit is contained in:
@@ -1108,3 +1108,129 @@ export function revokeAdminWorkerRiskBan(banId: string, reason?: string) {
|
||||
{ reason },
|
||||
)
|
||||
}
|
||||
|
||||
export type OrderServiceField = {
|
||||
key: string
|
||||
label: string
|
||||
type: 'text' | 'textarea' | 'select' | 'radio' | 'number' | 'date'
|
||||
required: boolean
|
||||
placeholder?: string
|
||||
helpText?: string
|
||||
options?: string[]
|
||||
sortOrder?: number
|
||||
}
|
||||
|
||||
export type AdminOrderServiceProfile = {
|
||||
id: number
|
||||
categoryId: number
|
||||
name: string
|
||||
title: string
|
||||
description: string
|
||||
guideImage: UploadedFile | Record<string, unknown>
|
||||
fields: OrderServiceField[]
|
||||
screenshots: {
|
||||
enabled: boolean
|
||||
required: boolean
|
||||
minCount: number
|
||||
maxCount: number
|
||||
label: string
|
||||
helpText?: string
|
||||
}
|
||||
autoPublish: {
|
||||
enabled: boolean
|
||||
requireVoucherConsume: boolean
|
||||
retryMax: number
|
||||
}
|
||||
submitText: string
|
||||
successText: string
|
||||
status: 'draft' | 'published' | 'archived' | string
|
||||
currentVersionNo: number | null
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
export type AdminOrderServiceCategory = {
|
||||
categoryId: number
|
||||
categoryKey: string
|
||||
name: string
|
||||
parentId?: number | null
|
||||
status: string
|
||||
}
|
||||
|
||||
export type AdminOrderServiceProfileList = {
|
||||
categories: AdminOrderServiceCategory[]
|
||||
profiles: AdminOrderServiceProfile[]
|
||||
}
|
||||
|
||||
export function fetchAdminOrderServiceProfiles() {
|
||||
return apiGet<AdminOrderServiceProfileList>(
|
||||
'/api/v1/admin/worker-platform/order-service/profiles',
|
||||
)
|
||||
}
|
||||
|
||||
export function saveAdminOrderServiceProfile(payload: {
|
||||
categoryId: number
|
||||
name: string
|
||||
title?: string
|
||||
description?: string
|
||||
guideImage?: UploadedFile | Record<string, unknown>
|
||||
fields: OrderServiceField[]
|
||||
screenshots: {
|
||||
enabled: boolean
|
||||
required: boolean
|
||||
minCount: number
|
||||
maxCount: number
|
||||
label: string
|
||||
helpText?: string
|
||||
}
|
||||
autoPublish: {
|
||||
enabled: boolean
|
||||
requireVoucherConsume: boolean
|
||||
retryMax: number
|
||||
}
|
||||
submitText?: string
|
||||
successText?: string
|
||||
}) {
|
||||
return apiPost<{ profile: AdminOrderServiceProfile }>(
|
||||
'/api/v1/admin/worker-platform/order-service/profiles',
|
||||
payload,
|
||||
)
|
||||
}
|
||||
|
||||
export function publishAdminOrderServiceProfile(profileId: number) {
|
||||
return apiPost<{ versionNo: number }>(
|
||||
`/api/v1/admin/worker-platform/order-service/profiles/${profileId}/publish`,
|
||||
)
|
||||
}
|
||||
|
||||
export function archiveAdminOrderServiceProfile(profileId: number) {
|
||||
return apiPost<{ profile: AdminOrderServiceProfile }>(
|
||||
`/api/v1/admin/worker-platform/order-service/profiles/${profileId}/archive`,
|
||||
)
|
||||
}
|
||||
|
||||
export type AdminOrderServiceAutoPublishJob = {
|
||||
id: number
|
||||
workOrderId: number
|
||||
status: 'pending' | 'processing' | 'succeeded' | 'failed' | 'skipped' | string
|
||||
attemptCount: number
|
||||
maxAttempts: number
|
||||
nextRunAt: string | null
|
||||
lastError: string
|
||||
productName: string
|
||||
platformOrderId: string
|
||||
workOrderStatus: string
|
||||
updatedAt: string | null
|
||||
}
|
||||
|
||||
export function fetchAdminOrderServiceAutoPublishJobs(status = 'failed') {
|
||||
return apiGet<{ items: AdminOrderServiceAutoPublishJob[] }>(
|
||||
'/api/v1/admin/worker-platform/order-service/auto-publish-jobs',
|
||||
{ status },
|
||||
)
|
||||
}
|
||||
|
||||
export function retryAdminOrderServiceAutoPublishJob(jobId: number) {
|
||||
return apiPost<{ jobId: number }>(
|
||||
`/api/v1/admin/worker-platform/order-service/auto-publish-jobs/${jobId}/retry`,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user