处理积分下单,及退款

This commit is contained in:
朱耘稷
2021-01-06 20:29:16 +08:00
parent 0b6939f14f
commit e4c2e9906a
11 changed files with 217 additions and 119 deletions

View File

@ -34,19 +34,19 @@ public class ConfigurerAdapter implements WebMvcConfigurer {
@Value("${file.avatar}")
private String avatar;
// @Bean
// public CorsFilter corsFilter() {
// UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
// CorsConfiguration config = new CorsConfiguration();
// config.setAllowCredentials(true);
// // 设置允许跨域请求的域名
// config.setAllowedOriginPatterns(Arrays.asList("*"));
// config.addAllowedOrigin("*");
// config.addAllowedHeader("*");
// config.addAllowedMethod("*");
// source.registerCorsConfiguration("/**", config);
// return new CorsFilter(source);
// }
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true); // 允许cookies跨域
config.addAllowedOriginPattern("*");// #允许向该服务器提交请求的URI*表示全部允许在SpringMVC中如果设成*会自动转成当前请求头中的Origin
config.addAllowedHeader("*");// #允许访问的头信息,*表示全部
config.setMaxAge(18000L);// 预检请求的缓存时间(秒),即在这个时间段里,对于相同的跨域请求不会再预检了
config.addAllowedMethod("OPTIONS");// 允许提交请求的方法类型,*表示全部允许
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {

View File

@ -1,47 +1,47 @@
package co.yixiang.config;
/**
* @author LionCity
* @date Created in 2020-12-21 13:38
* @description
* @modified By
* @version:
*/
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import co.yixiang.utils.StringUtils;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
@Component
@Order(-9999)
public class CorsFilter extends HttpFilter {
/**
*
*/
private static final long serialVersionUID = -8387103310559517243L;
@Override
protected void doFilter(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws IOException, ServletException {
String origin = req.getHeader(HttpHeaders.ORIGIN);
if (!StringUtils.isEmpty(origin)){
res.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, origin);
res.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, "Origin, x-requested-with, Content-Type, Accept, Authorization");
res.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");
res.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET, POST, PUT, OPTIONS, DELETE");
res.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Cache-Control, Content-Language, Content-Type, Expires, Last-Modified, Pragma");
res.addHeader(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "60");
}
super.doFilter(req, res, chain);
}
}
//package co.yixiang.config;
//
///**
// * @author LionCity
// * @date Created in 2020-12-21 13:38
// * @description
// * @modified By
// * @version:
// */
//import java.io.IOException;
//
//import javax.servlet.FilterChain;
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpFilter;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import co.yixiang.utils.StringUtils;
//import org.springframework.core.annotation.Order;
//import org.springframework.http.HttpHeaders;
//import org.springframework.stereotype.Component;
//
//@Component
//@Order(-9999)
//public class CorsFilter extends HttpFilter {
//
// /**
// *
// */
// private static final long serialVersionUID = -8387103310559517243L;
//
// @Override
// protected void doFilter(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws IOException, ServletException {
//
// String origin = req.getHeader(HttpHeaders.ORIGIN);
//
// if (!StringUtils.isEmpty(origin)){
// res.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, origin);
// res.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, "Origin, x-requested-with, Content-Type, Accept, Authorization");
// res.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");
// res.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET, POST, PUT, OPTIONS, DELETE");
// res.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Cache-Control, Content-Language, Content-Type, Expires, Last-Modified, Pragma");
// res.addHeader(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "60");
// }
// super.doFilter(req, res, chain);
// }
//}

View File

@ -6,7 +6,6 @@
package co.yixiang.modules.security.config;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.config.CorsFilter;
import co.yixiang.modules.security.security.JwtAccessDeniedHandler;
import co.yixiang.modules.security.security.JwtAuthenticationEntryPoint;
import co.yixiang.modules.security.security.TokenConfigurer;
@ -24,6 +23,7 @@ import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;

View File

@ -6,9 +6,9 @@ spring:
druid:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/yshopb2c?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull
username: root
password: xxcs@!2019
url: jdbc:mysql://localhost:3366/yshopb2c?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull
username: yshopb2c
password: bkfGfAimifjPZtNE
# 初始化配置
initial-size: 3
@ -41,10 +41,10 @@ spring:
redis:
#数据库索引
database: 2
database: 5
host: 127.0.0.1
port: 6379
password:
port: 6399 # Redis服务器连接端口
password: 6379@@6379 # Redis服务器连接密码默认为空
#连接超时时间
timeout: 5000
@ -87,8 +87,9 @@ swagger:
file:
path: /home/yshop/file/
avatar: /home/yshop/avatar/
path: /www/wwwroot/thapi.xinxintuan.co/upload/file/
avatar: /www/wwwroot/thapi.xinxintuan.co/upload/avatar/
# 文件大小 /M
maxSize: 100
avatarMaxSize: 5