package hook import ( "fmt" "strings" ) // 获取好友和群信息 func (h *Hook) GetFriendAndChatRoomList(typeStr string) (result GetFriendAndChatRoomListReap, err error) { resp, err := h.Client.R().SetBody(&GetFriendAndChatRoomListReq{ Type: typeStr, }).SetSuccessResult(&result).Post("http://" + h.ServerIp + ":" + h.WxPort + "/GetFriendAndChatRoomList") if err != nil { return } if !resp.IsSuccessState() { err = fmt.Errorf("GetFriendAndChatRoomList failed with status code %d", resp.StatusCode) return } return } // 批量获取联系人简明信息(每次100个) func (h *Hook) BatchGetContactBriefInfo(wxids []string) (result BatchGetContactBriefInfoReap, err error) { wxidList := strings.Join(wxids, ",") resp, err := h.Client.R().SetBody(&BatchGetContactBriefInfoReq{ WxidList: wxidList, }).SetSuccessResult(&result).Post("http://" + h.ServerIp + ":" + h.WxPort + "/BatchGetContactBriefInfo") if err != nil { return } if !resp.IsSuccessState() { err = fmt.Errorf("BatchGetChatRoomMemberWxid failed with status code %d", resp.StatusCode) return } return }