From c3fdb33b1734cc82dbeab108aace8649193f67c4 Mon Sep 17 00:00:00 2001 From: coward Date: Tue, 9 Jan 2024 15:58:34 +0800 Subject: [PATCH] =?UTF-8?q?:art:=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E8=8E=B7=E5=8F=96=E7=BE=A4=E6=88=90=E5=91=98=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client.go | 23 +++++++++++++++++++++++ request.go | 6 ++++++ response.go | 15 +++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/client.go b/client.go index 3217e13..a44686c 100644 --- a/client.go +++ b/client.go @@ -324,3 +324,26 @@ func (w *WxHelper) GetChatRoomMember(param ChatRoomId) (members *ChatRoomMembers _ = json.Unmarshal(data, &members) return } + +// GetChatRoomMemberProfile +// @description: 获取群成员详细信息 +// @receiver w +// @return memberProfile +// @return err +func (w *WxHelper) GetChatRoomMemberProfile(param WxId) (memberProfile *ChatRoomMemberProfile, err error) { + req := w.client.R() + req.Header.Set("Content-Type", "application/json") + req.SetBody(param) + _, err = req.SetResult(&w.tmpResult).Post(w.GetAddr("/api/getContactProfile")) + if err != nil { + return nil, fmt.Errorf("获取群成员详细信息失败: %v", err.Error()) + } + + if w.tmpResult.Code <= 0 { + return nil, fmt.Errorf("获取群成员详细信息失败: %v", w.tmpResult.Msg) + } + + data, _ := json.Marshal(w.tmpResult.Data) + _ = json.Unmarshal(data, &memberProfile) + return +} diff --git a/request.go b/request.go index 40c99bc..01ff14d 100644 --- a/request.go +++ b/request.go @@ -58,3 +58,9 @@ type ForwardMsg struct { Wxid string `json:"wxid"` MsgId string `json:"msgId"` } + +// WxId +// @description: 微信ID +type WxId struct { + WxId string `json:"wxId"` +} diff --git a/response.go b/response.go index 79b9896..34c85d7 100644 --- a/response.go +++ b/response.go @@ -85,3 +85,18 @@ func (r *ChatRoomMembers) String() string { data, _ := json.Marshal(r) return string(data) } + +// ChatRoomMemberProfile +// @description: 获取群成员详细信息 +type ChatRoomMemberProfile struct { + Account string `json:"account"` + HeadImage string `json:"headImage"` + Nickname string `json:"nickname"` + V3 string `json:"v3"` + Wxid string `json:"wxid"` +} + +func (r *ChatRoomMemberProfile) String() string { + data, _ := json.Marshal(r) + return string(data) +}