新增开发 Mock 后台菜单与造单能力
非生产环境在后台提供 lewan/feifei 领取造单与 91 查单模拟,CLI 复用同一服务,避免依赖真实平台联调。
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
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)
|
||||
}
|
||||
@@ -6,3 +6,4 @@ export * from './platform-config'
|
||||
export * from './kuaishou-industry'
|
||||
export * from './orders'
|
||||
export * from './tasks'
|
||||
export * from './dev-mock'
|
||||
|
||||
Reference in New Issue
Block a user