还原多余代码

This commit is contained in:
liyj 2025-05-20 18:09:38 +08:00
parent 2d6404624e
commit 6f0bc7fcf7
3 changed files with 2 additions and 43 deletions

View File

@ -85,8 +85,8 @@ public class ShopBaseProductTypeServiceImpl extends BaseServiceImpl<ShopBaseProd
data.put("assists", assistService.getAssistsByIds(shopBaseProductType.getType_assist_ids())); data.put("assists", assistService.getAssistsByIds(shopBaseProductType.getType_assist_ids()));
data.put("brands", brandService.getBrandsByIds(shopBaseProductType.getType_brand_ids())); data.put("brands", brandService.getBrandsByIds(shopBaseProductType.getType_brand_ids()));
//Integer store_id = Convert.toInt(userInfoService.getUser().getStore_id()); Integer store_id = Convert.toInt(userInfoService.getUser().getStore_id());
Integer store_id =1; //Integer store_id =1;
data.put("specs", specService.getSpecsByIds(shopBaseProductType.getType_spec_ids(), store_id)); data.put("specs", specService.getSpecsByIds(shopBaseProductType.getType_spec_ids(), store_id));

View File

@ -1,30 +0,0 @@
package com.suisung.mall.shop.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.reactive.CorsWebFilter;
import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
import org.springframework.web.util.pattern.PathPatternParser;
/**
* 全局跨域配置
* 注意前端从网关进行调用时需要配置 //本地测试
*/
@Configuration
public class GlobalCorsConfig {
@Bean
public CorsWebFilter corsFilter() {
CorsConfiguration config = new CorsConfiguration();
config.addAllowedMethod("*");
config.addAllowedOrigin("*");
config.addAllowedHeader("*");
config.setAllowCredentials(true);
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(new PathPatternParser());
source.registerCorsConfiguration("/**", config);
return new CorsWebFilter(source);
}
}

View File

@ -16,15 +16,4 @@ public class WebConfig implements WebMvcConfigurer {
public void addResourceHandlers(ResourceHandlerRegistry registry) { public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/"); registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
} }
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**") // 对所有路径应用CORS配置
.allowedOrigins("*") // 允许的源
.allowedMethods("GET", "POST", "PUT", "DELETE") // 允许的方法
.allowedHeaders("*") // 允许的头部
.allowCredentials(true) // 是否发送cookies等信息
.maxAge(3600); // 预检请求的有效期
}
} }