mp_api

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 服务器类型
	ServerHostUniversal  = "api.weixin.qq.com"    // 通用域名
	ServerHostUniversal2 = "api2.weixin.qq.com"   // 通用异地容灾域名
	ServerHostShangHai   = "sh.api.weixin.qq.com" // 上海域名
	ServerHostShenZhen   = "sz.api.weixin.qq.com" // 深圳域名
	ServerHostHK         = "hk.api.weixin.qq.com" // 香港域名
)
View Source
const (
	// 开始开发
	BasicInformationToken         = "cgi-bin/token"             // 获取Access token
	BasicInformationApiDomainIp   = "cgi-bin/get_api_domain_ip" // 获取微信服务器IP地址
	BasicInformationCallbackCheck = "cgi-bin/callback/check"    // 网络检测

	// 自定义菜单
	CustomMenuCreate              = "cgi-bin/menu/create"               // 创建自定义菜单
	CustomMenuCurrentSelfMenuInfo = "cgi-bin/get_current_selfmenu_info" // 查询自定义菜单
	CustomMenuDelete              = "cgi-bin/menu/delete"               // 删除默认菜单及全部个性化菜单

	// 消息
	MessageCustomServiceKfAccountAdd           = "customservice/kfaccount/add"           // 添加客服
	MessageCustomServiceKfAccountUpdate        = "customservice/kfaccount/update"        // 修改客服
	MessageCustomServiceKfAccountDel           = "customservice/kfaccount/del"           // 删除客服
	MessageCustomServiceKfAccountUploadHeadImg = "customservice/kfaccount/uploadheadimg" // 上传客服头像
	MessageCustomServiceKfList                 = "cgi-bin/customservice/getkflist"       // 获取所有客服
	MessageCustomSend                          = "cgi-bin/message/custom/send"           // 客服接口-发消息
	MessageTemplateSend                        = "cgi-bin/message/template/send"         // 发送模板消息

	// 媒体文件上传
	MediaUploadImg = "cgi-bin/media/uploadimg" // 上传图文消息内的图片获取URL
	MediaUpload    = "cgi-bin/media/upload"    // 新增临时素材

	// 微信网页开发
	OaWebAppsSnsAuth2AccessToken = "sns/oauth2/access_token"  // 通过code换取网页授权access_token
	OaWebAppsSnsUserInfo         = "sns/userinfo"             // 拉取用户信息(需scope为 snsapi_userinfo)
	OaWebAppsJsSDKTicket         = "cgi-bin/ticket/getticket" // 获取JsSDK ticket

	// 用户管理
	UserTagsCreate           = "cgi-bin/tags/create"                 // 创建标签
	UserTagsGet              = "cgi-bin/tags/get"                    // 获取公众号已创建的标签
	UserTagsUpdate           = "cgi-bin/tags/update"                 // 编辑标签
	UserTagsDelete           = "cgi-bin/tags/delete"                 // 删除标签
	UserTagGet               = "cgi-bin/user/tag/get"                // 获取标签下粉丝列表
	UserTagMembersBatch      = "cgi-bin/tags/members/batchtagging"   // 批量为用户打标签
	UserTagMembersBatchUnTag = "cgi-bin/tags/members/batchuntagging" // 批量为用户取消标签
	UserTagsGetIdList        = "cgi-bin/tags/getidlist"              // 获取用户身上的标签列表
	UserInfoUpdateRemark     = "cgi-bin/user/info/updateremark"      // 用户设置备注名
	UserInfo                 = "cgi-bin/user/info"                   // 获取用户基本信息(包括UnionID机制)
	UserInfoBatchGet         = "cgi-bin/user/info/batchget"          // 批量获取用户基本信息
	UserGet                  = "cgi-bin/user/get"                    // 获取关注者列表

	// 账号管理
	AccountQrCreate = "cgi-bin/qrcode/create" // 二维码
	AccountShortUrl = "cgi-bin/shorturl"      // 长链接转成短链接

	// 对话能力
	GuideAccountAdd = "cgi-bin/guide/addguideacct"          // 添加顾问
	GuideAddBuyer   = "cgi-bin/guide/addguidebuyerrelation" // 为顾问分配客户

	// 小程序
	MiniProgramJsCode2Session = "sns/jscode2session" // 登录凭证校验
)
View Source
const (
	MessageCustomSendTypeText            = "text"
	MessageCustomSendTypeImage           = "image"
	MessageCustomSendTypeVideo           = "video"
	MessageCustomSendTypeMusic           = "music"
	MessageCustomSendTypeNews            = "news"
	MessageCustomSendTypeMpNews          = "mpnews"
	MessageCustomSendTypeMsgMenu         = "msgmenu"
	MessageCustomSendTypeWxCard          = "wxcard"
	MessageCustomSendTypeMiniProgramPage = "miniprogrampage"
)
View Source
const (
	MediaTypeImage = "image"
	MediaTypeVoice = "voice"
	MediaTypeVideo = "video"
	MediaTypeThumb = "thumb"
)
View Source
const (
	QrActionTypeScene         = "QR_SCENE"
	QrActionTypeLimitScene    = "QR_LIMIT_SCENE"
	QrActionTypeLimitStrScene = "QR_LIMIT_STR_SCENE"
)
View Source
const (
	JsSDKTicketTypeJSAPI  = "jsapi"
	JsSDKTicketTypeWxCard = "wx_card"
)
View Source
const ShortUrlAction = "long2short"
View Source
const TokenGrantType = "client_credential"

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountQrCreateData

type AccountQrCreateData struct {
	ExpireSeconds int64        `json:"expire_seconds,omitempty"`
	ActionName    QrActionType `json:"action_name"`
	ActionInfo    struct {
		Scene struct {
			SceneId  int64  `json:"scene_id,omitempty"`
			SceneStr string `json:"scene_str,omitempty"`
		} `json:"scene"`
	} `json:"action_info"`
}

type AccountQrCreateRes

type AccountQrCreateRes struct {
	Ticket        string `json:"ticket"`
	ExpireSeconds int64  `json:"expire_seconds"`
	Url           string `json:"url"`
}

type AccountShortUrlData

type AccountShortUrlData struct {
	Action  string `json:"action"`
	LongUrl string `json:"long_url"`
}

type AccountShortUrlRes

type AccountShortUrlRes struct {
	MpBaseResp
	ShortUrl string `json:"short_url"`
}

type BasicInformationTokenQuery added in v1.0.1

type BasicInformationTokenQuery struct {
	GrantType string `url:"grant_type"`
	AppId     string `url:"appid"`
	Secret    string `url:"secret"`
}

type BasicInformationTokenRes added in v1.0.1

type BasicInformationTokenRes struct {
	MpBaseResp
	AccessToken string `json:"access_token"`
	ExpiresIn   int64  `json:"expires_in"`
}

type CallbackCheckData

type CallbackCheckData struct {
	Action        string `json:"action"`
	CheckOperator string `json:"check_operator"`
}

type CallbackCheckRes

type CallbackCheckRes struct {
	MpBaseResp
	Dns []struct {
		Ip           string `json:"ip"`
		RealOperator string `json:"real_operator"`
	} `json:"dns"`
	Ping []struct {
		Ip           string `json:"ip"`
		FromOperator string `json:"from_operator"`
		PackageLoss  string `json:"package_loss"`
		Time         string `json:"time"`
	} `json:"ping"`
}

type CustomMenuCurrentSelfMenuInfoRes

type CustomMenuCurrentSelfMenuInfoRes struct {
	MpBaseResp
	IsMenuOpen   int64 `json:"is_menu_open"`
	SelfMenuInfo struct {
		Button []MenuButton `json:"button"`
	} `json:"selfmenu_info"`
}

type GetApiDomainIpRes

type GetApiDomainIpRes struct {
	MpBaseResp
	IpList []string `json:"ip_list"`
}

type GuideAccountAddData

type GuideAccountAddData struct {
	GuideAccount    string `json:"guide_account,omitempty"`
	GuideOpenId     string `json:"guide_openid,omitempty"`
	GuideHeadImgUrl string `json:"guide_headimgurl,omitempty"`
	GuideNickname   string `json:"guide_nickname,omitempty"`
}

type GuideAddBuyerData

type GuideAddBuyerData struct {
	GuideAccount string `json:"guide_account,omitempty"`
	GuideOpenid  string `json:"guide_openid,omitempty"`
	GuideBuyer
	BuyerList []GuideBuyer `json:"buyer_list,omitempty"`
}

type GuideBuyer

type GuideBuyer struct {
	OpenId        string `json:"openid,omitempty"`
	BuyerNickname string `json:"buyer_nickname,omitempty"`
}

type JsSDKTicketType added in v1.0.1

type JsSDKTicketType string

type KfAccountData

type KfAccountData struct {
	KfId         int64  `json:"kf_id,omitempty"`
	KfAccount    string `json:"kf_account"`
	NickName     string `json:"nickname"`
	Password     string `json:"password"`
	KfHeadImgUrl string `json:"kf_headimgurl,omitempty"`
}

type MediaType

type MediaType string

type MediaUploadImgRes

type MediaUploadImgRes struct {
	MpBaseResp
	Url string `json:"url"`
}

type MediaUploadQuery

type MediaUploadQuery struct {
	Type MediaType `url:"type"`
}

type MediaUploadRes

type MediaUploadRes struct {
	MpBaseResp
	Type      string `json:"type"`
	MediaId   string `json:"media_id"`
	CreatedAt int64  `json:"created_at"`
}
type MenuButton struct {
	Type      string       `json:"type"`
	Name      string       `json:"name"`
	Key       string       `json:"key,omitempty"`
	Url       string       `json:"url,omitempty"`
	MediaId   string       `json:"media_id,omitempty"`
	AppId     string       `json:"appid,omitempty"`
	PagePath  string       `json:"pagepath,omitempty"`
	SubButton []MenuButton `json:"sub_button,omitempty"`
}
type MenuCreateData struct {
	Button []MenuButton `json:"button"`
}

type MessageCustomSendArticle

type MessageCustomSendArticle struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Url         string `json:"url"`
	PicUrl      string `json:"picurl"`
}

type MessageCustomSendData

type MessageCustomSendData struct {
	ToUser  string                `json:"touser"`
	MsgType MessageCustomSendType `json:"msgtype"`
	Text    struct {
		Content string `json:"content"`
	} `json:"text"`
	Image struct {
		MediaId string `json:"media_id"`
	} `json:"image"`
	Voice struct {
		MediaId string `json:"media_id"`
	} `json:"voice"`
	Video struct {
		MediaId      string `json:"media_id"`
		ThumbMediaId string `json:"thumb_media_id"`
		Title        string `json:"title"`
		Description  string `json:"description"`
	} `json:"video"`
	Music struct {
		Title        string `json:"title"`
		Description  string `json:"description"`
		MusicUrl     string `json:"music_url"`
		HqMusicUrl   string `json:"hq_music_url"`
		ThumbMediaId string `json:"thumb_media_id"`
	} `json:"music"`
	News struct {
		Articles []MessageCustomSendArticle `json:"articles"`
	} `json:"news"`
	MpNews struct {
		MediaId string `json:"media_id"`
	} `json:"mp_news"`
	MsgMenu struct {
		HeadContent string                         `json:"head_content"`
		List        []MessageCustomSendMsgMenuItem `json:"list"`
		TailContent string                         `json:"tail_content"`
	}
	WxCard struct {
		CardId string `json:"card_id"`
	} `json:"wx_card"`
	MiniProgramPage struct {
		Title        string `json:"title"`
		AppId        string `json:"appid"`
		PagePath     string `json:"pagepath"`
		ThumbMediaId string `json:"thumb_media_id"`
	} `json:"miniprogrampage"`
	CustomService struct {
		KfAccount string `json:"kf_account"`
	} `json:"customservice"`
}

type MessageCustomSendMsgMenuItem

type MessageCustomSendMsgMenuItem struct {
	Id      string `json:"id"`
	Content string `json:"content"`
}

type MessageCustomSendType

type MessageCustomSendType string

type MessageCustomServiceKfAccountUploadHeadImgQuery

type MessageCustomServiceKfAccountUploadHeadImgQuery struct {
	KfAccount string `url:"kf_account"`
}

type MessageCustomServiceKfListRes

type MessageCustomServiceKfListRes struct {
	MpBaseResp
	KfList []KfAccountData `json:"kf_list"`
}

type MessageData

type MessageData struct {
	ToUserName   string  `xml:"ToUserName" json:"to_user_name,omitempty"`
	Encrypt      string  `xml:"Encrypt" json:"encrypt,omitempty"`
	FromUserName string  `xml:"FromUserName" json:"from_user_name,omitempty"`
	CreateTime   int64   `xml:"CreateTime" json:"create_time,omitempty"`
	MsgType      string  `xml:"MsgType" json:"msg_type,omitempty"`
	Content      string  `xml:"Content" json:"content,omitempty"`
	MsgId        int64   `xml:"MsgId" json:"msg_id,omitempty"`
	PicUrl       string  `xml:"PicUrl" json:"pic_url,omitempty"`
	MediaId      string  `xml:"MediaId" json:"media_id,omitempty"`
	Format       string  `xml:"Format" json:"format,omitempty"`
	Recognition  string  `xml:"Recognition" json:"recognition,omitempty"`
	ThumbMediaId string  `xml:"ThumbMediaId" json:"thumb_media_id,omitempty"`
	LocationX    float64 `xml:"Location_X" json:"location_x,omitempty"`
	LocationY    float64 `xml:"Location_Y" json:"location_y,omitempty"`
	Scale        int64   `xml:"Scale" json:"scale,omitempty"`
	Label        string  `xml:"Label" json:"label,omitempty"`
	Title        string  `xml:"Title" json:"title,omitempty"`
	Description  string  `xml:"Description" json:"description,omitempty"`
	Url          string  `xml:"Url" json:"url,omitempty"`
	Event        string  `xml:"Event" json:"event,omitempty"`
	EventKey     string  `xml:"EventKey" json:"event_key,omitempty"`
	Ticket       string  `xml:"Ticket" json:"ticket,omitempty"`
	Latitude     float64 `xml:"Latitude" json:"latitude,omitempty"`
	Longitude    float64 `xml:"Longitude" json:"longitude,omitempty"`
	Precision    float64 `xml:"Precision" json:"precision,omitempty"`
	SessionFrom  string  `xml:"SessionFrom" json:"session_from,omitempty"`
	Status       string  `xml:"Status" json:"status,omitempty"`
	MsgID        int64   `xml:"MsgID" json:"msgID,omitempty"`
	SentCount    int64   `xml:"SentCount" json:"sent_count,omitempty"`
	AppId        string  `xml:"-" json:"app_id,omitempty"`
}

公众号消息

func (*MessageData) ShouldDecode

func (msg *MessageData) ShouldDecode(EncodingAESKey string) (err error)

公众号消息解密

type MessageQuery

type MessageQuery struct {
	Signature    string `param:"signature" binding:"required"`
	Timestamp    string `param:"timestamp" binding:"required"`
	Nonce        string `param:"nonce" binding:"required"`
	EchoStr      string `param:"echostr"`
	OpenId       string `param:"openid"`
	EncryptType  string `param:"encrypt_type"`
	MsgSignature string `param:"msg_signature"`
}

消息通知`query`数据

func (MessageQuery) Validate

func (mq MessageQuery) Validate(PrivateToken string) (err error)

安全验证

type MessageTemplateSendData

type MessageTemplateSendData struct {
	ToUser      string `json:"touser"`
	TemplateId  string `json:"template_id"`
	Url         string `json:"url"`
	MiniProgram struct {
		AppId    string `json:"appid"`
		PagePath string `json:"pagepath"`
	} `json:"mini_program"`
	Data map[string]MessageTemplateSendDataItem `json:"data"`
}

type MessageTemplateSendDataItem

type MessageTemplateSendDataItem struct {
	Value string `json:"value"`
	Color string `json:"color"`
}

type MessageTemplateSendRes

type MessageTemplateSendRes struct {
	MpBaseResp
	MsgId int64 `json:"msgid"`
}

type MiniProgramJsCode2SessionQuery

type MiniProgramJsCode2SessionQuery struct {
	AppId     string `json:"appid"`
	Secret    string `json:"secret"`
	JsCode    string `json:"js_code"`
	GrantType string `json:"grant_type"`
}

type MiniProgramJsCode2SessionRes

type MiniProgramJsCode2SessionRes struct {
	MpBaseResp
	OpenId     string `json:"openid"`
	SessionKey string `json:"session_key"`
	UnionId    string `json:"unionid"`
}

type MpApi

type MpApi string

type MpBaseResp

type MpBaseResp struct {
	ErrCode int64  `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
}

type OaWebAppsJsSDKTicketQuery added in v1.0.1

type OaWebAppsJsSDKTicketQuery struct {
	Type JsSDKTicketType `param:"type"`
}

type OaWebAppsJsSDKTicketRes added in v1.0.1

type OaWebAppsJsSDKTicketRes struct {
	MpBaseResp
	Ticket    string `json:"ticket"`
	ExpiresIn int64  `json:"expires_in"`
}

type OaWebAppsSnsAuth2AccessTokenQuery

type OaWebAppsSnsAuth2AccessTokenQuery struct {
	AppId     string `param:"appid"`
	Secret    string `param:"secret"`
	Code      string `param:"code"`
	GrantType string `param:"grant_type"`
}

type OaWebAppsSnsAuth2AccessTokenRes

type OaWebAppsSnsAuth2AccessTokenRes struct {
	MpBaseResp
	AccessToken  string `json:"access_token"`
	ExpireIn     int64  `json:"expire_in"`
	RefreshToken string `json:"refresh_token"`
	OpenId       string `json:"openid"`
	Scope        string `json:"scope"`
}

type OaWebAppsSnsUserInfoQuery

type OaWebAppsSnsUserInfoQuery struct {
	OpenId string `param:"open_id"`
	Lang   string `param:"lang"`
}

type OaWebAppsSnsUserInfoRes

type OaWebAppsSnsUserInfoRes struct {
	MpBaseResp
	OpenId     string   `json:"open_id"`
	NickName   string   `json:"nickname"`
	Sex        int64    `json:"sex"`
	Province   string   `json:"province"`
	City       string   `json:"city"`
	Country    string   `json:"country"`
	HeadImgUrl string   `json:"headimgurl"`
	Privilege  []string `json:"privilege"`
	UnionId    string   `json:"unionid"`
}

type QrActionType

type QrActionType string

type ServerHost

type ServerHost string

type UserGetQuery

type UserGetQuery struct {
	NextOpenId string `url:"next_openid"`
}

type UserGetRes

type UserGetRes struct {
	MpBaseResp
	Total int64 `json:"total"`
	Count int64 `json:"count"`
	Data  struct {
		OpenId []string `json:"openid"`
	} `json:"data"`
	NextOpenId string `json:"next_openid"`
}

type UserInfoBatchGetData

type UserInfoBatchGetData struct {
	UserList []UserInfoBatchGetDataItem `json:"user_list"`
}

type UserInfoBatchGetDataItem

type UserInfoBatchGetDataItem struct {
	OpenId string `json:"open_id"`
	Lang   string `json:"lang"`
}

type UserInfoBatchGetRes

type UserInfoBatchGetRes struct {
	MpBaseResp
	UserInfoList []UserInfoRes `json:"user_info_list"`
}

type UserInfoQuery

type UserInfoQuery struct {
	OpenId string `url:"openid"`
	Lang   string `url:"lang"`
}

type UserInfoRes

type UserInfoRes struct {
	MpBaseResp
	Subscribe      int64   `json:"subscribe"`
	OpenId         string  `json:"openid"`
	NickName       string  `json:"nickname"`
	Sex            int64   `json:"sex"`
	Language       string  `json:"language"`
	City           string  `json:"city"`
	Province       string  `json:"province"`
	Country        string  `json:"country"`
	HeadImgUrl     string  `json:"headimgurl"`
	SubscribeTime  int64   `json:"subscribe_time"`
	UnionId        string  `json:"unionid"`
	Remark         string  `json:"remark"`
	GroupId        int64   `json:"group_id"`
	TagIdList      []int64 `json:"tagid_list"`
	SubscribeScene string  `json:"subscribe_scene"`
	QrScene        int64   `json:"qr_scene"`
	QrSceneStr     string  `json:"qr_scene_str"`
}

type UserInfoUpdateRemarkData

type UserInfoUpdateRemarkData struct {
	OpenId string `json:"openid"`
	Remark string `json:"remark"`
}

type UserTag

type UserTag struct {
	Id    int64  `json:"id,omitempty"`
	Name  string `json:"name,omitempty"`
	Count int64  `json:"count,omitempty"`
}

type UserTagGetQuery

type UserTagGetQuery struct {
	TagId      int64  `url:"tagid"`
	NextOpenId string `url:"next_openid"`
}

type UserTagGetRes

type UserTagGetRes struct {
	Count int64 `json:"count"`
	Data  struct {
		OpenId []string `json:"openid"`
	} `json:"data"`
	NextOpenId string `json:"next_openid"`
}

type UserTagMembersBatchData

type UserTagMembersBatchData struct {
	OpenIdList []string `json:"openid_list"`
	TagId      int64    `json:"tagid"`
}

type UserTagMembersBatchUnTagData

type UserTagMembersBatchUnTagData struct {
	OpenIdList []string `json:"openid_list"`
	TagId      int64    `json:"tagid"`
}

type UserTagsCreateData

type UserTagsCreateData struct {
	Tag UserTag `json:"tag"`
}

type UserTagsCreateRes

type UserTagsCreateRes struct {
	MpBaseResp
	Tag UserTag `json:"tag"`
}

type UserTagsDeleteData

type UserTagsDeleteData struct {
	Tag UserTag `json:"tag"`
}

type UserTagsGetIdListData

type UserTagsGetIdListData struct {
	OpenId string `json:"openid"`
}

type UserTagsGetIdListRes

type UserTagsGetIdListRes struct {
	MpBaseResp
	TagIdList []int64 `json:"tagid_list"`
}

type UserTagsGetRes

type UserTagsGetRes struct {
	MpBaseResp
	Tags []UserTag `json:"tags"`
}

type UserTagsUpdateData

type UserTagsUpdateData struct {
	Tag UserTag `json:"tag"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL