Files
customer-server/model/dto/webhook_dto.go
2026-03-14 10:02:49 +08:00

52 lines
2.1 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package dto
import "github.com/gogf/gf/v2/frame/g"
// WebhookReceiveReq 接收平台消息请求
type WebhookReceiveReq struct {
g.Meta `path:"/:platform" method:"post" tags:"Webhook" summary:"接收平台消息" dc:"接收小红书/抖音等平台推送的用户消息"`
Platform string `p:"platform" v:"required#平台标识不能为空" dc:"平台标识(xiaohongshu/douyin/kuaishou)"`
UserId string `json:"userId" v:"required#用户ID不能为空" dc:"平台用户ID"`
AccountId string `json:"accountId" dc:"客服账号ID"`
Content string `json:"content" v:"required#消息内容不能为空" dc:"消息内容"`
MsgId string `json:"msgId" dc:"平台消息ID用于去重"`
Timestamp int64 `json:"timestamp" dc:"消息时间戳"`
}
type WebhookReceiveRes struct {
Success bool `json:"success" dc:"是否成功"`
MsgId string `json:"msg_id,omitempty" dc:"消息ID"`
}
// WebhookCallbackReq 平台回调验证请求(部分平台需要)
type WebhookCallbackReq struct {
g.Meta `path:"/:platform/verify" method:"get" tags:"Webhook" summary:"回调验证" dc:"平台回调验证(部分平台接入时需要)"`
Platform string `p:"platform" dc:"平台标识"`
Signature string `p:"signature" dc:"签名"`
Timestamp string `p:"timestamp" dc:"时间戳"`
Nonce string `p:"nonce" dc:"随机数"`
Echostr string `p:"echostr" dc:"回显字符串"`
}
type WebhookCallbackRes struct {
g.Meta `mime:"text/plain"`
}
// ConversationListReq 对话记录查询请求
type ConversationListReq struct {
g.Meta `path:"/history" method:"get" tags:"Webhook" summary:"查询对话记录" dc:"查询用户历史对话记录"`
UserId string `p:"user_id" v:"required#用户ID不能为空" dc:"用户ID"`
Limit int64 `p:"limit" d:"20" dc:"返回数量默认20"`
}
type ConversationListRes struct {
List []*ConversationItem `json:"list" dc:"对话记录列表"`
}
type ConversationItem struct {
Question string `json:"question" dc:"用户问题"`
Answer string `json:"answer" dc:"AI回复"`
MsgTime string `json:"msgTime" dc:"消息时间"`
SessionId string `json:"sessionId" dc:"会话ID"`
}