当前位置: 首页 > news >正文

怎么网站做二维码/黑科技引流工具

怎么网站做二维码,黑科技引流工具,河南疫情,厦门国外网站建设公司哪家好前提:需要一台nginx服务器做反向代理 前言:支付宝支付手机支付一共分4个页面分别为1、输入手机号页面,2、输入验证码页面,3、输入支付密码页面,4、支付结果页面 1、配置nginx服务器为 https://mclient.alipay.com做反向…

前提:需要一台nginx服务器做反向代理

前言:支付宝支付手机支付一共分4个页面分别为1、输入手机号页面,2、输入验证码页面,3、输入支付密码页面,4、支付结果页面

1、配置nginx服务器为 https://mclient.alipay.com做反向代理,对app和支付宝做反向代理如下,要求支付宝的反向代理后的域名与app的域名为同域。

server {listen 80;
    server_name app.domin.com;
    access_log /var/website/app/logs/access.log;
    error_log /var/website/app/logs/error.log;
location /app {proxy_pass http://xxx.xx.xxx.xxx:8080/app;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header REMOTE-HOST $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        client_max_body_size 100m;
    }location / {proxy_pass https://mclient.alipay.com/;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header REMOTE-HOST $remote_addr;
        client_max_body_size 100m;
    }
}

2、前端需要嵌套一个iframe链接支付宝的反向代理地址,看js部分,对第1、2个页面做前端域名替换因为不涉及到js问题,所以没有做处理,第3、4个页面涉及到js的调用,因为支付宝js的写法导致原本绑定的事件不能执行,第3个页面包含了【确认付款】这几个字,所以以此为判断条件,如果是第三个页面就把一个表单插入到iframe的body中,用js把页面的html提交到本文第5节的地址中去,又这个方法处理后增加一个chuliguo的标志重新返回html,使输入密码的js可以正常执行,第4步同理。

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${ pageContext.request.contextPath }" /> 
<!DOCTYPE html>
<html lang="zh-cn">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>支付</title><script src="//cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script><style>.scroll-wrapper{   position: fixed;    right: 0;    bottom: 0;    left: 0;   top: 0;   -webkit-overflow-scrolling: touch;   overflow-y: scroll;   }   .scroll-wrapper {   height: 100%;   width: 100%;   border: none;}   </style>
</head>
<body>
<iframe class="scroll-wrapper" src="${ ctx }/alipay/pay?id=${ id }&type=${ type }"></iframe>
<script>var form = "<form id='sbform' action='${ ctx }/alipay/rerender' method='post'><input type='hidden' id='submit_html' value='' name='html'></form>";function buildRegex() {var op = "g";return new RegExp("https://mclient.alipay.com", op);}$(".scroll-wrapper").get(0).onload = function(){var docuemnt = $("iframe").get(0).contentWindow.document;var html = $(docuemnt).find("html").html();if(html.indexOf("确认付款") > 0 ){            if(html.indexOf("chuliguo") < 0){$(docuemnt).find("html").find('body').append($(form));$(docuemnt).find("html").find('body').find('#sbform').find('#submit_html').val($(docuemnt).find("html").html());$(docuemnt).find("html").find('body').find('#sbform').submit();}}else if(html.indexOf("付款结果") > 0 ){if(html.indexOf("chuliguo") < 0){$(docuemnt).find("html").find('body').append($(form));$(docuemnt).find("html").find('body').find('#sbform').find('#submit_html').val($(docuemnt).find("html").html());$(docuemnt).find("html").find('body').find('#sbform').submit();}else{location.href = $(docuemnt).find("html").find('body').find(".J-return-link").find("a").attr("href");}}else{html = html.replace(buildRegex(), "http://app.domin.com")$(docuemnt).find("html").html(html);}$("iframe").show();}
</script>
</body>
</html>

3、生成支付宝订单的时候把openapi的地址替换成项目中的一个action,其中urlService.getUrl返回的是http://app.domin.com/alipay/middle/

form = form.replace("https://openapi.alipay.com", urlService.getUrl("alipay", "middle", request))

4、表单提交到的本地方法如下,因为上一步中支付宝生成的表单中的地址是https://openapi.alipay.com/gateway.do,上一步替换完了就是app.domin.com/alipay/middle/gateway.do。或者上一步连gateway.do一起替换。不清楚可以此处打断点调试。此方法就是对原本的openapi.alipay的请求做一个中转,返回支付宝给的表单html。这一步不能直接对openapi域名反向代理,因为提交以后支付宝端直接跳转到mclient地址,没有替换域名的机会。此处把mclient.alipay.com替换成项目域名也就是app.domin.com,项目域名根目录第一节中反向代理了mclient.alipay.com

@RequestMapping(value = "middle/gateway.do")public void middle(HttpServletRequest request,HttpServletResponse response) throws IOException{String queryString = request.getQueryString();String biz_content = request.getParameter("biz_content");Map<String, String> param = new HashMap<>();param.put("biz_content", biz_content);String res = HttpUtil.http("https://openapi.alipay.com/gateway.do?" + queryString, param,null);res = res.replaceAll("https://mclient.alipay.com", urlService.serverPath(request, ""));response.getWriter().write(res);}

5、后台需要一个重新渲染支付宝html的方法,把支付宝的地址换成我们反向代理支付宝的地址 ,此代码在输完手机号验证码输入支付密码的页面调用见第2节的说明,因为有的步骤是前台做html中域名替换,导致这一步输入不了密码。处理完成后拼接一个chuliguo的input作为前台判断的标志,防止循环重载此页面。可结合前台代码一起理解这一步的作用。

@RequestMapping(value = "rerender")public void rerender(HttpServletRequest request,HttpServletResponse response) throws IOException{String html = request.getParameter("html");html = html.replaceAll("https://mclient.alipay.com", "http://app.domin.com");html += "<input type='hidden' value='chuliguo'>";response.setHeader("X-XSS-Protection", "0");response.getWriter().write(html);}

 

转载于:https://www.cnblogs.com/tonghounb/p/5974188.html

http://www.lbrq.cn/news/1342513.html

相关文章:

  • 专业的网站建设/sem优化技巧
  • 做兼职什么网站好/专业seo站长工具
  • 俄罗斯网站模版/国内新闻今日头条
  • 大型服装网站建设/中国互联网域名注册服务机构
  • 广告设计网站排行榜前十名有哪些/网站营销网站营销推广
  • 重庆建设部网站/seo综合查询是什么
  • 网站建设教程自学/海口seo计费
  • 做推送的网站除了秀米还有/鼓楼网站seo搜索引擎优化
  • 微博账号滚动图网站怎么做/seo优化公司信
  • 网站原型图大小/最新消息今天的新闻
  • 前端做项目网站/如何获取网站的seo
  • 衢州网站建设有限公司/整站优化seo
  • 电子商务网站建设可用性/网页设计制作网站代码
  • 网站开发要学多久/济南疫情最新消息
  • 甘肃省建设银行网站/永久免费开网店app
  • 南昌电商网站设计/优化营商环境的意义
  • 网站建设与规划结论/网站推广方法有哪些
  • 上饶网站优化/微信推广文案
  • 游戏大全免费版入口/快排seo软件
  • 木门行业做网站有什么好处/全国疫情最新情况公布
  • 网站项目建设的组织机构/seo哪个软件好
  • 武汉网站建设027/网站建设设计
  • 做视频网站的公司有哪些/百度后台登录
  • 什么叫网站根目录/企业策划咨询公司
  • 免费网站如何做推广方案/国产搜什么关键词最好看
  • 移动端网站模板怎么做的/seo文案范例
  • mvc5 网站开发之学 pdf/google谷歌搜索
  • 商务网站建设的一般流程图/目录搜索引擎有哪些
  • 彩票网站开发制作需要什么/外贸网站免费推广
  • 怎么做淘宝联盟网站制作/网页制作html代码
  • 小明的魔法地图:迷宫探险智慧(记忆性递归)
  • ATF(TF-A)安全通告 TFV-13(CVE-2024-7881)
  • 文件 IO
  • Cherryusb UAC例程对接STM32内置ADC和DAC播放音乐和录音(中)=>UAC+STM32 ADC+DAC实现录音和播放
  • 【Git】Visual Studio 实现合并分支
  • 线上排查问题的一般流程是怎么样的?