Commit 772268ce authored by 张永's avatar 张永

V1.1.7.5

parent ff017898
......@@ -209,7 +209,7 @@
</executions>
<configuration>
<repository>dockerhub.linkfern.com/b2c/shopapi</repository>
<tag>V1.1.7.4</tag>
<tag>V1.1.7.5</tag>
<buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
......
package com.egolm.shop.common.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
......@@ -12,6 +13,8 @@ import com.egolm.shop.common.interceptor.OpenInterceptor;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Value("${server.isSign:false}")
private boolean isSign;
@Autowired
OpenInterceptor openInterceptor;
......@@ -45,6 +48,11 @@ public class WebMvcConfig implements WebMvcConfigurer {
InterceptorRegistration logsRegistration = registry.addInterceptor(logInterceptor).addPathPatterns("/**");
logsRegistration.excludePathPatterns("/", "/**.*", "/error");
logsRegistration.excludePathPatterns("/csrf", "/swagger-resources/**", "/webjars/**");
if(isSign) {
registry.addInterceptor(openInterceptor).addPathPatterns("/**").excludePathPatterns("/pay/**");
}
}
}
......@@ -32,6 +32,9 @@ public class OpenInterceptor extends HandlerInterceptorAdapter {
@Value("${ignoreTimestamp:false}")
private Boolean ignoreTimestamp;
@Value("${server.md5key:90f49d4bb0216c10816c7dec6bf28c89}")
private String defaultMd5Key;
@Autowired
private RedisTemplate<String, Object> redisTemplate;
......@@ -51,9 +54,10 @@ public class OpenInterceptor extends HandlerInterceptorAdapter {
throw new XException(I18NUtils.getMessage(langID, "Msg_Paramter_Empty","[sign,timestamp,langID,terminal]")) ;
}
Long timeLong = Util.objTo(timestamp, Long.class, 0L);
if(!ignoreTimestamp && Math.abs(timeLong - System.currentTimeMillis()) > (60L*5L)) {
throw new XException("时间戳无效");
boolean checkTimstamp = StringUtil.checkTimeStamp_13(5, timestamp);
if(!checkTimstamp) {
throw new XException("时间戳错误或失效");
}
SortedMap<Object,Object> parameters = new TreeMap<Object,Object>();
......@@ -62,17 +66,19 @@ public class OpenInterceptor extends HandlerInterceptorAdapter {
String value = req.getParameter(key);
parameters.put(key,value);
}
redisTemplate.opsForHash().put("SystemCtl1111", "test","111");
/* redisTemplate.opsForHash().put("SystemCtl1111", "test","111");
System.out.println(redisTemplate.opsForHash().get("SystemCtl1111", "test"));
Map<?, ?> map = (Map<?, ?>)redisTemplate.opsForHash().get(ShopContstrant.SystemCtl_Redis_Base_Key, ShopContstrant.CLIENT_MD5KEY);
System.out.println(map);
if(map != null) {
parameters.put("md5Key", map.get("sValue1")+"");
parameters.put("md5Key", defaultMd5Key);
}else {
logger.info("从redis中获取 计算签名用的md5key 获取失败");
throw new XException(I18NUtils.getMessage(langID, "Msg_Sign_failure"));
}
} */
parameters.put("md5Key", defaultMd5Key);
logger.info("request sign >>>>>>"+sign);
String createSign = MD5Util.createSign(encoding, parameters);
......
......@@ -7,6 +7,8 @@ server.session.timeout=90000
server.tomcat.uri-encoding=utf-8
server.shop.name=shop
server.isSign=true
server.md5key=90f49d4bb0216c10816c7dec6bf28c89
spring.http.multipart.maxFileSize=5MB
spring.http.multipart.maxRequestSize=5MB
......
......@@ -24,6 +24,8 @@
</head>
<body>
<div id="app">
<el-divider content-position="left">V1.1.7.5 2024-3-13</el-divider>
<p class="title">1.增加接口签名验证及开关</p>
<el-divider content-position="left">V1.1.7.4 2024-3-1</el-divider>
<p class="title">1.将日志写入SqlServer LGODB的idcSystemLog,一月一表: idcSystemLog_yyyyMM</p>
<p class="title">2.读写分离拆分 需求 #16467</p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment