新增获取微信服务器IP地址接口以及消息AES加密解密实现
This commit is contained in:
+21
-1
@@ -1,5 +1,8 @@
|
||||
package com.foxinmy.weixin4j.mp.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
@@ -72,4 +75,21 @@ public class HelperApi extends BaseApi {
|
||||
return response.getAsObject(new TypeReference<SemResult>() {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信服务器IP地址
|
||||
*
|
||||
* @return IP地址
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E5%BE%AE%E4%BF%A1%E6%9C%8D%E5%8A%A1%E5%99%A8IP%E5%9C%B0%E5%9D%80">获取IP地址</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public List<String> getcallbackip() throws WeixinException {
|
||||
String getcallbackip_uri = getRequestUri("getcallbackip_uri");
|
||||
Token token = tokenHolder.getToken();
|
||||
Response response = request.post(String.format(getcallbackip_uri,
|
||||
token.getAccessToken()));
|
||||
return JSON.parseArray(response.getAsJson().getString("ip_list"),
|
||||
String.class);
|
||||
}
|
||||
}
|
||||
+2
@@ -72,6 +72,8 @@ updateremark_uri={api_cgi_url}/user/info/updateremark?access_token=%s
|
||||
template_send_uri={api_cgi_url}/message/template/send?access_token=%s
|
||||
# \u8bed\u4e49\u7406\u89e3
|
||||
semantic_uri={api_base_url}/semantic/semproxy/search?access_token=%s
|
||||
# \u5fae\u4fe1\u670d\u52a1\u5730\u5740
|
||||
getcallbackip_uri={api_cgi_url}/getcallbackip?access_token=%s
|
||||
|
||||
# \u8ba2\u5355\u67e5\u8be2
|
||||
orderquery_uri={api_base_url}/pay/orderquery?access_token=%s
|
||||
|
||||
+1
-2
@@ -49,7 +49,6 @@ public class PayAction {
|
||||
// V3 支付
|
||||
// 此处的openid为微信用户的openid
|
||||
WeixinAccount weixinAccount = ConfigUtil.getWeixinAccount();
|
||||
weixinAccount.setOpenId("用户的openId");
|
||||
payPackage = new PayPackageV3(weixinAccount, "用户openid", "商品描述",
|
||||
"系统内部订单号", 1d, "IP地址", TradeType.JSAPI);
|
||||
// V2 支付
|
||||
@@ -147,7 +146,7 @@ public class PayAction {
|
||||
*
|
||||
*
|
||||
* @param inputStream
|
||||
* 订单细腻
|
||||
* 订单回调
|
||||
* @return <xml><br>
|
||||
* <return_code>SUCCESS/FAIL</return_code><br>
|
||||
* <return_msg>如非空,为错误 原因签名失败参数格式校验错误</return_msg><br>
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package com.foxinmy.weixin4j.mp.type;
|
||||
|
||||
public enum EncryptType {
|
||||
RAW, AES
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
# \u516c\u4f17\u53f7\u4fe1\u606f
|
||||
account={"appId":"wx4ab8f8de58159a57","appSecret":"1d4eb0f4bf556aaed539f30ed05ca795",\
|
||||
"token":"\u5f00\u653e\u8005\u7684token \u975e\u5fc5\u987b","openId":"\u516c\u4f17\u53f7\u7684openid \u975e\u5fc5\u987b",\
|
||||
"encodingAesKey":"\u516c\u4f17\u53f7\u8bbe\u7f6e\u4e86\u52a0\u5bc6\u65b9\u5f0f\u4e14\u4e3a\u300c\u5b89\u5168\u6a21\u5f0f\u300d\u9700\u8981\u586b\u5165",\
|
||||
"mchId":"V3.x\u7248\u672c\u4e0b\u7684\u5fae\u4fe1\u5546\u6237\u53f7",\
|
||||
"version":3,\
|
||||
"partnerId":"\u8d22\u4ed8\u901a\u7684\u5546\u6237\u53f7","partnerKey":"\u8d22\u4ed8\u901a\u5546\u6237\u6743\u9650\u5bc6\u94a5Key",\
|
||||
|
||||
Reference in New Issue
Block a user