支付回调
获取数据列表接口问题 token有效期 及 续期 订单详情 为null的情况 根据桌码获取shopid接口调整 首页 默认值
This commit is contained in:
@@ -10,6 +10,7 @@ import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.*;
|
||||
@@ -36,7 +37,7 @@ public class LoginFilter implements Filter {
|
||||
// 忽略静态资源
|
||||
"css/**",
|
||||
"js/**",
|
||||
"cashierService/websocket/table/**",//websocket
|
||||
"cashierService/websocket/table",//websocket
|
||||
"cashierService/phoneValidateCode",//验证码
|
||||
"cashierService/tbPlatformDict",//获取菜单
|
||||
"cashierService/location/**",//高德 获取行政区域
|
||||
@@ -45,7 +46,10 @@ public class LoginFilter implements Filter {
|
||||
"cashierService/order/testMessage",//首页
|
||||
"cashierService/common/**",//通用接口
|
||||
"cashierService/distirict/**",//首页其它接口
|
||||
"cashierService/login/**",//登录部分接口不校验
|
||||
|
||||
// "cashierService/login/**",//登录部分接口不校验
|
||||
"cashierService/login/wx/**",//登录部分接口不校验
|
||||
"cashierService/login/app/login",//登录部分接口不校验
|
||||
"cashierService/product/queryProduct",
|
||||
"cashierService/product/queryProductSku",
|
||||
"cashierService/product/productInfo",
|
||||
@@ -95,16 +99,18 @@ public class LoginFilter implements Filter {
|
||||
return;
|
||||
}
|
||||
String message = "";
|
||||
String tokenKey="";
|
||||
if(environment.equals("app")){
|
||||
//获取当前登录人的用户id
|
||||
String loginName = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||
tokenKey=RedisCst.ONLINE_APP_USER.concat(userId);
|
||||
//获取redis中的token
|
||||
message = redisUtil.getMessage(RedisCst.ONLINE_APP_USER.concat(loginName));
|
||||
}else if(environment.equals("wx")){
|
||||
//获取当前登录人的用户id
|
||||
String openId = TokenUtil.parseParamFromToken(token).getString("openId");
|
||||
message = redisUtil.getMessage(RedisCst.ONLINE_USER.concat(openId));
|
||||
tokenKey=RedisCst.ONLINE_USER.concat(openId);
|
||||
}
|
||||
message = redisUtil.getMessage(tokenKey);
|
||||
if (StringUtils.isBlank(message)) {
|
||||
Result result = new Result(CodeEnum.TOKEN_EXPIRED);
|
||||
String jsonString = JSONObject.toJSONString(result);
|
||||
@@ -131,9 +137,19 @@ public class LoginFilter implements Filter {
|
||||
response.getWriter().flush();//流里边的缓存刷出
|
||||
return;
|
||||
}
|
||||
checkRenewal(tokenKey);
|
||||
chain.doFilter(req, resp);
|
||||
}
|
||||
|
||||
@Async
|
||||
public void checkRenewal(String tokenKey) {
|
||||
// 判断是否续期token,计算token的过期时间
|
||||
long time = redisUtil.getRemainingTime(tokenKey);
|
||||
if(time<60*60*24*10L){
|
||||
redisUtil.setKeyExpirationTime(tokenKey,60*60*24*30L);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断url请求是否配置在urls列表中
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user