wip: baseline changes before channel-conversation-task boundary implementation
This commit is contained in:
@@ -6,20 +6,70 @@ export function login(data: { tenantCode: string; username: string; password: st
|
||||
})
|
||||
}
|
||||
|
||||
export function createTenant(data: { tenantCode: string; tenantName: string }) {
|
||||
export function createTenant(data: {
|
||||
tenantCode: string
|
||||
tenantName: string
|
||||
inboundWebhookUrl?: string
|
||||
initAdminUsername?: string
|
||||
initAdminPassword?: string
|
||||
}) {
|
||||
return client.post('/api/v1/account/tenant', data)
|
||||
}
|
||||
|
||||
export function updateTenant(
|
||||
id: number,
|
||||
data: { tenantName: string; inboundWebhookUrl?: string; status?: number }
|
||||
) {
|
||||
return client.put(`/api/v1/account/tenant/${id}`, data)
|
||||
}
|
||||
|
||||
export function deleteTenant(id: number) {
|
||||
return client.delete(`/api/v1/account/tenant/${id}`)
|
||||
}
|
||||
|
||||
export function listTenants() {
|
||||
return client.get('/api/v1/account/tenant/list')
|
||||
}
|
||||
|
||||
export function createUser(data: { username: string; password: string; realName?: string; roleCodes?: string[] }) {
|
||||
return client.post('/api/v1/account/user', data)
|
||||
export function listRoles() {
|
||||
return client.get('/api/v1/account/role/list')
|
||||
}
|
||||
|
||||
export function listUsers() {
|
||||
return client.get('/api/v1/account/user/list')
|
||||
export function createUser(
|
||||
tenantCode: string,
|
||||
data: {
|
||||
username: string
|
||||
password: string
|
||||
realName?: string
|
||||
phone?: string
|
||||
roleCodes?: string[]
|
||||
}
|
||||
) {
|
||||
return client.post('/api/v1/account/user', data, {
|
||||
headers: { 'X-Tenant-Code': tenantCode },
|
||||
})
|
||||
}
|
||||
|
||||
export function updateUser(
|
||||
id: number,
|
||||
data: {
|
||||
realName: string
|
||||
phone?: string
|
||||
status?: number
|
||||
roleCodes?: string[]
|
||||
}
|
||||
) {
|
||||
return client.put(`/api/v1/account/user/${id}`, data)
|
||||
}
|
||||
|
||||
export function deleteUser(id: number) {
|
||||
return client.delete(`/api/v1/account/user/${id}`)
|
||||
}
|
||||
|
||||
export function listUsers(tenantCode?: string) {
|
||||
return client.get('/api/v1/account/user/list', {
|
||||
params: tenantCode ? { tenantCode } : {},
|
||||
})
|
||||
}
|
||||
|
||||
export function me() {
|
||||
|
||||
@@ -1,24 +1,6 @@
|
||||
import client from './client'
|
||||
|
||||
export function createChannelSubject(data: any) {
|
||||
return client.post('/api/v1/channel-subject', data)
|
||||
}
|
||||
|
||||
export function listChannelSubjects() {
|
||||
return client.get('/api/v1/channel-subject/list')
|
||||
}
|
||||
|
||||
export function createChannelAccount(data: any) {
|
||||
return client.post('/api/v1/channel-account', data)
|
||||
}
|
||||
|
||||
export function listChannelAccounts() {
|
||||
return client.get('/api/v1/channel-account/list')
|
||||
}
|
||||
|
||||
export function initChannelAccount(data: any) {
|
||||
return client.post('/api/v1/channel-account/init', data)
|
||||
}
|
||||
export * from './channelSubject'
|
||||
export * from './channelAccount'
|
||||
|
||||
export function createConversation(data: any) {
|
||||
return client.post('/api/v1/conversation', data)
|
||||
@@ -28,6 +10,14 @@ export function listConversations() {
|
||||
return client.get('/api/v1/conversation/list')
|
||||
}
|
||||
|
||||
export function updateConversation(id: number, data: any) {
|
||||
return client.put(`/api/v1/conversation/${id}`, data)
|
||||
}
|
||||
|
||||
export function deleteConversation(id: number) {
|
||||
return client.delete(`/api/v1/conversation/${id}`)
|
||||
}
|
||||
|
||||
export function bindConversationAccount(conversationId: number, data: any) {
|
||||
return client.post(`/api/v1/conversation/${conversationId}/bind-account`, data)
|
||||
}
|
||||
|
||||
33
admin-web/src/api/channelAccount.ts
Normal file
33
admin-web/src/api/channelAccount.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import client from './client'
|
||||
|
||||
export function createChannelAccount(data: any) {
|
||||
return client.post('/api/v1/channel-account', data)
|
||||
}
|
||||
|
||||
export function listChannelAccounts() {
|
||||
return client.get('/api/v1/channel-account/list')
|
||||
}
|
||||
|
||||
export function updateChannelAccount(id: number, data: any) {
|
||||
return client.put(`/api/v1/channel-account/${id}`, data)
|
||||
}
|
||||
|
||||
export function deleteChannelAccount(id: number) {
|
||||
return client.delete(`/api/v1/channel-account/${id}`)
|
||||
}
|
||||
|
||||
export function updateChannelAccountStatus(id: number, data: any) {
|
||||
return client.patch(`/api/v1/channel-account/${id}/status`, data)
|
||||
}
|
||||
|
||||
export function getChannelAccountStatus(id: number) {
|
||||
return client.get(`/api/v1/channel-account/${id}/status`)
|
||||
}
|
||||
|
||||
export function initChannelAccount(data: any) {
|
||||
return client.post('/api/v1/channel-account/init', data)
|
||||
}
|
||||
|
||||
export function syncChannelAccountConversations(id: number) {
|
||||
return client.post(`/api/v1/channel-account/${id}/sync-conversations`)
|
||||
}
|
||||
21
admin-web/src/api/channelSubject.ts
Normal file
21
admin-web/src/api/channelSubject.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import client from './client'
|
||||
|
||||
export function createChannelSubject(data: any) {
|
||||
return client.post('/api/v1/channel-subject', data)
|
||||
}
|
||||
|
||||
export function listChannelSubjects() {
|
||||
return client.get('/api/v1/channel-subject/list')
|
||||
}
|
||||
|
||||
export function updateChannelSubject(id: number, data: any) {
|
||||
return client.put(`/api/v1/channel-subject/${id}`, data)
|
||||
}
|
||||
|
||||
export function deleteChannelSubject(id: number) {
|
||||
return client.delete(`/api/v1/channel-subject/${id}`)
|
||||
}
|
||||
|
||||
export function updateChannelSubjectStatus(id: number, data: any) {
|
||||
return client.patch(`/api/v1/channel-subject/${id}/status`, data)
|
||||
}
|
||||
@@ -21,7 +21,13 @@ client.interceptors.request.use((config) => {
|
||||
})
|
||||
|
||||
client.interceptors.response.use(
|
||||
(response) => response.data,
|
||||
(response) => {
|
||||
const data = response.data
|
||||
if (data && typeof data === 'object' && 'code' in data && data.code !== 0) {
|
||||
return Promise.reject(new Error(data.message || '请求失败'))
|
||||
}
|
||||
return data
|
||||
},
|
||||
(error) => {
|
||||
if (error.response?.status === 401) {
|
||||
localStorage.clear()
|
||||
|
||||
@@ -8,10 +8,42 @@ export function listPersons() {
|
||||
return client.get('/api/v1/person/list')
|
||||
}
|
||||
|
||||
export function listTags() {
|
||||
return client.get('/api/v1/tag/list')
|
||||
export function updatePerson(id: number, data: any) {
|
||||
return client.put(`/api/v1/person/${id}`, data)
|
||||
}
|
||||
|
||||
export function deletePerson(id: number) {
|
||||
return client.delete(`/api/v1/person/${id}`)
|
||||
}
|
||||
|
||||
export function listPersonIdentities(personId: number) {
|
||||
return client.get(`/api/v1/person/${personId}/identities`)
|
||||
}
|
||||
|
||||
export function createPersonIdentity(personId: number, data: any) {
|
||||
return client.post(`/api/v1/person/${personId}/identities`, data)
|
||||
}
|
||||
|
||||
export function deletePersonIdentity(personId: number, identityId: number) {
|
||||
return client.delete(`/api/v1/person/${personId}/identities/${identityId}`)
|
||||
}
|
||||
|
||||
export function bindPersonTags(personId: number, data: any) {
|
||||
return client.post(`/api/v1/person/${personId}/bind-tags`, data)
|
||||
}
|
||||
|
||||
export function createTag(data: any) {
|
||||
return client.post('/api/v1/tag', data)
|
||||
}
|
||||
|
||||
export function listTags() {
|
||||
return client.get('/api/v1/tag/list')
|
||||
}
|
||||
|
||||
export function updateTag(id: number, data: any) {
|
||||
return client.put(`/api/v1/tag/${id}`, data)
|
||||
}
|
||||
|
||||
export function deleteTag(id: number) {
|
||||
return client.delete(`/api/v1/tag/${id}`)
|
||||
}
|
||||
|
||||
75
admin-web/src/api/inboundFlow.ts
Normal file
75
admin-web/src/api/inboundFlow.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import client from './client'
|
||||
|
||||
export interface FlowNodeConfig {
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export interface FlowNode {
|
||||
id: string
|
||||
type: string
|
||||
config: FlowNodeConfig
|
||||
}
|
||||
|
||||
export interface FlowEdge {
|
||||
source: string
|
||||
target: string
|
||||
label?: string
|
||||
}
|
||||
|
||||
export interface FlowDefinition {
|
||||
nodes: FlowNode[]
|
||||
edges: FlowEdge[]
|
||||
}
|
||||
|
||||
export interface FlowRecord {
|
||||
id: number
|
||||
flowCode: string
|
||||
flowName: string
|
||||
flowType: number
|
||||
status: number
|
||||
definitionJson: string | FlowDefinition
|
||||
version?: number
|
||||
createTime?: string
|
||||
updateTime?: string
|
||||
}
|
||||
|
||||
export interface SaveFlowPayload {
|
||||
flowCode: string
|
||||
flowName: string
|
||||
flowType?: string
|
||||
definitionJson: FlowDefinition
|
||||
}
|
||||
|
||||
export function listFlows() {
|
||||
return client.get('/api/v1/inbound/flow/list')
|
||||
}
|
||||
|
||||
export function getFlow(flowCode: string) {
|
||||
return client.get(`/api/v1/inbound/flow/${flowCode}`)
|
||||
}
|
||||
|
||||
export function saveFlow(data: SaveFlowPayload) {
|
||||
return client.post('/api/v1/inbound/flow', {
|
||||
...data,
|
||||
flowType: data.flowType || 'inbound',
|
||||
})
|
||||
}
|
||||
|
||||
export function updateFlow(flowCode: string, data: SaveFlowPayload) {
|
||||
return client.post(`/api/v1/inbound/flow/${flowCode}`, {
|
||||
...data,
|
||||
flowType: data.flowType || 'inbound',
|
||||
})
|
||||
}
|
||||
|
||||
export function publishFlow(flowCode: string) {
|
||||
return client.post(`/api/v1/inbound/flow/${flowCode}/publish`)
|
||||
}
|
||||
|
||||
export function offlineFlow(flowCode: string) {
|
||||
return client.post(`/api/v1/inbound/flow/${flowCode}/offline`)
|
||||
}
|
||||
|
||||
export function deleteFlow(flowCode: string) {
|
||||
return client.delete(`/api/v1/inbound/flow/${flowCode}`)
|
||||
}
|
||||
13
admin-web/src/api/inboundWebhook.ts
Normal file
13
admin-web/src/api/inboundWebhook.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import client from './client'
|
||||
|
||||
export function getInboundWebhookConfig() {
|
||||
return client.get('/api/v1/account/tenant/webhook')
|
||||
}
|
||||
|
||||
export function updateInboundWebhookConfig(data: any) {
|
||||
return client.post('/api/v1/account/tenant/webhook', data)
|
||||
}
|
||||
|
||||
export function testInboundWebhook(data: { url: string }) {
|
||||
return client.post('/api/v1/account/tenant/webhook/test', data)
|
||||
}
|
||||
75
admin-web/src/api/ivrFlow.ts
Normal file
75
admin-web/src/api/ivrFlow.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import client from './client'
|
||||
|
||||
export interface FlowNodeConfig {
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export interface FlowNode {
|
||||
id: string
|
||||
type: string
|
||||
config: FlowNodeConfig
|
||||
}
|
||||
|
||||
export interface FlowEdge {
|
||||
source: string
|
||||
target: string
|
||||
label?: string
|
||||
}
|
||||
|
||||
export interface FlowDefinition {
|
||||
nodes: FlowNode[]
|
||||
edges: FlowEdge[]
|
||||
}
|
||||
|
||||
export interface FlowRecord {
|
||||
id: number
|
||||
flowCode: string
|
||||
flowName: string
|
||||
flowType: number
|
||||
status: number
|
||||
definitionJson: string | FlowDefinition
|
||||
version?: number
|
||||
createTime?: string
|
||||
updateTime?: string
|
||||
}
|
||||
|
||||
export interface SaveFlowPayload {
|
||||
flowCode: string
|
||||
flowName: string
|
||||
flowType?: string
|
||||
definitionJson: FlowDefinition
|
||||
}
|
||||
|
||||
export function listFlows() {
|
||||
return client.get('/api/v1/flow/list')
|
||||
}
|
||||
|
||||
export function getFlow(flowCode: string) {
|
||||
return client.get(`/api/v1/flow/${flowCode}`)
|
||||
}
|
||||
|
||||
export function saveFlow(data: SaveFlowPayload) {
|
||||
return client.post('/api/v1/flow', {
|
||||
...data,
|
||||
flowType: data.flowType || 'ivr',
|
||||
})
|
||||
}
|
||||
|
||||
export function updateFlow(flowCode: string, data: SaveFlowPayload) {
|
||||
return client.post(`/api/v1/flow/${flowCode}`, {
|
||||
...data,
|
||||
flowType: data.flowType || 'ivr',
|
||||
})
|
||||
}
|
||||
|
||||
export function publishFlow(flowCode: string) {
|
||||
return client.post(`/api/v1/flow/${flowCode}/publish`)
|
||||
}
|
||||
|
||||
export function offlineFlow(flowCode: string) {
|
||||
return client.post(`/api/v1/flow/${flowCode}/offline`)
|
||||
}
|
||||
|
||||
export function deleteFlow(flowCode: string) {
|
||||
return client.delete(`/api/v1/flow/${flowCode}`)
|
||||
}
|
||||
25
admin-web/src/api/sendPolicy.ts
Normal file
25
admin-web/src/api/sendPolicy.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import client from './client'
|
||||
|
||||
export function listPolicyGroups() {
|
||||
return client.get('/api/v1/policy-group/list')
|
||||
}
|
||||
|
||||
export function getPolicyGroup(groupCode: string) {
|
||||
return client.get(`/api/v1/policy-group/${groupCode}`)
|
||||
}
|
||||
|
||||
export function createPolicyGroup(data: any) {
|
||||
return client.post('/api/v1/policy-group', data)
|
||||
}
|
||||
|
||||
export function updatePolicyGroup(groupCode: string, data: any) {
|
||||
return client.post(`/api/v1/policy-group/${groupCode}`, data)
|
||||
}
|
||||
|
||||
export function updatePolicyGroupStatus(groupCode: string, status: number) {
|
||||
return client.post(`/api/v1/policy-group/${groupCode}/status`, { status })
|
||||
}
|
||||
|
||||
export function deletePolicyGroup(groupCode: string) {
|
||||
return client.post(`/api/v1/policy-group/${groupCode}/delete`)
|
||||
}
|
||||
31
admin-web/src/api/sendRecord.ts
Normal file
31
admin-web/src/api/sendRecord.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import client from './client'
|
||||
|
||||
export interface QueryRecordsParams {
|
||||
taskId?: string
|
||||
start?: string
|
||||
end?: string
|
||||
channelType?: string
|
||||
status?: number | string
|
||||
page?: number
|
||||
size?: number
|
||||
}
|
||||
|
||||
export function queryRecords(params: QueryRecordsParams) {
|
||||
return client.get('/api/v1/send/records', { params })
|
||||
}
|
||||
|
||||
export function getTaskStatus(taskId: string) {
|
||||
return client.get(`/api/v1/send/${taskId}/status`)
|
||||
}
|
||||
|
||||
export function cancelTask(taskId: string) {
|
||||
return client.post(`/api/v1/send/${taskId}/cancel`)
|
||||
}
|
||||
|
||||
export function testSend(data: any) {
|
||||
return client.post('/api/v1/send/test', data)
|
||||
}
|
||||
|
||||
export function getStatistics(start: string, end: string) {
|
||||
return client.get('/api/v1/send/statistics', { params: { start, end } })
|
||||
}
|
||||
Reference in New Issue
Block a user