diff --git a/nxhs-service/src/main/java/cc/yunxi/service/impl/ClientServiceImpl.java b/nxhs-service/src/main/java/cc/yunxi/service/impl/ClientServiceImpl.java index ea0b832..f9532b9 100644 --- a/nxhs-service/src/main/java/cc/yunxi/service/impl/ClientServiceImpl.java +++ b/nxhs-service/src/main/java/cc/yunxi/service/impl/ClientServiceImpl.java @@ -166,22 +166,23 @@ public class ClientServiceImpl extends ServiceImpl impleme @Override @Transactional(rollbackFor = Exception.class) public void cashBalance(String openId, Integer amount) throws Exception { - // 模拟提现成功 this.changeBalance(openId, new BigDecimal(amount), null, null, BalanceChangeTypeEnum.CASH_OUT); - /* BatchTransferModel batchTransferModel = new BatchTransferModel() + // 微信提现(单位:分) + amount = amount * 100; + BatchTransferModel batchTransferModel = new BatchTransferModel() .setAppid(wxPayV3Properties.getAppId()) .setOut_batch_no(PayKit.generateStr()) - .setBatch_name("测试商户转账到零钱") - .setBatch_remark("测试商户转账到零钱") + .setBatch_name("提现到零钱") + .setBatch_remark("提现到零钱") .setTotal_amount(amount) .setTotal_num(1) .setTransfer_detail_list(Collections.singletonList( new TransferDetailInput() .setOut_detail_no(PayKit.generateStr()) - .setTransfer_amount(1) - .setTransfer_remark("测试商户转账到零钱") - .setOpenid(openId))); - + .setTransfer_amount(amount) + .setTransfer_remark("提现到零钱") + .setOpenid(openId)) + ); log.info("发起商家转账请求参数 {}", JSONUtil.toJsonStr(batchTransferModel)); // 删除 IJPayHttpResponse response = WxPayApi.v3( @@ -195,8 +196,8 @@ public class ClientServiceImpl extends ServiceImpl impleme JSONUtil.toJsonStr(batchTransferModel) ); log.info("发起商家转账响应 {}", response); -// 根据证书序列号查询对应的证书来验证签名结果 - boolean verifySignature = WxPayKit.verifySignature(response, wxPayV3Properties.getPlatformCertPath()); +// 验证签名不校验 +// boolean verifySignature = WxPayKit.verifySignature(response, wxPayV3Properties.getPlatformCertPath()); // log.info("verifySignature: {}", verifySignature); // if (response.getStatus() == OK && verifySignature) { // return response.getBody(); @@ -204,7 +205,7 @@ public class ClientServiceImpl extends ServiceImpl impleme if (response.getStatus() != OK) { throw new BizIllegalException("提现失败"); } -// return response.getBody(); */ +// return response.getBody(); } @@ -271,7 +272,7 @@ public class ClientServiceImpl extends ServiceImpl impleme accountBill.setAccountBalance(fund); accountBill.setPayoutAmount(amount); accountBill.setOrderNumber(orderNo); - accountBill.setRemark("支付给散户"+ amountStr + "元"); + accountBill.setRemark("支付给散户" + amountStr + "元"); accountBill.setCreatorTime(now); accountBillMapper.insert(accountBill); @@ -280,7 +281,7 @@ public class ClientServiceImpl extends ServiceImpl impleme throw new BizIllegalException("余额不足"); } balance = balance.subtract(amount); - remark = "微信提现" + amountStr + "元"; + remark = "微信提现" + amountStr + "元"; } // 更新散户余额 client.setBanlance(balance);