Exemple #1
0
 def subscribe(request):
     startDate = request.GET.get('startDate', '')
     endDate = request.GET.get('endDate', '')
     if not startDate:
         startDate = timeHelper.getFormatDate('start')
     if not endDate:
         endDate = timeHelper.getFormatDate('end')
     subscribePieData = peanutService().getSubscribePieRangeData([startDate, endDate])
     data = {"data": [subscribePieData], "startDate": startDate, "endDate": endDate}
     return baseView.urlRender(request, 'peanut_subscribe.html', data, "peanut")
Exemple #2
0
    def login(request):
        # 获取用户输入的信息
        user_name = request.POST.get('user_name', '')
        user_pwd = request.POST.get('user_pwd', '')

        # 参数为空则返回登录页面
        if user_name == '' or user_pwd == '':
            return baseView.urlRender(request, 'user.html')

        # 判断是否正确
        if logchartUser().login(user_name, user_pwd):
            # 往session中插入用户名
            baseView.setSession(request, 'username', user_name)
            # 往session中插入登陆状态
            baseView.setSession(request, 'is_login', True)
            # 登录成功重定向到首页
            return baseView.urlRedirect('/index')
        else:
            # 账号密码错误则返回登录页面
            return baseView.urlRender(request, 'user.html')
Exemple #3
0
 def pagelist(request):
     pageId = int(request.GET.get('pageId', -1))
     equipment = int(request.GET.get('equipment', 1))
     pagelist = yiyiyuanPageService().getPageList(pageId, equipment)
     data = {
         'nameList': pagelist['nameList'].items(),
         'pageList': pagelist['pageList'],
         'pageId': pageId,
         'equipment': equipment
     }
     return baseView.urlRender(request, 'yiyiyuan_pagelist.html', data,
                               "yiyiyuan")
Exemple #4
0
    def index(request):
        # 获取今天的起止时间
        todayStart = timeHelper.getFormatDate('start')
        todayEnd = timeHelper.getFormatDate('end')
        # 获取昨天的起止时间
        yesterdayStart = timeHelper.getFormatDate(
            'start', timeHelper.getTimestamp(-60 * 60 * 24))
        yesterdayEnd = timeHelper.getFormatDate(
            'end', timeHelper.getTimestamp(-60 * 60 * 24))
        dayRange = {
            "today": [todayStart, todayEnd],
            "yesterday": [yesterdayStart, yesterdayEnd]
        }
        # 获取天维度的数据
        peanutDayData = peanut().getDayData(dayRange)
        yiyiyuanDayData = yiyiyuan().getDayData(dayRange)

        # 获取今天的是周几
        num = timeHelper.getWeekNum()
        # 获取这周的起止时间
        thisWeekStart = timeHelper.getFormatDate(
            'start', timeHelper.getTimestamp(-60 * 60 * 24 * num))
        thisWeekStartEnd = timeHelper.getFormatDate('end')
        # 获取上周的起止时间
        lastWeekStart = timeHelper.getFormatDate(
            'start', timeHelper.getTimestamp(-60 * 60 * 24 * (num + 7)))
        lastWeekEend = timeHelper.getFormatDate(
            'end', timeHelper.getTimestamp(-60 * 60 * 24 * (num + 1)))
        weekRange = {
            "thisWeek": [thisWeekStart, thisWeekStartEnd],
            "lastWeek": [lastWeekStart, lastWeekEend]
        }
        # 获取周维度的数据
        peanutWeekData = peanut().getWeekData(weekRange)
        yiyiyuanWeekData = yiyiyuan().getWeekData(weekRange)

        data = {
            "peanutData": {
                'name': '花生米富',
                'dayData': peanutDayData,
                'weekData': peanutWeekData,
            },
            "yiyiyuanData": {
                'name': '先花一亿元',
                'dayData': yiyiyuanDayData,
                'weekData': yiyiyuanWeekData,
            },
        }
        # 跳转到展示页面
        return baseView.urlRender(request, 'index.html', data, "index")
Exemple #5
0
 def register(request):
     startDate = request.GET.get('startDate', '')
     endDate = request.GET.get('endDate', '')
     if not startDate:
         startDate = timeHelper.getFormatDate('start')
     if not endDate:
         endDate = timeHelper.getFormatDate('end')
     registerPieData = yiyiyuanService().getRegisterPieRangeData(
         [startDate, endDate])
     data = {
         "data": [registerPieData],
         "startDate": startDate,
         "endDate": endDate
     }
     return baseView.urlRender(request, 'yiyiyuan_register.html', data,
                               "yiyiyuan")
Exemple #6
0
 def browse(request):
     startDate = request.GET.get('startDate')
     endDate = request.GET.get('endDate')
     if not startDate:
         startDate = timeHelper.getFormatDate('start')
     if not endDate:
         endDate = timeHelper.getFormatDate('end')
     pageId = int(request.GET.get('pageId', -1))
     equipment = int(request.GET.get('equipment', -1))
     timeRange = [startDate, endDate]
     page = request.GET.get('page', 1)
     getBrowseData = peanutService().getBrowseData(timeRange, pageId, equipment, page)
     print(equipment)
     data = {
         "pageNameList": getBrowseData['pageNameList'].items(),
         "contacts": getBrowseData['contacts'],
         "pageId": pageId,
         "equipment": equipment,
         "startDate": startDate,
         "endDate": endDate
     }
     return baseView.urlRender(request, 'peanut_browse.html', data, "peanut")
Exemple #7
0
 def logout(request):
     baseView.setSession(request, 'is_login', False)
     return baseView.urlRender(request, 'user.html')
Exemple #8
0
 def index(request):
     dataList = clickhouseMonitor().doMonitor()
     data = {"data": dataList}
     return baseView.urlRender(request, 'monitor.html', data, "monitor")