|
|
@@ -97,25 +97,14 @@ public class WxController extends BaseController {
|
|
|
|
|
|
@PostMapping("/pay")
|
|
|
public R<String> wxPay(HttpServletRequest request, @RequestParam String ssoId, @RequestParam String transValue) {
|
|
|
- //String userAgent = request.getHeader("user-agent");
|
|
|
- //String userId = LoginHelper.getUserId().toString();
|
|
|
+ String userAgent = request.getHeader("user-agent");
|
|
|
+ String userId = LoginHelper.getUserId().toString();
|
|
|
String openId = Base64.decodeStr(ssoId);
|
|
|
- //Map<String, String> mapParams = new HashMap<>();
|
|
|
- //mapParams.put("userId", userId);
|
|
|
- //mapParams.put("ssoId", openId);
|
|
|
- //mapParams.put("dealValue", transValue);
|
|
|
- //mapParams.put("userAgent", userAgent);
|
|
|
- //return thirdPayBusiness.createDirectPayment(mapParams);
|
|
|
- String callBackUrl = "http://10.32.23.157:8080/pay-server/pay/back/1881509159999418369";
|
|
|
- String payUrl = "https://portal.hnswdx.gov.cn/pay/toPay.html?openid=" + URLUtil.encode(openId) + "&price=" + transValue + "&title="
|
|
|
- + URLUtil.encode("微信支付") + "&userAgent=MicroMessenger&detailsId=3&callBackUrl=" + callBackUrl;
|
|
|
- log.info("支付地址");
|
|
|
- HttpRequest req = HttpUtil.createGet(payUrl).header("user-agent", request.getHeader("user-agent"));
|
|
|
- try (HttpResponse res = req.execute()) {
|
|
|
- return R.ok(res.body());
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("[微信支付错误]-[{0}]", e);
|
|
|
- return R.fail(e.getLocalizedMessage());
|
|
|
- }
|
|
|
+ Map<String, String> mapParams = new HashMap<>();
|
|
|
+ mapParams.put("userId", userId);
|
|
|
+ mapParams.put("ssoId", openId);
|
|
|
+ mapParams.put("dealValue", transValue);
|
|
|
+ mapParams.put("userAgent", userAgent);
|
|
|
+ return thirdPayBusiness.createDirectPayment(mapParams);
|
|
|
}
|
|
|
}
|