Commit f30aa02a authored by Quxl's avatar Quxl

x

parent 32a02e25
......@@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
......@@ -18,6 +19,7 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.egolm.common.GsonUtil;
import com.egolm.common.MD5Util;
import com.egolm.common.StringUtil;
import com.egolm.common.Util;
import com.egolm.shop.common.XException;
import com.egolm.shop.common.utils.I18NUtils;
import com.egolm.shop.common.utils.ShopContstrant;
......@@ -27,6 +29,9 @@ public class OpenInterceptor extends HandlerInterceptorAdapter {
Log logger = LogFactory.getLog(OpenInterceptor.class);
String encoding = "UTF-8";
@Value("${ignoreTimestamp:false}")
private Boolean ignoreTimestamp;
@Autowired
private RedisTemplate<String, Object> redisTemplate;
......@@ -46,6 +51,11 @@ 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("时间戳无效");
}
SortedMap<Object,Object> parameters = new TreeMap<Object,Object>();
Set<String> keys = paramMap.keySet() ;
for (String key : keys) {
......
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