优化:支付功能(10550)

This commit is contained in:
2025-07-26 15:15:42 +08:00
parent 29ee53f79d
commit e051fcc2de
2 changed files with 10 additions and 15 deletions

View File

@@ -110,7 +110,7 @@ public class ShopOrderController extends BaseController {
return fail("捐款金额最低不能少于10元感谢您的爱心捐赠^_^");
}
// 测试支付
if (loginUser.getUserId().equals(28748)) {
if (loginUser.getPhone().equals("13737128880")) {
shopOrder.setPrice(new BigDecimal("0.01"));
shopOrder.setTotalPrice(new BigDecimal("0.01"));
}

View File

@@ -204,25 +204,20 @@
final PaymentParam paymentParam = new PaymentParam();
paymentParam.setType(order.getPayType());
final List<Payment> payments = paymentService.listRel(paymentParam);
if (payments.isEmpty()) {
throw new BusinessException("请完成支付配置");
}
return payments.get(0);
}
/**
* 构建微信支付
* @param order
* @return
*/
public JsapiServiceExtension getWxService(ShopOrder order) {
// Integer payType = order.getPayType();
final String uploadPath = config.getUploadPath(); // 服务器本地路径
// final HashMap<String, String> orderInfo = new HashMap<>();
// 微信小程序(微信支付)
// String key = "mp-weixin:".concat(order.getTenantId().toString());
// final String string = redisUtil.get(key);
// System.out.println("string = " + string);
// final JSONObject mpWx = JSONObject.parseObject(string);
// System.out.println("mpWx = " + mpWx);
// String key2 = "Payment:".concat(payType.toString()).concat(":").concat(order.getTenantId().toString());
final String uploadPath = config.getUploadPath();
final Payment payment = getPayment(order);
if (ObjectUtil.isEmpty(payment)) {
throw new BusinessException("请完成支付配置");
}
String privateKey = uploadPath.concat("/file").concat(payment.getApiclientKey()); // 秘钥证书
String apiclientCert = uploadPath.concat("/file").concat(payment.getApiclientCert());
String pubKey = uploadPath.concat("/file").concat(payment.getPubKey()); // 公钥证书