码迷,mamicode.com
首页 > 微信 > 详细

微信自定义菜单

时间:2017-03-22 00:48:07      阅读:245      评论:0      收藏:0      [点我收藏+]

标签:推荐   menu   定义   token   warnings   http   class   str   微信自定义菜单   

微信自定义菜单

String accessToken = (String) obj1;
        String url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token="+accessToken;
        Map<String, Object> request = new HashMap<String, Object>();
        
        List<Map<String, Object>> buttonList= new ArrayList<Map<String,Object>>();
        Map<String, Object> jichangyouhui = new HashMap<String, Object>();
        jichangyouhui.put("name", "优惠");
        List<Map<String, String>> subButtonList01 = new ArrayList<Map<String,String>>();
        Map<String, String> youhuixinxi = new HashMap<String, String>();
        youhuixinxi.put("type", "view");
        youhuixinxi.put("name", "优惠 ");
        youhuixinxi.put("url", "http://weix ");
        subButtonList01.add(youhuixinxi);
        Map<String, String> danpintuijian = new HashMap<String, String>();
        danpintuijian.put("type", "view");
        danpintuijian.put("name", " 推荐");
        danpintuijian.put("url", "http://weixin ");
        subButtonList01.add(danpintuijian);
        jichangyouhui.put("sub_button", subButtonList01);
        buttonList.add(jichangyouhui); 

request.put("button", buttonList); @SuppressWarnings("unchecked") Map<String,String> postMap = template.postForObject(url, request, Map.class);

 

微信自定义菜单

标签:推荐   menu   定义   token   warnings   http   class   str   微信自定义菜单   

原文地址:http://www.cnblogs.com/stono/p/6597518.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!