This commit is contained in:
邹宗楠
2025-12-10 10:55:50 +08:00
parent ee4b2859bb
commit ad4ad6bbf8
8 changed files with 243 additions and 10 deletions

View File

@@ -0,0 +1,121 @@
package jdapi
type ContextFrom struct {
Pin string `json:"pin"` // 发送消息的账号,从接收消息MQ里面取
App string `json:"app"` // im.waiter 固定值
ClientType string `json:"clientType"` // gw 固定值
}
type ContextTo struct {
Pin string `json:"pin"` // 消息接收者的账号, 从接收消息MQ里面取
App string `json:"app"` // im.customer 固定值
}
type ContextBody struct {
Type string `json:"type"` // 消息类型,根据需求场景
Content string `json:"content"` // 字符型,必须。文本消息内容。
Chatinfo ContextBodyChatInfo `json:"chatinfo"`
Template struct {
Source string `json:"source"` // dd_msg_产品线标识_消息标识“ 卡片类消息必传
} `json:"template"`
Mt int `json:"mt"`
}
type ContextBodyChatInfo struct {
VenderId string `json:"venderId"` // 服务商id,从接收消息MQ里面取
AskAllocateType string `json:"askAllocateType"` // multiChat 固定值
Sid string `json:"sid"` // 从接收消息MQ里面取
Source string `json:"source"` // dd_msg_产品线标识_消息标识“ 必传
}
// ContextMsg 消息发送接口 - 向用户发送在线消息
type ContextMsg struct {
Id string `json:"id"` // uuid 随机生成字符串
Lang string `json:"lang"` // 固定值 zh_CN
Type string `json:"type"` // 固定值 chat_message
From ContextFrom `json:"from"`
To ContextTo `json:"to"`
//Body ContextBody `json:"body"`
Body interface{} `json:"body"`
Timestamp int64 `json:"timestamp"`
ClientTime int64 `json:"clientTime"`
}
type BaseInfo struct {
AppKey string `json:"app_key"`
Token string `json:"token"`
Timestamp string `json:"timestamp"`
Sign string `json:"sign"`
Format string `json:"format"`
V string `json:"v"`
}
// ChatRisMsgCallback 风控消息
type ChatRisMsgCallback struct {
BaseInfo
StationId string `json:"stationId"` // 秒送门店ID
VenderId string `json:"venderId"` // 秒送商家ID
ExtendJsonData string `json:"extendJsonData"`
}
type ChatRisInfo struct {
RiskType int `json:"riskType"` // 风控类型1 风控平台, 2 商家自己设置敏感词, 3 开放平台
RiskCode string `json:"riskCode"` // 风控文案
From struct {
App string `json:"app"`
Art string `json:"art"`
ClientType string `json:"clientType"`
Pin string `json:"pin"`
} `json:"from"` // 发送方消息
To struct {
App string `json:"app"`
Pin string `json:"pin"`
} `json:"to"` // 接收方消息
Type string `json:"type"` // 消息类型
Body interface{} `json:"body"` // 消息信息
Timestamp int64 `json:"timestamp"` // 时间
Sid string `json:"sid"` // 客服咨询业务的会话ID[与接收的消息体里面的sid关联属于同一会话]
Id string `json:"id"` // 咚咚聊天消息唯一ID[即chat_message消息体内的id字段]
}
// UserChatMsg 用户消息推送
type UserChatMsg struct {
Id string `json:"id"` // 咚咚聊天消息唯一ID[即chat_message消息体内的id字段]
Lang string `json:"lang"` // 语言类型
Type string `json:"type"`
From struct {
Pin string `json:"pin"` // 发送消息的账号
App string `json:"app"` // 发送消息的app
ClientType string `json:"clientType"` // 发送消息终端
} `json:"from"`
To struct {
Pin string `json:"pin"` // 消息接收者的账号
App string `json:"app"` // 接收消息的app
ClientType string `json:"clientType"` // 接收消息的终端"
} `json:"to"`
Body interface{} `json:"body"`
Timestamp int64 `json:"timestamp"`
ClientTime int64 `json:"clientTime"`
}
// UserMsgReadAck 已读消息推送
type UserMsgReadAck struct {
Timestamp int64 `json:"timestamp"`
To struct {
App string `json:"app"`
Pin string `json:"pin"`
} `json:"to"`
Body interface{} `json:"body"`
From struct {
App string `json:"app"`
Pin string `json:"pin"`
} `json:"from"`
Datetime int64 `json:"datetime"`
Type string `json:"type"`
}
// JxSendData 京西回复京东用户消息
type JxSendData struct {
FromPin string `json:"from_pin"`
ToPin string `json:"to_pin"`
Content string `json:"content"`
}