docs: README补附件全链路章节(上传/规整/展示/打开下载/错误码/charset乱码修复)

This commit is contained in:
yumoqing 2026-09-11 13:32:42 +08:00
parent eb5393f299
commit 14a04e0b5a

View File

@ -26,10 +26,26 @@
| 表 | 说明 |
|---|------|
| tk_tickets | 工单主表(状态机+当前受理角色/人+agent处理锁 |
| tk_messages | 往来消息visibility: customer客户可见/internal内部备注 |
| tk_tickets | 工单主表(状态机+当前受理角色/人+agent处理锁customer_user_id 必填=提单人,待办精确到人 |
| tk_messages | 往来消息visibility: customer客户可见/internal内部备注attachments JSON 列存附件清单 |
| tk_transfers | 转派流水append-only每次受理方变更必留痕 |
## 附件2026-09-11 上线,全链路)
- **上传**客户建单表单Form uitype=file multiple、追问/回复弹窗UiFile multiple
FormData multipart → ahserver getPostData 自动落 FileStoragefilesroot按用户目录分片
params_kw['attachments'] 得 webpath单 str / 多 list。前端拦截单条 ≤9 个、总量 ≤9.5MB。
- **服务端规整**core.normalize_attachments 生成 [{id,name,webpath,size}](不信任客户端):
路径必须 '/' 开头无 '..'、realpath 不越出 filesroot、真实存在并调 tfr.file_useful 把文件
从临时清理队列摘除(否则 multipart 上传 1 小时后被当临时文件删)。错误码 TK_E014。
- **展示**ticket_detail_popup.dspy页面详情与平台待办共用消息流内联附件行 +
末尾「全部附件」汇总区;上传方彩色徽标区分(客户蓝/智能助手紫/人工客服橙)+昵称。
附件不做 markdown 链接——MdWidget 会劫持同源 <a> 为加载 markdown用独立按钮行。
- **打开/下载**ticket_attachment.dspymsg_id+att_id 反查I5 服务端校验:客户只能取
visibility=customer 消息附件staff/admin 全量)→ FileResponse?download=1 加 attachment 头。
文本类显式 Content-Type charset=utf-8aiohttp FileResponse 猜类型不附 charset → 中文乱码)。
错误码 TK_E015附件不存在/丢失。load_path 已注册 logined。
## 参数params 表,运行时可改)
| 参数 | 默认 | 说明 |