最近看过不少微信H5支付的例子,我是根据这个网址来配置的:https://blog.csdn.net/leigelg/article/details/80456758 这里已经说的很明白,就是在支付的时候老是提示“网络环境未能通过安全验证,请稍后重试”后来发现真是IP地址问题,这是我实际项目的代码。
//这里是支付的Controller 用的是spingmvc
@SecurityMapping(display = false, rsequence = 0, title = “wap订单支付”, value = “/wxwap_submit.htm*”, rtype = “buyer”, rname = “购物流程3”, rcode = “goods_cart”, rgroup = “在线购物”)
@RequestMapping(value = “/pay_submit.htm”,produces=“text/html; charset=UTF-8”)
public String paymentSubmit(HttpServletRequest request,
HttpServletResponse response, String payType, String order_id) {
OrderForm of = this.orderFormService.getObjById(CommUtil.null2Long(order_id));
if (of != null && of.getOrder_status() == 10) {
List payments = new ArrayList();
Map params = new HashMap();
// 1为平台支付:
if (this.configService.getSysConfig().getConfig_payment_type() == 1) {
params.put("mark", payType);
params.put("type", "admin");
payments = this.paymentService.query("select obj from Payment obj where obj.mark=:mark and obj.type=:type", params, -1, -1);
} else {
params.put("store_id", of.getStore().getId());
params.put("mark", payType);
payments = this.paymentService.query("select obj from Payment obj where obj.mark=:mark and obj.store.id=:store_id", params, -1, -1);
}
// 支付方式已经配置:wap支持支付宝wap支付以及微信公众号支付
if (payments.size() > 0) {
of.setPayment((Payment) payments.get(0));
this.orderFormService.update(of);
// 微信公众号支付weixin_wap
if (payType.equal