本文整理汇总了Java中me.chanjar.weixin.common.bean.menu.WxMenuButton.setType方法的典型用法代码示例。如果您正苦于以下问题:Java WxMenuButton.setType方法的具体用法?Java WxMenuButton.setType怎么用?Java WxMenuButton.setType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类me.chanjar.weixin.common.bean.menu.WxMenuButton
的用法示例。
在下文中一共展示了WxMenuButton.setType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAddConditionalToJson
import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
@Test(dataProvider = "wxAddConditionalMenu")
public void testAddConditionalToJson(String json) {
WxMenu menu = new WxMenu();
WxMenuButton button1 = new WxMenuButton();
button1.setType("click");
button1.setName("今日歌曲");
button1.setKey("V1001_TODAY_MUSIC");
menu.getButtons().add(button1);
WxMenuRule wxMenuRule = new WxMenuRule();
wxMenuRule.setTagId("2");
wxMenuRule.setSex("1");
wxMenuRule.setCountry("中国");
wxMenuRule.setProvince("广东");
wxMenuRule.setCity("广州");
wxMenuRule.setClientPlatformType("2");
wxMenuRule.setLanguage("zh_CN");
menu.setMatchRule(wxMenuRule);
Assert.assertEquals(menu.toJson(), json);
}
示例2: convertFromJson
import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
protected WxMenuButton convertFromJson(JsonObject json) {
WxMenuButton button = new WxMenuButton();
button.setName(GsonHelper.getString(json, "name"));
button.setKey(GsonHelper.getString(json, "key"));
button.setUrl(GsonHelper.getString(json, "url"));
button.setType(GsonHelper.getString(json, "type"));
button.setMediaId(GsonHelper.getString(json, "media_id"));
return button;
}
示例3: convertFromJson
import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
protected WxMenuButton convertFromJson(JsonObject json) {
WxMenuButton button = new WxMenuButton();
button.setName(GsonHelper.getString(json, "name"));
button.setKey(GsonHelper.getString(json, "key"));
button.setUrl(GsonHelper.getString(json, "url"));
button.setType(GsonHelper.getString(json, "type"));
button.setMediaId(GsonHelper.getString(json, "media_id"));
button.setAppId(GsonHelper.getString(json, "appid"));
button.setPagePath(GsonHelper.getString(json, "pagepath"));
return button;
}
示例4: getMenu
import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
@DataProvider(name = "menu")
public Object[][] getMenu() {
WxMenu menu = new WxMenu();
WxMenuButton button1 = new WxMenuButton();
button1.setType(WxConsts.BUTTON_CLICK);
button1.setName("今日歌曲");
button1.setKey("V1001_TODAY_MUSIC");
WxMenuButton button2 = new WxMenuButton();
button2.setType(WxConsts.BUTTON_CLICK);
button2.setName("歌手简介");
button2.setKey("V1001_TODAY_SINGER");
WxMenuButton button3 = new WxMenuButton();
button3.setName("菜单");
menu.getButtons().add(button1);
menu.getButtons().add(button2);
menu.getButtons().add(button3);
WxMenuButton button31 = new WxMenuButton();
button31.setType(WxConsts.BUTTON_VIEW);
button31.setName("搜索");
button31.setUrl("http://www.soso.com/");
WxMenuButton button32 = new WxMenuButton();
button32.setType(WxConsts.BUTTON_VIEW);
button32.setName("视频");
button32.setUrl("http://v.qq.com/");
WxMenuButton button33 = new WxMenuButton();
button33.setType(WxConsts.BUTTON_CLICK);
button33.setName("赞一下我们");
button33.setKey("V1001_GOOD");
button3.getSubButtons().add(button31);
button3.getSubButtons().add(button32);
button3.getSubButtons().add(button33);
return new Object[][]{
new Object[]{
menu
}
};
}
示例5: getMenu
import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
@DataProvider(name = "menu")
public Object[][] getMenu() {
WxMenu menu = new WxMenu();
WxMenuButton button1 = new WxMenuButton();
button1.setType(WxConsts.BUTTON_CLICK);
button1.setName("今日歌曲");
button1.setKey("V1001_TODAY_MUSIC");
WxMenuButton button2 = new WxMenuButton();
button2.setType(WxConsts.BUTTON_CLICK);
button2.setName("歌手简介");
button2.setKey("V1001_TODAY_SINGER");
WxMenuButton button3 = new WxMenuButton();
button3.setName("菜单");
menu.getButtons().add(button1);
menu.getButtons().add(button2);
menu.getButtons().add(button3);
WxMenuButton button31 = new WxMenuButton();
button31.setType(WxConsts.BUTTON_VIEW);
button31.setName("搜索");
button31.setUrl("http://www.soso.com/");
WxMenuButton button32 = new WxMenuButton();
button32.setType(WxConsts.BUTTON_VIEW);
button32.setName("视频");
button32.setUrl("http://v.qq.com/");
WxMenuButton button33 = new WxMenuButton();
button33.setType(WxConsts.BUTTON_CLICK);
button33.setName("赞一下我们");
button33.setKey("V1001_GOOD");
button3.getSubButtons().add(button31);
button3.getSubButtons().add(button32);
button3.getSubButtons().add(button33);
return new Object[][]{
new Object[]{
menu
}
};
}
示例6: testToJson
import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
@Test(dataProvider = "wxPushMenu")
public void testToJson(String json) {
WxMenu menu = new WxMenu();
WxMenuButton button1 = new WxMenuButton();
button1.setType("click");
button1.setName("今日歌曲");
button1.setKey("V1001_TODAY_MUSIC");
WxMenuButton button2 = new WxMenuButton();
button2.setType("click");
button2.setName("歌手简介");
button2.setKey("V1001_TODAY_SINGER");
WxMenuButton button3 = new WxMenuButton();
button3.setName("菜单");
menu.getButtons().add(button1);
menu.getButtons().add(button2);
menu.getButtons().add(button3);
WxMenuButton button31 = new WxMenuButton();
button31.setType("view");
button31.setName("搜索");
button31.setUrl("http://www.soso.com/");
WxMenuButton button32 = new WxMenuButton();
button32.setType("view");
button32.setName("视频");
button32.setUrl("http://v.qq.com/");
WxMenuButton button33 = new WxMenuButton();
button33.setType("click");
button33.setName("赞一下我们");
button33.setKey("V1001_GOOD");
button3.getSubButtons().add(button31);
button3.getSubButtons().add(button32);
button3.getSubButtons().add(button33);
Assert.assertEquals(menu.toJson(), json);
}
示例7: menuData
import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
@DataProvider
public Object[][] menuData() {
WxMenu menu = new WxMenu();
WxMenuButton button1 = new WxMenuButton();
button1.setType(WxConsts.MenuButtonType.CLICK);
button1.setName("今日歌曲");
button1.setKey("V1001_TODAY_MUSIC");
WxMenuButton button2 = new WxMenuButton();
button2.setType(WxConsts.MenuButtonType.CLICK);
button2.setName("歌手简介");
button2.setKey("V1001_TODAY_SINGER");
WxMenuButton button3 = new WxMenuButton();
button3.setName("菜单");
menu.getButtons().add(button1);
menu.getButtons().add(button2);
menu.getButtons().add(button3);
WxMenuButton button31 = new WxMenuButton();
button31.setType(WxConsts.MenuButtonType.VIEW);
button31.setName("搜索");
button31.setUrl("http://www.soso.com/");
WxMenuButton button32 = new WxMenuButton();
button32.setType(WxConsts.MenuButtonType.VIEW);
button32.setName("视频");
button32.setUrl("http://v.qq.com/");
WxMenuButton button33 = new WxMenuButton();
button33.setType(WxConsts.MenuButtonType.CLICK);
button33.setName("赞一下我们");
button33.setKey("V1001_GOOD");
button3.getSubButtons().add(button31);
button3.getSubButtons().add(button32);
button3.getSubButtons().add(button33);
return new Object[][]{
new Object[]{
menu
}
};
}
示例8: getMenu
import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
@DataProvider(name = "menu")
public Object[][] getMenu() {
WxMenu menu = new WxMenu();
WxMenuButton button1 = new WxMenuButton();
button1.setType(WxConsts.MenuButtonType.CLICK);
button1.setName("今日歌曲");
button1.setKey("V1001_TODAY_MUSIC");
// WxMenuButton button2 = new WxMenuButton();
// button2.setType(WxConsts.MenuButtonType.MINIPROGRAM);
// button2.setName("小程序");
// button2.setAppId("wx286b93c14bbf93aa");
// button2.setPagePath("pages/lunar/index.html");
// button2.setUrl("http://mp.weixin.qq.com");
WxMenuButton button3 = new WxMenuButton();
button3.setName("菜单");
menu.getButtons().add(button1);
// menu.getButtons().add(button2);
menu.getButtons().add(button3);
WxMenuButton button31 = new WxMenuButton();
button31.setType(WxConsts.MenuButtonType.VIEW);
button31.setName("搜索");
button31.setUrl("http://www.soso.com/");
WxMenuButton button32 = new WxMenuButton();
button32.setType(WxConsts.MenuButtonType.VIEW);
button32.setName("视频");
button32.setUrl("http://v.qq.com/");
WxMenuButton button33 = new WxMenuButton();
button33.setType(WxConsts.MenuButtonType.CLICK);
button33.setName("赞一下我们");
button33.setKey("V1001_GOOD");
button3.getSubButtons().add(button31);
button3.getSubButtons().add(button32);
button3.getSubButtons().add(button33);
return new Object[][]{
new Object[]{
menu
}
};
}
示例9: getMenu
import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
@DataProvider(name="menu")
public Object[][] getMenu() {
WxMenu menu = new WxMenu();
WxMenuButton button1 = new WxMenuButton();
button1.setType(WxConsts.BUTTON_CLICK);
button1.setName("今日歌曲");
button1.setKey("V1001_TODAY_MUSIC");
WxMenuButton button2 = new WxMenuButton();
button2.setType(WxConsts.BUTTON_CLICK);
button2.setName("歌手简介");
button2.setKey("V1001_TODAY_SINGER");
WxMenuButton button3 = new WxMenuButton();
button3.setName("菜单");
menu.getButtons().add(button1);
menu.getButtons().add(button2);
menu.getButtons().add(button3);
WxMenuButton button31 = new WxMenuButton();
button31.setType(WxConsts.BUTTON_VIEW);
button31.setName("搜索");
button31.setUrl("http://www.soso.com/");
WxMenuButton button32 = new WxMenuButton();
button32.setType(WxConsts.BUTTON_VIEW);
button32.setName("视频");
button32.setUrl("http://v.qq.com/");
WxMenuButton button33 = new WxMenuButton();
button33.setType(WxConsts.BUTTON_CLICK);
button33.setName("赞一下我们");
button33.setKey("V1001_GOOD");
button3.getSubButtons().add(button31);
button3.getSubButtons().add(button32);
button3.getSubButtons().add(button33);
return new Object[][] {
new Object[] {
menu
}
};
}