57 lines
1.6 KiB
Go
57 lines
1.6 KiB
Go
|
package core
|
||
|
|
||
|
import "github.com/goWxHook/goWxHook/utils/json"
|
||
|
|
||
|
type GetCollectListResponseData struct {
|
||
|
Items []struct {
|
||
|
FromUser string `json:"from_user"`
|
||
|
LocalId int `json:"local_id"`
|
||
|
RoomMember string `json:"room_member"`
|
||
|
Title string `json:"title"`
|
||
|
Type int `json:"type"`
|
||
|
UpdateTime int `json:"update_time"`
|
||
|
Xml string `json:"xml"`
|
||
|
} `json:"items"`
|
||
|
Status int `json:"status"`
|
||
|
}
|
||
|
|
||
|
type GetCollectListResponse struct {
|
||
|
Data GetCollectListResponseData `json:"data"`
|
||
|
Type int `json:"type"`
|
||
|
}
|
||
|
|
||
|
// GetCollectList 获取收藏列表
|
||
|
func (w *WxApi) GetCollectList() (*GetCollectListResponseData, error) {
|
||
|
resp, err := w.internalCall(MtGetCollectListMsg, 20, MtGetCollectListMsg, map[string]interface{}{}, nil)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
var rdata GetCollectListResponse
|
||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
||
|
if err != nil {
|
||
|
return nil, WxError{-1, err.Error()}
|
||
|
}
|
||
|
return &rdata.Data, nil
|
||
|
}
|
||
|
|
||
|
type SendCollectRequest struct {
|
||
|
ToWxid string `json:"to_wxid"`
|
||
|
LocalId int `json:"local_id"`
|
||
|
}
|
||
|
|
||
|
// SendCollect 发送收藏(旧)
|
||
|
func (w *WxApi) SendCollect(request SendCollectRequest) error {
|
||
|
_, err := w.internalCall(MtSendCollectMsg, 20, MtSendCollectMsg, request, nil)
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
type SendCollectMsgByMsgIdRequest struct {
|
||
|
Msgid string `json:"msgid"`
|
||
|
}
|
||
|
|
||
|
// SendCollectMsgByMsgId 收藏指定消息(旧)
|
||
|
func (w *WxApi) SendCollectMsgByMsgId(request SendCollectMsgByMsgIdRequest) error {
|
||
|
_, err := w.internalCall(MtSendCollectMsgByMsgId, 20, MtSendCollectMsgByMsgId, request, nil)
|
||
|
return err
|
||
|
}
|