fixed #88
This commit is contained in:
parent
0356484f44
commit
a443c29d23
@ -73,7 +73,7 @@ public class WeixinComponentProxy {
|
|||||||
CacheStorager<Token> cacheStorager) {
|
CacheStorager<Token> cacheStorager) {
|
||||||
if (weixinMpAccount == null) {
|
if (weixinMpAccount == null) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"weixinPayAccount must not be empty");
|
"weixinMpAccount must not be empty");
|
||||||
}
|
}
|
||||||
if (cacheStorager == null) {
|
if (cacheStorager == null) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
|
|||||||
@ -213,7 +213,7 @@ public class WeixinProxy {
|
|||||||
private WeixinProxy(WeixinAccount weixinAccount, TokenCreator tokenCreator,
|
private WeixinProxy(WeixinAccount weixinAccount, TokenCreator tokenCreator,
|
||||||
CacheStorager<Token> cacheStorager) {
|
CacheStorager<Token> cacheStorager) {
|
||||||
if (weixinAccount == null) {
|
if (weixinAccount == null) {
|
||||||
throw new IllegalArgumentException("settings must not be empty");
|
throw new IllegalArgumentException("weixinAccount must not be empty");
|
||||||
}
|
}
|
||||||
if (tokenCreator == null) {
|
if (tokenCreator == null) {
|
||||||
throw new IllegalArgumentException("tokenCreator must not be empty");
|
throw new IllegalArgumentException("tokenCreator must not be empty");
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import java.util.List;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.fastjson.JSONPath;
|
|
||||||
import com.alibaba.fastjson.TypeReference;
|
import com.alibaba.fastjson.TypeReference;
|
||||||
import com.alibaba.fastjson.parser.deserializer.ExtraProcessor;
|
import com.alibaba.fastjson.parser.deserializer.ExtraProcessor;
|
||||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||||
@ -127,8 +126,10 @@ public class HelperApi extends MpApi {
|
|||||||
for (int i = 0; i < buttons.size(); i++) {
|
for (int i = 0; i < buttons.size(); i++) {
|
||||||
buttonObj = buttons.getJSONObject(i);
|
buttonObj = buttons.getJSONObject(i);
|
||||||
if (buttonObj.containsKey("sub_button")) {
|
if (buttonObj.containsKey("sub_button")) {
|
||||||
JSONPath.set(buttonObj, "$.sub_button", buttonObj
|
buttonObj.put(
|
||||||
.getJSONObject("sub_button").getJSONArray("list"));
|
"sub_button",
|
||||||
|
buttonObj.getJSONObject("sub_button").getJSONArray(
|
||||||
|
"list"));
|
||||||
buttonObj.put("type", ButtonType.popups);
|
buttonObj.put("type", ButtonType.popups);
|
||||||
}
|
}
|
||||||
buttonList.add(JSON.parseObject(buttonObj.toJSONString(),
|
buttonList.add(JSON.parseObject(buttonObj.toJSONString(),
|
||||||
@ -160,9 +161,9 @@ public class HelperApi extends MpApi {
|
|||||||
article.remove("source_url"));
|
article.remove("source_url"));
|
||||||
newsList.add(JSON.toJavaObject(article, MpArticle.class));
|
newsList.add(JSON.toJavaObject(article, MpArticle.class));
|
||||||
}
|
}
|
||||||
JSONPath.set(object, "$.extar", newsList);
|
((Button) object).setExtra(newsList);
|
||||||
} else {
|
} else {
|
||||||
JSONPath.set(object, "$.content", value);
|
((Button) object).setContent(String.valueOf(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import java.util.List;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.fastjson.JSONPath;
|
|
||||||
import com.alibaba.fastjson.parser.deserializer.ExtraProcessor;
|
import com.alibaba.fastjson.parser.deserializer.ExtraProcessor;
|
||||||
import com.alibaba.fastjson.parser.deserializer.ParseProcess;
|
import com.alibaba.fastjson.parser.deserializer.ParseProcess;
|
||||||
import com.alibaba.fastjson.serializer.NameFilter;
|
import com.alibaba.fastjson.serializer.NameFilter;
|
||||||
@ -229,7 +228,7 @@ public class MenuApi extends MpApi {
|
|||||||
private final ParseProcess buttonProcess = new ExtraProcessor() {
|
private final ParseProcess buttonProcess = new ExtraProcessor() {
|
||||||
@Override
|
@Override
|
||||||
public void processExtra(Object object, String key, Object value) {
|
public void processExtra(Object object, String key, Object value) {
|
||||||
JSONPath.set(object, "$.content", value);
|
((Button) object).setContent(String.valueOf(value));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package com.foxinmy.weixin4j.mp.oldpayment;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.fastjson.JSONPath;
|
|
||||||
import com.foxinmy.weixin4j.sign.AbstractWeixinSignature;
|
import com.foxinmy.weixin4j.sign.AbstractWeixinSignature;
|
||||||
import com.foxinmy.weixin4j.type.SignType;
|
import com.foxinmy.weixin4j.type.SignType;
|
||||||
import com.foxinmy.weixin4j.util.DigestUtil;
|
import com.foxinmy.weixin4j.util.DigestUtil;
|
||||||
@ -41,11 +40,11 @@ public class WeixinOldPaymentSignature extends AbstractWeixinSignature {
|
|||||||
@Override
|
@Override
|
||||||
public String sign(Object obj) {
|
public String sign(Object obj) {
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
obj = JSON.parse((String) obj);
|
obj = JSON.parse(String.valueOf(obj));
|
||||||
} else {
|
} else {
|
||||||
obj = ((JSONObject) JSON.toJSON(obj));
|
obj = ((JSONObject) JSON.toJSON(obj));
|
||||||
}
|
}
|
||||||
JSONPath.set(obj, "appKey", paySignKey);
|
((JSONObject) obj).put("appKey", paySignKey);
|
||||||
return DigestUtil.SHA1(join(obj).toString());
|
return DigestUtil.SHA1(join(obj).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user