update
This commit is contained in:
parent
470d07d416
commit
be3e3bbf9d
@ -350,7 +350,7 @@ public class Live implements ApplicationContextAware {
|
|||||||
BilibiliLiveData liveData = new BilibiliLiveData();
|
BilibiliLiveData liveData = new BilibiliLiveData();
|
||||||
String danmu;
|
String danmu;
|
||||||
GiftData giftData;
|
GiftData giftData;
|
||||||
Log.i(AppTools.getToDayTimeToString(startTime),roomId,json.toJSONString());
|
Log.i(AppTools.getToDayTime(),roomId,json.toJSONString());
|
||||||
switch (json.getString("cmd")) {
|
switch (json.getString("cmd")) {
|
||||||
case "INTERACT_WORD"://普通用户进直播间
|
case "INTERACT_WORD"://普通用户进直播间
|
||||||
danmu = json.getJSONObject("data").getString("uname") + " 进入到直播间";
|
danmu = json.getJSONObject("data").getString("uname") + " 进入到直播间";
|
||||||
|
@ -31,48 +31,52 @@ public class APIFilter implements Filter {
|
|||||||
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||||
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||||
String token = request.getParameter("token");
|
String token = request.getParameter("token");
|
||||||
if(StringUtils.isEmpty(token)){
|
if (StringUtils.isEmpty(token)) {
|
||||||
Cookie cookie=AppTools.getCookie(request,"login");
|
Cookie cookie = AppTools.getCookie(request, "login");
|
||||||
if(cookie!=null){
|
if (cookie != null) {
|
||||||
token=cookie.getValue();
|
token = cookie.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String tmp = request.getRequestURI();
|
String tmp = request.getRequestURI();
|
||||||
if(tmp.contains("/user/login.do")
|
if (tmp.contains("/user/login.do")
|
||||||
||tmp.contains("/user/reg.do")
|
|| tmp.contains("/user/reg.do")
|
||||||
||tmp.contains("/user/logout.do")
|
|| tmp.contains("/user/logout.do")
|
||||||
||tmp.contains("/user/get/test.do")
|
|| tmp.contains("/user/get/test.do")
|
||||||
||tmp.contains("/system/public/reg.do")
|
|| tmp.contains("/system/public/reg.do")
|
||||||
||tmp.contains("/favicon.ico")
|
|| tmp.contains("/favicon.ico")
|
||||||
){
|
) {
|
||||||
filterChain.doFilter(servletRequest,servletResponse);
|
filterChain.doFilter(servletRequest, servletResponse);
|
||||||
}else {
|
} else {
|
||||||
UUser user= service.getUserToUid(Integer.parseInt(RedisTools.get(token)));;
|
if (StringUtils.isEmpty(token)) {
|
||||||
if(user==null){
|
response.sendRedirect("/");
|
||||||
response.sendRedirect("/");
|
return;
|
||||||
}else{
|
}
|
||||||
String url=null;
|
UUser user = service.getUserToUid(Integer.parseInt(RedisTools.get(token)));
|
||||||
try {
|
if (user == null) {
|
||||||
url = tmp.split(tmp.split("/")[tmp.split("/").length - 1])[0];
|
response.sendRedirect("/");
|
||||||
} catch (Exception e) {
|
} else {
|
||||||
com.yutou.bilibili.Tools.Log.e(e);
|
String url = null;
|
||||||
com.yutou.bilibili.Tools.Log.i("无权限请求:"+tmp);
|
try {
|
||||||
return;
|
url = tmp.split(tmp.split("/")[tmp.split("/").length - 1])[0];
|
||||||
}
|
} catch (Exception e) {
|
||||||
JSONArray powers = JSONArray.parseArray(user.getPower());
|
com.yutou.bilibili.Tools.Log.e(e);
|
||||||
if(powers.toJavaList(Integer.class).contains(-1)){
|
com.yutou.bilibili.Tools.Log.i("无权限请求:" + tmp);
|
||||||
filterChain.doFilter(servletRequest,servletResponse);
|
return;
|
||||||
}else {
|
}
|
||||||
PermissionExample pExample = new PermissionExample();
|
JSONArray powers = JSONArray.parseArray(user.getPower());
|
||||||
pExample.createCriteria().andUrlEqualTo(url);
|
if (powers.toJavaList(Integer.class).contains(-1)) {
|
||||||
List<Permission> permissions = permissionDao.selectByExample(pExample);
|
filterChain.doFilter(servletRequest, servletResponse);
|
||||||
if (permissions != null && permissions.size() > 0) {
|
} else {
|
||||||
if (powers.toJavaList(Integer.class).contains(permissions.get(0).getId())) {
|
PermissionExample pExample = new PermissionExample();
|
||||||
filterChain.doFilter(servletRequest,servletResponse);
|
pExample.createCriteria().andUrlEqualTo(url);
|
||||||
}
|
List<Permission> permissions = permissionDao.selectByExample(pExample);
|
||||||
}
|
if (permissions != null && permissions.size() > 0) {
|
||||||
}
|
if (powers.toJavaList(Integer.class).contains(permissions.get(0).getId())) {
|
||||||
}
|
filterChain.doFilter(servletRequest, servletResponse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user