功能
反向代理
location /mySystem/ {
#设置被代理服务器的端口或套接字,以及URL
proxy_pass http://192.168.1.56:8081;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
#以上三行,目的是将代理服务器收到的用户的信息传到真实服务器上
proxy_set_header REMOTE-HOST $remote_addr;
client_max_body_size 50m;
client_body_buffer_size 256k;
proxy_connect_timeout 15s;#nginx与upstream server的连接超时时间
proxy_send_timeout 30s;#nginx发送数据至upstream server超时, 默认60s, 如果连续的60s内没有发送1个字节, 连接关闭
proxy_read_timeout 60s;#nginx接收upstream server数据超时, 默认60s, 如果连续的60s内没有收到1个字节, 连接关闭
#以下这些参数都是针对每一个http request ,不是全局的。
proxy_buffer_size 256k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
proxy_max_temp_file_size 128m;
}
引入依赖
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>1.4.0</version>
</dependency>
引入依赖
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.7.3</version>
</dependency>
定义Login注解,在不需要登陆的接口方法上注解@Login(false)
/*
* 本注解用在Controller层的接口上,表示该接口是否需要登录
*/
// 本注解只能用在方法上
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Login {
// 是否需要登录(默认为true)
public boolean value() default true;
}
调用统一收单创建接口,整体流程是在支付宝打开调用页面后点击下单,商户后台调用统一收单创建接口,调用成功返回结果给下单页面,下单页面根据tradeNo的值执行jJSAPI吊起支付宝钱包然后付款,付款成功后商户后台的异步通知地址收到支付结果通知
引入依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
application中配置redis相关参数
spring.redis.host=I192.168.1.2
spring.redis.port=6379
spring.redis.password=123456
spring.redis.database=0
spring.redis.jedis.pool.max-active=200
spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=10
spring.redis.jedis.pool.min-idle=5
spring.redis.timeout=60000