• 大小: 26KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-07-21
  • 语言: Java
  • 标签:

资源简介

java实现扫一扫的类

资源截图

代码片段和文件信息

package com.wpro.platform.saoyisao.main;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.wpro.platform.saoyisao.menu.Button;
import com.wpro.platform.saoyisao.menu.CommonButton;
import com.wpro.platform.saoyisao.menu.ComplexButton;
import com.wpro.platform.saoyisao.menu.Menu;
import com.wpro.platform.saoyisao.pojo.AccessToken;
import com.wpro.platform.saoyisao.util.WeixinUtil;


/**
 * 菜单管理器类
 * @author Administrator
 *
 */
public class MenuManager {

/**
 * 因为公众号没有自定义菜单的权限,所以是不能成功的
 */
private static Logger log = LoggerFactory.getLogger(MenuManager.class);

public static void main(String[] args) {
//第三方用户唯一凭证
String appId = “wx374680a50bb40517“;
String appSecret = “eef1ecfef730000bae316ca6e9fd999a“;

//调用解耦库获取access_token
AccessToken at = WeixinUtil.getAccessToken(appId appSecret);

if(null != at){
//调用接口创建菜单
int result = WeixinUtil.createMenu(getMenu() at.getToken());

//判断菜单创建结果
if(0 == result){
//log.info(“菜单创建成功!“);
System.out.println(“菜单创建成功!“);
}else{
//log.info(“菜单创建失败,错误码:“ + result);
System.out.println(“菜单创建失败,错误码:“ + result);
}
}
}

/**
     * 组装菜单数据
     * 
     * @return
     */
    private static Menu getMenu() {
        CommonButton btn11 = new CommonButton();
        btn11.setName(“天气预报“);
        btn11.setType(“click“);
        btn11.setKey(“11“);

        CommonButton btn12 = new CommonButton();
        btn12.setName(“公交查询“);
        btn12.setType(“click“);
        btn12.setKey(“12“);

        CommonButton btn13 = new CommonButton();
        btn13.setName(“周边搜索“);
        btn13.setType(“click“);
        btn13.setKey(“13“);

        CommonButton btn14 = new CommonButton();
        btn14.setName(“历史上的今天“);
        btn14.setType(“click“);
        btn14.setKey(“14“);

        CommonButton btn21 = new CommonButton();
        btn21.setName(“歌曲点播“);
        btn21.setType(“click“);
        btn21.setKey(“21“);

        CommonButton btn22 = new CommonButton();
        btn22.setName(“经典游戏“);
        btn22.setType(“click“);
        btn22.setKey(“22“);

        CommonButton btn23 = new CommonButton();
        btn23.setName(“美女电台“);
        btn23.setType(“click“);
        btn23.setKey(“23“);

        CommonButton btn24 = new CommonButton();
        btn24.setName(“人脸识别“);
        btn24.setType(“click“);
        btn24.setKey(“24“);

        CommonButton btn25 = new CommonButton();
        btn25.setName(“聊天唠嗑“);
        btn25.setType(“click“);
        btn25.setKey(“25“);

        CommonButton btn31 = new CommonButton();
        btn31.setName(“Q友圈“);
        btn31.setType(“click“);
        btn31.setKey(“31“);

        CommonButton btn32 = new CommonButton();
        btn32.setName(“电影排行榜“);
        btn32.setType(“click“);
        btn32.setKey(“32“);

        CommonButton btn33 = new CommonButton();
  

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       4412  2016-12-26 09:26  saoyisao\main\MenuManager.java

     文件        345  2016-12-26 09:26  saoyisao\menu\Button.java

     文件        525  2016-12-26 09:26  saoyisao\menu\CommonButton.java

     文件        482  2016-12-26 09:26  saoyisao\menu\ComplexButton.java

     文件        299  2016-12-26 09:26  saoyisao\menu\Menu.java

     文件       1079  2016-12-26 09:26  saoyisao\message\event\baseEvent.java

     文件        727  2016-12-26 09:26  saoyisao\message\event\LocationEvent.java

     文件        387  2016-12-26 09:26  saoyisao\message\event\MenuEvent.java

     文件        527  2016-12-26 09:26  saoyisao\message\event\QRCodeEvent.java

     文件        175  2016-12-26 09:26  saoyisao\message\event\SubscribeEvent.java

     文件       1128  2016-12-26 09:26  saoyisao\message\req\baseMessage.java

     文件        523  2016-12-26 09:26  saoyisao\message\req\ImageMessage.java

     文件        652  2016-12-26 09:26  saoyisao\message\req\linkMessage.java

     文件        880  2016-12-26 09:26  saoyisao\message\req\LocationMessage.java

     文件        339  2016-12-26 09:26  saoyisao\message\req\TextMessage.java

     文件        534  2016-12-26 09:26  saoyisao\message\req\VideoMessage.java

     文件        495  2016-12-26 09:26  saoyisao\message\req\VoiceMessage.java

     文件        902  2016-12-26 09:26  saoyisao\message\resp\Article.java

     文件       1069  2016-12-26 09:26  saoyisao\message\resp\baseMessage.java

     文件        302  2016-12-26 09:26  saoyisao\message\resp\Image.java

     文件        285  2016-12-26 09:26  saoyisao\message\resp\ImageMessage.java

     文件       1166  2016-12-26 09:26  saoyisao\message\resp\Music.java

     文件        282  2016-12-26 09:26  saoyisao\message\resp\MusicMessage.java

     文件        523  2016-12-26 09:26  saoyisao\message\resp\NewsMessage.java

     文件        298  2016-12-26 09:26  saoyisao\message\resp\TextMessage.java

     文件        455  2016-12-26 09:26  saoyisao\message\resp\Video.java

     文件        283  2016-12-26 09:26  saoyisao\message\resp\VideoMessage.java

     文件        272  2016-12-26 09:26  saoyisao\message\resp\Voice.java

     文件        282  2016-12-26 09:26  saoyisao\message\resp\VoiceMessage.java

     文件        427  2016-12-26 09:26  saoyisao\pojo\AccessToken.java

............此处省略27个文件信息

评论

共有 条评论

相关资源