486 lines
16 KiB
Go
486 lines
16 KiB
Go
package core
|
|
|
|
import "github.com/goWxHook/goWxHook/utils/json"
|
|
|
|
type VideoMomentInitResponseData struct {
|
|
AliasInfo []struct {
|
|
AliasMsgName string `json:"aliasMsgName"`
|
|
AliasVersion int `json:"aliasVersion"`
|
|
HeadImgUrl string `json:"headImgUrl"`
|
|
Nickname string `json:"nickname"`
|
|
RoleType int `json:"roleType"`
|
|
} `json:"aliasInfo"`
|
|
BaseResponse struct {
|
|
ErrMsg struct {
|
|
String string `json:"string"`
|
|
} `json:"errMsg"`
|
|
Ret int `json:"ret"`
|
|
} `json:"baseResponse"`
|
|
Cmdlist []interface{} `json:"cmdlist"`
|
|
ContinueFlag int `json:"continueFlag"`
|
|
CurrentAliasRoleType int `json:"currentAliasRoleType"`
|
|
FinderUsernameList []struct {
|
|
FinderUsernameList string `json:"finderUsernameList"`
|
|
} `json:"finderUsernameList"`
|
|
Keybuf struct {
|
|
Buffer string `json:"buffer"`
|
|
ILen int `json:"iLen"`
|
|
} `json:"keybuf"`
|
|
Myacct []struct {
|
|
ArchievementInfo struct {
|
|
} `json:"archievementInfo"`
|
|
AuthInfo struct {
|
|
} `json:"authInfo"`
|
|
BindInfo []interface{} `json:"bindInfo"`
|
|
CoverEntranceFlag int `json:"coverEntranceFlag"`
|
|
CoverImgUrl string `json:"coverImgUrl"`
|
|
CoverUrl string `json:"coverUrl"`
|
|
ExtFlag int `json:"extFlag"`
|
|
ExtInfo struct {
|
|
BirthDay int `json:"birthDay"`
|
|
BirthMonth int `json:"birthMonth"`
|
|
BirthYear int `json:"birthYear"`
|
|
City string `json:"city"`
|
|
Country string `json:"country"`
|
|
Province string `json:"province"`
|
|
Sex int `json:"sex"`
|
|
} `json:"extInfo"`
|
|
FansCount int `json:"fansCount"`
|
|
FeedCount int `json:"feedCount"`
|
|
FollowFlag int `json:"followFlag"`
|
|
FollowTime int `json:"followTime"`
|
|
ForeignUserFlag int `json:"foreignUserFlag"`
|
|
FriendFollowCount int `json:"friendFollowCount"`
|
|
GuestInfo struct {
|
|
} `json:"guestInfo"`
|
|
HeadUrl string `json:"headUrl"`
|
|
LiveCoverImgUrl string `json:"liveCoverImgUrl"`
|
|
LiveInfo struct {
|
|
AnchorStatusFlag string `json:"anchorStatusFlag"`
|
|
LotterySetting struct {
|
|
} `json:"lotterySetting"`
|
|
MicSetting struct {
|
|
SettingFlag string `json:"settingFlag"`
|
|
SettingSwitchFlag string `json:"settingSwitchFlag"`
|
|
} `json:"micSetting"`
|
|
SwitchFlag int `json:"switchFlag"`
|
|
} `json:"liveInfo"`
|
|
LiveNoticeInfo struct {
|
|
} `json:"liveNoticeInfo"`
|
|
LiveStatus int `json:"liveStatus"`
|
|
LoggingoutWording string `json:"loggingoutWording"`
|
|
Menu []interface{} `json:"menu"`
|
|
MsgInfo struct {
|
|
} `json:"msgInfo"`
|
|
Nickname string `json:"nickname"`
|
|
OneTimeFlag int `json:"oneTimeFlag"`
|
|
OriginalEntranceFlag int `json:"originalEntranceFlag"`
|
|
OriginalFlag int `json:"originalFlag"`
|
|
OriginalInfo struct {
|
|
PostNeedCheckFlag int `json:"postNeedCheckFlag"`
|
|
PunishYearFlag int `json:"punishYearFlag"`
|
|
RestApplyOriginalCount int `json:"restApplyOriginalCount"`
|
|
RestPunishDay int `json:"restPunishDay"`
|
|
RestRepostCount int `json:"restRepostCount"`
|
|
} `json:"originalInfo"`
|
|
Seq string `json:"seq"`
|
|
Signature string `json:"signature"`
|
|
SpamStatus int `json:"spamStatus"`
|
|
UserFlag int `json:"userFlag"`
|
|
UserMode int `json:"userMode"`
|
|
Username string `json:"username"`
|
|
VestNickname string `json:"vestNickname"`
|
|
WxUsernameV5 string `json:"wxUsernameV5"`
|
|
} `json:"myacct"`
|
|
NextAliasModAvailableTime string `json:"nextAliasModAvailableTime"`
|
|
RetryDelaySecond int `json:"retryDelaySecond"`
|
|
RingtoneConfig struct {
|
|
} `json:"ringtoneConfig"`
|
|
SlideUpGuideConfig []interface{} `json:"slideUpGuideConfig"`
|
|
TabInfos []struct {
|
|
DisplayTabType int `json:"displayTabType"`
|
|
TabName string `json:"tabName"`
|
|
} `json:"tabInfos"`
|
|
TeenmodeSetting struct {
|
|
} `json:"teenmodeSetting"`
|
|
TeenmodeTipsConfig struct {
|
|
} `json:"teenmodeTipsConfig"`
|
|
UserNotCreatedFlag int `json:"userNotCreatedFlag"`
|
|
Userver int `json:"userver"`
|
|
UserverForH5 int `json:"userverForH5"`
|
|
WxPersonalizedSetting struct {
|
|
} `json:"wxPersonalizedSetting"`
|
|
WxUserAttr struct {
|
|
NotAvailableFlag int `json:"notAvailableFlag"`
|
|
Wording string `json:"wording"`
|
|
} `json:"wxUserAttr"`
|
|
WxUsernameForH5 string `json:"wxUsernameForH5"`
|
|
}
|
|
|
|
type VideoMomentInitResponse struct {
|
|
Data VideoMomentInitResponseData `json:"data"`
|
|
Type int `json:"type"`
|
|
}
|
|
|
|
// VideoMomentInit 视频号初始化
|
|
func (w *WxApi) VideoMomentInit() (*VideoMomentInitResponseData, error) {
|
|
resp, err := w.internalCall(MtVideoMomentInitMsg, 120, MtVideoMomentInitMsg, nil, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var rdata VideoMomentInitResponse
|
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|
if err != nil {
|
|
return nil, WxError{-1, err.Error()}
|
|
}
|
|
return &rdata.Data, nil
|
|
}
|
|
|
|
type VideoMomentSearchRequest struct {
|
|
Query string `json:"query"`
|
|
LastBuff string `json:"last_buff"`
|
|
Scene int `json:"scene"`
|
|
}
|
|
|
|
type VideoMomentSearchResponse struct {
|
|
Data interface{} `json:"data"`
|
|
Type int `json:"type"`
|
|
}
|
|
|
|
// VideoMomentSearch 视频号搜索
|
|
func (w *WxApi) VideoMomentSearch(request VideoMomentSearchRequest) (interface{}, error) {
|
|
resp, err := w.internalCall(MtVideoMomentSearchMsg, 120, MtVideoMomentSearchMsg, request, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var rdata VideoMomentSearchResponse
|
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|
if err != nil {
|
|
return nil, WxError{-1, err.Error()}
|
|
}
|
|
return rdata.Data, nil
|
|
}
|
|
|
|
type VideoMomentUserHomeRequest struct {
|
|
Username string `json:"username"`
|
|
LastBuff string `json:"last_buff"`
|
|
}
|
|
|
|
type VideoMomentUserHomeResponse struct {
|
|
Data interface{} `json:"data"`
|
|
Type int `json:"type"`
|
|
}
|
|
|
|
// VideoMomentUserHome 视频号用户主页
|
|
func (w *WxApi) VideoMomentUserHome(request VideoMomentUserHomeRequest) (interface{}, error) {
|
|
resp, err := w.internalCall(MtVideoMomentUserHomeMsg, 120, MtVideoMomentUserHomeMsg, request, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var rdata VideoMomentUserHomeResponse
|
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|
if err != nil {
|
|
return nil, WxError{-1, err.Error()}
|
|
}
|
|
return rdata.Data, nil
|
|
}
|
|
|
|
type VideoMomentVideoDetailRequest struct {
|
|
ObjectId string `json:"object_id"`
|
|
ObjectNonceId string `json:"object_nonce_id"`
|
|
LastBuff string `json:"last_buff"`
|
|
}
|
|
|
|
type VideoMomentVideoDetailResponse struct {
|
|
Data interface{} `json:"data"`
|
|
Type int `json:"type"`
|
|
}
|
|
|
|
// VideoMomentVideoDetail 查看视频详细信息(包含评论)
|
|
func (w *WxApi) VideoMomentVideoDetail(request VideoMomentVideoDetailRequest) (interface{}, error) {
|
|
resp, err := w.internalCall(MtVideoMomentVideoDetailMsg, 120, MtVideoMomentVideoDetailMsg, request, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var rdata VideoMomentVideoDetailResponse
|
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|
if err != nil {
|
|
return nil, WxError{-1, err.Error()}
|
|
}
|
|
return rdata.Data, nil
|
|
}
|
|
|
|
type VideoMomentFollowRequest struct {
|
|
Username string `json:"username"`
|
|
}
|
|
|
|
type VideoMomentFollowResponseData struct {
|
|
BaseResponse struct {
|
|
ErrMsg struct {
|
|
String string `json:"string"`
|
|
} `json:"errMsg"`
|
|
Ret int `json:"ret"`
|
|
} `json:"baseResponse"`
|
|
Contact struct {
|
|
ArchievementInfo struct {
|
|
} `json:"archievementInfo"`
|
|
AuthInfo struct {
|
|
AppName string `json:"appName"`
|
|
AuthGuarantor struct {
|
|
} `json:"authGuarantor"`
|
|
AuthIconType int `json:"authIconType"`
|
|
AuthIconUrl string `json:"authIconUrl"`
|
|
AuthProfession string `json:"authProfession"`
|
|
AuthVerifyIdentity int `json:"authVerifyIdentity"`
|
|
CustomerType int `json:"customerType"`
|
|
DetailLink string `json:"detailLink"`
|
|
RealName string `json:"realName"`
|
|
VerifyStatus int `json:"verifyStatus"`
|
|
} `json:"authInfo"`
|
|
BindInfo []interface{} `json:"bindInfo"`
|
|
CoverEntranceFlag int `json:"coverEntranceFlag"`
|
|
CoverImgUrl string `json:"coverImgUrl"`
|
|
CoverUrl string `json:"coverUrl"`
|
|
ExtFlag int `json:"extFlag"`
|
|
ExtInfo struct {
|
|
BirthDay int `json:"birthDay"`
|
|
BirthMonth int `json:"birthMonth"`
|
|
BirthYear int `json:"birthYear"`
|
|
City string `json:"city"`
|
|
Country string `json:"country"`
|
|
Province string `json:"province"`
|
|
Sex int `json:"sex"`
|
|
} `json:"extInfo"`
|
|
FansCount int `json:"fansCount"`
|
|
FeedCount int `json:"feedCount"`
|
|
FollowFlag int `json:"followFlag"`
|
|
FollowTime int `json:"followTime"`
|
|
ForeignUserFlag int `json:"foreignUserFlag"`
|
|
FriendFollowCount int `json:"friendFollowCount"`
|
|
GuestInfo struct {
|
|
} `json:"guestInfo"`
|
|
HeadUrl string `json:"headUrl"`
|
|
LiveCoverImgUrl string `json:"liveCoverImgUrl"`
|
|
LiveInfo struct {
|
|
AnchorStatusFlag string `json:"anchorStatusFlag"`
|
|
LotterySetting struct {
|
|
AttendType int `json:"attendType"`
|
|
SettingFlag string `json:"settingFlag"`
|
|
} `json:"lotterySetting"`
|
|
MicSetting struct {
|
|
SettingFlag string `json:"settingFlag"`
|
|
SettingSwitchFlag string `json:"settingSwitchFlag"`
|
|
} `json:"micSetting"`
|
|
SwitchFlag int `json:"switchFlag"`
|
|
} `json:"liveInfo"`
|
|
LiveNoticeInfo struct {
|
|
} `json:"liveNoticeInfo"`
|
|
LiveStatus int `json:"liveStatus"`
|
|
LoggingoutWording string `json:"loggingoutWording"`
|
|
Menu []interface{} `json:"menu"`
|
|
MsgInfo struct {
|
|
} `json:"msgInfo"`
|
|
Nickname string `json:"nickname"`
|
|
OneTimeFlag int `json:"oneTimeFlag"`
|
|
OriginalEntranceFlag int `json:"originalEntranceFlag"`
|
|
OriginalFlag int `json:"originalFlag"`
|
|
OriginalInfo struct {
|
|
} `json:"originalInfo"`
|
|
Seq int `json:"seq"`
|
|
Signature string `json:"signature"`
|
|
SpamStatus int `json:"spamStatus"`
|
|
UserFlag int `json:"userFlag"`
|
|
UserMode int `json:"userMode"`
|
|
Username string `json:"username"`
|
|
VestNickname string `json:"vestNickname"`
|
|
WxUsernameV5 string `json:"wxUsernameV5"`
|
|
} `json:"contact"`
|
|
LiveStatusFlag int `json:"liveStatusFlag"`
|
|
}
|
|
|
|
type VideoMomentFollowResponse struct {
|
|
Data VideoMomentFollowResponseData `json:"data"`
|
|
Type int `json:"type"`
|
|
}
|
|
|
|
// VideoMomentFollow 关注视频号
|
|
func (w *WxApi) VideoMomentFollow(request VideoMomentFollowRequest) (*VideoMomentFollowResponseData, error) {
|
|
resp, err := w.internalCall(MtVideoMomentFollowMsg, 120, MtVideoMomentFollowMsg, request, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var rdata VideoMomentFollowResponse
|
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|
if err != nil {
|
|
return nil, WxError{-1, err.Error()}
|
|
}
|
|
return &rdata.Data, nil
|
|
}
|
|
|
|
type VideoMomentLikeRequest struct {
|
|
ObjectId string `json:"object_id"`
|
|
ObjectNonceId string `json:"object_nonce_id"`
|
|
}
|
|
|
|
type VideoMomentLikeResponseData struct {
|
|
BaseResponse struct {
|
|
ErrMsg struct {
|
|
String string `json:"string"`
|
|
} `json:"errMsg"`
|
|
Ret int `json:"ret"`
|
|
} `json:"baseResponse"`
|
|
Likeid int `json:"likeid"`
|
|
}
|
|
|
|
type VideoMomentLikeResponse struct {
|
|
Data VideoMomentLikeResponseData `json:"data"`
|
|
Type int `json:"type"`
|
|
}
|
|
|
|
// VideoMomentLike 视频号点赞
|
|
func (w *WxApi) VideoMomentLike(request VideoMomentLikeRequest) (*VideoMomentLikeResponseData, error) {
|
|
resp, err := w.internalCall(MtVideoMomentLikeMsg, 120, MtVideoMomentLikeMsg, request, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var rdata VideoMomentLikeResponse
|
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|
if err != nil {
|
|
return nil, WxError{-1, err.Error()}
|
|
}
|
|
return &rdata.Data, nil
|
|
}
|
|
|
|
type VideoMomentGetSessionIdRequest struct {
|
|
ToUsername string `json:"to_username"`
|
|
RoleType int `json:"roleType"`
|
|
}
|
|
|
|
type VideoMomentGetSessionIdResponseData struct {
|
|
BaseResponse struct {
|
|
ErrMsg struct {
|
|
} `json:"errMsg"`
|
|
Ret int `json:"ret"`
|
|
} `json:"baseResponse"`
|
|
EnableAction int `json:"enableAction"`
|
|
SessionId string `json:"sessionId"`
|
|
SessionInfo struct {
|
|
EnableAction int `json:"enableAction"`
|
|
MsgExtInfo string `json:"msgExtInfo"`
|
|
RejectMsg int `json:"rejectMsg"`
|
|
SessionId string `json:"sessionId"`
|
|
ToUsername string `json:"toUsername"`
|
|
} `json:"sessionInfo"`
|
|
ToUsername string `json:"toUsername"`
|
|
}
|
|
|
|
type VideoMomentGetSessionIdResponse struct {
|
|
Data VideoMomentGetSessionIdResponseData `json:"data"`
|
|
Type int `json:"type"`
|
|
}
|
|
|
|
// VideoMomentGetSessionId 获取私信sessionId
|
|
func (w *WxApi) VideoMomentGetSessionId(request VideoMomentGetSessionIdRequest) (*VideoMomentGetSessionIdResponseData, error) {
|
|
resp, err := w.internalCall(MtVideoMomentGetSessionIdMsg, 120, MtVideoMomentGetSessionIdMsg, request, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var rdata VideoMomentGetSessionIdResponse
|
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|
if err != nil {
|
|
return nil, WxError{-1, err.Error()}
|
|
}
|
|
return &rdata.Data, nil
|
|
}
|
|
|
|
type VideoMomentSendMsgRequest struct {
|
|
ToUsername string `json:"to_username"`
|
|
SessionId string `json:"session_id"`
|
|
Content string `json:"content"`
|
|
}
|
|
|
|
type VideoMomentSendMsgResponseData struct {
|
|
BaseResponse struct {
|
|
ErrMsg struct {
|
|
String string `json:"string"`
|
|
} `json:"errMsg"`
|
|
Ret int `json:"ret"`
|
|
} `json:"baseResponse"`
|
|
Newmsgid int `json:"newmsgid"`
|
|
}
|
|
|
|
type VideoMomentSendMsgResponse struct {
|
|
Data VideoMomentSendMsgResponseData `json:"data"`
|
|
Type int `json:"type"`
|
|
}
|
|
|
|
// VideoMomentSendMsg 发送私信消息
|
|
func (w *WxApi) VideoMomentSendMsg(request VideoMomentSendMsgRequest) (*VideoMomentSendMsgResponseData, error) {
|
|
resp, err := w.internalCall(MtVideoMomentSendMsg, 120, MtVideoMomentSendMsg, request, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var rdata VideoMomentSendMsgResponse
|
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|
if err != nil {
|
|
return nil, WxError{-1, err.Error()}
|
|
}
|
|
return &rdata.Data, nil
|
|
}
|
|
|
|
type VideoMomentCreateVirtualNickNameRequest struct {
|
|
Nickname string `json:"nickname"`
|
|
HeadimgUrl string `json:"headimg_url"`
|
|
}
|
|
|
|
type VideoMomentCreateVirtualNickNameResponse struct {
|
|
Data interface{} `json:"data"`
|
|
Type int `json:"type"`
|
|
}
|
|
|
|
// VideoMomentCreateVirtualNickName 创建虚拟昵称
|
|
func (w *WxApi) VideoMomentCreateVirtualNickName(request VideoMomentCreateVirtualNickNameRequest) (interface{}, error) {
|
|
resp, err := w.internalCall(MtVideoMomentCreateVirtualNickNameMsg, 120, MtVideoMomentCreateVirtualNickNameMsg, request, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var rdata VideoMomentCreateVirtualNickNameResponse
|
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|
if err != nil {
|
|
return nil, WxError{-1, err.Error()}
|
|
}
|
|
return rdata.Data, nil
|
|
}
|
|
|
|
type VideoMomentSwitchVirtualNickNameRequest struct {
|
|
RoleType int `json:"role_type"`
|
|
}
|
|
|
|
type VideoMomentSwitchVirtualNickNameResponse struct {
|
|
Data interface{} `json:"data"`
|
|
Type int `json:"type"`
|
|
}
|
|
|
|
// VideoMomentSwitchVirtualNickName 切换虚拟昵称
|
|
func (w *WxApi) VideoMomentSwitchVirtualNickName(request VideoMomentSwitchVirtualNickNameRequest) (interface{}, error) {
|
|
resp, err := w.internalCall(MtVideoMomentSwitchVirtualNickNameMsg, 120, MtVideoMomentSwitchVirtualNickNameMsg, request, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var rdata VideoMomentSwitchVirtualNickNameResponse
|
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|
if err != nil {
|
|
return nil, WxError{-1, err.Error()}
|
|
}
|
|
return rdata.Data, nil
|
|
}
|
|
|
|
// VideoMomentDeleteVirtualNickName 删除虚拟昵称
|
|
func (w *WxApi) VideoMomentDeleteVirtualNickName() error {
|
|
_, err := w.internalCall(0, -1, MtVideoMomentDeleteVirtualNickNameMsg, map[string]interface{}{}, nil)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|