From 2bf31411c09dd81dee663b96b2797bc2521de0f1 Mon Sep 17 00:00:00 2001 From: altusea <114981887+altusea@users.noreply.github.com> Date: Mon, 3 Mar 2025 15:34:00 +0800 Subject: [PATCH 01/25] =?UTF-8?q?:art:=20#3492=E3=80=90=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E5=8F=B7=E3=80=91=20=E5=BE=AE=E4=BF=A1=E5=B0=8F=E5=BA=97?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=A2=9E=E5=8A=A0=E6=96=B0=E5=B8=A6=E8=B4=A7=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0Id=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weixin/channel/bean/order/OrderCommissionInfo.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderCommissionInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderCommissionInfo.java index 78e391e77..f3cab1f4b 100644 --- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderCommissionInfo.java +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderCommissionInfo.java @@ -42,4 +42,8 @@ public class OrderCommissionInfo implements Serializable { /** 达人openfinderid */ @JsonProperty("openfinderid") private String openFinderId; + + /** 新带货平台 id */ + @JsonProperty("talent_id") + private String talentId; } From 44a95578d949987bb124728ef13f755f95c563dd Mon Sep 17 00:00:00 2001 From: sober Date: Mon, 3 Mar 2025 15:39:23 +0800 Subject: [PATCH 02/25] =?UTF-8?q?:bug:=20#3508=20=E3=80=90=E4=BC=81?= =?UTF-8?q?=E4=B8=9A=E5=BE=AE=E4=BF=A1=E3=80=91=E8=8E=B7=E5=8F=96=E4=BC=81?= =?UTF-8?q?=E4=B8=9A=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=E5=86=99=E5=AF=BC=E8=87=B4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chanjar/weixin/cp/api/impl/WxCpOAuth2ServiceImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOAuth2ServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOAuth2ServiceImpl.java index 2a64f52bc..d04a051c0 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOAuth2ServiceImpl.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOAuth2ServiceImpl.java @@ -13,6 +13,8 @@ import me.chanjar.weixin.cp.bean.workbench.WxCpSecondVerificationInfo; import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; +import java.util.Optional; + import static me.chanjar.weixin.common.api.WxConsts.OAuth2Scope.*; import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.OAuth2.*; @@ -74,9 +76,9 @@ public WxCpOauth2UserInfo getUserInfo(Integer agentId, String code) throws WxErr JsonObject jo = GsonParser.parse(responseText); return WxCpOauth2UserInfo.builder() - .userId(GsonHelper.getString(jo, "UserId")) + .userId(Optional.ofNullable(GsonHelper.getString(jo, "UserId")).orElse(GsonHelper.getString(jo, "userid"))) .deviceId(GsonHelper.getString(jo, "DeviceId")) - .openId(GsonHelper.getString(jo, "OpenId")) + .openId(Optional.ofNullable(GsonHelper.getString(jo, "OpenId")).orElse(GsonHelper.getString(jo, "openid"))) .userTicket(GsonHelper.getString(jo, "user_ticket")) .expiresIn(GsonHelper.getString(jo, "expires_in")) .externalUserId(GsonHelper.getString(jo, "external_userid")) From 5decfcb917b9562fea49be35c728768a082d6fe6 Mon Sep 17 00:00:00 2001 From: raven <52941626+raven1997s@users.noreply.github.com> Date: Mon, 3 Mar 2025 15:40:52 +0800 Subject: [PATCH 03/25] =?UTF-8?q?:art:=20=20#3505=E3=80=90=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E6=94=AF=E4=BB=98=E3=80=91=E4=BF=AE=E5=A4=8D=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E6=94=AF=E4=BB=98=E5=BC=82=E6=AD=A5=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E8=A7=A3=E6=9E=90=E5=A4=B1=E8=B4=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java index 1fa2f8dc8..16fa7a799 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java @@ -323,12 +323,13 @@ public WxPayOrderNotifyResult parseOrderNotifyResult(String xmlData, String sign log.debug("微信支付异步通知请求参数:{}", xmlData); WxPayOrderNotifyResult result = WxPayOrderNotifyResult.fromXML(xmlData); if (signType == null) { + String configKey = this.getConfigKey(result.getMchId(), result.getAppid()); if (result.getSignType() != null) { // 如果解析的通知对象中signType有值,则使用它进行验签 signType = result.getSignType(); - } else if (configMap.get(result.getMchId()).getSignType() != null) { + } else if (configMap.get(configKey).getSignType() != null) { // 如果配置中signType有值,则使用它进行验签 - signType = configMap.get(result.getMchId()).getSignType(); + signType = configMap.get(configKey).getSignType(); this.switchover(result.getMchId(), result.getAppid()); } } From 404102a4c8a5df1bd93bf3cc3125cf28209d053b Mon Sep 17 00:00:00 2001 From: wzl <45782921+wzl-1221@users.noreply.github.com> Date: Mon, 3 Mar 2025 15:42:26 +0800 Subject: [PATCH 04/25] =?UTF-8?q?:art:=20#3493=20=E3=80=90=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E6=94=AF=E4=BB=98=E3=80=91=E4=BF=AE=E5=A4=8D=E5=90=88?= =?UTF-8?q?=E5=8D=95=E6=94=AF=E4=BB=98combineTransactions=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=8F=82=E6=95=B0=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java index 16fa7a799..077562f03 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java @@ -809,7 +809,7 @@ public CombineTransactionsResult combine(TradeTypeEnum tradeType, CombineTransac @Override public T combineTransactions(TradeTypeEnum tradeType, CombineTransactionsRequest request) throws WxPayException { CombineTransactionsResult result = this.combine(tradeType, request); - return result.getPayInfo(tradeType, request.getCombineAppid(), request.getCombineAppid(), this.getConfig().getPrivateKey()); + return result.getPayInfo(tradeType, request.getCombineAppid(), request.getCombineMchid(), this.getConfig().getPrivateKey()); } @Override From 1f0dbcc2aa07f0dcb8c37a260567c1336ad9d7d2 Mon Sep 17 00:00:00 2001 From: Lyx Fly Date: Mon, 3 Mar 2025 15:43:38 +0800 Subject: [PATCH 05/25] =?UTF-8?q?:art:=20#3516=E3=80=90=E5=85=AC=E4=BC=97?= =?UTF-8?q?=E5=8F=B7=E3=80=91=E4=BF=AE=E6=AD=A3=E4=BB=A3=E7=90=86=E8=AE=A4?= =?UTF-8?q?=E8=AF=81=E8=AF=B7=E6=B1=82=E5=A4=B4=E8=AE=BE=E7=BD=AE=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../me/chanjar/weixin/mp/api/impl/WxMpServiceOkHttpImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceOkHttpImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceOkHttpImpl.java index 6d4869b6a..86555aa4a 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceOkHttpImpl.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceOkHttpImpl.java @@ -50,12 +50,12 @@ public void initHttp() { clientBuilder.proxy(getRequestHttpProxy().getProxy()); //设置授权 - clientBuilder.authenticator(new Authenticator() { + clientBuilder.proxyAuthenticator(new Authenticator() { @Override public Request authenticate(Route route, Response response) throws IOException { String credential = Credentials.basic(httpProxy.getProxyUsername(), httpProxy.getProxyPassword()); return response.request().newBuilder() - .header("Authorization", credential) + .header("Proxy-Authorization", credential) .build(); } }); From 03790d64bcf56b2c0ac202a84997bd0bfb38ed0c Mon Sep 17 00:00:00 2001 From: zhongjq Date: Thu, 6 Mar 2025 20:56:12 +0800 Subject: [PATCH 06/25] =?UTF-8?q?:art:=20WxMaMessage.allFieldsMap=E6=94=AF?= =?UTF-8?q?=E6=8C=81json=E6=A0=BC=E5=BC=8F=E6=95=B0=E6=8D=AE=E5=AD=98?= =?UTF-8?q?=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/binarywang/wx/miniapp/bean/WxMaMessage.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaMessage.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaMessage.java index 7a004b845..75d8174ca 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaMessage.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaMessage.java @@ -31,7 +31,7 @@ public class WxMaMessage implements Serializable { private static final long serialVersionUID = -3586245291677274914L; /** - * 使用dom4j解析的存放所有xml属性和值的map. + * 使用dom4j解析的存放所有xml或json属性和值的map. */ private Map allFieldsMap; @@ -287,6 +287,7 @@ public static WxMaMessage fromJson(String json) { } message.setUselessMsg(null); } + message.setAllFieldsMap(WxMaGsonBuilder.create().fromJson(json, Map.class)); return message; } From 5ac9922f8d56e345ecc4ded6b095a8a14957a1d5 Mon Sep 17 00:00:00 2001 From: SynchPj <46849861+SynchPj@users.noreply.github.com> Date: Mon, 17 Mar 2025 10:58:50 +0800 Subject: [PATCH 07/25] =?UTF-8?q?:art:=20#3498=E3=80=90=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E3=80=91=E6=9C=8D=E5=8A=A1=E5=95=86=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F-=E5=85=BC=E5=AE=B9=E5=85=AC=E9=92=A5=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E8=AF=B7=E6=B1=82=E5=A4=B4=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8F=B7=E4=BB=A5=E5=8F=8A=E7=81=B0=E5=BA=A6=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../binarywang/wxpay/config/WxPayConfig.java | 26 +++++++++++-------- .../impl/WxPayServiceApacheHttpImpl.java | 7 ++--- .../v3/auth/PublicCertificateVerifier.java | 9 +++++++ .../binarywang/wxpay/v3/auth/Verifier.java | 2 ++ 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java index 35558d563..dedbc6413 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java @@ -320,16 +320,7 @@ public CloseableHttpClient initApiV3HttpClient() throws WxPayException { //构造Http Proxy正向代理 WxPayHttpProxy wxPayHttpProxy = getWxPayHttpProxy(); - Verifier certificatesVerifier; - if (publicKey == null) { - certificatesVerifier = - new AutoUpdateCertificatesVerifier( - new WxPayCredentials(mchId, new PrivateKeySigner(certSerialNo, merchantPrivateKey)), - this.getApiV3Key().getBytes(StandardCharsets.UTF_8), this.getCertAutoUpdateTime(), - this.getPayBaseUrl(), wxPayHttpProxy); - } else { - certificatesVerifier = new PublicCertificateVerifier(publicKey, publicKeyId); - } + Verifier certificatesVerifier = getVerifier(merchantPrivateKey, wxPayHttpProxy, publicKey); WxPayV3HttpClientBuilder wxPayV3HttpClientBuilder = WxPayV3HttpClientBuilder.create() .withMerchant(mchId, certSerialNo, merchantPrivateKey) @@ -355,6 +346,19 @@ public CloseableHttpClient initApiV3HttpClient() throws WxPayException { } } + private Verifier getVerifier(PrivateKey merchantPrivateKey, WxPayHttpProxy wxPayHttpProxy, PublicKey publicKey) { + Verifier certificatesVerifier = new AutoUpdateCertificatesVerifier( + new WxPayCredentials(mchId, new PrivateKeySigner(certSerialNo, merchantPrivateKey)), + this.getApiV3Key().getBytes(StandardCharsets.UTF_8), this.getCertAutoUpdateTime(), + this.getPayBaseUrl(), wxPayHttpProxy); + if (publicKey != null) { + Verifier publicCertificatesVerifier = new PublicCertificateVerifier(publicKey, publicKeyId); + publicCertificatesVerifier.setOtherVerifier(certificatesVerifier); + certificatesVerifier = publicCertificatesVerifier; + } + return certificatesVerifier; + } + /** * 初始化一个WxPayHttpProxy对象 * @@ -382,7 +386,7 @@ private InputStream loadConfigInputStream(String configString, String configPath if (configContent != null) { return new ByteArrayInputStream(configContent); } - + if (StringUtils.isNotEmpty(configString)) { configContent = Base64.getDecoder().decode(configString); return new ByteArrayInputStream(configContent); diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java index 7fd793979..d8ba95971 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java @@ -100,6 +100,8 @@ public String postV3(String url, String requestStr) throws WxPayException { HttpPost httpPost = this.createHttpPost(url, requestStr); httpPost.addHeader(ACCEPT, APPLICATION_JSON); httpPost.addHeader(CONTENT_TYPE, APPLICATION_JSON); + String serialNumber = getWechatpaySerial(getConfig()); + httpPost.addHeader("Wechatpay-Serial", serialNumber); try (CloseableHttpResponse response = httpClient.execute(httpPost)) { //v3已经改为通过状态码判断200 204 成功 int statusCode = response.getStatusLine().getStatusCode(); @@ -387,10 +389,9 @@ private WxPayException convertException(JsonObject jsonObject) { * @return */ private String getWechatpaySerial(WxPayConfig wxPayConfig) { - String serialNumber = wxPayConfig.getVerifier().getValidCertificate().getSerialNumber().toString(16).toUpperCase(); if (StringUtils.isNotBlank(wxPayConfig.getPublicKeyId())) { - serialNumber = wxPayConfig.getPublicKeyId(); + return wxPayConfig.getPublicKeyId(); } - return serialNumber; + return wxPayConfig.getVerifier().getValidCertificate().getSerialNumber().toString(16).toUpperCase(); } } diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/v3/auth/PublicCertificateVerifier.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/v3/auth/PublicCertificateVerifier.java index 9344fc6f8..45f76818c 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/v3/auth/PublicCertificateVerifier.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/v3/auth/PublicCertificateVerifier.java @@ -9,6 +9,8 @@ public class PublicCertificateVerifier implements Verifier{ private final PublicKey publicKey; + private Verifier certificateVerifier; + private final X509PublicCertificate publicCertificate; public PublicCertificateVerifier(PublicKey publicKey, String publicId) { @@ -16,8 +18,15 @@ public PublicCertificateVerifier(PublicKey publicKey, String publicId) { this.publicCertificate = new X509PublicCertificate(publicKey, publicId); } + public void setOtherVerifier(Verifier verifier) { + this.certificateVerifier = verifier; + } + @Override public boolean verify(String serialNumber, byte[] message, String signature) { + if (!serialNumber.contains("PUB_KEY_ID")) { + return this.certificateVerifier.verify(serialNumber, message, signature); + } try { Signature sign = Signature.getInstance("SHA256withRSA"); sign.initVerify(publicKey); diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/v3/auth/Verifier.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/v3/auth/Verifier.java index 49f92e2f5..22676601c 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/v3/auth/Verifier.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/v3/auth/Verifier.java @@ -7,4 +7,6 @@ public interface Verifier { X509Certificate getValidCertificate(); + + default void setOtherVerifier(Verifier verifier) {}; } From 25309e06ad0f631591f0c9bcdd85ed5b34de87f4 Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Tue, 18 Mar 2025 12:58:09 +0800 Subject: [PATCH 08/25] =?UTF-8?q?:bookmark:=20=E5=8F=91=E5=B8=83=204.7.3.B?= =?UTF-8?q?=20=E6=B5=8B=E8=AF=95=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- solon-plugins/pom.xml | 2 +- solon-plugins/wx-java-channel-multi-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-channel-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-cp-multi-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-cp-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-miniapp-multi-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-miniapp-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-mp-multi-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-mp-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-open-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-pay-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-qidian-solon-plugin/pom.xml | 2 +- spring-boot-starters/pom.xml | 2 +- .../wx-java-channel-multi-spring-boot-starter/pom.xml | 2 +- .../wx-java-channel-spring-boot-starter/pom.xml | 2 +- .../wx-java-cp-multi-spring-boot-starter/pom.xml | 2 +- spring-boot-starters/wx-java-cp-spring-boot-starter/pom.xml | 2 +- .../wx-java-miniapp-multi-spring-boot-starter/pom.xml | 2 +- .../wx-java-miniapp-spring-boot-starter/pom.xml | 2 +- .../wx-java-mp-multi-spring-boot-starter/pom.xml | 2 +- spring-boot-starters/wx-java-mp-spring-boot-starter/pom.xml | 2 +- spring-boot-starters/wx-java-open-spring-boot-starter/pom.xml | 2 +- spring-boot-starters/wx-java-pay-spring-boot-starter/pom.xml | 2 +- spring-boot-starters/wx-java-qidian-spring-boot-starter/pom.xml | 2 +- weixin-graal/pom.xml | 2 +- weixin-java-channel/pom.xml | 2 +- weixin-java-common/pom.xml | 2 +- weixin-java-cp/pom.xml | 2 +- weixin-java-miniapp/pom.xml | 2 +- weixin-java-mp/pom.xml | 2 +- weixin-java-open/pom.xml | 2 +- weixin-java-pay/pom.xml | 2 +- weixin-java-qidian/pom.xml | 2 +- 34 files changed, 34 insertions(+), 34 deletions(-) diff --git a/pom.xml b/pom.xml index c7c40521b..2151c117a 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.github.binarywang wx-java - 4.7.2.B + 4.7.3.B pom WxJava - Weixin/Wechat Java SDK 微信开发Java SDK diff --git a/solon-plugins/pom.xml b/solon-plugins/pom.xml index 9585e9617..8dbc6b43d 100644 --- a/solon-plugins/pom.xml +++ b/solon-plugins/pom.xml @@ -6,7 +6,7 @@ com.github.binarywang wx-java - 4.7.2.B + 4.7.3.B pom wx-java-solon-plugins diff --git a/solon-plugins/wx-java-channel-multi-solon-plugin/pom.xml b/solon-plugins/wx-java-channel-multi-solon-plugin/pom.xml index a9b794a96..fc2796117 100644 --- a/solon-plugins/wx-java-channel-multi-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-channel-multi-solon-plugin/pom.xml @@ -5,7 +5,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/solon-plugins/wx-java-channel-solon-plugin/pom.xml b/solon-plugins/wx-java-channel-solon-plugin/pom.xml index 4e0dc723a..83a00deac 100644 --- a/solon-plugins/wx-java-channel-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-channel-solon-plugin/pom.xml @@ -3,7 +3,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/solon-plugins/wx-java-cp-multi-solon-plugin/pom.xml b/solon-plugins/wx-java-cp-multi-solon-plugin/pom.xml index 9cf2b3172..512cb41d4 100644 --- a/solon-plugins/wx-java-cp-multi-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-cp-multi-solon-plugin/pom.xml @@ -4,7 +4,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/solon-plugins/wx-java-cp-solon-plugin/pom.xml b/solon-plugins/wx-java-cp-solon-plugin/pom.xml index 46266b8e8..f147e36ee 100644 --- a/solon-plugins/wx-java-cp-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-cp-solon-plugin/pom.xml @@ -4,7 +4,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/solon-plugins/wx-java-miniapp-multi-solon-plugin/pom.xml b/solon-plugins/wx-java-miniapp-multi-solon-plugin/pom.xml index 1e5dab26b..b8387c3c0 100644 --- a/solon-plugins/wx-java-miniapp-multi-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-miniapp-multi-solon-plugin/pom.xml @@ -5,7 +5,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/solon-plugins/wx-java-miniapp-solon-plugin/pom.xml b/solon-plugins/wx-java-miniapp-solon-plugin/pom.xml index 805018b81..712e1abfb 100644 --- a/solon-plugins/wx-java-miniapp-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-miniapp-solon-plugin/pom.xml @@ -4,7 +4,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/solon-plugins/wx-java-mp-multi-solon-plugin/pom.xml b/solon-plugins/wx-java-mp-multi-solon-plugin/pom.xml index 4ccc4fa7d..39df8cfef 100644 --- a/solon-plugins/wx-java-mp-multi-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-mp-multi-solon-plugin/pom.xml @@ -5,7 +5,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/solon-plugins/wx-java-mp-solon-plugin/pom.xml b/solon-plugins/wx-java-mp-solon-plugin/pom.xml index 3aa2b9be4..cd2bca716 100644 --- a/solon-plugins/wx-java-mp-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-mp-solon-plugin/pom.xml @@ -5,7 +5,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/solon-plugins/wx-java-open-solon-plugin/pom.xml b/solon-plugins/wx-java-open-solon-plugin/pom.xml index 355ef6f93..bbd6b39ab 100644 --- a/solon-plugins/wx-java-open-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-open-solon-plugin/pom.xml @@ -5,7 +5,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/solon-plugins/wx-java-pay-solon-plugin/pom.xml b/solon-plugins/wx-java-pay-solon-plugin/pom.xml index 6357cc908..31698e010 100644 --- a/solon-plugins/wx-java-pay-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-pay-solon-plugin/pom.xml @@ -5,7 +5,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/solon-plugins/wx-java-qidian-solon-plugin/pom.xml b/solon-plugins/wx-java-qidian-solon-plugin/pom.xml index 4ff6dba00..8a45c7284 100644 --- a/solon-plugins/wx-java-qidian-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-qidian-solon-plugin/pom.xml @@ -3,7 +3,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/spring-boot-starters/pom.xml b/spring-boot-starters/pom.xml index c5cb2954d..fbb85e686 100644 --- a/spring-boot-starters/pom.xml +++ b/spring-boot-starters/pom.xml @@ -6,7 +6,7 @@ com.github.binarywang wx-java - 4.7.2.B + 4.7.3.B pom wx-java-spring-boot-starters diff --git a/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/pom.xml index dca311c01..4018347e6 100644 --- a/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/spring-boot-starters/wx-java-channel-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-channel-spring-boot-starter/pom.xml index 8f427c6d0..7b9ae6ee2 100644 --- a/spring-boot-starters/wx-java-channel-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-channel-spring-boot-starter/pom.xml @@ -3,7 +3,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/pom.xml index 6ea0eb005..03cb191fe 100644 --- a/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/pom.xml @@ -4,7 +4,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/spring-boot-starters/wx-java-cp-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-cp-spring-boot-starter/pom.xml index fdbe3d1e5..8de92d3ee 100644 --- a/spring-boot-starters/wx-java-cp-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-cp-spring-boot-starter/pom.xml @@ -4,7 +4,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/pom.xml index cedde8174..886cf8f88 100644 --- a/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/spring-boot-starters/wx-java-miniapp-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-miniapp-spring-boot-starter/pom.xml index fba6da9e0..a2f3aa742 100644 --- a/spring-boot-starters/wx-java-miniapp-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-miniapp-spring-boot-starter/pom.xml @@ -4,7 +4,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/spring-boot-starters/wx-java-mp-multi-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-mp-multi-spring-boot-starter/pom.xml index 867f57055..3f3ecc50d 100644 --- a/spring-boot-starters/wx-java-mp-multi-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-mp-multi-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/spring-boot-starters/wx-java-mp-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-mp-spring-boot-starter/pom.xml index cddf39300..ab6d89e6f 100644 --- a/spring-boot-starters/wx-java-mp-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-mp-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/spring-boot-starters/wx-java-open-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-open-spring-boot-starter/pom.xml index 189ff9467..cdb43685f 100644 --- a/spring-boot-starters/wx-java-open-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-open-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/spring-boot-starters/wx-java-pay-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-pay-spring-boot-starter/pom.xml index d4de4e77f..1aa1dc6f6 100644 --- a/spring-boot-starters/wx-java-pay-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-pay-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/spring-boot-starters/wx-java-qidian-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-qidian-spring-boot-starter/pom.xml index e118aba65..c38a1d350 100644 --- a/spring-boot-starters/wx-java-qidian-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-qidian-spring-boot-starter/pom.xml @@ -3,7 +3,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/weixin-graal/pom.xml b/weixin-graal/pom.xml index 338a22a56..ab9ec8c91 100644 --- a/weixin-graal/pom.xml +++ b/weixin-graal/pom.xml @@ -6,7 +6,7 @@ com.github.binarywang wx-java - 4.7.2.B + 4.7.3.B weixin-graal diff --git a/weixin-java-channel/pom.xml b/weixin-java-channel/pom.xml index 8d34754cb..76be718a4 100644 --- a/weixin-java-channel/pom.xml +++ b/weixin-java-channel/pom.xml @@ -6,7 +6,7 @@ com.github.binarywang wx-java - 4.7.2.B + 4.7.3.B weixin-java-channel diff --git a/weixin-java-common/pom.xml b/weixin-java-common/pom.xml index e89234d17..88e1b2c3f 100644 --- a/weixin-java-common/pom.xml +++ b/weixin-java-common/pom.xml @@ -6,7 +6,7 @@ com.github.binarywang wx-java - 4.7.2.B + 4.7.3.B weixin-java-common diff --git a/weixin-java-cp/pom.xml b/weixin-java-cp/pom.xml index 467ba9885..95d067244 100644 --- a/weixin-java-cp/pom.xml +++ b/weixin-java-cp/pom.xml @@ -7,7 +7,7 @@ com.github.binarywang wx-java - 4.7.2.B + 4.7.3.B weixin-java-cp diff --git a/weixin-java-miniapp/pom.xml b/weixin-java-miniapp/pom.xml index cfe52b968..500add0e4 100644 --- a/weixin-java-miniapp/pom.xml +++ b/weixin-java-miniapp/pom.xml @@ -7,7 +7,7 @@ com.github.binarywang wx-java - 4.7.2.B + 4.7.3.B weixin-java-miniapp diff --git a/weixin-java-mp/pom.xml b/weixin-java-mp/pom.xml index 0aecd36da..dde82cf5d 100644 --- a/weixin-java-mp/pom.xml +++ b/weixin-java-mp/pom.xml @@ -7,7 +7,7 @@ com.github.binarywang wx-java - 4.7.2.B + 4.7.3.B weixin-java-mp diff --git a/weixin-java-open/pom.xml b/weixin-java-open/pom.xml index f7fac62e6..e94059131 100644 --- a/weixin-java-open/pom.xml +++ b/weixin-java-open/pom.xml @@ -7,7 +7,7 @@ com.github.binarywang wx-java - 4.7.2.B + 4.7.3.B weixin-java-open diff --git a/weixin-java-pay/pom.xml b/weixin-java-pay/pom.xml index 6eeb06624..f66456aa4 100644 --- a/weixin-java-pay/pom.xml +++ b/weixin-java-pay/pom.xml @@ -5,7 +5,7 @@ com.github.binarywang wx-java - 4.7.2.B + 4.7.3.B 4.0.0 diff --git a/weixin-java-qidian/pom.xml b/weixin-java-qidian/pom.xml index 737af413d..4e96a904b 100644 --- a/weixin-java-qidian/pom.xml +++ b/weixin-java-qidian/pom.xml @@ -7,7 +7,7 @@ com.github.binarywang wx-java - 4.7.2.B + 4.7.3.B weixin-java-qidian From 5604a16ae89dcbfb2cf4db45d2f908bdc6a72758 Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Sun, 23 Mar 2025 20:00:52 +0800 Subject: [PATCH 09/25] :art: fix doc --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c70396482..0b16b4779 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,7 +28,7 @@ $ git push * 定期使用项目仓库内容更新自己仓库内容。 ```bash -$ git remote add upstream https://github.com/Wechat-Group/WxJava +$ git remote add upstream https://github.com/binarywang/WxJava $ git fetch upstream $ git checkout develop $ git rebase upstream/develop From b225afbd68f69ebe44af3b6fad0bc3404d28d067 Mon Sep 17 00:00:00 2001 From: yangmengyu2021 <87807185+yangmengyu2021@users.noreply.github.com> Date: Sun, 23 Mar 2025 20:07:01 +0800 Subject: [PATCH 10/25] =?UTF-8?q?:art:=20#3532=20=E3=80=90=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E6=94=AF=E4=BB=98=E3=80=91=E4=BF=AE=E5=A4=8D=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=80=9A=E7=9F=A5=E5=9B=9E=E8=B0=83=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wxpay/service/impl/BaseWxPayServiceImpl.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java index 077562f03..05d1f8c22 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java @@ -323,14 +323,13 @@ public WxPayOrderNotifyResult parseOrderNotifyResult(String xmlData, String sign log.debug("微信支付异步通知请求参数:{}", xmlData); WxPayOrderNotifyResult result = WxPayOrderNotifyResult.fromXML(xmlData); if (signType == null) { - String configKey = this.getConfigKey(result.getMchId(), result.getAppid()); + this.switchover(result.getMchId(), result.getAppid()); if (result.getSignType() != null) { // 如果解析的通知对象中signType有值,则使用它进行验签 signType = result.getSignType(); - } else if (configMap.get(configKey).getSignType() != null) { + } else if (this.getConfig().getSignType() != null) { // 如果配置中signType有值,则使用它进行验签 - signType = configMap.get(configKey).getSignType(); - this.switchover(result.getMchId(), result.getAppid()); + signType = this.getConfig().getSignType(); } } From dd407141b03c102f1aaff878685a7ebd14271147 Mon Sep 17 00:00:00 2001 From: SynchPj <46849861+SynchPj@users.noreply.github.com> Date: Mon, 7 Apr 2025 13:01:53 +0800 Subject: [PATCH 11/25] =?UTF-8?q?:art:=20#3530=20=E3=80=90=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E6=94=AF=E4=BB=98=E3=80=91=E4=BF=AE=E5=A4=8D=E6=9C=AA?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=B9=B3=E5=8F=B0=E8=AF=81=E4=B9=A6=E5=BC=95?= =?UTF-8?q?=E8=B5=B7=E7=9A=84v3=E8=AF=B7=E6=B1=82=E6=9E=84=E9=80=A0?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../github/binarywang/wxpay/config/WxPayConfig.java | 12 ++++++++---- .../wxpay/v3/auth/PublicCertificateVerifier.java | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java index dedbc6413..7a14ea152 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java @@ -347,10 +347,14 @@ public CloseableHttpClient initApiV3HttpClient() throws WxPayException { } private Verifier getVerifier(PrivateKey merchantPrivateKey, WxPayHttpProxy wxPayHttpProxy, PublicKey publicKey) { - Verifier certificatesVerifier = new AutoUpdateCertificatesVerifier( - new WxPayCredentials(mchId, new PrivateKeySigner(certSerialNo, merchantPrivateKey)), - this.getApiV3Key().getBytes(StandardCharsets.UTF_8), this.getCertAutoUpdateTime(), - this.getPayBaseUrl(), wxPayHttpProxy); + Verifier certificatesVerifier = null; + // 如果配置了平台证书,则初始化验证器以备v2版本接口验签(公钥灰度实现) + if (this.getPrivateCertPath() != null && this.getPrivateKeyPath() != null) { + certificatesVerifier = new AutoUpdateCertificatesVerifier( + new WxPayCredentials(mchId, new PrivateKeySigner(certSerialNo, merchantPrivateKey)), + this.getApiV3Key().getBytes(StandardCharsets.UTF_8), this.getCertAutoUpdateTime(), + this.getPayBaseUrl(), wxPayHttpProxy); + } if (publicKey != null) { Verifier publicCertificatesVerifier = new PublicCertificateVerifier(publicKey, publicKeyId); publicCertificatesVerifier.setOtherVerifier(certificatesVerifier); diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/v3/auth/PublicCertificateVerifier.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/v3/auth/PublicCertificateVerifier.java index 45f76818c..8c9c4f356 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/v3/auth/PublicCertificateVerifier.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/v3/auth/PublicCertificateVerifier.java @@ -24,7 +24,7 @@ public void setOtherVerifier(Verifier verifier) { @Override public boolean verify(String serialNumber, byte[] message, String signature) { - if (!serialNumber.contains("PUB_KEY_ID")) { + if (!serialNumber.contains("PUB_KEY_ID") && this.certificateVerifier != null) { return this.certificateVerifier.verify(serialNumber, message, signature); } try { From 3f0b8d4e2bf4fe2d355e412e074078f71eef261b Mon Sep 17 00:00:00 2001 From: cloudX Date: Mon, 7 Apr 2025 13:03:10 +0800 Subject: [PATCH 12/25] =?UTF-8?q?:art:=20#3538=20=E3=80=90=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E6=94=AF=E4=BB=98=E3=80=91V3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=9E=E5=90=8D=E6=94=AF=E4=BB=98=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request/WxPayUnifiedOrderV3Request.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayUnifiedOrderV3Request.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayUnifiedOrderV3Request.java index 98dae388e..8ac588de8 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayUnifiedOrderV3Request.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayUnifiedOrderV3Request.java @@ -250,6 +250,12 @@ public static class Payer implements Serializable { */ @SerializedName(value = "openid") private String openid; + + /** + * 实名支付用户身份标识 + */ + @SerializedName(value = "identity") + private Identity identity; } @Data @@ -572,4 +578,36 @@ public static class SettleInfo implements Serializable { @SerializedName(value = "profit_sharing") private Boolean profitSharing; } + + + @Data + @NoArgsConstructor + public static class Identity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 证件类型 + * IDCARD:身份证 + * HONGKONG_MACAO:港澳回乡证 + * HONGKONG_MACAO_RESIDENT:港澳居住证 + * TAIWAN_RESIDENT:台湾居住证 + * FOREIGN_RESIDENT:外国人永居证 + * OVERSEA_PASSPORT:护照 + */ + @SerializedName(value = "type") + private String type; + /** + * 证件号 + * 证件号,如身份证号。 + * 示例值:43102119910910512X + */ + @SerializedName(value = "number") + private String number; + /** + * 证件姓名。 + * 示例值:周星星 + */ + @SerializedName(value = "name") + private String name; + } } From 4828a314e9f5a721dfc8cadc04a25f1d0ff63649 Mon Sep 17 00:00:00 2001 From: yangmengyu2021 <87807185+yangmengyu2021@users.noreply.github.com> Date: Mon, 7 Apr 2025 13:04:33 +0800 Subject: [PATCH 13/25] =?UTF-8?q?:art:=20#3534=20=E4=B8=BAconnectionReques?= =?UTF-8?q?tTimeout=E8=AE=BE=E7=BD=AE=E9=BB=98=E8=AE=A4=E5=80=BC=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E5=BC=80=E5=8F=91=E8=80=85=E5=9C=A8=E8=99=9A?= =?UTF-8?q?=E6=8B=9F=E7=BA=BF=E7=A8=8B=E4=B8=AD=E8=B0=83=E7=94=A8=E6=A1=86?= =?UTF-8?q?=E6=9E=B6=E7=9A=84httpClient=E6=97=B6=E9=80=A0=E6=88=90?= =?UTF-8?q?=E7=9A=84=E6=97=A0=E9=99=90=E7=AD=89=E5=BE=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/util/http/apache/DefaultApacheHttpClientBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/apache/DefaultApacheHttpClientBuilder.java b/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/apache/DefaultApacheHttpClientBuilder.java index 4c06f5168..12f04ba20 100644 --- a/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/apache/DefaultApacheHttpClientBuilder.java +++ b/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/apache/DefaultApacheHttpClientBuilder.java @@ -59,7 +59,7 @@ public class DefaultApacheHttpClientBuilder implements ApacheHttpClientBuilder { * 设置为负数是使用系统默认设置(非3000ms的默认值,而是httpClient的默认设置). *

*/ - private int connectionRequestTimeout = -1; + private int connectionRequestTimeout = 3000; /** * 建立链接的超时时间,默认为5000ms.由于是在链接池获取链接,此设置应该并不起什么作用 From 0452a05dd4e093dc50d4b3fed859521b830036fc Mon Sep 17 00:00:00 2001 From: cxiaoxifeng <11973717+cxiaoxifeng@user.noreply.gitee.com> Date: Wed, 19 Mar 2025 08:54:05 +0000 Subject: [PATCH 14/25] =?UTF-8?q?:art:=20=E3=80=90=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E3=80=91=E4=BF=AE=E5=A4=8D=E7=89=A9=E6=B5=81=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E6=9F=A5=E8=AF=A2=E7=BB=84=E4=BB=B6=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=89=A9=E5=93=81=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3=E7=9A=84?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wx/miniapp/api/impl/WxMaImmediateDeliveryServiceImpl.java | 2 +- .../cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaImmediateDeliveryServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaImmediateDeliveryServiceImpl.java index 05e8f2e0a..342224eff 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaImmediateDeliveryServiceImpl.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaImmediateDeliveryServiceImpl.java @@ -207,7 +207,7 @@ public GetDeliveryListResponse getDeliveryList() throws WxErrorException { @Override public WxMaBaseResponse updateWaybillGoods(UpdateWaybillGoodsRequest request) throws WxErrorException { - String responseContent = this.wxMaService.post(InstantDelivery.GET_DELIVERY_LIST_URL,request); + String responseContent = this.wxMaService.post(InstantDelivery.UPDATE_WAYBILL_GOODS_URL,request); WxMaBaseResponse response = WxMaGsonBuilder.create().fromJson(responseContent, WxMaBaseResponse.class); if (response.getErrcode() == -1) { throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java index d61ade73c..30d52b17c 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java @@ -626,7 +626,7 @@ public interface InstantDelivery { String GET_DELIVERY_LIST_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/get_delivery_list"; - /** 获取运力id列表get_delivery_list 商户使用此接口获取所有运力id的列表 */ + /** 物流服务-查询组件-更新物品信息接口 update_waybill_goods 更新物品信息 */ String UPDATE_WAYBILL_GOODS_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/update_waybill_goods"; From b6c3d74cbae1946ccd2e996bbb3ce097ff1fa08f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=88=E7=AC=91?= <2300064869@qq.com> Date: Wed, 19 Mar 2025 08:57:40 +0000 Subject: [PATCH 15/25] =?UTF-8?q?:new:=20#3529=20=E3=80=90=E4=BC=81?= =?UTF-8?q?=E4=B8=9A=E5=BE=AE=E4=BF=A1=E3=80=91=E5=A2=9E=E5=8A=A0=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E8=AE=BE=E7=BD=AE=E5=BA=94=E7=94=A8=E5=9C=A8=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=B7=A5=E4=BD=9C=E5=8F=B0=E5=B1=95=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cp/api/WxCpAgentWorkBenchService.java | 8 ++ .../impl/WxCpAgentWorkBenchServiceImpl.java | 6 ++ .../weixin/cp/bean/WxCpAgentWorkBench.java | 91 +++++++++++++++++++ .../weixin/cp/constant/WxCpApiPathConsts.java | 4 + 4 files changed, 109 insertions(+) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpAgentWorkBenchService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpAgentWorkBenchService.java index c50aa2f5f..67c57a8a8 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpAgentWorkBenchService.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpAgentWorkBenchService.java @@ -36,4 +36,12 @@ public interface WxCpAgentWorkBenchService { * @throws WxErrorException the wx error exception */ void setWorkBenchData(WxCpAgentWorkBench wxCpAgentWorkBench) throws WxErrorException; + + /** + * Batch sets work bench data. + * + * @param wxCpAgentWorkBench the wx cp agent work bench + * @throws WxErrorException the wx error exception + */ + void batchSetWorkBenchData(WxCpAgentWorkBench wxCpAgentWorkBench) throws WxErrorException; } diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpAgentWorkBenchServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpAgentWorkBenchServiceImpl.java index bb5c191e9..b0bbb3864 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpAgentWorkBenchServiceImpl.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpAgentWorkBenchServiceImpl.java @@ -38,4 +38,10 @@ public void setWorkBenchData(WxCpAgentWorkBench wxCpAgentWorkBench) throws WxErr final String url = String.format(this.mainService.getWxCpConfigStorage().getApiUrl(WORKBENCH_DATA_SET)); this.mainService.post(url, wxCpAgentWorkBench.toUserDataString()); } + + @Override + public void batchSetWorkBenchData(WxCpAgentWorkBench wxCpAgentWorkBench) throws WxErrorException { + final String url = String.format(this.mainService.getWxCpConfigStorage().getApiUrl(WORKBENCH_BATCH_DATA_SET)); + this.mainService.post(url, wxCpAgentWorkBench.toBatchUserDataString()); + } } diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpAgentWorkBench.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpAgentWorkBench.java index e74173ee3..6687e8761 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpAgentWorkBench.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpAgentWorkBench.java @@ -6,12 +6,14 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import me.chanjar.weixin.common.util.json.WxGsonBuilder; import me.chanjar.weixin.cp.bean.workbench.WorkBenchKeyData; import me.chanjar.weixin.cp.bean.workbench.WorkBenchList; import me.chanjar.weixin.cp.constant.WxCpConsts; import java.io.Serializable; import java.util.List; +import java.util.Set; /** * The type Wx cp agent work bench. @@ -33,6 +35,10 @@ public class WxCpAgentWorkBench implements Serializable { * 用户的userid */ private String userId; + /** + * 用户的userIds + */ + private Set userIds; /** * 应用id */ @@ -93,6 +99,20 @@ public String toUserDataString() { return userDataObject.toString(); } + /** + * 生成批量用户数据Json字符串 + * + * @return the string + */ + public String toBatchUserDataString() { + JsonObject userDataObject = new JsonObject(); + userDataObject.addProperty("agentid", this.agentId); + JsonArray useridList = WxGsonBuilder.create().toJsonTree(this.userIds).getAsJsonArray(); + userDataObject.add("userid_list", useridList); + this.handleBatch(userDataObject); + return userDataObject.toString(); + } + /** * 处理不用类型的工作台数据 */ @@ -152,4 +172,75 @@ private void handle(JsonObject templateObject) { } } + /** + * 处理不用类型的工作台数据 + */ + private void handleBatch(JsonObject templateObject) { + switch (this.getType()) { + case WxCpConsts.WorkBenchType.KEYDATA: { + JsonArray keyDataArray = new JsonArray(); + JsonObject itemsObject = new JsonObject(); + for (WorkBenchKeyData keyDataItem : this.keyDataList) { + JsonObject keyDataObject = new JsonObject(); + keyDataObject.addProperty("key", keyDataItem.getKey()); + keyDataObject.addProperty("data", keyDataItem.getData()); + keyDataObject.addProperty("jump_url", keyDataItem.getJumpUrl()); + keyDataObject.addProperty("pagepath", keyDataItem.getPagePath()); + keyDataArray.add(keyDataObject); + } + itemsObject.add("items", keyDataArray); + JsonObject dataObject = new JsonObject(); + dataObject.addProperty("type", WxCpConsts.WorkBenchType.KEYDATA); + dataObject.add("keydata", itemsObject); + templateObject.add("data", dataObject); + break; + } + case WxCpConsts.WorkBenchType.IMAGE: { + JsonObject image = new JsonObject(); + image.addProperty("url", this.url); + image.addProperty("jump_url", this.jumpUrl); + image.addProperty("pagepath", this.pagePath); + JsonObject dataObject = new JsonObject(); + dataObject.addProperty("type", WxCpConsts.WorkBenchType.IMAGE); + dataObject.add("image", image); + templateObject.add("data", dataObject); + break; + } + case WxCpConsts.WorkBenchType.LIST: { + JsonArray listArray = new JsonArray(); + JsonObject itemsObject = new JsonObject(); + for (WorkBenchList listItem : this.lists) { + JsonObject listObject = new JsonObject(); + listObject.addProperty("title", listItem.getTitle()); + listObject.addProperty("jump_url", listItem.getJumpUrl()); + listObject.addProperty("pagepath", listItem.getPagePath()); + listArray.add(listObject); + } + itemsObject.add("items", listArray); + JsonObject dataObject = new JsonObject(); + dataObject.addProperty("type", WxCpConsts.WorkBenchType.LIST); + dataObject.add("list", itemsObject); + templateObject.add("data", dataObject); + break; + } + case WxCpConsts.WorkBenchType.WEBVIEW: { + JsonObject webview = new JsonObject(); + webview.addProperty("url", this.url); + webview.addProperty("jump_url", this.jumpUrl); + webview.addProperty("pagepath", this.pagePath); + if (null != this.enableWebviewClick) { + webview.addProperty("enable_webview_click", this.enableWebviewClick); + } + JsonObject dataObject = new JsonObject(); + dataObject.addProperty("type", WxCpConsts.WorkBenchType.WEBVIEW); + dataObject.add("webview", webview); + templateObject.add("data", dataObject); + break; + } + default: { + //do nothing + } + } + } + } diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java index 3aecf7212..d70f0ff4c 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java @@ -130,6 +130,10 @@ interface WorkBench { * The constant WORKBENCH_DATA_SET. */ String WORKBENCH_DATA_SET = "/cgi-bin/agent/set_workbench_data"; + /** + * The constant WORKBENCH_BATCH_DATA_SET. + */ + String WORKBENCH_BATCH_DATA_SET = "/cgi-bin/agent/batch_set_workbench_data"; } /** From b44dd2e34758e66a0c8fbe0c740ba21f11a0d28d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=88=E7=AC=91?= <2300064869@qq.com> Date: Mon, 7 Apr 2025 07:01:35 +0000 Subject: [PATCH 16/25] =?UTF-8?q?:art:=20#3541=E3=80=90=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E3=80=91=E5=A2=9E=E5=8A=A0=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?WebView=E5=9E=8B=E5=BA=94=E7=94=A8=E5=9C=A8=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E5=8F=B0=E5=B1=95=E7=A4=BA=E7=9A=84=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weixin/cp/bean/WxCpAgentWorkBench.java | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpAgentWorkBench.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpAgentWorkBench.java index 6687e8761..2a3e4448b 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpAgentWorkBench.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpAgentWorkBench.java @@ -13,7 +13,6 @@ import java.io.Serializable; import java.util.List; -import java.util.Set; /** * The type Wx cp agent work bench. @@ -38,7 +37,7 @@ public class WxCpAgentWorkBench implements Serializable { /** * 用户的userIds */ - private Set userIds; + private List useridList; /** * 应用id */ @@ -64,6 +63,15 @@ public class WxCpAgentWorkBench implements Serializable { * 参考示例:今日要闻 */ private Boolean enableWebviewClick; + /** + * 高度。可以有两种选择:single_row与double_row。当为single_row时,高度为106px(如果隐藏标题则为147px)。 + * 当为double_row时,高度固定为171px(如果隐藏标题则为212px)。默认值为double_row + */ + private String height; + /** + * 是否要隐藏展示了应用名称的标题部分,默认值为false。 + */ + private Boolean hideTitle; private List keyDataList; @@ -107,7 +115,7 @@ public String toUserDataString() { public String toBatchUserDataString() { JsonObject userDataObject = new JsonObject(); userDataObject.addProperty("agentid", this.agentId); - JsonArray useridList = WxGsonBuilder.create().toJsonTree(this.userIds).getAsJsonArray(); + JsonArray useridList = WxGsonBuilder.create().toJsonTree(this.useridList).getAsJsonArray(); userDataObject.add("userid_list", useridList); this.handleBatch(userDataObject); return userDataObject.toString(); @@ -160,9 +168,9 @@ private void handle(JsonObject templateObject) { webview.addProperty("url", this.url); webview.addProperty("jump_url", this.jumpUrl); webview.addProperty("pagepath", this.pagePath); - if (null != this.enableWebviewClick) { - webview.addProperty("enable_webview_click", this.enableWebviewClick); - } + webview.addProperty("enable_webview_click", this.enableWebviewClick); + webview.addProperty("height", this.height); + webview.addProperty("hide_title", this.hideTitle); templateObject.add("webview", webview); break; } @@ -228,9 +236,9 @@ private void handleBatch(JsonObject templateObject) { webview.addProperty("url", this.url); webview.addProperty("jump_url", this.jumpUrl); webview.addProperty("pagepath", this.pagePath); - if (null != this.enableWebviewClick) { - webview.addProperty("enable_webview_click", this.enableWebviewClick); - } + webview.addProperty("enable_webview_click", this.enableWebviewClick); + webview.addProperty("height", this.height); + webview.addProperty("hide_title", this.hideTitle); JsonObject dataObject = new JsonObject(); dataObject.addProperty("type", WxCpConsts.WorkBenchType.WEBVIEW); dataObject.add("webview", webview); From 373c1e65cbc3e1efcc3691728bacadd7fc7d95a7 Mon Sep 17 00:00:00 2001 From: jimmyjimmy-sw <57387749+jimmyjimmy-sw@users.noreply.github.com> Date: Mon, 7 Apr 2025 17:47:48 +0800 Subject: [PATCH 17/25] =?UTF-8?q?:bug:=20#3522=20=E3=80=90=E5=85=AC?= =?UTF-8?q?=E4=BC=97=E5=8F=B7=E3=80=91=E4=BF=AE=E5=A4=8DWxMpMapConfigImpl?= =?UTF-8?q?=E9=9D=99=E6=80=81=E5=B1=9E=E6=80=A7=E5=AD=98=E5=82=A8token?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=A4=9A=E4=B8=AA=E5=AE=9E=E4=BE=8B=E6=97=B6?= =?UTF-8?q?=E5=87=BA=E7=8E=B0token=E6=B2=A1=E6=9C=89=E9=9A=94=E7=A6=BB?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mp/config/impl/WxMpMapConfigImpl.java | 2 +- .../mp/api/impl/WxMpMapConfigImplTest.java | 58 +++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpMapConfigImplTest.java diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/config/impl/WxMpMapConfigImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/config/impl/WxMpMapConfigImpl.java index cd701d1ef..72e6e615f 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/config/impl/WxMpMapConfigImpl.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/config/impl/WxMpMapConfigImpl.java @@ -15,7 +15,7 @@ public class WxMpMapConfigImpl extends WxMpDefaultConfigImpl { private static final long serialVersionUID = 5311395137835650104L; - private static final ConcurrentHashMap CONCURRENT_HASH_MAP = new ConcurrentHashMap<>(1); + private final ConcurrentHashMap CONCURRENT_HASH_MAP = new ConcurrentHashMap<>(1); private static final String MAP_KEY = "access_token"; diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpMapConfigImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpMapConfigImplTest.java new file mode 100644 index 000000000..167c0e019 --- /dev/null +++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpMapConfigImplTest.java @@ -0,0 +1,58 @@ +package me.chanjar.weixin.mp.api.impl; + +import com.google.inject.Inject; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.api.test.ApiTestModule; +import me.chanjar.weixin.mp.config.impl.WxMpMapConfigImpl; +import me.chanjar.weixin.mp.util.WxMpConfigStorageHolder; +import org.testng.annotations.Guice; +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; + +/** + * 测试 ConcurrentHashMap 保存配置信息 + * @author jimmyjimmy-sw + */ +@Test +@Guice(modules = ApiTestModule.class) +public class WxMpMapConfigImplTest { + + @Inject + private WxMpService wxService; + + /** + * 测试多租户保存 WxMpMapConfigImpl 到 WxMpService,切换之后能获取到租户各自AppId对应的token + * @throws WxErrorException + */ + @Test + public void testAppidSwitch() throws WxErrorException { + // 保存租户A的配置信息,并获取token + WxMpMapConfigImpl configAppA = new WxMpMapConfigImpl(); + String appidA = "APPID_A"; + configAppA.setAppId(appidA); + configAppA.setSecret("APP_SECRET_A"); + configAppA.useStableAccessToken(true); + String tokenA = "TOKEN_A"; + configAppA.updateAccessToken(tokenA,60 * 60 * 1); + wxService.addConfigStorage(appidA, configAppA); + WxMpConfigStorageHolder.set(appidA); + assertEquals(this.wxService.getAccessToken(),tokenA); + + // 保存租户B的配置信息,并获取token + WxMpMapConfigImpl configAppB = new WxMpMapConfigImpl(); + String appidB = "APPID_B"; + configAppB.setAppId(appidB); + configAppB.setSecret("APP_SECRET_B"); + configAppB.useStableAccessToken(true); + String tokenB = "TOKEN_B"; + configAppB.updateAccessToken(tokenB,60 * 60 * 1); + wxService.addConfigStorage(appidB, configAppB); + WxMpConfigStorageHolder.set(appidB); + assertEquals(this.wxService.getAccessToken(),tokenB); + + // 上下文切换到租户A 获取租户A的token + WxMpConfigStorageHolder.set(appidA); + assertEquals(this.wxService.getAccessToken(),tokenA); + } +} From 833ff706805770babca343f8f907608d3159fed8 Mon Sep 17 00:00:00 2001 From: zhangrongguang <123545250@qq.com> Date: Thu, 27 Mar 2025 18:07:27 +0800 Subject: [PATCH 18/25] =?UTF-8?q?=E3=80=90=E4=BC=81=E4=B8=9A=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E3=80=91=E6=8E=A5=E5=BE=85=E4=BA=BA=E5=91=98=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E6=B7=BB=E5=8A=A0=E6=8E=A5=E5=BE=85=E4=BA=BA?= =?UTF-8?q?=E5=91=98/=E5=88=A0=E9=99=A4=E6=8E=A5=E5=BE=85=E4=BA=BA?= =?UTF-8?q?=E5=91=98=20=E5=A2=9E=E5=8A=A0=20department=5Fid=5Flist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chanjar/weixin/cp/api/WxCpKfService.java | 26 +++++++++ .../weixin/cp/api/impl/WxCpKfServiceImpl.java | 53 ++++++++++++++++--- 2 files changed, 72 insertions(+), 7 deletions(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpKfService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpKfService.java index 86b342f2f..5a53829dc 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpKfService.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpKfService.java @@ -75,6 +75,19 @@ public interface WxCpKfService { */ WxCpKfServicerOpResp addServicer(String openKfid, List userIdList) throws WxErrorException; + /** + * 接待人员管理 + * 添加指定客服账号的接待人员,每个客服账号目前最多可添加2000个接待人员,20个部门。 + * userid_list和department_id_list至少需要填其中一个 + * + * @param openKfid 客服帐号ID + * @param userIdList 接待人员userid列表。第三方应用填密文userid,即open_userid 可填充个数:1 ~ 100。超过100个需分批调用。 + * @param departmentIdList 接待人员部门id列表 可填充个数:0 ~ 20。 + * @return 添加客服账号结果 wx cp kf servicer op resp + * @throws WxErrorException 异常 + */ + WxCpKfServicerOpResp addServicer(String openKfid, List userIdList,List departmentIdList) throws WxErrorException; + /** * 接待人员管理 * 从客服帐号删除接待人员 @@ -86,6 +99,19 @@ public interface WxCpKfService { */ WxCpKfServicerOpResp delServicer(String openKfid, List userIdList) throws WxErrorException; + /** + * 接待人员管理 + * 从客服帐号删除接待人员 + * userid_list和department_id_list至少需要填其中一个 + * + * @param openKfid 客服帐号ID + * @param userIdList 接待人员userid列表。第三方应用填密文userid,即open_userid 可填充个数:1 ~ 100。超过100个需分批调用。 + * @param departmentIdList 接待人员部门id列表 可填充个数:0 ~ 100。超过100个需分批调用。 + * @return 删除客服账号结果 wx cp kf servicer op resp + * @throws WxErrorException 异常 + */ + WxCpKfServicerOpResp delServicer(String openKfid, List userIdList, List departmentIdList) throws WxErrorException; + /** * 接待人员管理 * 获取某个客服帐号的接待人员列表 diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpKfServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpKfServiceImpl.java index 29e84c516..be4f2a585 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpKfServiceImpl.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpKfServiceImpl.java @@ -70,23 +70,62 @@ public WxCpKfAccountLinkResp getAccountLink(WxCpKfAccountLink link) throws WxErr @Override public WxCpKfServicerOpResp addServicer(String openKfid, List userIdList) throws WxErrorException { - return servicerOp(openKfid, userIdList, SERVICER_ADD); + return servicerOp(openKfid, userIdList, null, SERVICER_ADD); + } + + @Override + public WxCpKfServicerOpResp addServicer(String openKfId, List userIdList, List departmentIdList) throws WxErrorException { + validateParameters(SERVICER_ADD, userIdList, departmentIdList); + return servicerOp(openKfId, userIdList, departmentIdList, SERVICER_ADD); } @Override public WxCpKfServicerOpResp delServicer(String openKfid, List userIdList) throws WxErrorException { - return servicerOp(openKfid, userIdList, SERVICER_DEL); + return servicerOp(openKfid, userIdList, null, SERVICER_DEL); } - private WxCpKfServicerOpResp servicerOp(String openKfid, List userIdList, String uri) throws WxErrorException { + @Override + public WxCpKfServicerOpResp delServicer(String openKfid, List userIdList, List departmentIdList) throws WxErrorException { + validateParameters(SERVICER_DEL, userIdList, departmentIdList); + return servicerOp(openKfid, userIdList, departmentIdList, SERVICER_DEL); + } + + private void validateParameters(String uri, List userIdList, List departmentIdList) { + if ((userIdList == null || userIdList.isEmpty()) && (departmentIdList == null || departmentIdList.isEmpty())) { + throw new IllegalArgumentException("userid_list和department_id_list至少需要填其中一个"); + } + if (SERVICER_DEL.equals(uri)) { + if (userIdList != null && userIdList.size() > 100) { + throw new IllegalArgumentException("可填充个数:0 ~ 100。超过100个需分批调用。"); + } + if (departmentIdList != null && departmentIdList.size() > 100) { + throw new IllegalArgumentException("可填充个数:0 ~ 100。超过100个需分批调用。"); + } + } else { + if (userIdList != null && userIdList.size() > 100) { + throw new IllegalArgumentException("可填充个数:0 ~ 100。超过100个需分批调用。"); + } + if (departmentIdList != null && departmentIdList.size() > 20) { + throw new IllegalArgumentException("可填充个数:0 ~ 20。"); + } + } + } + + private WxCpKfServicerOpResp servicerOp(String openKfid, List userIdList, List departmentIdList, String uri) throws WxErrorException { String url = cpService.getWxCpConfigStorage().getApiUrl(uri); JsonObject json = new JsonObject(); json.addProperty("open_kfid", openKfid); - JsonArray userIdArray = new JsonArray(); - userIdList.forEach(userIdArray::add); - json.add("userid_list", userIdArray); - + if (userIdList != null && !userIdList.isEmpty()) { + JsonArray userIdArray = new JsonArray(); + userIdList.forEach(userIdArray::add); + json.add("userid_list", userIdArray); + } + if (departmentIdList != null && !departmentIdList.isEmpty()) { + JsonArray departmentIdArray = new JsonArray(); + departmentIdList.forEach(departmentIdArray::add); + json.add("department_id_list", departmentIdArray); + } String responseContent = cpService.post(url, json.toString()); return WxCpKfServicerOpResp.fromJson(responseContent); } From 0423e6849ddfef9bfcf90b39118145f054d7b0da Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Tue, 8 Apr 2025 08:39:24 +0800 Subject: [PATCH 19/25] =?UTF-8?q?:bookmark:=20=E5=8F=91=E5=B8=83=204.7.4.B?= =?UTF-8?q?=20=E6=B5=8B=E8=AF=95=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- solon-plugins/pom.xml | 2 +- solon-plugins/wx-java-channel-multi-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-channel-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-cp-multi-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-cp-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-miniapp-multi-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-miniapp-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-mp-multi-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-mp-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-open-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-pay-solon-plugin/pom.xml | 2 +- solon-plugins/wx-java-qidian-solon-plugin/pom.xml | 2 +- spring-boot-starters/pom.xml | 2 +- .../wx-java-channel-multi-spring-boot-starter/pom.xml | 2 +- .../wx-java-channel-spring-boot-starter/pom.xml | 2 +- .../wx-java-cp-multi-spring-boot-starter/pom.xml | 2 +- spring-boot-starters/wx-java-cp-spring-boot-starter/pom.xml | 2 +- .../wx-java-miniapp-multi-spring-boot-starter/pom.xml | 2 +- .../wx-java-miniapp-spring-boot-starter/pom.xml | 2 +- .../wx-java-mp-multi-spring-boot-starter/pom.xml | 2 +- spring-boot-starters/wx-java-mp-spring-boot-starter/pom.xml | 2 +- spring-boot-starters/wx-java-open-spring-boot-starter/pom.xml | 2 +- spring-boot-starters/wx-java-pay-spring-boot-starter/pom.xml | 2 +- spring-boot-starters/wx-java-qidian-spring-boot-starter/pom.xml | 2 +- weixin-graal/pom.xml | 2 +- weixin-java-channel/pom.xml | 2 +- weixin-java-common/pom.xml | 2 +- weixin-java-cp/pom.xml | 2 +- weixin-java-miniapp/pom.xml | 2 +- weixin-java-mp/pom.xml | 2 +- weixin-java-open/pom.xml | 2 +- weixin-java-pay/pom.xml | 2 +- weixin-java-qidian/pom.xml | 2 +- 34 files changed, 34 insertions(+), 34 deletions(-) diff --git a/pom.xml b/pom.xml index 2151c117a..5c00e66a7 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.github.binarywang wx-java - 4.7.3.B + 4.7.4.B pom WxJava - Weixin/Wechat Java SDK 微信开发Java SDK diff --git a/solon-plugins/pom.xml b/solon-plugins/pom.xml index 8dbc6b43d..3bec9cb54 100644 --- a/solon-plugins/pom.xml +++ b/solon-plugins/pom.xml @@ -6,7 +6,7 @@ com.github.binarywang wx-java - 4.7.3.B + 4.7.4.B pom wx-java-solon-plugins diff --git a/solon-plugins/wx-java-channel-multi-solon-plugin/pom.xml b/solon-plugins/wx-java-channel-multi-solon-plugin/pom.xml index fc2796117..84c14a101 100644 --- a/solon-plugins/wx-java-channel-multi-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-channel-multi-solon-plugin/pom.xml @@ -5,7 +5,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/solon-plugins/wx-java-channel-solon-plugin/pom.xml b/solon-plugins/wx-java-channel-solon-plugin/pom.xml index 83a00deac..6238a55e4 100644 --- a/solon-plugins/wx-java-channel-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-channel-solon-plugin/pom.xml @@ -3,7 +3,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/solon-plugins/wx-java-cp-multi-solon-plugin/pom.xml b/solon-plugins/wx-java-cp-multi-solon-plugin/pom.xml index 512cb41d4..742b86239 100644 --- a/solon-plugins/wx-java-cp-multi-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-cp-multi-solon-plugin/pom.xml @@ -4,7 +4,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/solon-plugins/wx-java-cp-solon-plugin/pom.xml b/solon-plugins/wx-java-cp-solon-plugin/pom.xml index f147e36ee..b758ff8a5 100644 --- a/solon-plugins/wx-java-cp-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-cp-solon-plugin/pom.xml @@ -4,7 +4,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/solon-plugins/wx-java-miniapp-multi-solon-plugin/pom.xml b/solon-plugins/wx-java-miniapp-multi-solon-plugin/pom.xml index b8387c3c0..52db2699b 100644 --- a/solon-plugins/wx-java-miniapp-multi-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-miniapp-multi-solon-plugin/pom.xml @@ -5,7 +5,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/solon-plugins/wx-java-miniapp-solon-plugin/pom.xml b/solon-plugins/wx-java-miniapp-solon-plugin/pom.xml index 712e1abfb..fd8643699 100644 --- a/solon-plugins/wx-java-miniapp-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-miniapp-solon-plugin/pom.xml @@ -4,7 +4,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/solon-plugins/wx-java-mp-multi-solon-plugin/pom.xml b/solon-plugins/wx-java-mp-multi-solon-plugin/pom.xml index 39df8cfef..4ba79c8a5 100644 --- a/solon-plugins/wx-java-mp-multi-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-mp-multi-solon-plugin/pom.xml @@ -5,7 +5,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/solon-plugins/wx-java-mp-solon-plugin/pom.xml b/solon-plugins/wx-java-mp-solon-plugin/pom.xml index cd2bca716..bea895694 100644 --- a/solon-plugins/wx-java-mp-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-mp-solon-plugin/pom.xml @@ -5,7 +5,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/solon-plugins/wx-java-open-solon-plugin/pom.xml b/solon-plugins/wx-java-open-solon-plugin/pom.xml index bbd6b39ab..80a5df100 100644 --- a/solon-plugins/wx-java-open-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-open-solon-plugin/pom.xml @@ -5,7 +5,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/solon-plugins/wx-java-pay-solon-plugin/pom.xml b/solon-plugins/wx-java-pay-solon-plugin/pom.xml index 31698e010..4dabbe46b 100644 --- a/solon-plugins/wx-java-pay-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-pay-solon-plugin/pom.xml @@ -5,7 +5,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/solon-plugins/wx-java-qidian-solon-plugin/pom.xml b/solon-plugins/wx-java-qidian-solon-plugin/pom.xml index 8a45c7284..23ad77ea1 100644 --- a/solon-plugins/wx-java-qidian-solon-plugin/pom.xml +++ b/solon-plugins/wx-java-qidian-solon-plugin/pom.xml @@ -3,7 +3,7 @@ wx-java-solon-plugins com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/spring-boot-starters/pom.xml b/spring-boot-starters/pom.xml index fbb85e686..7f185f9fe 100644 --- a/spring-boot-starters/pom.xml +++ b/spring-boot-starters/pom.xml @@ -6,7 +6,7 @@ com.github.binarywang wx-java - 4.7.3.B + 4.7.4.B pom wx-java-spring-boot-starters diff --git a/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/pom.xml index 4018347e6..e7faca156 100644 --- a/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/spring-boot-starters/wx-java-channel-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-channel-spring-boot-starter/pom.xml index 7b9ae6ee2..360c71d1a 100644 --- a/spring-boot-starters/wx-java-channel-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-channel-spring-boot-starter/pom.xml @@ -3,7 +3,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/pom.xml index 03cb191fe..a32306110 100644 --- a/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/pom.xml @@ -4,7 +4,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/spring-boot-starters/wx-java-cp-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-cp-spring-boot-starter/pom.xml index 8de92d3ee..37b185228 100644 --- a/spring-boot-starters/wx-java-cp-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-cp-spring-boot-starter/pom.xml @@ -4,7 +4,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/pom.xml index 886cf8f88..5736c9dec 100644 --- a/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/spring-boot-starters/wx-java-miniapp-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-miniapp-spring-boot-starter/pom.xml index a2f3aa742..41f449da3 100644 --- a/spring-boot-starters/wx-java-miniapp-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-miniapp-spring-boot-starter/pom.xml @@ -4,7 +4,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/spring-boot-starters/wx-java-mp-multi-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-mp-multi-spring-boot-starter/pom.xml index 3f3ecc50d..11680de01 100644 --- a/spring-boot-starters/wx-java-mp-multi-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-mp-multi-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/spring-boot-starters/wx-java-mp-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-mp-spring-boot-starter/pom.xml index ab6d89e6f..20a527eba 100644 --- a/spring-boot-starters/wx-java-mp-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-mp-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/spring-boot-starters/wx-java-open-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-open-spring-boot-starter/pom.xml index cdb43685f..95d3a9941 100644 --- a/spring-boot-starters/wx-java-open-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-open-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/spring-boot-starters/wx-java-pay-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-pay-spring-boot-starter/pom.xml index 1aa1dc6f6..9a415ef12 100644 --- a/spring-boot-starters/wx-java-pay-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-pay-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/spring-boot-starters/wx-java-qidian-spring-boot-starter/pom.xml b/spring-boot-starters/wx-java-qidian-spring-boot-starter/pom.xml index c38a1d350..795cfcbe7 100644 --- a/spring-boot-starters/wx-java-qidian-spring-boot-starter/pom.xml +++ b/spring-boot-starters/wx-java-qidian-spring-boot-starter/pom.xml @@ -3,7 +3,7 @@ wx-java-spring-boot-starters com.github.binarywang - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/weixin-graal/pom.xml b/weixin-graal/pom.xml index ab9ec8c91..323df0d86 100644 --- a/weixin-graal/pom.xml +++ b/weixin-graal/pom.xml @@ -6,7 +6,7 @@ com.github.binarywang wx-java - 4.7.3.B + 4.7.4.B weixin-graal diff --git a/weixin-java-channel/pom.xml b/weixin-java-channel/pom.xml index 76be718a4..3264a2fe9 100644 --- a/weixin-java-channel/pom.xml +++ b/weixin-java-channel/pom.xml @@ -6,7 +6,7 @@ com.github.binarywang wx-java - 4.7.3.B + 4.7.4.B weixin-java-channel diff --git a/weixin-java-common/pom.xml b/weixin-java-common/pom.xml index 88e1b2c3f..d45cc46d4 100644 --- a/weixin-java-common/pom.xml +++ b/weixin-java-common/pom.xml @@ -6,7 +6,7 @@ com.github.binarywang wx-java - 4.7.3.B + 4.7.4.B weixin-java-common diff --git a/weixin-java-cp/pom.xml b/weixin-java-cp/pom.xml index 95d067244..23cdd4d22 100644 --- a/weixin-java-cp/pom.xml +++ b/weixin-java-cp/pom.xml @@ -7,7 +7,7 @@ com.github.binarywang wx-java - 4.7.3.B + 4.7.4.B weixin-java-cp diff --git a/weixin-java-miniapp/pom.xml b/weixin-java-miniapp/pom.xml index 500add0e4..3c5c3fd95 100644 --- a/weixin-java-miniapp/pom.xml +++ b/weixin-java-miniapp/pom.xml @@ -7,7 +7,7 @@ com.github.binarywang wx-java - 4.7.3.B + 4.7.4.B weixin-java-miniapp diff --git a/weixin-java-mp/pom.xml b/weixin-java-mp/pom.xml index dde82cf5d..0b8adf038 100644 --- a/weixin-java-mp/pom.xml +++ b/weixin-java-mp/pom.xml @@ -7,7 +7,7 @@ com.github.binarywang wx-java - 4.7.3.B + 4.7.4.B weixin-java-mp diff --git a/weixin-java-open/pom.xml b/weixin-java-open/pom.xml index e94059131..d09746719 100644 --- a/weixin-java-open/pom.xml +++ b/weixin-java-open/pom.xml @@ -7,7 +7,7 @@ com.github.binarywang wx-java - 4.7.3.B + 4.7.4.B weixin-java-open diff --git a/weixin-java-pay/pom.xml b/weixin-java-pay/pom.xml index f66456aa4..4525620d7 100644 --- a/weixin-java-pay/pom.xml +++ b/weixin-java-pay/pom.xml @@ -5,7 +5,7 @@ com.github.binarywang wx-java - 4.7.3.B + 4.7.4.B 4.0.0 diff --git a/weixin-java-qidian/pom.xml b/weixin-java-qidian/pom.xml index 4e96a904b..f7f0d9ac6 100644 --- a/weixin-java-qidian/pom.xml +++ b/weixin-java-qidian/pom.xml @@ -7,7 +7,7 @@ com.github.binarywang wx-java - 4.7.3.B + 4.7.4.B weixin-java-qidian From 89280abd004b3691a53003bca9c73675c9c1c956 Mon Sep 17 00:00:00 2001 From: Holy <34299400+holylcd@users.noreply.github.com> Date: Mon, 14 Apr 2025 11:32:34 +0800 Subject: [PATCH 20/25] =?UTF-8?q?:art:=20=20#3547=E3=80=90=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E6=94=AF=E4=BB=98=E3=80=91=E4=BF=AE=E5=A4=8D=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E5=99=A8=E6=9C=AA=E6=AD=A3=E7=A1=AE=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E5=AF=BC=E8=87=B4=E7=9A=84v3=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E6=9E=84=E9=80=A0=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wxpay/config/VerifierBuilder.java | 131 ++++++++++++++++++ .../binarywang/wxpay/config/WxPayConfig.java | 28 ++-- 2 files changed, 139 insertions(+), 20 deletions(-) create mode 100644 weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/VerifierBuilder.java diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/VerifierBuilder.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/VerifierBuilder.java new file mode 100644 index 000000000..c7bc14f52 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/VerifierBuilder.java @@ -0,0 +1,131 @@ +package com.github.binarywang.wxpay.config; + +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.v3.auth.*; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.nio.charset.StandardCharsets; +import java.security.PrivateKey; +import java.security.PublicKey; + +/** + * 验证器构建. + * + * @author holy + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +class VerifierBuilder { + /** + * 构建验证器. + *

+ * 场景 + *

+   *   1. 老商户号,只有平台证书,未开通公钥 (已验证)
+   *   2. 新商户号,被强制开通公钥,没有平台证书 (已验证)
+   *   3. 老商户号,有平台证书,主动开通公钥 (未验证,具备条件的朋友,可以帮忙验证下)
+   *   ...
+   * 
+ * + * @param certSerialNo c + * @param mchId m + * @param apiV3Key a + * @param merchantPrivateKey m + * @param wxPayHttpProxy w + * @param certAutoUpdateTime c + * @param payBaseUrl p + * @param publicKeyId p + * @param publicKey p + * @return v + * @throws WxPayException e + */ + @SuppressWarnings("java:S107") + static Verifier build( + // 平台证书 - 依赖参数 + String certSerialNo, + String mchId, + String apiV3Key, + PrivateKey merchantPrivateKey, + WxPayHttpProxy wxPayHttpProxy, + int certAutoUpdateTime, + String payBaseUrl, + // 公钥 - 依赖参数 + String publicKeyId, + PublicKey publicKey + ) throws WxPayException { + Verifier certificatesVerifier = null; + Exception ex = null; + + // 构建平台证书验证器 + // (沿用旧逻辑)优先构建平台证书验证器,因为公钥验证器需要平台证书验证器 (见以下 .setOtherVerifier ) + // 新商户号默认无平台证书,已确认无法构建平台证书验证器,会抛出异常;老商户号,有平台证书主动开通公钥的情况,待具备条件的朋友验证 + // 建议公钥模式稳定后,优先构建公钥验证器,以免每次都尝试构建平台证书验证器,且失败 {@link com.github.binarywang.wxpay.v3.auth.PublicCertificateVerifier.verify} + if (merchantPrivateKey != null && StringUtils.isNoneBlank(certSerialNo, apiV3Key)) { + try { + certificatesVerifier = getCertificatesVerifier( + certSerialNo, mchId, apiV3Key, merchantPrivateKey, wxPayHttpProxy, certAutoUpdateTime, payBaseUrl + ); + } catch (Exception e) { + ex = e; + } + } + + // 构建公钥验证器 + if (publicKey != null && StringUtils.isNotBlank(publicKeyId)) { + try { + certificatesVerifier = getPublicCertVerifier(publicKeyId, publicKey, certificatesVerifier); + } catch (Exception e) { + ex = e; + } + } + if (certificatesVerifier != null) { + return certificatesVerifier; + } + + // 有异常时抛出 + if (ex != null) { + throw new WxPayException(ex.getMessage(), ex); + } + + // 没有证书验证器时。不确定是否抛出异常,沿用之前逻辑,返回 null + return null; + } + + /** + * 获取证书验证器. + * + * @param certSerialNo certSerialNo + * @param mchId mchId + * @param apiV3Key apiV3Key + * @param merchantPrivateKey merchantPrivateKey + * @param wxPayHttpProxy wxPayHttpProxy + * @param certAutoUpdateTime certAutoUpdateTime + * @param payBaseUrl payBaseUrl + * @return verifier + */ + private static AutoUpdateCertificatesVerifier getCertificatesVerifier( + String certSerialNo, String mchId, String apiV3Key, PrivateKey merchantPrivateKey, + WxPayHttpProxy wxPayHttpProxy, int certAutoUpdateTime, String payBaseUrl + ) { + return new AutoUpdateCertificatesVerifier( + new WxPayCredentials(mchId, new PrivateKeySigner(certSerialNo, merchantPrivateKey)), + apiV3Key.getBytes(StandardCharsets.UTF_8), certAutoUpdateTime, + payBaseUrl, wxPayHttpProxy); + } + + /** + * 获取公钥验证器. + * + * @param publicKeyId id + * @param publicKey key + * @param certificatesVerifier verifier + * @return verifier + */ + private static Verifier getPublicCertVerifier(String publicKeyId, PublicKey publicKey, Verifier certificatesVerifier) { + Verifier publicCertificatesVerifier = new PublicCertificateVerifier(publicKey, publicKeyId); + publicCertificatesVerifier.setOtherVerifier(certificatesVerifier); + certificatesVerifier = publicCertificatesVerifier; + return certificatesVerifier; + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java index 7a14ea152..43f41e963 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java @@ -4,7 +4,8 @@ import com.github.binarywang.wxpay.util.HttpProxyUtils; import com.github.binarywang.wxpay.util.ResourcesUtils; import com.github.binarywang.wxpay.v3.WxPayV3HttpClientBuilder; -import com.github.binarywang.wxpay.v3.auth.*; +import com.github.binarywang.wxpay.v3.auth.Verifier; +import com.github.binarywang.wxpay.v3.auth.WxPayValidator; import com.github.binarywang.wxpay.v3.util.PemUtils; import lombok.Data; import lombok.EqualsAndHashCode; @@ -19,7 +20,6 @@ import javax.net.ssl.SSLContext; import java.io.*; import java.net.URL; -import java.nio.charset.StandardCharsets; import java.security.KeyStore; import java.security.PrivateKey; import java.security.PublicKey; @@ -320,7 +320,12 @@ public CloseableHttpClient initApiV3HttpClient() throws WxPayException { //构造Http Proxy正向代理 WxPayHttpProxy wxPayHttpProxy = getWxPayHttpProxy(); - Verifier certificatesVerifier = getVerifier(merchantPrivateKey, wxPayHttpProxy, publicKey); + // 构造证书验签器 + Verifier certificatesVerifier = VerifierBuilder.build( + this.getCertSerialNo(), this.getMchId(), this.getApiV3Key(), merchantPrivateKey, wxPayHttpProxy, + this.getCertAutoUpdateTime(), this.getPayBaseUrl(), + this.getPublicKeyId(), publicKey + ); WxPayV3HttpClientBuilder wxPayV3HttpClientBuilder = WxPayV3HttpClientBuilder.create() .withMerchant(mchId, certSerialNo, merchantPrivateKey) @@ -346,23 +351,6 @@ public CloseableHttpClient initApiV3HttpClient() throws WxPayException { } } - private Verifier getVerifier(PrivateKey merchantPrivateKey, WxPayHttpProxy wxPayHttpProxy, PublicKey publicKey) { - Verifier certificatesVerifier = null; - // 如果配置了平台证书,则初始化验证器以备v2版本接口验签(公钥灰度实现) - if (this.getPrivateCertPath() != null && this.getPrivateKeyPath() != null) { - certificatesVerifier = new AutoUpdateCertificatesVerifier( - new WxPayCredentials(mchId, new PrivateKeySigner(certSerialNo, merchantPrivateKey)), - this.getApiV3Key().getBytes(StandardCharsets.UTF_8), this.getCertAutoUpdateTime(), - this.getPayBaseUrl(), wxPayHttpProxy); - } - if (publicKey != null) { - Verifier publicCertificatesVerifier = new PublicCertificateVerifier(publicKey, publicKeyId); - publicCertificatesVerifier.setOtherVerifier(certificatesVerifier); - certificatesVerifier = publicCertificatesVerifier; - } - return certificatesVerifier; - } - /** * 初始化一个WxPayHttpProxy对象 * From e16e0e93735884472300c7e77df63e4d586ec11d Mon Sep 17 00:00:00 2001 From: HerveyHall Date: Tue, 15 Apr 2025 15:14:12 +0800 Subject: [PATCH 21/25] =?UTF-8?q?:art:=20#3548=E3=80=90=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E3=80=91=E4=BF=AE=E5=A4=8D=E5=85=AC=E9=92=A5?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8BV3=E6=8E=A5=E5=8F=A3=E6=9C=AA?= =?UTF-8?q?=E8=AE=BE=E7=BD=AEWechatpay-Serial=E8=AF=B7=E6=B1=82=E5=A4=B4?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=9A=84=E9=AA=8C=E7=AD=BE=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../binarywang/wxpay/config/WxPayConfig.java | 5 +++ .../service/impl/BaseWxPayServiceImpl.java | 34 +++++++++---------- .../impl/WxPayServiceApacheHttpImpl.java | 3 ++ 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java index 43f41e963..2cfec2bc1 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java @@ -227,6 +227,11 @@ public class WxPayConfig { */ private Verifier verifier; + /** + * 是否将全部v3接口的请求都添加Wechatpay-Serial请求头,默认不添加 + */ + private boolean strictlyNeedWechatPaySerial = false; + /** * 返回所设置的微信支付接口请求地址域名. * diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java index 05d1f8c22..530609a7d 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java @@ -251,7 +251,7 @@ public WxPayRefundResult refundV2(WxPayRefundRequest request) throws WxPayExcept @Override public WxPayRefundV3Result refundV3(WxPayRefundV3Request request) throws WxPayException { String url = String.format("%s/v3/refund/domestic/refunds", this.getPayBaseUrl()); - String response = this.postV3(url, GSON.toJson(request)); + String response = this.postV3WithWechatpaySerial(url, GSON.toJson(request)); return GSON.fromJson(response, WxPayRefundV3Result.class); } @@ -294,21 +294,21 @@ public WxPayRefundQueryResult refundQueryV2(WxPayRefundQueryRequest request) thr @Override public WxPayRefundQueryV3Result refundQueryV3(String outRefundNo) throws WxPayException { String url = String.format("%s/v3/refund/domestic/refunds/%s", this.getPayBaseUrl(), outRefundNo); - String response = this.getV3(url); + String response = this.getV3WithWechatPaySerial(url); return GSON.fromJson(response, WxPayRefundQueryV3Result.class); } @Override public WxPayRefundQueryV3Result refundQueryV3(WxPayRefundQueryV3Request request) throws WxPayException { String url = String.format("%s/v3/refund/domestic/refunds/%s", this.getPayBaseUrl(), request.getOutRefundNo()); - String response = this.getV3(url); + String response = this.getV3WithWechatPaySerial(url); return GSON.fromJson(response, WxPayRefundQueryV3Result.class); } @Override public WxPayRefundQueryV3Result refundPartnerQueryV3(WxPayRefundQueryV3Request request) throws WxPayException { String url = String.format("%s/v3/refund/domestic/refunds/%s?sub_mchid=%s", this.getPayBaseUrl(), request.getOutRefundNo(), request.getSubMchid()); - String response = this.getV3(url); + String response = this.getV3WithWechatPaySerial(url); return GSON.fromJson(response, WxPayRefundQueryV3Result.class); } @@ -523,7 +523,7 @@ public WxPayOrderQueryV3Result queryOrderV3(WxPayOrderQueryV3Request request) th url = String.format("%s/v3/pay/transactions/id/%s", this.getPayBaseUrl(), request.getTransactionId()); } String query = String.format("?mchid=%s", request.getMchid()); - String response = this.getV3(url + query); + String response = this.getV3WithWechatPaySerial(url + query); return GSON.fromJson(response, WxPayOrderQueryV3Result.class); } @@ -548,14 +548,14 @@ public WxPayPartnerOrderQueryV3Result queryPartnerOrderV3(WxPayPartnerOrderQuery url = String.format("%s/v3/pay/partner/transactions/id/%s", this.getPayBaseUrl(), request.getTransactionId()); } String query = String.format("?sp_mchid=%s&sub_mchid=%s", request.getSpMchId(), request.getSubMchId()); - String response = this.getV3(url + query); + String response = this.getV3WithWechatPaySerial(url + query); return GSON.fromJson(response, WxPayPartnerOrderQueryV3Result.class); } @Override public CombineQueryResult queryCombine(String combineOutTradeNo) throws WxPayException { String url = String.format("%s/v3/combine-transactions/out-trade-no/%s", this.getPayBaseUrl(), combineOutTradeNo); - String response = this.getV3(url); + String response = this.getV3WithWechatPaySerial(url); return GSON.fromJson(response, CombineQueryResult.class); } @@ -609,7 +609,7 @@ public void closeOrderV3(WxPayOrderCloseV3Request request) throws WxPayException request.setMchid(this.getConfig().getMchId()); } String url = String.format("%s/v3/pay/transactions/out-trade-no/%s/close", this.getPayBaseUrl(), request.getOutTradeNo()); - this.postV3(url, GSON.toJson(request)); + this.postV3WithWechatpaySerial(url, GSON.toJson(request)); } @Override @@ -621,13 +621,13 @@ public void closePartnerOrderV3(WxPayPartnerOrderCloseV3Request request) throws request.setSubMchId(this.getConfig().getSubMchId()); } String url = String.format("%s/v3/pay/partner/transactions/out-trade-no/%s/close", this.getPayBaseUrl(), request.getOutTradeNo()); - this.postV3(url, GSON.toJson(request)); + this.postV3WithWechatpaySerial(url, GSON.toJson(request)); } @Override public void closeCombine(CombineCloseRequest request) throws WxPayException { String url = String.format("%s/v3/combine-transactions/out-trade-no/%s/close", this.getPayBaseUrl(), request.getCombineOutTradeNo()); - this.postV3(url, GSON.toJson(request)); + this.postV3WithWechatpaySerial(url, GSON.toJson(request)); } @Override @@ -771,7 +771,7 @@ public WxPayUnifiedOrderV3Result unifiedPartnerOrderV3(TradeTypeEnum tradeType, } String url = this.getPayBaseUrl() + tradeType.getBasePartnerUrl(); - String response = this.postV3(url, GSON.toJson(request)); + String response = this.postV3WithWechatpaySerial(url, GSON.toJson(request)); return GSON.fromJson(response, WxPayUnifiedOrderV3Result.class); } @@ -788,7 +788,7 @@ public WxPayUnifiedOrderV3Result unifiedOrderV3(TradeTypeEnum tradeType, WxPayUn } String url = this.getPayBaseUrl() + tradeType.getPartnerUrl(); - String response = this.postV3(url, GSON.toJson(request)); + String response = this.postV3WithWechatpaySerial(url, GSON.toJson(request)); return GSON.fromJson(response, WxPayUnifiedOrderV3Result.class); } @@ -801,7 +801,7 @@ public CombineTransactionsResult combine(TradeTypeEnum tradeType, CombineTransac request.setCombineMchid(this.getConfig().getMchId()); } String url = this.getPayBaseUrl() + tradeType.getCombineUrl(); - String response = this.postV3(url, GSON.toJson(request)); + String response = this.postV3WithWechatpaySerial(url, GSON.toJson(request)); return GSON.fromJson(response, CombineTransactionsResult.class); } @@ -1114,7 +1114,7 @@ public WxPayApplyBillV3Result applyTradeBill(WxPayApplyTradeBillV3Request reques } else { url = String.format("%s/v3/bill/tradebill?bill_date=%s&bill_type=%s&tar_type=%s", this.getPayBaseUrl(), request.getBillDate(), request.getBillType(), request.getTarType()); } - String response = this.getV3(url); + String response = this.getV3WithWechatPaySerial(url); return GSON.fromJson(response, WxPayApplyBillV3Result.class); } @@ -1126,7 +1126,7 @@ public WxPayApplyBillV3Result applyFundFlowBill(WxPayApplyFundFlowBillV3Request } else { url = String.format("%s/v3/bill/fundflowbill?bill_date=%s&account_type=%s&tar_type=%s", this.getPayBaseUrl(), request.getBillDate(), request.getAccountType(), request.getTarType()); } - String response = this.getV3(url); + String response = this.getV3WithWechatPaySerial(url); return GSON.fromJson(response, WxPayApplyBillV3Result.class); } @@ -1155,7 +1155,7 @@ public WxPayCodepayResult codepay(WxPayCodepayRequest request) throws WxPayExcep request.setMchid(this.getConfig().getMchId()); } String url = String.format("%s/v3/pay/transactions/codepay", this.getPayBaseUrl()); - String body = this.postV3(url, GSON.toJson(request)); + String body = this.postV3WithWechatpaySerial(url, GSON.toJson(request)); return GSON.fromJson(body, WxPayCodepayResult.class); } @@ -1181,7 +1181,7 @@ public WxPayOrderReverseV3Result reverseOrderV3(WxPayOrderReverseV3Request reque } // 拼接参数请求路径并发送 String url = String.format("%s/v3/pay/transactions/out-trade-no/%s/reverse", this.getPayBaseUrl(), request.getOutTradeNo()); - String response = this.postV3(url, GSON.toJson(request)); + String response = this.postV3WithWechatpaySerial(url, GSON.toJson(request)); return GSON.fromJson(response, WxPayOrderReverseV3Result.class); } diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java index d8ba95971..f57ff13d4 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java @@ -243,6 +243,9 @@ public String requestV3(String url, HttpRequestBase httpRequest) throws WxPayExc @Override public String getV3(String url) throws WxPayException { + if (this.getConfig().isStrictlyNeedWechatPaySerial()) { + return getV3WithWechatPaySerial(url); + } HttpGet httpGet = new HttpGet(url); httpGet.addHeader(ACCEPT, APPLICATION_JSON); httpGet.addHeader(CONTENT_TYPE, APPLICATION_JSON); From bb76db052d8e9dd7a8a2a4efc88a61b445691544 Mon Sep 17 00:00:00 2001 From: Henry Heng Date: Tue, 15 Apr 2025 19:32:54 +0800 Subject: [PATCH 22/25] =?UTF-8?q?:art:=20#3554=E3=80=90=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E3=80=91=E4=BF=AE=E5=A4=8D=E5=AE=A1=E6=89=B9?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E8=8A=82=E7=82=B9=E8=8E=B7=E5=8F=96=E4=B8=8D?= =?UTF-8?q?=E5=88=B0=E7=94=A8=E6=88=B7ID=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../me/chanjar/weixin/cp/bean/message/WxCpXmlApprovalInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlApprovalInfo.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlApprovalInfo.java index 7193c7cf6..997a463f9 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlApprovalInfo.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlApprovalInfo.java @@ -190,7 +190,7 @@ public static class Item implements Serializable { /** * 分支审批人userid */ - @XStreamAlias("ItemUserid") + @XStreamAlias("ItemUserId") @XStreamConverter(value = XStreamCDataConverter.class) private String itemUserId; From 3718b499a0f7f69ea432d78bc0065d4f627d598f Mon Sep 17 00:00:00 2001 From: Henry Heng Date: Wed, 16 Apr 2025 10:43:55 +0800 Subject: [PATCH 23/25] =?UTF-8?q?:art:=20#3554=E3=80=90=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E3=80=91=E4=BF=AE=E5=A4=8D=E5=AE=A1=E6=89=B9?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E8=8A=82=E7=82=B9=E8=8E=B7=E5=8F=96=E4=B8=8D?= =?UTF-8?q?=E5=88=B0=E7=94=A8=E6=88=B7ID=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../me/chanjar/weixin/cp/bean/message/WxCpXmlApprovalInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlApprovalInfo.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlApprovalInfo.java index 997a463f9..798a5c8b0 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlApprovalInfo.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlApprovalInfo.java @@ -118,7 +118,7 @@ public static class NotifyNode implements Serializable { /** * 抄送人userid */ - @XStreamAlias("ItemUserid") + @XStreamAlias("ItemUserId") @XStreamConverter(value = XStreamCDataConverter.class) private String itemUserId; From 59f5a99fda363cb426f90f50d714a5c3d3cbe3d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A5=BF=E4=B8=9C?= Date: Mon, 21 Apr 2025 09:55:13 +0800 Subject: [PATCH 24/25] =?UTF-8?q?:new:=20=E6=B7=BB=E5=8A=A0wx-java-channel?= =?UTF-8?q?-solon-plugin=20README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- solon-plugins/pom.xml | 2 +- .../wx-java-channel-solon-plugin/README.md | 92 +++++++++++++++++++ 2 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 solon-plugins/wx-java-channel-solon-plugin/README.md diff --git a/solon-plugins/pom.xml b/solon-plugins/pom.xml index 3bec9cb54..8d14b4461 100644 --- a/solon-plugins/pom.xml +++ b/solon-plugins/pom.xml @@ -14,7 +14,7 @@ WxJava 各个模块的 Solon Plugin - 3.0.1 + 3.2.0 diff --git a/solon-plugins/wx-java-channel-solon-plugin/README.md b/solon-plugins/wx-java-channel-solon-plugin/README.md new file mode 100644 index 000000000..a7168a8ed --- /dev/null +++ b/solon-plugins/wx-java-channel-solon-plugin/README.md @@ -0,0 +1,92 @@ +# wx-java-channel-solon-plugin + +## 快速开始 +1. 引入依赖 + ```xml + + + com.github.binarywang + wx-java-channel-solon-plugin + ${version} + + + + + redis.clients + jedis + ${jedis.version} + + + + + org.redisson + redisson + ${redisson.version} + + + ``` +2. 添加配置(app.properties) + ```properties + # 视频号配置(必填) + ## 视频号小店的appId和secret + wx.channel.app-id=@appId + wx.channel.secret=@secret + # 视频号配置 选填 + ## 设置视频号小店消息服务器配置的token + wx.channel.token=@token + ## 设置视频号小店消息服务器配置的EncodingAESKey + wx.channel.aes-key= + ## 支持JSON或者XML格式,默认JSON + wx.channel.msg-data-format=JSON + ## 是否使用稳定版 Access Token + wx.channel.use-stable-access-token=false + + + # ConfigStorage 配置(选填) + ## 配置类型: memory(默认), jedis, redisson, redis_template + wx.channel.config-storage.type=memory + ## 相关redis前缀配置: wx:channel(默认) + wx.channel.config-storage.key-prefix=wx:channel + wx.channel.config-storage.redis.host=127.0.0.1 + wx.channel.config-storage.redis.port=6379 + wx.channel.config-storage.redis.password=123456 + + + # http 客户端配置(选填) + ## # http客户端类型: http_client(默认) + wx.channel.config-storage.http-client-type=http_client + wx.channel.config-storage.http-proxy-host= + wx.channel.config-storage.http-proxy-port= + wx.channel.config-storage.http-proxy-username= + wx.channel.config-storage.http-proxy-password= + ## 最大重试次数,默认:5 次,如果小于 0,则为 0 + wx.channel.config-storage.max-retry-times=5 + ## 重试时间间隔步进,默认:1000 毫秒,如果小于 0,则为 1000 + wx.channel.config-storage.retry-sleep-millis=1000 + ``` +3. 自动注入的类型 +- `WxChannelService` +- `WxChannelConfig` +4. 使用样例 + +```java +import me.chanjar.weixin.channel.api.WxChannelService; +import me.chanjar.weixin.channel.bean.shop.ShopInfoResponse; +import me.chanjar.weixin.channel.util.JsonUtils; +import me.chanjar.weixin.common.error.WxErrorException; +import org.noear.solon.annotation.Inject; + +@Component +public class DemoService { + @Inject + private WxChannelService wxChannelService; + + public String getShopInfo() throws WxErrorException { + // 获取店铺基本信息 + ShopInfoResponse response = wxChannelService.getBasicService().getShopInfo(); + // 此处为演示,如果要返回response的结果,建议自己封装一个VO,避免直接返回response + return JsonUtils.encode(response); + } +} +``` + From 6a4ed91ae2bedee4c65edf749f2de6cfd4b2a847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=8B=E4=BA=BAA?= <2330172120@qq.com> Date: Mon, 21 Apr 2025 09:58:51 +0800 Subject: [PATCH 25/25] =?UTF-8?q?:art:=20#3558=20=E3=80=90=E4=BC=81?= =?UTF-8?q?=E4=B8=9A=E5=BE=AE=E4=BF=A1=E3=80=91=E4=BF=AE=E5=A4=8D=E4=BC=9A?= =?UTF-8?q?=E8=AF=9D=E5=86=85=E5=AE=B9=E5=AD=98=E6=A1=A3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=A7=A3=E5=AF=86=E7=9A=84=E8=81=8A=E5=A4=A9?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=97=B6=E6=96=87=E4=BB=B6=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E5=87=BA=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/me/chanjar/weixin/cp/bean/msgaudit/WxCpChatModel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/msgaudit/WxCpChatModel.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/msgaudit/WxCpChatModel.java index 8a9d2130d..c88cb7b9b 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/msgaudit/WxCpChatModel.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/msgaudit/WxCpChatModel.java @@ -603,7 +603,7 @@ public static class File implements Serializable { private String sdkFileId; @SerializedName("filesize") - private Integer fileSize; + private Long fileSize; /** * From json file.