gzh

package
v0.0.0-...-62bdd2e Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenModel

type AccessTokenModel struct {
	//获取到的凭证
	AccessToken string `json:"access_token"`
	//凭证有效时间,单位:秒
	ExpiresIN time.Duration `json:"expires_in"`
}

---------------------------------------------------基础支持--------------------------------------------------------

AccessToken公众号的全局唯一接口调用凭据

type GzhApi

type GzhApi struct {
	//appid 从公众号开发者中心获取
	AppID string `json:"appid"`
	//secret 从公众号开发者中心获取
	Secret string `json:"secret"`
}

公众号对象

func (*GzhApi) AddTemplate

func (this *GzhApi) AddTemplate(_template_id_short string) (interface{}, error)

*

  • @Description: 获得模板ID
  • @receiver this
  • @param _template_id_short 模板库中模板的编号,有“TM**”和“OPENTMTM**”等形式
  • @return interface{}
  • @return error

func (*GzhApi) CodeAccessToken

func (this *GzhApi) CodeAccessToken(_code, _grant_type string) (interface{}, error)

*

  • @Description: 通过code换取网页授权access_token
  • @receiver this

func (*GzhApi) DelPrivateTemplate

func (this *GzhApi) DelPrivateTemplate(_template_id string) (interface{}, error)

*

  • @Description:删除模板
  • @receiver this
  • @param _template_id 模板id
  • @return interface{}
  • @return error

func (*GzhApi) GetAllPrivateTemplate

func (this *GzhApi) GetAllPrivateTemplate() (interface{}, error)

*

  • @Description: 获取模板列表
  • @receiver this
  • @param _template_id_short
  • @return interface{}
  • @return error

func (*GzhApi) GetApiDomainIP

func (this *GzhApi) GetApiDomainIP() (interface{}, error)

*

  • @Description: 获取微信API接口 IP地址
  • @receiver this

func (*GzhApi) GetCallBackIP

func (this *GzhApi) GetCallBackIP() (interface{}, error)

*

  • @Description: 获取微信callback IP地址
  • @receiver this

func (*GzhApi) GetIndustry

func (this *GzhApi) GetIndustry() (interface{}, error)

*

  • @Description:获取设置的行业信息
  • @receiver this

func (*GzhApi) SendTemplate

func (this *GzhApi) SendTemplate(_data interface{}) (interface{}, error)

*

  • @Description:发送模板消息
  • @receiver this
  • @param _map 模板消息内容
  • @return interface{}
  • @return error

func (*GzhApi) SetIndustry

func (this *GzhApi) SetIndustry() (interface{}, error)

---------------------------------------模板消息---------------------------------------------------------- *

  • @Description:设置所属行业(小心使用,一旦使用该接口线上模板会被自动清空)
  • @receiver this

type MsgBase

type MsgBase struct {
	//开发者微信号
	ToUserName string `xml:"ToUserName" json:"ToUserName"`
	//发送方帐号(一个OpenID)
	FromUserName string `xml:"FromUserName" json:"FromUserName"`
	//消息创建时间 (整型)
	CreateTime string `xml:"CreateTime" json:"CreateTime"`
	//消息类型,文本为text,消息类型,图片为image,语音为voice,视频为video,小视频为shortvideo,地理位置为location,链接为link,事件event,扫描 SCAN,上报地理位置 LOCATION
	MsgType string `xml:"MsgType" json:"MsgType"`
}

---------------------------------------------------普通消息-------------------------------------------------------- *

  • @Description: 消息对象基础类

type MsgCustomMenu

type MsgCustomMenu struct {
	MsgBase
	//事件类型,CLICK
	Event string `xml:"Event" json:"Event"`
	//事件KEY值,与自定义菜单接口中KEY值对应
	EventKey string `xml:"EventKey" json:"EventKey"`
}

*

  • @Description:自定义菜单事件
type MsgLink struct {
	MsgPT
	//消息标题
	Title string `xml:"Title" json:"Title"`
	//消息描述
	Description string `xml:"Description" json:"Description"`
	//消息链接
	Url string `xml:"Url" json:"Url"`
}

*

  • @Description: 消息对象-链接消息

type MsgLocation

type MsgLocation struct {
	MsgPT
	//地理位置纬度
	LocationX string `xml:"Location_X" json:"Location_X"`
	//地理位置经度
	LocationY string `xml:"Location_Y" json:"Location_Y"`
	//地图缩放大小
	Scale string `xml:"Scale" json:"Scale"`
	//地理位置信息
	Label string `xml:"Label" json:"Label"`
}

*

  • @Description: 消息对象-地理位置消息

type MsgMedia

type MsgMedia struct {
	MsgPT
	//语音消息媒体id,可以调用获取临时素材接口拉取数据。
	MediaId string `xml:"MediaId" json:"MediaId"`
	//语音格式,如amr,speex等
	Format string `xml:"Format" json:"Format"`
	//语音识别结果,UTF8编码
	Recognition string `xml:"Recognition" json:"Recognition"`
}

*

  • @Description: 消息对象-语音消息

type MsgPT

type MsgPT struct {
	MsgBase
	//消息id,64位整型
	MsgID string `xml:"MsgId" json:"MsgId"`
}

*

  • @Description: 消息对象普通消息基础类

type MsgPic

type MsgPic struct {
	MsgPT
	//
	PicUrl string `xml:"PicUrl" json:"PicUrl"`
	//图片消息媒体id,可以调用获取临时素材接口拉取数据。
	MediaId string `xml:"MediaId" json:"MediaId"`
}

*

  • @Description: 消息对象-图片消息

type MsgPostLocation

type MsgPostLocation struct {
	MsgBase
	//事件类型,LOCATION
	Event string `xml:"Event" json:"Event"`
	//地理位置纬度
	Latitude string `xml:"Latitude" json:"Latitude"`
	//地理位置经度
	Longitude string `xml:"Longitude" json:"Longitude"`
	//地理位置精度
	Precision string `xml:"Precision" json:"Precision"`
}

*

  • @Description:上报地理位置信息

type MsgScan

type MsgScan struct {
	MsgBase
	//事件类型,subscribe
	Event string `xml:"Event" json:"Event"`
	//事件KEY值,qrscene_为前缀,后面为二维码的参数值
	EventKey string `xml:"EventKey" json:"EventKey"`
	//二维码的ticket,可用来换取二维码图片
	Ticket string `xml:"Ticket" json:"Ticket"`
}

*

  • @Description:扫描带参数二维码事件

type MsgShortVideo

type MsgShortVideo struct {
	MsgPT
	//视频消息媒体id,可以调用获取临时素材接口拉取数据。
	MediaId string `xml:"MediaId" json:"MediaId"`
	//视频消息缩略图的媒体id,可以调用获取临时素材接口拉取数据。
	ThumbMediaId string `xml:"ThumbMediaId" json:"ThumbMediaId"`
}

*

  • @Description: 消息对象-小视频消息

type MsgSubscribeOrUnsubscribe

type MsgSubscribeOrUnsubscribe struct {
	MsgBase
	//事件类型,subscribe(订阅)、unsubscribe(取消订阅)
	Event string `xml:"Event" json:"Event"`
}

---------------------------------------------------事件消息-------------------------------------------------------- *

  • @Description:取消关注事件

type MsgSubscribed

type MsgSubscribed struct {
	MsgBase
	//事件类型,SCAN
	Event string `xml:"Event" json:"Event"`
	//事件KEY值,是一个32位无符号整数,即创建二维码时的二维码scene_id
	EventKey string `xml:"EventKey" json:"EventKey"`
	//二维码的ticket,可用来换取二维码图片
	Ticket string `xml:"Ticket" json:"Ticket"`
}

*

  • @Description:用户已关注时的事件推送

type MsgText

type MsgText struct {
	MsgPT
	//文本消息内容
	Content string `xml:"Content" json:"Content"`
}

*

  • @Description: 消息对象-文本消息

type MsgVideo

type MsgVideo struct {
	MsgPT
	//视频消息媒体id,可以调用获取临时素材接口拉取数据。
	MediaId string `xml:"MediaId" json:"MediaId"`
	//视频消息缩略图的媒体id,可以调用多媒体文件下载接口拉取数据。
	ThumbMediaId string `xml:"ThumbMediaId" json:"ThumbMediaId"`
}

*

  • @Description: 消息对象-视频消息

type ReplyMsgArticles

type ReplyMsgArticles struct {
	MsgBase
	//图文消息个数;当用户发送文本、图片、语音、视频、图文、地理位置这六种消息时,开发者只能回复1条图文消息;其余场景最多可回复8条图文消息
	ArticleCount string `xml:"ArticleCount" json:"ArticleCount"`
	//图文消息信息,注意,如果图文数超过限制,则将只发限制内的条数
	Articles []struct {
		Item struct {
			//图文消息标题
			Title string `xml:"Title" json:"Title"`
			//图文消息描述
			Description string `xml:"MediaId" json:"Description"`
			//图片链接,支持JPG、PNG格式,较好的效果为大图360*200,小图200*200
			PicUrl string `xml:"PicUrl" json:"PicUrl"`
			//点击图文消息跳转链接
			Url string `xml:"Url" json:"Url"`
		} `xml:"item" json:"item"`
	} `xml:"Articles" json:"Articles"`
}

*

  • @Description:回复图文消息

type ReplyMsgMedia

type ReplyMsgMedia struct {
	MsgBase
	//回复的语音消息内容
	Voice struct {
		//通过素材管理中的接口上传多媒体文件,得到的id
		MediaId string `xml:"MediaId" json:"MediaId"`
	} `xml:"Voice" json:"Voice"`
}

*

  • @Description:回复语音消息

type ReplyMsgMusic

type ReplyMsgMusic struct {
	MsgBase
	//回复的音乐消息内容
	Music struct {
		//音乐标题
		Title string `xml:"Title" json:"Title"`
		//音乐描述
		Description string `xml:"MediaId" json:"Description"`
		//音乐链接
		MusicUrl string `xml:"MusicUrl" json:"MusicUrl"`
		//高质量音乐链接,WIFI环境优先使用该链接播放音乐
		HQMusicUrl string `xml:"MediaId" json:"HQMusicUrl"`
		//缩略图的媒体id,通过素材管理中的接口上传多媒体文件,得到的id
		ThumbMediaId string `xml:"MediaId" json:"ThumbMediaId"`
	} `xml:"Music" json:"Music"`
}

*

  • @Description:回复音乐消息

type ReplyMsgPic

type ReplyMsgPic struct {
	MsgBase
	//回复的图片消息内容
	Image struct {
		//通过素材管理中的接口上传多媒体文件,得到的id
		MediaId string `xml:"MediaId" json:"MediaId"`
	} `xml:"Image" json:"Image"`
}

*

  • @Description:回复图片消息

type ReplyMsgText

type ReplyMsgText struct {
	MsgBase
	//回复的消息内容(换行:在content中能够换行,微信客户端就支持换行显示)
	Content string `xml:"Content" json:"Content"`
}

---------------------------------------------------被动回复用户消息-------------------------------------------------------- *

  • @Description:回复文本消息

type ReplyMsgVideo

type ReplyMsgVideo struct {
	MsgBase
	//回复的视频消息内容
	Video struct {
		//通过素材管理中的接口上传多媒体文件,得到的id
		MediaId string `xml:"MediaId" json:"MediaId"`
		//视频消息的标题
		Title string `xml:"Title" json:"Title"`
		//视频消息的描述
		Description string `xml:"MediaId" json:"Description"`
	} `xml:"Video" json:"Video"`
}

*

  • @Description:回复视频消息

Jump to

Keyboard shortcuts

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