菜单管理 - 微信SDK开发文档
获取菜单操作实例
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"`
}