Beispiel #1
0
def index():
    admin_id = session.get('admin_id')
    admin_info = Admin.query.filter_by(ID=admin_id).first()
    user_ip = request.remote_addr
    if admin_info.RoleID == 0 and admin_info.IsSystem == 1:
        role_name = '超级管理员'
        agent_name = '总代理'
    else:
        if admin_info.AgentID == 0 or admin_info.AgentID == 1:
            agent_name = '顶级代理'
            role_info = Role.query.filter_by(RoleID=admin_info.RoleID).first()
            role_name = role_info.RoleName
        else:
            role_info = Role.query.filter_by(RoleID=admin_info.RoleID).first()
            role_name = role_info.RoleName
            agent_info = Agent.query.filter_by(
                AgentID=admin_info.AgentID).first()
            agent_name = agent_info.AgentName
    nav_dict = api.init_nav()
    return render_template('index.html',
                           admin_info=admin_info,
                           role_name=role_name,
                           user_ip=user_ip,
                           agent_name=agent_name,
                           nav_dict=nav_dict)
Beispiel #2
0
def my_context_processor():
    try:
        nav_dict = api.init_nav()
        nav_on = api.last_nav()
        return {'nav_dict': nav_dict, 'nav_on': nav_on}
    except:
        return redirect(url_for('index.login'))
Beispiel #3
0
def my_context_processor():
    try:
        admin_user = session.get('admin_user')
        nav_dict = api.init_nav()
        nav_on = api.last_nav()
        return {'nav_dict': nav_dict, 'nav_on': nav_on, 'admin_user': admin_user}
    except:
        return redirect(url_for('index.login'))
Beispiel #4
0
def info():
    nav_dict = api.init_nav()
    nav_on = api.last_nav()
    role_info = ''
    id = request.args.get("id")
    return render_template('Role_info.html',
                           nav_dict=nav_dict,
                           nav_on=nav_on,
                           role_info=role_info,
                           id=id)
Beispiel #5
0
def log():
    nav_dict = api.init_nav()
    nav_on = api.last_nav()
    keyword = request.args.get("keyword")
    if keyword == None:
        keyword = ''
    starttime = (datetime.datetime.now() -
                 datetime.timedelta(days=7)).strftime('%Y-%m-%d')
    endtime = datetime.datetime.now().strftime('%Y-%m-%d')
    return render_template('Admin_log.html',
                           nav_dict=nav_dict,
                           nav_on=nav_on,
                           starttime=starttime,
                           endtime=endtime,
                           keyword=keyword)
Beispiel #6
0
def info():
    nav_dict = api.init_nav()
    return render_template('Admin_info.html', nav_dict=nav_dict)
Beispiel #7
0
def index():
    nav_dict = api.init_nav()
    nav_on = api.last_nav()
    return render_template('Admin_index.html',
                           nav_dict=nav_dict,
                           nav_on=nav_on)