Ejemplo n.º 1
0
def userData(request):
    '''
    返回用户信息:
    在线人数、今日签到、从未签到、从未使用
    '''

    data = [NodeOnlineLog.totalOnlineUser(), len(User.todayRegister()),
            SSUser.userTodyChecked(), SSUser.userNeverChecked(),
            SSUser.userNeverUsed(), ]
    return JsonResponse({'data': data})
Ejemplo n.º 2
0
def userData(request):
    '''
    返回用户信息:
    在线人数、今日签到、从未签到、从未使用
    '''

    data = [
        NodeOnlineLog.totalOnlineUser(),
        User.get_today_register_user().count(),
        Suser.get_today_checked_user_num(),
        Suser.get_never_checked_user_num(),
        Suser.get_never_used_num(),
    ]
    return JsonResponse({'data': data})
Ejemplo n.º 3
0
def userData(request):
    '''
    返回用户信息:
    在线人数、今日签到、从未签到、从未使用
    '''

    data = [
        NodeOnlineLog.totalOnlineUser(),
        len(User.todayRegister()),
        SSUser.userTodyChecked(),
        SSUser.userNeverChecked(),
        SSUser.userNeverUsed(),
    ]
    return JsonResponse({'data': data})
Ejemplo n.º 4
0
def user_status(request):
    """站内用户分析"""
    # 查询今日注册的用户
    todayRegistered = User.get_today_register_user().values()
    for t in todayRegistered:
        try:
            t["inviter"] = User.objects.get(pk=t["invited_by"])
        except User.DoesNotExist:
            t["inviter"] = "ehco"
    todayRegisteredNum = len(todayRegistered)
    # 查询消费水平前十的用户
    richUser = Donate.richPeople()
    # 查询流量用的最多的用户
    coreUser = Suser.get_user_by_traffic(num=10)
    context = {
        "userNum": User.get_total_user_num(),
        "todayChecked": Suser.get_today_checked_user_num(),
        "aliveUser": NodeOnlineLog.totalOnlineUser(),
        "todayRegistered": todayRegistered[:10],
        "todayRegisteredNum": todayRegisteredNum,
        "richUser": richUser,
        "coreUser": coreUser,
    }
    return render(request, "backend/userstatus.html", context=context)
Ejemplo n.º 5
0
def user_status(request):
    '''站内用户分析'''
    # 查询今日注册的用户
    todayRegistered = User.todayRegister().values()
    for t in todayRegistered:
        try:
            t['inviter'] = User.objects.get(pk=t['invited_by'])
        except:
            t['inviter'] = 'ehco'
    todayRegisteredNum = len(todayRegistered)
    # 查询消费水平前十的用户
    richUser = Donate.richPeople()
    # 查询流量用的最多的用户
    coreUser = SSUser.coreUser()
    context = {
        'userNum': User.userNum(),
        'todayChecked': SSUser.userTodyChecked(),
        'aliveUser': NodeOnlineLog.totalOnlineUser(),
        'todayRegistered': todayRegistered[:10],
        'todayRegisteredNum': todayRegisteredNum,
        'richUser': richUser,
        'coreUser': coreUser,
    }
    return render(request, 'backend/userstatus.html', context=context)
Ejemplo n.º 6
0
def clean_online_log():
    """清空所有在线记录"""
    count = TrafficLog.objects.count()
    NodeOnlineLog.truncate()
    print("Time {} online record removed!:{}".format(timezone.now(), count))