1 Star 0 Fork 191

HuntFalcon / hm-tools-wxmp-adapter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
IMenuApiTest.java 2.23 KB
一键复制 编辑 原始数据 按行查看 历史
JHybo 提交于 2020-05-31 11:22 . 测试删除自定义菜单接口 ok
package top.hmtools.wxmp.menu.apis;
import org.junit.Test;
import com.alibaba.fastjson.JSON;
import top.hmtools.wxmp.core.model.ErrcodeBean;
import top.hmtools.wxmp.menu.BaseTest;
import top.hmtools.wxmp.menu.models.simple.Button;
import top.hmtools.wxmp.menu.models.simple.CurrentSelfMenuInfoBean;
import top.hmtools.wxmp.menu.models.simple.MenuBean;
import top.hmtools.wxmp.menu.models.simple.MenuWapperBean;
public class IMenuApiTest extends BaseTest{
private IMenuApi menuApi ;
/**
* 测试创建自定义菜单
*/
@Test
public void testcreateMenu(){
String baseUrl = "hm.hn.cn";
//底部第一个主按钮
Button bbGuanwang = new Button();
bbGuanwang.setName("官网").setType("view").setUrl("http://m.hybo.net/main/index/index.html");
Button bbDongTai = new Button();
bbDongTai.setName("动态").setType("view").setUrl("http://"+baseUrl+"/main/news/index.html");
Button bbVideo = new Button();
bbVideo.setName("视频").setType("view").setUrl("http://"+baseUrl+"/main/news/video.html");
Button buttonBeanIndex = new Button();
buttonBeanIndex.setName("哈哈");
buttonBeanIndex.addSubButton(bbGuanwang,bbDongTai,bbVideo);
MenuBean menuBean = new MenuBean();
menuBean.addButton(buttonBeanIndex);
ErrcodeBean createMenu = this.menuApi.createMenu(menuBean);
this.printFormatedJson("测试 创建自定义菜单",createMenu);
}
/**
* 测试查询自定义菜单接口
*/
@Test
public void testGetMenu() {
MenuWapperBean menu = menuApi.getMenu();
this.printFormatedJson("测试 查询自定义菜单",menu);
}
/**
* 测试删除自定义菜单接口
*/
@Test
public void testdeleteAllMenu(){
ErrcodeBean deleteAllMenu = this.menuApi.deleteAllMenu();
this.printFormatedJson("测试删除自定义菜单接口",deleteAllMenu);
}
@Test
public void testgetCurrentSelfMenuInfoUri(){
CurrentSelfMenuInfoBean currentSelfMenuInfoUri = this.menuApi.getCurrentSelfMenuInfo();
System.out.println(JSON.toJSONString(currentSelfMenuInfoUri));
}
@Override
public void initSub() {
this.menuApi = this.wxmpSession.getMapper(IMenuApi.class);
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/HuntFalcon/hm-tools-wxmp-adapter.git
git@gitee.com:HuntFalcon/hm-tools-wxmp-adapter.git
HuntFalcon
hm-tools-wxmp-adapter
hm-tools-wxmp-adapter
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891