1
0
mirror of synced 2026-10-26 10:16:15 +08:00
Files
WxJava/weixin-java-cp/README.md
2014-10-22 12:15:02 +08:00

47 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
weixin-java-cp
===========
微信企业号Java SDK开发工具集,本项目主要分为两大块:微信消息路由器、微信Java API
详细文档请看 [wiki](https://github.com/chanjarster/weixin-java-tools/wiki)
# Quickstart
在你的maven项目中添加:
```xml
<dependency>
<groupId>me.chanjar</groupId>
<artifactId>weixin-java-cp-tools</artifactId>
<version>1.0.3</version>
</dependency>
```
如果要使用``*-SNAPSHOT``版,则需要在你的``pom.xml``中添加这段:
```xml
<repositories>
<repository>
<snapshots />
<id>sonatype snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
```
## Hello World
```java
WxCpInMemoryConfigStorage config = new WxCpInMemoryConfigStorage();
config.getCorpId(...); // 设置微信企业号的appid
config.getCorpSecret(...); // 设置微信企业号的app corpSecret
config.setAgentId(...); // 设置微信企业号应用ID
config.setToken(...); // 设置微信企业号应用的token
config.setAesKey(...); // 设置微信企业号应用的EncodingAESKey
WxCpServiceImpl wxCpService = new WxCpServiceImpl();
wxCpService.setWxCpConfigStorage(config);
String userId = ...;
WxCpMessage message = WxCpMessage.TEXT().agentId(...).toUser(userId).content("Hello World").build();
wxService.messageSend(message);
```