搜索工单列表(管理员视角)
管理员视角按多维度条件全量搜索工单。创建时间默认取近 30 天,最大跨度 90 天;opTime/updateTime 同样限制 90 天;offset 最大 50000,超出直接报错。statusList 优先于 status 生效;withCustomField=true 时为每张工单单独查询自定义字段值,查询量大时注意性能。withMailReplyList=true 时批量查询邮件回复记录并挂载到各工单 mailReplyList 字段。
请求参数
| 名称 | 类型 | 必填 | 描述 | 示例值 |
|---|---|---|---|---|
| appKey | string | 是 | 应用 AppKey | |
| time | int64 | 是 | 请求时间戳(秒) | |
| checksum | string | 是 | 请求签名校验和 | |
| checksumAlgorithm | int32 | 否 | 签名算法:0 - 默认(SHA1),1 - SHA256 |
请求体
| 名称 | 类型 | 必填 | 描述 | 示例值 |
|---|---|---|---|---|
| ticketId | int64 | 否 | 工单 ID 精确匹配 | 123456 |
| mobile | string | 否 | 用户手机号 | 13800138000 |
| templateId | int64 | 否 | 工单模板 ID | 30001 |
| limit | int32 | 否 | 每页数量,最大 500,默认 500 | 500 |
| offset | int64 | 否 | 偏移量,最大 50000,默认 0 | 0 |
| status | int32 | 否 | 单一状态过滤:0-未知,1-已提交,5-未受理,10-受理中,20-完结,25-已驳回,50-已挂起,999-已删除 | 10 |
| statusList | string | 否 | 多状态过滤,逗号分隔,取值同 status;传入时优先于 status 生效 | 5,10,20 |
| sortBy | string | 否 | 排序字段,默认 ct | ct |
| order | string | 否 | 排序方向:asc / desc,默认 desc | desc |
| start | int64 | 否 | 创建时间起始(毫秒时间戳),默认近 30 天,最大跨度 90 天 | 1719763200000 |
| end | int64 | 否 | 创建时间结束(毫秒时间戳) | 1722441599000 |
| opStart | int64 | 否 | 操作时间起始(毫秒时间戳),最大跨度 90 天 | 1719849600000 |
| opEnd | int64 | 否 | 操作时间结束(毫秒时间戳) | 1722441599000 |
| updateStart | int64 | 否 | 更新时间起始(毫秒时间戳),最大跨度 90 天 | 1719849600000 |
| updateEnd | int64 | 否 | 更新时间结束(毫秒时间戳) | 1722441599000 |
| uid | string | 否 | 访客外部 ID(uid) | user_3f9a2c8d |
| queryCrmInfo | string | 否 | 是否查询 CRM 信息 | true |
| type | int32 | 否 | CRM 类型 | 1 |
| solveStatus | int32 | 否 | 评价解决状态 | 1 |
| withMailReplyList | boolean | 否 | 是否返回邮件回复列表 | true |
| withCustomField | boolean | 否 | 是否返回自定义字段 | true |
| customFields | object[] | 否 | 工单自定义字段过滤条件。推荐传 JSON 数组;兼容传入包含同一数组的 JSON 字符串。字段标识兼容 id 别名,多个条件按 AND 组合 | [{"fieldId":81001,"value":"SO202407010001"}] |
| └fieldId | int64 | 否 | 工单自定义字段定义 ID;兼容使用 id 别名 | 81001 |
| └value | string | 否 | 搜索值,必须以字符串传递;接口不会移除首尾空格 | SO202407010001 |
返回参数
| 名称 | 类型 | 描述 | 示例值 |
|---|---|---|---|
| code | int32 | 状态码,200 表示成功 | 200 |
| message | object | 工单分页数据 | {"total":2,"tickets":[{"id":123456,"staffId":10001,"holderId":10002,"lastFinishProcessor":10002,"templateId":30001,"typeId":40001,"priority":8,"groupId":20001,"title":"售后咨询:订单取消后未退款","content":"用户反馈订单取消后 3 个工作日仍未收到退款,请协助核实。","status":10,"createTime":1720085400000}]} |
| └total | int64 | 工单总数 | 2 |
| └tickets | object[] | 工单列表 | [{"id":123456,"staffId":10001,"holderId":10002,"lastFinishProcessor":10002,"templateId":30001,"typeId":40001,"priority":8,"groupId":20001,"title":"售后咨询:订单取消后未退款","content":"用户反馈订单取消后 3 个工作日仍未收到退款,请协助核实。","status":10,"createTime":1720085400000}] |
| └id | int64 | 工单ID | 123456 |
| └staffId | int64 | 发起人(坐席)ID | 10001 |
| └holderId | int64 | 受理人(坐席)ID | 10002 |
| └lastFinishProcessor | int64 | 最后完结人ID | 10002 |
| └templateId | int64 | 工单模板ID | 30001 |
| └typeId | int64 | 工单分类ID | 40001 |
| └priority | int32 | 优先级:2-低,5-一般,8-紧急,10-非常紧急 | 8 |
| └groupId | int64 | 受理组ID | 20001 |
| └title | string | 工单标题 | 售后咨询:订单取消后未退款 |
| └content | string | 工单内容 | 用户反馈订单取消后 3 个工作日仍未收到退款,请协助核实。 |
| └status | int32 | 工单状态:0-未知,1-已提交,5-未受理,10-受理中,20-完结,25-已驳回,50-已挂起,999-已删除 | 10 |
| └createTime | int64 | 工单创建时间(毫秒时间戳) | 1720085400000 |
| └userName | string | 用户姓名 | 张三 |
| └userEmail | string | 用户邮箱 | zhangsan@example.com |
| └userMobile | string | 用户手机号 | 13800138000 |
| └properties | string | 工单附加属性(JSON 字符串) | {"orderId":"SO202407010001","channel":"wechat"} |
| └typeStr | string | 分类名称路径字符串(请求返回分类路径时返回) | 售后服务/退款问题 |
| └modifyLast | boolean | 最后一次操作是否为修改 | false |
| └attachments | object[] | 创建工单时的附件列表 | [{"name":"退款凭证.pdf","size":245760,"url":"https://nos.example.com/ticket/refund-proof.pdf"}] |
| └name | string | 附件文件名 | 退款凭证.pdf |
| └size | int64 | 附件大小(字节) | 245760 |
| └url | string | 附件下载地址 | https://nos.example.com/ticket/refund-proof.pdf |
| └comments | object[] | 工单流转评论列表 | [{"staffId":10001,"comment":"已联系财务核实退款状态,请耐心等待。","timestamp":1720087200000,"attachments":[]}] |
| └staffId | int64 | 操作坐席ID | 10001 |
| └comment | string | 回复/备注内容 | 已联系财务核实退款状态,请耐心等待。 |
| └timestamp | int64 | 操作时间(毫秒时间戳) | 1720087200000 |
| └attachments | object[] | 随此次操作上传的附件列表 | [{"name":"退款凭证.pdf","size":245760,"url":"https://nos.example.com/ticket/refund-proof.pdf"}] |
| └name | string | 附件文件名 | 退款凭证.pdf |
| └size | int64 | 附件大小(字节) | 245760 |
| └url | string | 附件下载地址 | https://nos.example.com/ticket/refund-proof.pdf |
| └custom | object[] | 自定义字段值列表 | [{"id":91001,"name":"订单号","value":"SO202407010001","fieldId":81001}] |
| └id | int64 | 自定义字段记录ID | 91001 |
| └name | string | 自定义字段名称 | 订单号 |
| └value | object | 自定义字段值 | SO202407010001 |
| └fieldId | int64 | 自定义字段定义 ID | 81001 |
| └follower | string | 关注人ID列表(JSON 字符串) | [10003,10004] |
| └crmUserName | string | CRM 用户姓名 | 张三 |
| └crmUserEmail | string | CRM 用户邮箱 | zhangsan@example.com |
| └crmUserPhone | string | CRM 用户手机号 | 13800138000 |
| └crmId | string | CRM 用户ID | crm_78901 |
| └userId | int64 | 访客用户ID | 556677 |
| └crmForeignId | string | CRM 外部ID(foreignId) | crm_ext_001 |
| └connectionType | int32 | 关联会话连接类型 | 1 |
| └connectionId | int64 | 关联会话连接ID | 987654321 |
| └holderPlatformId | int64 | 受理方平台ID | 1 |
| └mailReplyList | object[] | 邮件回复列表(withMailReplyList=true 时返回) | [{"ticketId":123456,"id":88001,"sender":{"nickname":"七鱼售后","address":"support@example.com"},"toMailList":[{"nickname":"张三","address":"zhangsan@example.com"}],"ccMailList":[{"nickname":"财务","address":"finance@example.com"}],"subject":"Re: 订单退款咨询","sendTime":1720089000000,"monitorStatus":1,"replyStatus":2,"mailDir":2,"lastOperatorId":10002,"replyStaffId":10002,"lastUpdateTime":1720089300000}] |
| └ticketId | int64 | 关联工单ID | 123456 |
| └id | int64 | 邮件记录ID | 88001 |
| └sender | object | 邮箱昵称与地址 | [{"nickname":"财务","address":"finance@example.com"}] |
| └nickname | string | 邮箱昵称 | 七鱼售后 |
| └address | string | 邮箱地址 | support@example.com |
| └toMailList | object[] | 收件人列表 | [{"nickname":"张三","address":"zhangsan@example.com"}] |
| └nickname | string | 邮箱昵称 | 七鱼售后 |
| └address | string | 邮箱地址 | support@example.com |
| └ccMailList | object[] | 抄送人列表 | [{"nickname":"财务","address":"finance@example.com"}] |
| └nickname | string | 邮箱昵称 | 七鱼售后 |
| └address | string | 邮箱地址 | support@example.com |
| └subject | string | 邮件主题 | Re: 订单退款咨询 |
| └sendTime | int64 | 发送时间(毫秒时间戳) | 1720089000000 |
| └monitorStatus | int32 | 监测状态 | 1 |
| └replyStatus | int32 | 回复状态 | 2 |
| └mailDir | int32 | 邮件方向:1-接收,2-发送 | 2 |
| └lastOperatorId | int64 | 最后操作坐席ID(目前为修改监测状态的坐席) | 10002 |
| └replyStaffId | int64 | 回复坐席ID | 10002 |
| └lastUpdateTime | int64 | 最后修改时间(毫秒时间戳,目前为最后修改监测状态的时间) | 1720089300000 |
| └pluginUrl | string | 工单插件 URL | https://openapi.qiyukf.com/plugin/ticket/123456 |
| └groupName | string | 受理组名称 | 售后组 |
| └holderName | string | 受理人名称 | 李四 |
| └comment | string | 最新回复内容 | 已联系财务核实退款状态,请耐心等待。 |
| └commentStaffName | string | 最新回复坐席姓名 | 李四 |
| └modifyTime | int64 | 工单最后更新时间(毫秒时间戳) | 1720089000000 |
| └firstDispatchTime | int64 | 首次分配时间(毫秒时间戳) | 1720086000000 |
错误码
| 状态码 | 描述 |
|---|---|
| 14004 | 时间范围超过 90 天;offset 超过 50000;请求体 JSON 格式错误 |
| 14500 | 服务内部异常 |
/openapi/v2/ticket/searchcurl -X POST "https://qiyukf.com/openapi/v2/ticket/search?appKey=string&time=0&checksum=string" \ -H "Content-Type: application/json" \ -d '{}'{
"code": 200,
"message": {
"total": 2,
"tickets": [
{
"id": 123456,
"staffId": 10001,
"holderId": 10002,
"lastFinishProcessor": 10002,
"templateId": 30001,
"typeId": 40001,
"priority": 8,
"groupId": 20001,
"title": "售后咨询:订单取消后未退款",
"content": "用户反馈订单取消后 3 个工作日仍未收到退款,请协助核实。",
"status": 10,
"createTime": 1720085400000
}
]
}
}{
"code": 14004,
"message": "时间范围超过 90 天;offset 超过 50000;请求体 JSON 格式错误"
}{
"code": 14500,
"message": "服务内部异常"
}这篇文档有帮助吗?
创建工单
代访客创建工单,支持普通工单(OpenAPI 来源)和邮件工单(fromType=4)。 **参数与工单类型** - uid 与 userMobile 二选一。 - 普通工单的 staffId 必填:-1 代表访客自助提交,正数代表发起坐席,且该坐席必须有效并属于本企业。 - 邮件工单的 uid 和 userEmail 必填,不使用 staffId 和受理目标规则。 **受理目标规则** 1. 未使用自动流转模板时,优先使用接口传入的 targetStaffId、targetGroupId,未传的字段可由模板预设补充。 2. 若最终没有有效受理目标,staffId 为正数时会自动成为受理人,staffId=-1 时则创建失败。 3. 未指定模板(templateId=0)时,staffId=-1 必须传 targetStaffId、targetGroupId 中的至少一个;staffId 为真实坐席时两者可不传,默认由 staffId 受理。 4. 使用自动流转模板时,接口传入的 targetStaffId、targetGroupId 仍会先进行有效性校验,但在实际分配时会被模板流程覆盖。 5. 部分企业若将非自动流转模板的受理组和受理人同时配置为必填,则两者最终都必须有值;同时指定受理组和受理人时,受理人必须属于该组。 **幂等与附件** - uniqueId 最长 32 字符,重复提交时返回已创建的工单 ID。 - 附件最多 5 个、总大小不超过 50 MB;type=1 为 Base64 图片上传后生成 URL,type=2 为 URL 直接使用。
搜索已删除工单
搜索已逻辑删除的工单,适用于数据同步场景。删除时间(dbUpdateTime)默认取近 30 天,最大跨度 90 天,超出直接报错。limit 最大 500;withMailReplyList=true 时批量查询邮件回复记录并挂载到各工单 mailReplyList 字段。