parent
c09ce5731d
commit
0099680c55
@ -1,48 +0,0 @@
|
|||||||
package com.dsideal.ZhuQue.Interceptor;
|
|
||||||
|
|
||||||
import com.dsideal.ZhuQue.Util.CommonUtil;
|
|
||||||
import com.dsideal.ZhuQue.Util.SessionKit;
|
|
||||||
import com.jfinal.aop.Interceptor;
|
|
||||||
import com.jfinal.aop.Invocation;
|
|
||||||
import com.jfinal.core.Controller;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 需要是系统管理员身份校验
|
|
||||||
*
|
|
||||||
* @author Administrator
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class IsSysAdminInterceptor implements Interceptor {
|
|
||||||
@Override
|
|
||||||
public void intercept(Invocation inv) {
|
|
||||||
IsSysAdminInterface annotation = inv.getMethod().getAnnotation(IsSysAdminInterface.class);
|
|
||||||
if (annotation != null) {
|
|
||||||
checkSysAdmin(annotation, inv);
|
|
||||||
} else {
|
|
||||||
inv.invoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void checkSysAdmin(IsSysAdminInterface annotation, Invocation inv) {
|
|
||||||
Controller con = inv.getController();
|
|
||||||
String header = con.getHeader("Content-Type"); //取出head头
|
|
||||||
if (header != null && header.indexOf("multipart/form-data") != -1) { //判断是否是form-data
|
|
||||||
inv.invoke();
|
|
||||||
}
|
|
||||||
boolean isTrue = false;
|
|
||||||
String[] value = annotation.value();
|
|
||||||
if (SessionKit.get(con.getRequest(), con.getResponse(), "identity_id") != null) {
|
|
||||||
for (String v : value) {
|
|
||||||
if (SessionKit.get(con.getRequest(), con.getResponse(), "identity_id").equals(v)) {
|
|
||||||
isTrue = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isTrue) {
|
|
||||||
inv.invoke();
|
|
||||||
} else {
|
|
||||||
con.renderJson(CommonUtil.returnMessageJson(false, "您的身份有误,未被识别为管理员或管理员权限不足,无法进行操作!"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
package com.dsideal.ZhuQue.Interceptor;
|
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
|
||||||
|
|
||||||
@Inherited
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
|
||||||
public @interface LayUiPageInfoInterface {
|
|
||||||
String[] value();
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
package com.dsideal.ZhuQue.Interceptor;
|
|
||||||
|
|
||||||
import com.dsideal.ZhuQue.Util.SessionKit;
|
|
||||||
import com.jfinal.aop.Interceptor;
|
|
||||||
import com.jfinal.aop.Invocation;
|
|
||||||
import com.jfinal.kit.PropKit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Administrator
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class OnlinePersonCountInterceptor implements Interceptor {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void intercept(Invocation inv) {
|
|
||||||
var req = inv.getController().getRequest();
|
|
||||||
var res = inv.getController().getResponse();
|
|
||||||
if (inv.getController().getRequest().getRequestURL().indexOf("/loginPerson/showOnline") >= 0) {
|
|
||||||
inv.invoke();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//根据JSessionId判断是不是已登录
|
|
||||||
String sessionKey = PropKit.get("sessionKey");
|
|
||||||
boolean flag = false;
|
|
||||||
for (var c : sessionKey.split(",")) {
|
|
||||||
if (SessionKit.get(req, res, c) != null) {
|
|
||||||
flag = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String action_set_login = PropKit.get("action_set_login");
|
|
||||||
String action_set_nologin = PropKit.get("action_set_nologin");
|
|
||||||
if (flag) {//已登录
|
|
||||||
OnlinePersonCountUtil.addSet(action_set_login, req, res);
|
|
||||||
} else {//未登录
|
|
||||||
OnlinePersonCountUtil.addSet(action_set_nologin, req, res);
|
|
||||||
}
|
|
||||||
inv.invoke();
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue