weixin4j-mp:新增个性化菜单接口 & 其他优化

This commit is contained in:
jinyu 2015-12-23 15:46:28 +08:00
parent 3c9d4937fe
commit d497fc639a
7 changed files with 26 additions and 16 deletions

View File

@ -558,3 +558,8 @@
* 2015-12-19 * 2015-12-19
+ weixin4j-base:删除PayUtil类,接口转移到PayApi类 + weixin4j-base:删除PayUtil类,接口转移到PayApi类
* 2015-12-21
+ weixin4j-server:WeixinMessageHanlder中新增weight接口

View File

@ -48,13 +48,6 @@ weixin4j
<version>1.1.4</version> <version>1.1.4</version>
</dependency> </dependency>
以上依赖如果出现Missing artifact错误 请尝试在eclipse里这么做
+ 进入 Window > Show View > Other > Maven Repositories 展开 Global Repositories 在group或者central上右键执行`update index` 操作
+ 或者进入 Windows > Preferences > Maven 选中 `Download repository index updates on startup` 即可
###2.直接下载jar包 ###2.直接下载jar包
* [weixin4j-mp-xx-full.jar](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.foxinmy%22%20AND%20a%3A%22weixin4j-mp%22)&nbsp;[weixin4j-qy-xx-full.jar](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.foxinmy%22%20AND%20a%3A%22weixin4j-qy%22)&nbsp;[weixin4j-server-xx.jar](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.foxinmy%22%20AND%20a%3A%22weixin4j-server%22) * [weixin4j-mp-xx-full.jar](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.foxinmy%22%20AND%20a%3A%22weixin4j-mp%22)&nbsp;[weixin4j-qy-xx-full.jar](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.foxinmy%22%20AND%20a%3A%22weixin4j-qy%22)&nbsp;[weixin4j-server-xx.jar](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.foxinmy%22%20AND%20a%3A%22weixin4j-server%22)
@ -72,10 +65,18 @@ weixin4j
接下来 接下来
------ ------
* 公众号第三方服务应用 * [公众号第三方服务应用](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419318292&token=&lang=zh_CN)
* 硬件设备 & 摇一摇周边 * [微信硬件平台](http://iot.weixin.qq.com/)
* 微信小店&门店 * [微信小店](http://mp.weixin.qq.com/wiki/6/ae98ac4a7219405153cedc9dddccacca.html)
* 微信卡券 * [微信卡券](http://mp.weixin.qq.com/wiki/10/597cb57750f375a4b37e2536fd3331ea.html)
* [微信门店](http://mp.weixin.qq.com/wiki/11/081986f089826bf94393bef9bf287b8b.html)
* [微信摇一摇周边](http://mp.weixin.qq.com/wiki/19/9fe9fdbb50fee9f9660438c551142ccf.html)
* [微信连WI-FI](http://mp.weixin.qq.com/wiki/9/fd2d692e28b938a8d618f57cf9c79fb1.html)
* [微信扫一扫](http://mp.weixin.qq.com/wiki/19/e833eb10470cc25cad4719677c46ecdb.html)

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j</artifactId> <artifactId>weixin4j</artifactId>
<version>1.6.5</version> <version>1.6.6</version>
</parent> </parent>
<artifactId>weixin4j-base</artifactId> <artifactId>weixin4j-base</artifactId>
<name>weixin4j-base</name> <name>weixin4j-base</name>

View File

@ -14,7 +14,7 @@ import com.foxinmy.weixin4j.model.Token;
*/ */
public interface TokenCreator { public interface TokenCreator {
/** /**
* 返回缓存KEY的名称 * 返回缓存KEY的名称:Prefix+UniqueId的组合
* *
* @return * @return
*/ */

View File

@ -58,7 +58,7 @@ public class MenuApi extends MpApi {
private JsonResult createMenu0(String url, JSONObject data) private JsonResult createMenu0(String url, JSONObject data)
throws WeixinException { throws WeixinException {
WeixinResponse response = weixinExecutor.post( WeixinResponse response = weixinExecutor.post(
String.format(url, tokenHolder.getAccessToken()), String.format(url, "h5hb64iP9mBzt0rK6DW1OuOpE066F6iQXmHUqJ83fxTHkDaA0tNOjMMuUrWGwAves4Vi5bfwPKdp3IVhCsZCOHhsX74GXnrTtMg_oFPgiUwSXEhAIABGN"),
JSON.toJSONString(data, new NameFilter() { JSON.toJSONString(data, new NameFilter() {
@Override @Override
public String process(Object object, String name, public String process(Object object, String name,

View File

@ -10,12 +10,15 @@ package com.foxinmy.weixin4j.mp.type;
* @see * @see
*/ */
public final class URLConsts { public final class URLConsts {
public static final String BASE_URL = "https://api.weixin.qq.com/cgi-bin";
/** /**
* 公众平台获取token的url * 公众平台获取token的url
*/ */
public static final String ASSESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s"; public static final String ASSESS_TOKEN_URL = BASE_URL
+ "/token?grant_type=client_credential&appid=%s&secret=%s";
/** /**
* 公众平台jssdk获取token的url * 公众平台jssdk获取token的url
*/ */
public static final String JS_TICKET_URL = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=%s&type=jsapi"; public static final String JS_TICKET_URL = BASE_URL
+ "/ticket/getticket?access_token=%s&type=jsapi";
} }

View File

@ -47,6 +47,7 @@ public class MenuTest extends TokenTest {
"小哥介绍", "小哥介绍",
"http://mp.weixin.qq.com/s?__biz=MzI2MTA5OTM4OQ==&mid=400990970&idx=1&sn=5c7fd72e782c49f7c933b91c63eddc80#rd", "http://mp.weixin.qq.com/s?__biz=MzI2MTA5OTM4OQ==&mid=400990970&idx=1&sn=5c7fd72e782c49f7c933b91c63eddc80#rd",
ButtonType.view)); ButtonType.view));
button.pushSub(new Button("兴趣部落", "http://buluo.qq.com/p/barindex.html?from=share&bid=282651", ButtonType.view));
button.pushSub(new Button("服务流程", "FLOW", ButtonType.click)); button.pushSub(new Button("服务流程", "FLOW", ButtonType.click));
button.pushSub(new Button("在线客服", "KF", ButtonType.click)); button.pushSub(new Button("在线客服", "KF", ButtonType.click));
buttons.add(button); buttons.add(button);