69 lines
1.4 KiB
TypeScript
69 lines
1.4 KiB
TypeScript
import { apiGet, apiPost } from '@/lib/http'
|
|
|
|
export type DevMockStatus = {
|
|
enabled: boolean
|
|
nodeEnv: string
|
|
defaultUid: string
|
|
platforms: Array<{
|
|
key: string
|
|
name: string
|
|
description: string
|
|
steps: string[]
|
|
}>
|
|
}
|
|
|
|
export type DevMockCreateResult = {
|
|
platform: 'lewan' | 'feifei'
|
|
orderId: number
|
|
orderNo: string
|
|
taskId: number
|
|
taskNo: string
|
|
claimToken: string
|
|
claimUrl: string
|
|
frontendClaimUrl: string
|
|
expectedUid: string
|
|
step: string
|
|
productName: string
|
|
tips: string[]
|
|
open91QueryHint: string
|
|
}
|
|
|
|
export type DevMockOpen91QueryResult = {
|
|
endpoint: string
|
|
requestBody: Record<string, unknown>
|
|
curl: string
|
|
response: unknown
|
|
}
|
|
|
|
export function fetchDevMockStatus() {
|
|
return apiGet<DevMockStatus>('/api/v1/admin/dev-mock/status')
|
|
}
|
|
|
|
export function createLewanDevMock(payload: {
|
|
step?: string
|
|
uid?: string
|
|
orderNo?: string
|
|
productNo?: string
|
|
}) {
|
|
return apiPost<DevMockCreateResult>('/api/v1/admin/dev-mock/lewan', payload)
|
|
}
|
|
|
|
export function createFeifeiDevMock(payload: {
|
|
step?: string
|
|
uid?: string
|
|
orderNo?: string
|
|
productName?: string
|
|
productCode?: string
|
|
h5Url?: string
|
|
}) {
|
|
return apiPost<DevMockCreateResult>('/api/v1/admin/dev-mock/feifei', payload)
|
|
}
|
|
|
|
export function buildOpen91QueryDevMock(payload: {
|
|
orderNo: string
|
|
execute?: boolean
|
|
baseUrl?: string
|
|
}) {
|
|
return apiPost<DevMockOpen91QueryResult>('/api/v1/admin/dev-mock/open91/query', payload)
|
|
}
|