Skip to content

Latest commit

 

History

History
79 lines (66 loc) · 1.41 KB

menu.md

File metadata and controls

79 lines (66 loc) · 1.41 KB

菜单管理

获取菜单操作实例

oa := wc.GetOfficialAccount(cfg)
m:=oa.GetMenu()

获取当前菜单设置

GetMenu() (resMenu ResMenu, err error)

其中ResMenu结果为:

//ResMenu 查询菜单的返回数据
type ResMenu struct {
	util.CommonError

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

添加菜单(struct方式)

SetMenu(buttons []*Button) error

添加菜单(JSON方式)

直接传入json

SetMenuByJSON(jsonInfo string) error

删除菜单

DeleteMenu() error

添加个性化菜单(struct方式)

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

添加个性化菜单(JSON方式)

直接传入json

AddConditionalByJSON(jsonInfo string) error

测试个性化菜单匹配结果

MenuTryMatch(userID string) (buttons []Button, err error)

删除个性化菜单

DeleteConditional(menuID int64) error

获取自定义菜单配置接口

GetCurrentSelfMenuInfo() (resSelfMenuInfo ResSelfMenuInfo, err error)

其中ResSelfMenuInfo结果为:

type ResSelfMenuInfo struct {
	util.CommonError

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