Exemplo n.º 1
0
func createMenu(wx *weixin.Weixin) {
	deleteMenu(wx)
	menu := &weixin.Menu{make([]weixin.MenuButton, 2)}
	menu.Buttons[0].Name = "我的简历"
	menu.Buttons[0].SubButtons = make([]weixin.MenuButton, 4)
	menu.Buttons[0].SubButtons[0].Name = "XX公司?"
	menu.Buttons[0].SubButtons[0].Type = weixin.MenuButtonTypeKey
	menu.Buttons[0].SubButtons[0].Key = menu_keys[0]
	menu.Buttons[0].SubButtons[1].Name = "CALIX"
	menu.Buttons[0].SubButtons[1].Type = weixin.MenuButtonTypeKey
	menu.Buttons[0].SubButtons[1].Key = menu_keys[1]
	menu.Buttons[0].SubButtons[2].Name = "MOTOROLA/NSN"
	menu.Buttons[0].SubButtons[2].Type = weixin.MenuButtonTypeKey
	menu.Buttons[0].SubButtons[2].Key = menu_keys[2]
	menu.Buttons[0].SubButtons[3].Name = "ZTE"
	menu.Buttons[0].SubButtons[3].Type = weixin.MenuButtonTypeKey
	menu.Buttons[0].SubButtons[3].Key = menu_keys[3]
	menu.Buttons[1].Name = "关于"
	menu.Buttons[1].SubButtons = make([]weixin.MenuButton, 2)
	menu.Buttons[1].SubButtons[0].Name = "更多"
	menu.Buttons[1].SubButtons[0].Type = weixin.MenuButtonTypeKey
	menu.Buttons[1].SubButtons[0].Key = "MENU_KEY_MORE"
	menu.Buttons[1].SubButtons[1].Name = "联系方式"
	menu.Buttons[1].SubButtons[1].Type = weixin.MenuButtonTypeKey
	menu.Buttons[1].SubButtons[1].Key = "MENU_KEY_CONTACT"
	err := wx.CreateMenu(menu)
	if err != nil {
		log.Print(err)
	}
}
Exemplo n.º 2
0
func deleteMenu(wx *weixin.Weixin) {
	err := wx.DeleteMenu()
	if err != nil {
		log.Print(err)
	}
}