menu

package
v2.1.4-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: Apache-2.0 Imports: 4 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 NewClickButton added in v2.0.5

func NewClickButton(name, key string) *Button

NewClickButton btn 为click类型

func NewLocationSelectButton added in v2.0.5

func NewLocationSelectButton(name, key string) *Button

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

func NewMediaIDButton added in v2.0.5

func NewMediaIDButton(name, mediaID string) *Button

NewMediaIDButton 下发消息(除文本消息) 类型按钮

func NewMiniprogramButton added in v2.0.5

func NewMiniprogramButton(name, url, appID, pagePath string) *Button

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

func NewPicPhotoOrAlbumButton added in v2.0.5

func NewPicPhotoOrAlbumButton(name, key string) *Button

NewPicPhotoOrAlbumButton 弹出拍照或者相册发图类型按钮

func NewPicSysPhotoButton added in v2.0.5

func NewPicSysPhotoButton(name, key string) *Button

NewPicSysPhotoButton 弹出系统拍照发图按钮

func NewPicWeixinButton added in v2.0.5

func NewPicWeixinButton(name, key string) *Button

NewPicWeixinButton 弹出微信相册发图器类型按钮

func NewScanCodePushButton added in v2.0.5

func NewScanCodePushButton(name, key string) *Button

NewScanCodePushButton 扫码推事件

func NewScanCodeWaitMsgButton added in v2.0.5

func NewScanCodeWaitMsgButton(name, key string) *Button

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

func NewSubButton added in v2.0.5

func NewSubButton(name string, subButtons []*Button) *Button

NewSubButton 二级菜单

func NewViewButton added in v2.0.5

func NewViewButton(name, url string) *Button

NewViewButton view类型

func NewViewLimitedButton added in v2.0.5

func NewViewLimitedButton(name, mediaID string) *Button

NewViewLimitedButton 跳转图文消息URL 类型按钮

func (*Button) SetClickButton

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

SetClickButton btn 为click类型

func (*Button) SetLocationSelectButton

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

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

func (*Button) SetMediaIDButton

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

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

func (*Button) SetMiniprogramButton

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

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

func (*Button) SetPicPhotoOrAlbumButton

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

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

func (*Button) SetPicSysPhotoButton

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

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

func (*Button) SetPicWeixinButton

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

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

func (*Button) SetScanCodePushButton

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

SetScanCodePushButton 扫码推事件

func (*Button) SetScanCodeWaitMsgButton

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

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

func (*Button) SetSubButton

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

SetSubButton 设置二级菜单

func (*Button) SetViewButton

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

SetViewButton view类型

func (*Button) SetViewLimitedButton

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

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            string `json:"group_id,omitempty"`
	Sex                string `json:"sex,omitempty"`
	Country            string `json:"country,omitempty"`
	Province           string `json:"province,omitempty"`
	City               string `json:"city,omitempty"`
	ClientPlatformType string `json:"client_platform_type,omitempty"`
	Language           string `json:"language,omitempty"`
}

MatchRule 个性化菜单规则

type Menu struct {
	*context.Context
}

Menu struct

func NewMenu

func NewMenu(context *context.Context) *Menu

NewMenu 实例

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

AddConditional 添加个性化菜单

func (menu *Menu) AddConditionalByJSON(jsonInfo string) error

AddConditionalByJSON 添加个性化菜单

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 设置按钮

func (menu *Menu) SetMenuByJSON(jsonInfo string) error

SetMenuByJSON 设置按钮

type ResMenu

type ResMenu struct {
	util.CommonError

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

ResMenu 查询菜单的返回数据

type ResSelfMenuInfo

type ResSelfMenuInfo struct {
	util.CommonError

	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 自定义菜单配置详情

Jump to

Keyboard shortcuts

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