Zhiqim Master(运营管理台)是在ZhiqimManager基础上改造成用于运营思路的管理系统,增加余额,和组织结构等,开放组织管理员,可以添加组织内的部门和角色和操作员。并增加该管理台上的一些组件,如充值支付等组件。适用于二级代理管理或该大型组织机构
森中灵 最后提交于7月前 替换为8.0.5版本
ZmrInterceptor.java3KB
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* https://zhiqim.org/project/zhiqim_components/zhiqim_master.htm
*
* Zhiqim Master is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
package org.zhiqim.manager;
import org.zhiqim.httpd.HttpRequest;
import org.zhiqim.httpd.context.ZmlContexts;
import org.zhiqim.httpd.context.core.Interceptor;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.util.Strings;
/**
* 检查是否登录拦截器
*
* @version v1.0.0 @author zouzhigang 2015-5-28 新建与整理
*/
@AnAlias("chkZmrLogin")
public class ZmrInterceptor implements Interceptor, ZmrConstants
{
private String mainUrl;
private String welcomeUrl;
public void intercept(HttpRequest request) throws Exception
{
if (mainUrl == null)
{//非框架首页
this.mainUrl = ZmlContexts.parseZmlContent(request, ZMR_MAIN_URL_DEFAULT);
}
if (welcomeUrl == null)
{//有框架首页
this.welcomeUrl = ZmlContexts.parseZmlContent(request, ZMR_MAIN_URL_WELCOME);
}
if (request.isXMLHttpRequest())
{//AJAX访问
if (!request.hasSessionUser(ZmrSessionUser.class))
{///AJAX访问会话超时
request.setResponseError("您闲置太久或未登录,请重新登录后再操作...");
return;
}
//AJAX正常则结束
return;
}
ZmrSessionUser sessionUser = request.getSessionUser(ZmrSessionUser.class);
if (sessionUser == null)
{//URL访问会话超时
request.setRedirectTop("/"+request.getContextAttributeString(ZMR_PATH)+"/logout.htm", "您闲置太久或未登录,正在返回初始界面,请确定.....");
return;
}
if (!_GET_.equalsIgnoreCase(request.getMethod()) || !ZMR_TEMPLATE_MAIN.equals(request.getView()))
{//非GET方法和没使用主模板的请求不处理
return;
}
if (!Strings.endsWith(request.getPathInContext(), ".htm") && !Strings.endsWith(request.getPathInContext(), ".zml"))
{//不是.htm/.zml结尾的不处理
return;
}
if (mainUrl.equals(request.getPathInContext()) || welcomeUrl.equals(request.getPathInContext()))
{//非框架首页、框架主页和框架内部首页的过滤
return;
}
//其他认为是内部页,设置到会话中,以便F5刷新恢复
sessionUser.setIncludeUrl(request.getRequestURI());
}
}