697 lines
20 KiB
Go
697 lines
20 KiB
Go
|
package core
|
|||
|
|
|||
|
import (
|
|||
|
"github.com/goWxHook/goWxHook/utils/json"
|
|||
|
)
|
|||
|
|
|||
|
type CDNInitialResponse struct {
|
|||
|
Data CDNInitialResponseData `json:"data"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNInitialResponseData struct {
|
|||
|
Status int `json:"status"`
|
|||
|
}
|
|||
|
|
|||
|
// InitialCDN CDN初始化
|
|||
|
func (w *WxApi) InitialCDN() (*CDNInitialResponseData, error) {
|
|||
|
resp, err := w.internalCall(MtCdnInitialMsg, 30, MtCdnInitialMsg, map[string]interface{}{}, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
var rdata CDNInitialResponse
|
|||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|||
|
if err != nil {
|
|||
|
return nil, WxError{-1, err.Error()}
|
|||
|
}
|
|||
|
return &rdata.Data, nil
|
|||
|
}
|
|||
|
|
|||
|
type CDNUploadRequest struct {
|
|||
|
FileType int `json:"file_type"`
|
|||
|
FilePath string `json:"file_path"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNUploadResponseData struct {
|
|||
|
AesKey string `json:"aes_key"`
|
|||
|
Crc32 int64 `json:"crc32"`
|
|||
|
ErrorCode int `json:"error_code"`
|
|||
|
FileId string `json:"file_id"`
|
|||
|
FileKey string `json:"file_key"`
|
|||
|
FileMd5 string `json:"file_md5"`
|
|||
|
FilePath string `json:"file_path"`
|
|||
|
FileSize int `json:"file_size"`
|
|||
|
ThumbFileMd5 string `json:"thumb_file_md5"`
|
|||
|
ThumbFileSize int `json:"thumb_file_size"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNUploadResponse struct {
|
|||
|
Data CDNUploadResponseData `json:"data"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
// CDNUpload CDN上传
|
|||
|
func (w *WxApi) CDNUpload(request CDNUploadRequest) (*CDNUploadResponseData, error) {
|
|||
|
resp, err := w.internalCall(MtCdnUploadFileMsg, 600, MtCdnUploadFileMsg, request, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
var rdata CDNUploadResponse
|
|||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|||
|
if err != nil {
|
|||
|
return nil, WxError{-1, err.Error()}
|
|||
|
}
|
|||
|
return &rdata.Data, nil
|
|||
|
}
|
|||
|
|
|||
|
type CDNDownloadRequest struct {
|
|||
|
FileId string `json:"file_id"`
|
|||
|
FileType int `json:"file_type"`
|
|||
|
AesKey string `json:"aes_key"`
|
|||
|
SavePath string `json:"save_path"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNDownloadResponseData struct {
|
|||
|
ErrorCode int `json:"error_code"`
|
|||
|
FileId string `json:"file_id"`
|
|||
|
FileSize int `json:"file_size"`
|
|||
|
SavePath string `json:"save_path"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNDownloadResponse struct {
|
|||
|
Data CDNDownloadResponseData `json:"data"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
// CDNDownload CDN下载
|
|||
|
func (w *WxApi) CDNDownload(request CDNDownloadRequest) (*CDNDownloadResponseData, error) {
|
|||
|
resp, err := w.internalCall(MtCdnDownloadFileMsg, 600, MtCdnDownloadFileMsg, request, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
var rdata CDNDownloadResponse
|
|||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|||
|
if err != nil {
|
|||
|
return nil, WxError{-1, err.Error()}
|
|||
|
}
|
|||
|
return &rdata.Data, nil
|
|||
|
}
|
|||
|
|
|||
|
type WorkWxCdnDownloadRequest struct {
|
|||
|
Url string `json:"url"`
|
|||
|
AuthKey string `json:"auth_key"`
|
|||
|
AesKey string `json:"aes_key"`
|
|||
|
SavePath string `json:"save_path"`
|
|||
|
}
|
|||
|
|
|||
|
type WorkWxCdnDownloadResponseData struct {
|
|||
|
ErrorCode int `json:"error_code"`
|
|||
|
SavePath string `json:"save_path"`
|
|||
|
}
|
|||
|
|
|||
|
type WorkWxCdnDownloadResponse struct {
|
|||
|
Data WorkWxCdnDownloadResponseData `json:"data"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
// WorkWxCdnDownload 企业微信CDN
|
|||
|
func (w *WxApi) WorkWxCdnDownload(request WorkWxCdnDownloadRequest) (*WorkWxCdnDownloadResponseData, error) {
|
|||
|
resp, err := w.internalCall(MtWorkWxCdnDownloadMsg, 600, MtWorkWxCdnDownloadMsg, request, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
var rdata WorkWxCdnDownloadResponse
|
|||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|||
|
if err != nil {
|
|||
|
return nil, WxError{-1, err.Error()}
|
|||
|
}
|
|||
|
return &rdata.Data, nil
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendTextMsgRequest struct {
|
|||
|
ToWxid string `json:"to_wxid"`
|
|||
|
Content string `json:"content"`
|
|||
|
AtList []string `json:"at_list"` // 群消息时候使用
|
|||
|
AtAll int `json:"at_all"` // 群消息时候,1是at所有人
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendTextMsgResponseData struct {
|
|||
|
BaseResponse struct {
|
|||
|
Ret int `json:"ret"`
|
|||
|
} `json:"baseResponse"`
|
|||
|
Count int `json:"count"`
|
|||
|
MsgResponseList []struct {
|
|||
|
ClientMsgId int `json:"clientMsgId"`
|
|||
|
CreateTime int `json:"createTime"`
|
|||
|
MsgId int `json:"msgId"`
|
|||
|
NewMsgId string `json:"newMsgId"`
|
|||
|
Ret int `json:"ret"`
|
|||
|
ServerTime int `json:"serverTime"`
|
|||
|
ToUserName struct {
|
|||
|
String string `json:"string"`
|
|||
|
} `json:"toUserName"`
|
|||
|
Type int `json:"type"`
|
|||
|
} `json:"msgResponseList"`
|
|||
|
}
|
|||
|
type CDNSendTextMsgResponse struct {
|
|||
|
Data CDNSendTextMsgResponseData `json:"data"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
// CDNSendTextMsg 发送文本消息
|
|||
|
func (w *WxApi) CDNSendTextMsg(request CDNSendTextMsgRequest) (*CDNSendTextMsgResponseData, error) {
|
|||
|
var (
|
|||
|
resp string
|
|||
|
err error
|
|||
|
)
|
|||
|
if len(request.AtList) > 0 || request.AtAll == 1 {
|
|||
|
resp, err = w.internalCall(MtCdnSendAtTextMsg, 30, MtCdnSendAtTextMsg, request, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
} else {
|
|||
|
resp, err = w.internalCall(MtCdnSendTextMsg, 30, MtCdnSendTextMsg, request, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
}
|
|||
|
var rdata CDNSendTextMsgResponse
|
|||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|||
|
if err != nil {
|
|||
|
return nil, WxError{-1, err.Error()}
|
|||
|
}
|
|||
|
return &rdata.Data, nil
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendImageMsgRequest struct {
|
|||
|
AesKey string `json:"aes_key"`
|
|||
|
FileId string `json:"file_id"`
|
|||
|
FileMd5 string `json:"file_md5"`
|
|||
|
FileSize int `json:"file_size"`
|
|||
|
ThumbFileSize int `json:"thumb_file_size"`
|
|||
|
Crc32 int `json:"crc32"`
|
|||
|
ToWxid string `json:"to_wxid"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendImageMsgResponseData struct {
|
|||
|
AesKey string `json:"aes_key"`
|
|||
|
FileId string `json:"file_id"`
|
|||
|
FileMd5 string `json:"file_md5"`
|
|||
|
FileSize int `json:"file_size"`
|
|||
|
ThumbFileSize int `json:"thumb_file_size"`
|
|||
|
Crc32 int `json:"crc32"`
|
|||
|
ToWxid string `json:"to_wxid"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendImageMsgResponse struct {
|
|||
|
Data CDNSendImageMsgResponseData `json:"data"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
// CDNSendImageMsg 发送图片
|
|||
|
func (w *WxApi) CDNSendImageMsg(request CDNSendImageMsgRequest) (*CDNSendImageMsgResponseData, error) {
|
|||
|
resp, err := w.internalCall(MtCdnSendImageMsg, 120, MtCdnSendImageMsg, request, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
var rdata CDNSendImageMsgResponse
|
|||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|||
|
if err != nil {
|
|||
|
return nil, WxError{-1, err.Error()}
|
|||
|
}
|
|||
|
return &rdata.Data, nil
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendVideoMsgRequest struct {
|
|||
|
AesKey string `json:"aes_key"`
|
|||
|
FileId string `json:"file_id"`
|
|||
|
FileMd5 string `json:"file_md5"`
|
|||
|
FileSize int `json:"file_size"`
|
|||
|
ThumbFileSize int `json:"thumb_file_size"`
|
|||
|
ToWxid string `json:"to_wxid"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendVideoMsgResponseData struct {
|
|||
|
ActionFlag int `json:"actionFlag"`
|
|||
|
Aeskey string `json:"aeskey"`
|
|||
|
BaseResponse struct {
|
|||
|
Ret int `json:"ret"`
|
|||
|
} `json:"baseResponse"`
|
|||
|
ClientMsgId string `json:"clientMsgId"`
|
|||
|
MsgId int `json:"msgId"`
|
|||
|
MsgSource string `json:"msgSource"`
|
|||
|
NewMsgId string `json:"newMsgId"`
|
|||
|
RawAeskey string `json:"rawAeskey"`
|
|||
|
RawVideoNeedReupload bool `json:"rawVideoNeedReupload"`
|
|||
|
ThumbStartPos int `json:"thumbStartPos"`
|
|||
|
VideoNeedReupload bool `json:"videoNeedReupload"`
|
|||
|
VideoStartPos int `json:"videoStartPos"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendVideoMsgResponse struct {
|
|||
|
Data CDNSendVideoMsgResponseData `json:"data"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
func (w *WxApi) CDNSendVideoMsg(request CDNSendVideoMsgRequest) (*CDNSendVideoMsgResponseData, error) {
|
|||
|
resp, err := w.internalCall(MtCdnSendVideoMsg, 120, MtCdnSendVideoMsg, request, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
var rdata CDNSendVideoMsgResponse
|
|||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|||
|
if err != nil {
|
|||
|
return nil, WxError{-1, err.Error()}
|
|||
|
}
|
|||
|
return &rdata.Data, nil
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendFileMsgRequest struct {
|
|||
|
AesKey string `json:"aes_key"`
|
|||
|
FileId string `json:"file_id"`
|
|||
|
FileMd5 string `json:"file_md5"`
|
|||
|
FileName string `json:"file_name"`
|
|||
|
FileSize int `json:"file_size"`
|
|||
|
ToWxid string `json:"to_wxid"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendFileMsgResponseData struct {
|
|||
|
ActionFlag int `json:"actionFlag"`
|
|||
|
Aeskey string `json:"aeskey"`
|
|||
|
AppId string `json:"appId"`
|
|||
|
BaseResponse struct {
|
|||
|
Ret int `json:"ret"`
|
|||
|
} `json:"baseResponse"`
|
|||
|
ClientMsgId string `json:"clientMsgId"`
|
|||
|
CreateTime int `json:"createTime"`
|
|||
|
FromUserName string `json:"fromUserName"`
|
|||
|
MsgId int `json:"msgId"`
|
|||
|
MsgSource string `json:"msgSource"`
|
|||
|
NewMsgId string `json:"newMsgId"`
|
|||
|
ToUserName string `json:"toUserName"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendFileMsgResponse struct {
|
|||
|
Data CDNSendFileMsgResponseData `json:"data"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
// CDNSendFileMsg 发送文件
|
|||
|
func (w *WxApi) CDNSendFileMsg(request CDNSendFileMsgRequest) (*CDNSendFileMsgResponseData, error) {
|
|||
|
resp, err := w.internalCall(MtCdnSendFileMsg, 120, MtCdnSendFileMsg, request, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
var rdata CDNSendFileMsgResponse
|
|||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|||
|
if err != nil {
|
|||
|
return nil, WxError{-1, err.Error()}
|
|||
|
}
|
|||
|
return &rdata.Data, nil
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendCardLinkMsgRequest struct {
|
|||
|
ToWxid string `json:"to_wxid"`
|
|||
|
Title string `json:"title"`
|
|||
|
Desc string `json:"desc"`
|
|||
|
Url string `json:"url"`
|
|||
|
ImageUrl string `json:"image_url"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendCardLinkMsgResponseData struct {
|
|||
|
ActionFlag int `json:"actionFlag"`
|
|||
|
Aeskey string `json:"aeskey"`
|
|||
|
AppId string `json:"appId"`
|
|||
|
BaseResponse struct {
|
|||
|
ErrMsg struct {
|
|||
|
} `json:"errMsg"`
|
|||
|
Ret int `json:"ret"`
|
|||
|
} `json:"baseResponse"`
|
|||
|
ClientMsgId string `json:"clientMsgId"`
|
|||
|
CreateTime int `json:"createTime"`
|
|||
|
FromUserName string `json:"fromUserName"`
|
|||
|
MsgId int `json:"msgId"`
|
|||
|
MsgSource string `json:"msgSource"`
|
|||
|
NewMsgId string `json:"newMsgId"`
|
|||
|
ToUserName string `json:"toUserName"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendCardLinkMsgResponse struct {
|
|||
|
Data CDNSendCardLinkMsgResponseData `json:"data"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
// CDNSendCardLinkMsg 发送链接卡片
|
|||
|
func (w *WxApi) CDNSendCardLinkMsg(request CDNSendCardLinkMsgRequest) (*CDNSendCardLinkMsgResponseData, error) {
|
|||
|
resp, err := w.internalCall(MtCdnSendCardLinkMsg, 120, MtCdnSendCardLinkMsg, request, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
var rdata CDNSendCardLinkMsgResponse
|
|||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|||
|
if err != nil {
|
|||
|
return nil, WxError{-1, err.Error()}
|
|||
|
}
|
|||
|
return &rdata.Data, nil
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendGifMsgRequest struct {
|
|||
|
AesKey string `json:"aes_key"`
|
|||
|
FileId string `json:"file_id"`
|
|||
|
FileMd5 string `json:"file_md5"`
|
|||
|
FileSize int `json:"file_size"`
|
|||
|
ToWxid string `json:"to_wxid"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendGifMsgResponseData struct {
|
|||
|
ActionFlag int `json:"actionFlag"`
|
|||
|
Aeskey string `json:"aeskey"`
|
|||
|
AppId string `json:"appId"`
|
|||
|
BaseResponse struct {
|
|||
|
Ret int `json:"ret"`
|
|||
|
} `json:"baseResponse"`
|
|||
|
ClientMsgId string `json:"clientMsgId"`
|
|||
|
CreateTime int `json:"createTime"`
|
|||
|
FromUserName string `json:"fromUserName"`
|
|||
|
MsgId int `json:"msgId"`
|
|||
|
MsgSource string `json:"msgSource"`
|
|||
|
NewMsgId string `json:"newMsgId"`
|
|||
|
ToUserName string `json:"toUserName"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendGifMsgResponse struct {
|
|||
|
Data CDNSendGifMsgResponseData `json:"data"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
// CDNSendGifMsg 发送动图
|
|||
|
func (w *WxApi) CDNSendGifMsg(request CDNSendGifMsgRequest) (*CDNSendGifMsgResponseData, error) {
|
|||
|
resp, err := w.internalCall(MtCdnSendGifMsg, 120, MtCdnSendGifMsg, request, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
var rdata CDNSendGifMsgResponse
|
|||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|||
|
if err != nil {
|
|||
|
return nil, WxError{-1, err.Error()}
|
|||
|
}
|
|||
|
return &rdata.Data, nil
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendMiniProgramMsgRequest struct {
|
|||
|
ToWxid string `json:"to_wxid"`
|
|||
|
Username string `json:"username"`
|
|||
|
Appid string `json:"appid"`
|
|||
|
Appname string `json:"appname"`
|
|||
|
Appicon string `json:"appicon"`
|
|||
|
Title string `json:"title"`
|
|||
|
PagePath string `json:"page_path"`
|
|||
|
FileId string `json:"file_id"`
|
|||
|
AesKey string `json:"aes_key"`
|
|||
|
FileMd5 string `json:"file_md5"`
|
|||
|
FileSize int `json:"file_size"`
|
|||
|
}
|
|||
|
type CDNSendMiniProgramMsgResponseData struct {
|
|||
|
ActionFlag int `json:"actionFlag"`
|
|||
|
Aeskey string `json:"aeskey"`
|
|||
|
AppId string `json:"appId"`
|
|||
|
BaseResponse struct {
|
|||
|
Ret int `json:"ret"`
|
|||
|
} `json:"baseResponse"`
|
|||
|
ClientMsgId string `json:"clientMsgId"`
|
|||
|
CreateTime int `json:"createTime"`
|
|||
|
FromUserName string `json:"fromUserName"`
|
|||
|
MsgId int `json:"msgId"`
|
|||
|
MsgSource string `json:"msgSource"`
|
|||
|
NewMsgId string `json:"newMsgId"`
|
|||
|
ToUserName string `json:"toUserName"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendMiniProgramMsgResponse struct {
|
|||
|
Data CDNSendMiniProgramMsgResponseData `json:"data"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
// CDNSendMiniProgramMsg 发送小程序
|
|||
|
func (w *WxApi) CDNSendMiniProgramMsg(request CDNSendMiniProgramMsgRequest) (*CDNSendMiniProgramMsgResponseData, error) {
|
|||
|
resp, err := w.internalCall(MtCdnSendMiniProgramMsg, 120, MtCdnSendMiniProgramMsg, request, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
var rdata CDNSendMiniProgramMsgResponse
|
|||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|||
|
if err != nil {
|
|||
|
return nil, WxError{-1, err.Error()}
|
|||
|
}
|
|||
|
return &rdata.Data, nil
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendVideoMomentMsgRequest struct {
|
|||
|
ToWxid string `json:"to_wxid"`
|
|||
|
ObjectId string `json:"object_id"`
|
|||
|
ObjectNonceId string `json:"object_nonce_id"`
|
|||
|
Nickname string `json:"nickname"`
|
|||
|
Username string `json:"username"`
|
|||
|
Avatar string `json:"avatar"`
|
|||
|
Desc string `json:"desc"`
|
|||
|
ThumbUrl string `json:"thumb_url"`
|
|||
|
Url string `json:"url"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendVideoMomentMsgResponseData struct {
|
|||
|
ActionFlag int `json:"actionFlag"`
|
|||
|
Aeskey string `json:"aeskey"`
|
|||
|
AppId string `json:"appId"`
|
|||
|
BaseResponse struct {
|
|||
|
Ret int `json:"ret"`
|
|||
|
} `json:"baseResponse"`
|
|||
|
ClientMsgId string `json:"clientMsgId"`
|
|||
|
CreateTime int `json:"createTime"`
|
|||
|
FromUserName string `json:"fromUserName"`
|
|||
|
MsgId int `json:"msgId"`
|
|||
|
MsgSource string `json:"msgSource"`
|
|||
|
NewMsgId string `json:"newMsgId"`
|
|||
|
ToUserName string `json:"toUserName"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendVideoMomentMsgResponse struct {
|
|||
|
Data CDNSendVideoMomentMsgResponseData `json:"data"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
// CDNSendVideoMomentMsg 发送视频号
|
|||
|
func (w *WxApi) CDNSendVideoMomentMsg(request CDNSendVideoMomentMsgRequest) (*CDNSendVideoMomentMsgResponseData, error) {
|
|||
|
resp, err := w.internalCall(MtCdnSendVideoMomentMsg, 120, MtCdnSendVideoMomentMsg, request, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
var rdata CDNSendVideoMomentMsgResponse
|
|||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|||
|
if err != nil {
|
|||
|
return nil, WxError{-1, err.Error()}
|
|||
|
}
|
|||
|
return &rdata.Data, nil
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendCardMsgRequest struct {
|
|||
|
ToWxid string `json:"to_wxid"`
|
|||
|
Username string `json:"username"`
|
|||
|
Nickname string `json:"nickname"`
|
|||
|
Avatar string `json:"avatar"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendCardMsgResponseData struct {
|
|||
|
BaseResponse struct {
|
|||
|
Ret int `json:"ret"`
|
|||
|
} `json:"baseResponse"`
|
|||
|
Count int `json:"count"`
|
|||
|
MsgResponseList []struct {
|
|||
|
ClientMsgId int `json:"clientMsgId"`
|
|||
|
CreateTime int `json:"createTime"`
|
|||
|
MsgId int `json:"msgId"`
|
|||
|
NewMsgId string `json:"newMsgId"`
|
|||
|
Ret int `json:"ret"`
|
|||
|
ServerTime int `json:"serverTime"`
|
|||
|
ToUserName struct {
|
|||
|
String string `json:"string"`
|
|||
|
} `json:"toUserName"`
|
|||
|
Type int `json:"type"`
|
|||
|
} `json:"msgResponseList"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendCardMsgResponse struct {
|
|||
|
Data CDNSendCardMsgResponseData `json:"data"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
// CDNSendCardMsg 发送名片
|
|||
|
func (w *WxApi) CDNSendCardMsg(request CDNSendCardMsgRequest) (*CDNSendCardMsgResponseData, error) {
|
|||
|
resp, err := w.internalCall(MtCdnSendCardMsg, 120, MtCdnSendCardMsg, request, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
var rdata CDNSendCardMsgResponse
|
|||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|||
|
if err != nil {
|
|||
|
return nil, WxError{-1, err.Error()}
|
|||
|
}
|
|||
|
return &rdata.Data, nil
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendLocationMsgRequest struct {
|
|||
|
ToWxid string `json:"to_wxid"`
|
|||
|
Address string `json:"address"`
|
|||
|
Latitude float64 `json:"latitude"`
|
|||
|
Longitude float64 `json:"longitude"`
|
|||
|
Title string `json:"title"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendLocationMsgResponseData struct {
|
|||
|
BaseResponse struct {
|
|||
|
Ret int `json:"ret"`
|
|||
|
} `json:"baseResponse"`
|
|||
|
Count int `json:"count"`
|
|||
|
MsgResponseList []struct {
|
|||
|
ClientMsgId int `json:"clientMsgId"`
|
|||
|
CreateTime int `json:"createTime"`
|
|||
|
MsgId int `json:"msgId"`
|
|||
|
NewMsgId string `json:"newMsgId"`
|
|||
|
Ret int `json:"ret"`
|
|||
|
ServerTime int `json:"serverTime"`
|
|||
|
ToUserName struct {
|
|||
|
String string `json:"string"`
|
|||
|
} `json:"toUserName"`
|
|||
|
Type int `json:"type"`
|
|||
|
} `json:"msgResponseList"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendLocationMsgResponse struct {
|
|||
|
Data CDNSendLocationMsgResponseData `json:"data"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
// CDNSendLocationMsg 发送位置
|
|||
|
func (w *WxApi) CDNSendLocationMsg(request CDNSendLocationMsgRequest) (*CDNSendLocationMsgResponseData, error) {
|
|||
|
resp, err := w.internalCall(MtCdnSendLocationMsg, 120, MtCdnSendLocationMsg, request, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
var rdata CDNSendLocationMsgResponse
|
|||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|||
|
if err != nil {
|
|||
|
return nil, WxError{-1, err.Error()}
|
|||
|
}
|
|||
|
return &rdata.Data, nil
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendRevokeMsgRequest struct {
|
|||
|
ClientMsgid interface{} `json:"client_msgid"`
|
|||
|
CreateTime int `json:"create_time"`
|
|||
|
ToWxid string `json:"to_wxid"`
|
|||
|
NewMsgid string `json:"new_msgid"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendRevokeMsgResponseData struct {
|
|||
|
BaseResponse struct {
|
|||
|
Ret int `json:"ret"`
|
|||
|
} `json:"baseResponse"`
|
|||
|
Introduction string `json:"introduction"`
|
|||
|
SysWording string `json:"sysWording"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendRevokeMsgResponse struct {
|
|||
|
Data CDNSendRevokeMsgResponseData `json:"data"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
// CDNSendRevokeMsg 撤回消息
|
|||
|
func (w *WxApi) CDNSendRevokeMsg(request CDNSendRevokeMsgRequest) (*CDNSendRevokeMsgResponseData, error) {
|
|||
|
resp, err := w.internalCall(MtCdnSendRevokeMsg, 120, MtCdnSendRevokeMsg, request, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
var rdata CDNSendRevokeMsgResponse
|
|||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|||
|
if err != nil {
|
|||
|
return nil, WxError{-1, err.Error()}
|
|||
|
}
|
|||
|
return &rdata.Data, nil
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendXmlMsgRequest struct {
|
|||
|
// "<appmsg appid=\"wx6618f1cfc6c132f8\" sdkver=\"0\"><title>1658934822522.gif<... ...</weappinfo><websearch /></appmsg>",
|
|||
|
Content string `json:"content"`
|
|||
|
ToWxid string `json:"to_wxid"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendXmlMsgResponseData struct {
|
|||
|
ActionFlag int `json:"actionFlag"`
|
|||
|
Aeskey string `json:"aeskey"`
|
|||
|
AppId string `json:"appId"`
|
|||
|
BaseResponse struct {
|
|||
|
Ret int `json:"ret"`
|
|||
|
} `json:"baseResponse"`
|
|||
|
ClientMsgId string `json:"clientMsgId"`
|
|||
|
CreateTime int `json:"createTime"`
|
|||
|
FromUserName string `json:"fromUserName"`
|
|||
|
MsgId int `json:"msgId"`
|
|||
|
MsgSource string `json:"msgSource"`
|
|||
|
NewMsgId string `json:"newMsgId"`
|
|||
|
ToUserName string `json:"toUserName"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendXmlMsgResponse struct {
|
|||
|
Data CDNSendXmlMsgResponseData `json:"data"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
// CDNSendXmlMsg 发送xml消息
|
|||
|
func (w *WxApi) CDNSendXmlMsg(request CDNSendXmlMsgRequest) (*CDNSendXmlMsgResponseData, error) {
|
|||
|
resp, err := w.internalCall(MtCdnSendXmlMsg, 120, MtCdnSendXmlMsg, request, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
var rdata CDNSendXmlMsgResponse
|
|||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|||
|
if err != nil {
|
|||
|
return nil, WxError{-1, err.Error()}
|
|||
|
}
|
|||
|
return &rdata.Data, nil
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendGifMsgNewRequest struct {
|
|||
|
Path string `json:"path"`
|
|||
|
ToWxid string `json:"to_wxid"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendGifMsgNewResponseData struct {
|
|||
|
Md5 string `json:"md5"`
|
|||
|
Size int `json:"size"`
|
|||
|
ToWxid string `json:"to_wxid"`
|
|||
|
}
|
|||
|
|
|||
|
type CDNSendGifMsgNewResponse struct {
|
|||
|
Data CDNSendGifMsgNewResponseData `json:"data"`
|
|||
|
Type int `json:"type"`
|
|||
|
}
|
|||
|
|
|||
|
// CDNSendGifMsgNew 发送动图
|
|||
|
func (w *WxApi) CDNSendGifMsgNew(request CDNSendGifMsgNewRequest) (*CDNSendGifMsgNewResponseData, error) {
|
|||
|
resp, err := w.internalCall(MtCdnSendGifMsgNew, 120, MtCdnSendGifMsgNew, request, nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
var rdata CDNSendGifMsgNewResponse
|
|||
|
err = json.Unmarshal([]byte(resp), &rdata)
|
|||
|
if err != nil {
|
|||
|
return nil, WxError{-1, err.Error()}
|
|||
|
}
|
|||
|
return &rdata.Data, nil
|
|||
|
}
|