Compare commits

...

4 Commits

Author SHA1 Message Date
李寻欢 f5d0ab01cd 完善回调解析结构体 2022-10-18 15:48:57 +08:00
李寻欢 8d299c45a5 bug fix. 2022-01-19 10:20:10 +08:00
李寻欢 ce5439d4b2 新增发送单聊消息接口 2022-01-19 09:42:50 +08:00
李寻欢 f51fb38d0b 🎨 完善参数 2022-01-12 14:25:36 +08:00
5 changed files with 36 additions and 1 deletions

13
api/message.go Normal file
View File

@ -0,0 +1,13 @@
package api
import (
"gitee.ltd/lxh/txim/api/param"
"gitee.ltd/lxh/txim/common"
)
// SendMessageToUser 发送单聊消息给用户
func SendMessageToUser(p *param.PushMessageToUserReq) (*param.PushMessageToUserRes, error) {
a := param.PushMessageToUserRes{}
err := Api(common.SendMessageToUser, p, &a)
return &a, err
}

View File

@ -77,3 +77,11 @@ type PushOrdinaryMsgToGroupReq struct {
Random int `json:"Random"` // 随机数
MsgBody []callback.TIMMessage `json:"MsgBody"` // 消息内容
}
// PushMessageToUserReq 给用户发单聊消息参数
type PushMessageToUserReq struct {
FromAccount string `json:"From_Account"` // 发信人
ToAccount string `json:"To_Account"` // 收信人
Random int `json:"MsgRandom"` // 随机数
MsgBody []callback.TIMMessage `json:"MsgBody"` // 消息内容
}

View File

@ -54,3 +54,12 @@ type PushOrdinaryMsgToGroupRes struct {
MsgTime int `json:"MsgTime"` // 消息发送的时间戳,对应后台 server 时间
MsgSeq int `json:"MsgSeq"` // 消息序列号,唯一标示一条消息
}
// PushMessageToUserRes 给用户发单聊消息返回参数
type PushMessageToUserRes struct {
ActionStatus string `json:"ActionStatus"`
ErrorInfo string `json:"ErrorInfo"`
ErrorCode int `json:"ErrorCode"`
MsgTime int `json:"MsgTime"`
MsgKey string `json:"MsgKey"`
}

View File

@ -11,7 +11,11 @@ type MessageCallbackData struct {
MsgTime int `json:"MsgTime"` // 消息的发送时间戳,单位为秒
MsgKey string `json:"MsgKey"` //消息的唯一标识,可用于 REST API 撤回单聊消息
OnlineOnlyFlag int `json:"OnlineOnlyFlag"` //在线消息为1否则为0
CloudCustomData string `json:"CloudCustomData"` // 消息自定义数据(云端保存,会发送到对端,程序卸载重装后还能拉取到)
SendMsgResult int `json:"SendMsgResult"` // 消息发送之后独有
ErrorInfo string `json:"ErrorInfo"` // 消息发送之后独有
UnreadMsgNum int `json:"UnreadMsgNum"` // 消息发送之后独有
UnreadMsgNum int `json:"UnreadMsgNum"` // 消息发送之后、已读回调、撤回消息共有
ReportAccount string `json:"Report_Account"` // 已读回调独有
PeerAccount string `json:"Peer_Account"` // 已读回调独有
LastReadTime int `json:"LastReadTime"` // 已读回调独有
}

View File

@ -11,5 +11,6 @@ var (
AccountDelete Api = Api{"im_open_login_svc", "account_delete"}
GroupCreate Api = Api{"group_open_http_svc", "create_group"}
PushOrdinaryMsgToGroup Api = Api{"group_open_http_svc", "send_group_msg"} // 发送普通群消息
SendMessageToUser Api = Api{"openim", "sendmsg"} // 发送单聊消息
ProfileSet Api = Api{"profile", "portrait_set"}
)