Version: v0.0.0-...-8c417dc Latest Latest

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

Go to latest
Published: Jul 18, 2020 License: Apache-2.0 Imports: 4 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Button

type Button struct {
	Type       string    `json:"type,omitempty"`
	Name       string    `json:"name,omitempty"`
	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"`
	SubButtons []*Button `json:"sub_button,omitempty"`

Button 菜单按钮

func (*Button) SetClickButton

func (btn *Button) SetClickButton(name, key string)

SetClickButton btn 为click类型

func (*Button) SetLocationSelectButton

func (btn *Button) SetLocationSelectButton(name, key string)

SetLocationSelectButton 设置 弹出地理位置选择器 类型按钮

func (*Button) SetMediaIDButton

func (btn *Button) SetMediaIDButton(name, mediaID string)

SetMediaIDButton 设置 下发消息(除文本消息) 类型按钮

func (*Button) SetMiniprogramButton

func (btn *Button) SetMiniprogramButton(name, url, appID, pagePath string)

SetMiniprogramButton 设置 跳转小程序 类型按钮 (公众号后台必须已经关联小程序)

func (*Button) SetPicPhotoOrAlbumButton

func (btn *Button) SetPicPhotoOrAlbumButton(name, key string)

SetPicPhotoOrAlbumButton 设置弹出拍照或者相册发图类型按钮

func (*Button) SetPicSysPhotoButton

func (btn *Button) SetPicSysPhotoButton(name, key string)

SetPicSysPhotoButton 设置弹出系统拍照发图按钮

func (*Button) SetPicWeixinButton

func (btn *Button) SetPicWeixinButton(name, key string)

SetPicWeixinButton 设置弹出微信相册发图器类型按钮

func (*Button) SetScanCodePushButton

func (btn *Button) SetScanCodePushButton(name, key string)

SetScanCodePushButton 扫码推事件

func (*Button) SetScanCodeWaitMsgButton

func (btn *Button) SetScanCodeWaitMsgButton(name, key string)

SetScanCodeWaitMsgButton 设置 扫码推事件且弹出"消息接收中"提示框

func (*Button) SetSubButton

func (btn *Button) SetSubButton(name string, subButtons []*Button)

SetSubButton 设置二级菜单

func (*Button) SetViewButton

func (btn *Button) SetViewButton(name, url string)

SetViewButton view类型

func (*Button) SetViewLimitedButton

func (btn *Button) SetViewLimitedButton(name, mediaID string)

SetViewLimitedButton 设置 跳转图文消息URL 类型按钮

type ButtonNew

type ButtonNew struct {
	Title      string `json:"title"`
	Author     string `json:"author"`
	Digest     string `json:"digest"`
	ShowCover  int32  `json:"show_cover"`
	CoverURL   string `json:"cover_url"`
	ContentURL string `json:"content_url"`
	SourceURL  string `json:"source_url"`

ButtonNew 图文消息菜单

type MatchRule

type MatchRule struct {
	GroupID            int32  `json:"group_id,omitempty"`
	Sex                int32  `json:"sex,omitempty"`
	Country            string `json:"country,omitempty"`
	Province           string `json:"province,omitempty"`
	City               string `json:"city,omitempty"`
	ClientPlatformType int32  `json:"client_platform_type,omitempty"`
	Language           string `json:"language,omitempty"`

MatchRule 个性化菜单规则

type Menu struct {

Menu struct

func NewMenu

func NewMenu(context *context.Context) *Menu

NewMenu 实例

func (menu *Menu) AddConditional(buttons []*Button, matchRule *MatchRule) error

AddConditional 添加个性化菜单

func (menu *Menu) DeleteConditional(menuID int64) error

DeleteConditional 删除个性化菜单

func (menu *Menu) DeleteMenu() error

DeleteMenu 删除菜单

func (menu *Menu) GetCurrentSelfMenuInfo() (resSelfMenuInfo ResSelfMenuInfo, err error)

GetCurrentSelfMenuInfo 获取自定义菜单配置接口

func (menu *Menu) GetMenu() (resMenu ResMenu, err error)

GetMenu 获取菜单配置

func (menu *Menu) MenuTryMatch(userID string) (buttons []Button, err error)

MenuTryMatch 菜单匹配

func (menu *Menu) SetMenu(buttons []*Button) error

SetMenu 设置按钮

type ResMenu

type ResMenu struct {

	Menu struct {
		Button []Button `json:"button"`
		MenuID int64    `json:"menuid"`
	} `json:"menu"`
	Conditionalmenu []resConditionalMenu `json:"conditionalmenu"`

ResMenu 查询菜单的返回数据

type ResSelfMenuInfo

type ResSelfMenuInfo struct {

	IsMenuOpen   int32 `json:"is_menu_open"`
	SelfMenuInfo struct {
		Button []SelfMenuButton `json:"button"`
	} `json:"selfmenu_info"`

ResSelfMenuInfo 自定义菜单配置返回结果

type SelfMenuButton

type SelfMenuButton struct {
	Type      string `json:"type"`
	Name      string `json:"name"`
	Key       string `json:"key"`
	URL       string `json:"url,omitempty"`
	Value     string `json:"value,omitempty"`
	SubButton struct {
		List []SelfMenuButton `json:"list"`
	} `json:"sub_button,omitempty"`
	NewsInfo struct {
		List []ButtonNew `json:"list"`
	} `json:"news_info,omitempty"`

SelfMenuButton 自定义菜单配置详情

Source Files

Jump to

Keyboard shortcuts

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