feat: add WeCom outbox management features including retry and ignore actions, permissions, and UI integration

This commit is contained in:
mlogclub
2026-08-02 14:03:23 +08:00
parent c69b30a659
commit 1d6c0e37db
16 changed files with 457 additions and 1 deletions
+39
View File
@@ -193,6 +193,23 @@ export type WxWorkKFAccount = {
managePrivilege: boolean
}
export type ChannelMessageOutbox = {
id: number
channelType: string
conversationId: number
messageId: number
payload: string
sendStatus: string
retryCount: number
nextRetryAt: string
lastError: string
sentAt: string
createdAt: string
updatedAt: string
createUserName: string
updateUserName: string
}
export type CreateAdminChannelPayload = {
channelType: string
aiAgentId: number
@@ -907,6 +924,28 @@ export function fetchWxWorkKFAccounts() {
return request<WxWorkKFAccount[]>("/api/dashboard/channel/wxwork/kf/accounts")
}
export function fetchWxWorkOutboxFailures(
query?: Record<string, string | number | undefined>
) {
return request<PageResult<ChannelMessageOutbox>>(
`/api/dashboard/channel/wxwork/outbox/failed/list${toQueryString(query)}`
)
}
export function retryWxWorkOutbox(id: number) {
return request<void>("/api/dashboard/channel/wxwork/outbox/retry", {
method: "POST",
body: JSON.stringify({ id }),
})
}
export function ignoreWxWorkOutbox(id: number) {
return request<void>("/api/dashboard/channel/wxwork/outbox/ignore", {
method: "POST",
body: JSON.stringify({ id }),
})
}
export function createChannel(payload: CreateAdminChannelPayload) {
return request<AdminChannel>("/api/dashboard/channel/create", {
method: "POST",
+7
View File
@@ -38,6 +38,13 @@ describe("isDashboardNavItemActive", () => {
isDashboardNavItemActive("/dashboard/tickets-extra", "/dashboard/tickets"),
false
)
assert.equal(
isDashboardNavItemActive(
"/dashboard/wxwork-outbox",
"/dashboard/channels"
),
false
)
})
it("only marks the dashboard home item active on the exact dashboard path", async () => {
+7
View File
@@ -7,6 +7,7 @@ import {
GlobeIcon,
KeyRoundIcon,
LayoutDashboardIcon,
MessageSquareWarningIcon,
MessageSquareCodeIcon,
MessageSquareMoreIcon,
ShieldCheckIcon,
@@ -169,6 +170,12 @@ export const dashboardNavSections: DashboardNavSectionConfig[] = [
icon: <GlobeIcon />,
requiredPermission: "channel.view",
},
{
titleKey: "nav.wxworkOutbox",
url: "/dashboard/wxwork-outbox",
icon: <MessageSquareWarningIcon />,
requiredPermission: "wxworkOutbox.view",
},
],
},
{
+2
View File
@@ -36,6 +36,7 @@ const PERMISSION_RESOURCE_LABELS: Record<string, { singular: string; plural: str
tag: { singular: "tag", plural: "tags" },
company: { singular: "company", plural: "companies" },
channel: { singular: "channel", plural: "channels" },
wxworkOutbox: { singular: "WeCom outbox record", plural: "WeCom outbox records" },
customer: { singular: "customer", plural: "customers" },
agent: { singular: "agent", plural: "agents" },
agentTeam: { singular: "agent team", plural: "agent teams" },
@@ -60,6 +61,7 @@ const PERMISSION_NAME_OVERRIDES: Record<string, string> = {
"channel.resetUserTokenSecret": "Reset channel user token secret",
"agent.config": "Configure agent service rules",
"agentTeamSchedule.batchGenerate": "Batch generate agent team schedules",
"wxworkOutbox.update": "Handle WeCom outbox records",
"mcp.view": "View MCP debug information",
"mcp.call": "Call MCP tools",
}