Skip to content

Commit

Permalink
me.chanjar.weixin.common.error.WxErrorException: 错误代码:-99, 错误信息:平台签名验…
Browse files Browse the repository at this point in the history
…证错误 binarywang#2714
  • Loading branch information
gxh0797 authored and guoxianhui committed Jul 27, 2022
1 parent 44ce1e9 commit 30e6a14
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public BindAccountResponse getBindAccount() throws WxErrorException {
*/
@Override
public AddOrderResponse addOrder(final AddOrderRequest request) throws WxErrorException {
request.getDeliverySign();
return this.parse(this.wxMaService.post(WxMaApiUrlConstants.InstantDelivery.PlaceAnOrder.ADD_ORDER, request),
AddOrderResponse.class);
}
Expand All @@ -115,6 +116,7 @@ public AddOrderResponse addOrder(final AddOrderRequest request) throws WxErrorEx
*/
@Override
public GetOrderResponse getOrder(final GetOrderRequest request) throws WxErrorException {
request.getDeliverySign();
return this.parse(this.wxMaService.post(WxMaApiUrlConstants.InstantDelivery.GET_ORDER, request),
GetOrderResponse.class);
}
Expand All @@ -131,6 +133,7 @@ public GetOrderResponse getOrder(final GetOrderRequest request) throws WxErrorEx
*/
@Override
public CancelOrderResponse cancelOrder(final CancelOrderRequest request) throws WxErrorException {
request.getDeliverySign();
return this.parse(this.wxMaService.post(WxMaApiUrlConstants.InstantDelivery.Cancel.CANCEL_ORDER, request),
CancelOrderResponse.class);
}
Expand All @@ -147,6 +150,7 @@ public CancelOrderResponse cancelOrder(final CancelOrderRequest request) throws
*/
@Override
public AbnormalConfirmResponse abnormalConfirm(final AbnormalConfirmRequest request) throws WxErrorException {
request.getDeliverySign();
return this.parse(this.wxMaService.post(WxMaApiUrlConstants.InstantDelivery.Cancel.ABNORMAL_CONFIRM, request),
AbnormalConfirmResponse.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ public String getDeliverySign() {
str = str.concat(getShopOrderId());
}
str = str.concat(getAppSecret());
return DigestUtils.sha1Hex(str);
this.deliverySign = DigestUtils.sha1Hex(str);
return this.deliverySign;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package cn.binarywang.wx.miniapp.test;

import cn.binarywang.wx.miniapp.bean.delivery.AddOrderRequest;
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
import org.testng.annotations.Test;

public class AddOrderJsonTest {

/**
* 验证转化Json时是否有deliverySign
*/
@Test
public void test(){
AddOrderRequest request = new AddOrderRequest();
request.setShopId("1");
request.setAppSecret("2");
request.getDeliverySign();
System.out.printf(WxGsonBuilder.create().toJson(request));
}
}

1 comment on commit 30e6a14

@Kidwind
Copy link

@Kidwind Kidwind commented on 30e6a14 Aug 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉这个修补方式不太理想

Please sign in to comment.