Compare commits
No commits in common. "master" and "v0.0.1" have entirely different histories.
25
client.go
25
client.go
@ -141,7 +141,7 @@ func (w *WxHelper) GetContactList(isShowTool bool) (friends []Friend, err error)
|
|||||||
var onlyFriends []Friend
|
var onlyFriends []Friend
|
||||||
for _, v := range friends {
|
for _, v := range friends {
|
||||||
// 固定开头
|
// 固定开头
|
||||||
if strings.HasPrefix(v.Wxid, "wxid") || strings.HasSuffix(v.Wxid, "@chatroom") {
|
if strings.HasPrefix(v.Wxid, "wxid") {
|
||||||
onlyFriends = append(onlyFriends, v)
|
onlyFriends = append(onlyFriends, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -324,26 +324,3 @@ func (w *WxHelper) GetChatRoomMember(param ChatRoomId) (members *ChatRoomMembers
|
|||||||
_ = json.Unmarshal(data, &members)
|
_ = json.Unmarshal(data, &members)
|
||||||
return
|
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
|
|
||||||
}
|
|
||||||
|
@ -58,9 +58,3 @@ type ForwardMsg struct {
|
|||||||
Wxid string `json:"wxid"`
|
Wxid string `json:"wxid"`
|
||||||
MsgId string `json:"msgId"`
|
MsgId string `json:"msgId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// WxId
|
|
||||||
// @description: 微信ID
|
|
||||||
type WxId struct {
|
|
||||||
WxId string `json:"wxId"`
|
|
||||||
}
|
|
||||||
|
42
response.go
42
response.go
@ -1,7 +1,5 @@
|
|||||||
package wx_helper_sdk
|
package wx_helper_sdk
|
||||||
|
|
||||||
import "encoding/json"
|
|
||||||
|
|
||||||
// CommonResponse
|
// CommonResponse
|
||||||
// @description: 公共返回
|
// @description: 公共返回
|
||||||
type CommonResponse struct {
|
type CommonResponse struct {
|
||||||
@ -10,11 +8,6 @@ type CommonResponse struct {
|
|||||||
Data any `json:"data"`
|
Data any `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *CommonResponse) String() string {
|
|
||||||
data, _ := json.Marshal(r)
|
|
||||||
return string(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UserInfo
|
// UserInfo
|
||||||
// @description: 当前用户信息
|
// @description: 当前用户信息
|
||||||
type UserInfo struct {
|
type UserInfo struct {
|
||||||
@ -32,11 +25,6 @@ type UserInfo struct {
|
|||||||
Wxid string `json:"wxid"`
|
Wxid string `json:"wxid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *UserInfo) String() string {
|
|
||||||
data, _ := json.Marshal(r)
|
|
||||||
return string(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Friend
|
// Friend
|
||||||
// @description: 朋友信息
|
// @description: 朋友信息
|
||||||
type Friend struct {
|
type Friend struct {
|
||||||
@ -52,11 +40,6 @@ type Friend struct {
|
|||||||
Wxid string `json:"wxid"`
|
Wxid string `json:"wxid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Friend) String() string {
|
|
||||||
data, _ := json.Marshal(r)
|
|
||||||
return string(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ChatRoomDetail
|
// ChatRoomDetail
|
||||||
// @description: 群聊详情
|
// @description: 群聊详情
|
||||||
type ChatRoomDetail struct {
|
type ChatRoomDetail struct {
|
||||||
@ -66,11 +49,6 @@ type ChatRoomDetail struct {
|
|||||||
Xml string `json:"xml"`
|
Xml string `json:"xml"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *ChatRoomDetail) String() string {
|
|
||||||
data, _ := json.Marshal(r)
|
|
||||||
return string(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ChatRoomMembers
|
// ChatRoomMembers
|
||||||
// @description: 群聊人员信息
|
// @description: 群聊人员信息
|
||||||
type ChatRoomMembers struct {
|
type ChatRoomMembers struct {
|
||||||
@ -80,23 +58,3 @@ type ChatRoomMembers struct {
|
|||||||
MemberNickname string `json:"memberNickname"`
|
MemberNickname string `json:"memberNickname"`
|
||||||
Members string `json:"members"`
|
Members string `json:"members"`
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user