예제 #1
0
    def get(self, request):
        user_status = [
            NodeOnlineLog.get_all_node_online_user_count(),
            User.get_today_register_user().count(),
            UserCheckInLog.get_today_checkin_user_count(),
            User.get_never_used_user_count(),
        ]
        donate_status = [
            Donate.get_donate_count_by_date(),
            Donate.get_donate_money_by_date(),
            Donate.get_donate_count_by_date(date=pendulum.today()),
            Donate.get_donate_money_by_date(date=pendulum.today()),
        ]

        active_nodes = SSNode.get_active_nodes() + VmessNode.get_active_nodes()

        node_status = {
            "names": [node.name for node in active_nodes],
            "traffics": [
                round(node.used_traffic / settings.GB, 2) for node in active_nodes
            ],
        }
        data = {
            "user_status": user_status,
            "donate_status": donate_status,
            "node_status": node_status,
        }
        return JsonResponse(data)
예제 #2
0
def donateData(request):
    '''
    返回捐赠信息
    捐赠笔数
    捐赠总金额
    '''
    data = [Donate.totalDonateNums(), int(Donate.totalDonateMoney())]
    return JsonResponse({'data': data})
예제 #3
0
def donateData(request):
    """
    返回捐赠信息
    捐赠笔数
    捐赠总金额
    """
    data = [Donate.totalDonateNums(), int(Donate.totalDonateMoney())]
    return JsonResponse({"data": data})
예제 #4
0
def donateData(request):
    '''
    返回捐赠信息
    捐赠笔数
    捐赠总金额
    '''
    data = [Donate.totalDonateNums(), int(Donate.totalDonateMoney())]
    return JsonResponse({'data': data})
예제 #5
0
    def get(self, request):
        today_register_user = User.get_today_register_user().values()[:10]
        # find inviter
        for u in today_register_user:
            try:
                u["inviter"] = User.objects.get(pk=u["inviter_id"])
            except User.DoesNotExist:
                u["inviter"] = "None"

        context = {
            "total_user_num":
            User.get_total_user_num(),
            "alive_user_count":
            NodeOnlineLog.get_all_node_online_user_count(),
            "today_checked_user_count":
            UserCheckInLog.get_today_checkin_user_count(),
            "today_register_user_count":
            len(today_register_user),
            "traffic_users":
            UserTraffic.get_user_order_by_traffic(count=10),
            "rich_users_data":
            Donate.get_most_donated_user_by_count(10),
            "today_register_user":
            today_register_user,
        }
        return render(request, "my_admin/user_status.html", context=context)