添加发送普通群消息接口

This commit is contained in:
李寻欢 2022-01-11 15:55:45 +08:00
parent f1e54a8fa2
commit c9b00d6a7b
4 changed files with 38 additions and 6 deletions

View File

@ -12,3 +12,10 @@ func GroupCreate(r *param.GroupCreateReq) (*param.GroupCreateRes, error) {
err := Api(common.GroupCreate, r, &a)
return &a, err
}
// PushOrdinaryMsgToGroup 发送普通群消息
func PushOrdinaryMsgToGroup(p *param.PushOrdinaryMsgToGroupReq) (*param.PushOrdinaryMsgToGroupRes, error) {
a := param.PushOrdinaryMsgToGroupRes{}
err := Api(common.PushOrdinaryMsgToGroup, p, &a)
return &a, err
}

View File

@ -1,6 +1,9 @@
package param
import "gitee.ltd/lxh/txim/common"
import (
"gitee.ltd/lxh/txim/callback"
"gitee.ltd/lxh/txim/common"
)
// AccountImportReq 单个账号导入
type AccountImportReq struct {
@ -64,3 +67,13 @@ type ProfileSetReqItem struct {
Tag string `json:"Tag"`
Value interface{} `json:"Value"`
}
// ========================================================
// PushOrdinaryMsgToGroupReq 发送普通群聊普通消息参数
type PushOrdinaryMsgToGroupReq struct {
GroupId string `json:"GroupId"` // 群组Id
FromAccount string `json:"From_Account"` // 发信人
Random int `json:"Random"` // 随机数
MsgBody []callback.TIMMessage `json:"MsgBody"` // 消息内容
}

View File

@ -43,3 +43,14 @@ type GroupCreateRes struct {
// ProfileSetRes 资料设置返回
type ProfileSetRes struct{}
// ===============================================================
// PushOrdinaryMsgToGroupRes 发送普通群聊普通消息返回参数
type PushOrdinaryMsgToGroupRes struct {
ActionStatus string `json:"ActionStatus"` // 请求处理的结果OK 表示处理成功FAIL 表示失败
ErrorInfo string `json:"ErrorInfo"` // 错误信息
ErrorCode int `json:"ErrorCode"` // 错误码0表示成功非0表示失败
MsgTime int `json:"MsgTime"` // 消息发送的时间戳,对应后台 server 时间
MsgSeq int `json:"MsgSeq"` // 消息序列号,唯一标示一条消息
}

View File

@ -6,9 +6,10 @@ type Api struct {
}
var (
AccountImport Api = Api{"im_open_login_svc", "account_import"}
AccountCheck Api = Api{"im_open_login_svc", "account_check"}
AccountDelete Api = Api{"im_open_login_svc", "account_delete"}
GroupCreate Api = Api{"group_open_http_svc", "create_group"}
ProfileSet Api = Api{"profile", "portrait_set"}
AccountImport Api = Api{"im_open_login_svc", "account_import"}
AccountCheck Api = Api{"im_open_login_svc", "account_check"}
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"} // 发送普通群消息
ProfileSet Api = Api{"profile", "portrait_set"}
)