Skip to content

企业号开发设置

borball edited this page Dec 12, 2015 · 4 revisions

企业号配置

  • 如果只有一对corpId和corpSecret

    可以直接在 classpath 下面增加 wx-qy-settings.xml,内容如下:

      <CorpSetting>
          <corpId>your coropId</corpId>
          <corpSecret>your corpSecret</corpSecret>
      </CorpSetting>
    

    其中corpSetting 为企业号corpId和corpSecret配置。

    以自定义菜单管理API为例:

      Menu menu = new Menu();
      ...
      int agentId = 30;
      Menus.defaultMenus().create(agentId, menu);
    
  • 如果有多个corpId和corpSecret

    使用编程的方式,同样以自定义菜单管理API为例:

      CorpSetting corpSetting = new CorpSetting('corpId', 'corpSecret');
    
      Menu menu = new Menu();
      ...
      int agentId = 30;
      Menus.with(corpSetting).create(agentId, menu);