!189 fitler data except H5 data

Merge pull request !189 from Admin/sit-Carl-V3
This commit is contained in:
Admin 2022-02-18 08:00:20 +00:00 committed by Gitee
commit 8c87ce58f0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -251,17 +251,18 @@ public class WxpayService {
}
/**
* /H5微信支付(预下单)
* /JSAPI微信支付(预下单)
* @return
* @throws Exception
*/
public String dounifiedOrderJSAPI(WxPayEntity wxPayEntity) throws Exception {
public String dounifiedOrderJSAPI(WxPayEntity wxPayEntity,String resp) throws Exception {
//返回参数
Map<String, String> returnMap = new HashMap<>();
WXPay wxpay = new WXPay(config);
// String getopenid_url = "https://api.weixin.qq.com/sns/oauth2/access_token";
// String param="appid="+config.getAppID()+"&secret="+config.getKey()+"&code="+code+"&grant_type=authorization_code";
//请求参数封装
Map<String, String> data = new HashMap<>();
data.put("out_trade_no",wxPayEntity.getOut_trade_no());
data.put("notify_url",config.notify_url);
data.put("fee_type","CNY");
@ -269,6 +270,7 @@ public class WxpayService {
data.put("spbill_create_ip", SmartIPUtil.getLocalHostIP());
data.put("trade_type", "JSAPI"); // 此处指定为H5支付
data.put("body","皇家宠物食品官方商城");
data.put("openid", resp.indexOf("openid") != -1 ? JSONObject.parseObject(resp).getString("openid") : "");
data.put("nonce_str", WXPayUtil.generateNonceStr());
data.put("product_id",wxPayEntity.getProduct_id());
String s = WXPayUtil.generateSignature(data, config.getKey()); //签名