From c9b00d6a7ba736e105ebe2a4ad94248adab0c445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AF=BB=E6=AC=A2?= Date: Tue, 11 Jan 2022 15:55:45 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=B7=BB=E5=8A=A0=E5=8F=91?= =?UTF-8?q?=E9=80=81=E6=99=AE=E9=80=9A=E7=BE=A4=E6=B6=88=E6=81=AF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/group.go | 7 +++++++ api/param/request.go | 15 ++++++++++++++- api/param/response.go | 11 +++++++++++ common/api.go | 11 ++++++----- 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/api/group.go b/api/group.go index d8d8751..38869d7 100644 --- a/api/group.go +++ b/api/group.go @@ -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 +} diff --git a/api/param/request.go b/api/param/request.go index bce4944..a8fb447 100644 --- a/api/param/request.go +++ b/api/param/request.go @@ -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"` // 消息内容 +} diff --git a/api/param/response.go b/api/param/response.go index 602a2fa..e7d8ec2 100644 --- a/api/param/response.go +++ b/api/param/response.go @@ -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"` // 消息序列号,唯一标示一条消息 +} diff --git a/common/api.go b/common/api.go index fd2d982..801ca2b 100644 --- a/common/api.go +++ b/common/api.go @@ -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"} )