Repository navigation
feat(ticket): 补齐 #9 —— 用户关单/催单、接单/转交、部门/分类/关联 - #2
Closed
worable233 wants to merge 0 commit into
Closed
worable233 wants to merge 0 commit into
worable233 wants to merge 0 commit into
Conversation
worable233
force-pushed
the
feat/ticket-full-lifecycle
branch
from
October 24, 2026 10:46
6978635 to
eb1fee4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
审计 #9 把「工单」压成一行笼统能力,结果是同时高估和漏记:
此前工单插件只有「提交 / 回话 / 管理员改状态」三条路。这份 PR 按真实缺口逐条补上,并保持已有接口完全兼容(旧
kernel-tests/ticket.test.ts9/9 原样通过,一行没改)。状态机
新增
PENDING_USER(等用户回话):PENDING_USERPENDING_USER/RESOLVED回到IN_PROGRESS之前「谁在等谁」无法表达,工单会一直停在
IN_PROGRESS而实际上用户在等客服。CLOSED成为真正终态:管理端不能把已关闭工单改回其它状态,否则「关闭」形同虚设。用户侧
POST /tickets/:id/closePOST /tickets/:id/remindreminderCount+ 记最后催单时间,不写消息(不污染时间线)管理侧
assigneeId非空且原状态为OPEN时自动进IN_PROGRESS。刻意只有一条写状态的路径 —— 两套接口迟早会产出不一致的
assignee/status组合。assigneeId,通知新处理人,不动状态。internal,只对管理员可见。过滤放在读取路径(而不是只在 UI 隐藏),并且该字段不进索引 —— 内核
where只接受已声明索引字段,否则直接 422。category/departmentId/unassigned(「待接单」队列)。数据模型
工单新增:
category、departmentId、relatedType+relatedId(成对校验,单边数据没有追溯价值)、reminderCount、lastRemindedAtMs、closedAtMs、closedBy;消息新增internal。全部新列可空且有默认值:扩展引擎只做
ADD COLUMN IF NOT EXISTS,老数据读出来是null,不会因为加字段而校验失败。前端
共享
TicketWorkspace只开挂载点(extraActions+ 可选文案),业务动词与文案留在插件里 —— 内核 UI 不该承载某个插件的工单语义。验证
内核侧 14 个用例锁的是行为而不是「接口存在」:
assigneeId= 自己,且状态从OPEN变IN_PROGRESSinternal: trueOPEN→ 409IN_PROGRESSrelatedId单边提交 → 400category=billing、unassigned=true计数正确未做(明确披露)
departmentId与筛选。部门表(名称/成员/路由规则)属于组织架构域,需要独立的数据模型与管理员 CRUD,不与工单强耦合。