Esempio n. 1
0
def show_index():
    refreshLocalDbDay()
    myData = s_data_numbyday.query.filter(
        s_data_numbyday.usertolnum > 0).order_by(db.desc(
            s_data_numbyday.time)).all()

    now = time.time()
    secDay = 3600 * 24
    todayUser = s_plat_user.query.filter(
        s_plat_user.regTime > myData[0].time + secDay).filter(
            s_plat_user.regTime < now).count()
    todayGame = s_plat_fightlog.query.filter(
        s_plat_fightlog.logTime > myData[0].time + secDay).filter(
            s_plat_fightlog.logTime < now).count()

    gdusers = s_plat_user.query.all()
    gsusers = s_plat_user.query.filter(s_plat_user.wxid.like("player_%")).all()

    tol_user = len(gdusers)
    tol_guest = len(gsusers)
    tol_wechat = tol_user - tol_guest
    gdgames = s_plat_fightlog.query.all()
    tol_game = len(gdgames)
    return render_template('index.html',
                           tol_user=tol_user,
                           tol_wechat=tol_wechat,
                           tol_guest=tol_guest,
                           tol_game=tol_game,
                           todayUser=todayUser,
                           todayGame=todayGame,
                           datas=myData[0:4])
Esempio n. 2
0
def userListByGeoPage(page):
    refreshLocalUserGeo()
    myData = s_data_usergeo.query.filter(s_data_usergeo.game != -1).order_by(
        db.desc(s_data_usergeo.userid)).all()
    tol_item = len(myData)
    tol_page = int(math.ceil(tol_item / 20.0))
    cur_page = page
    return render_template('userListByGeo.html',
                           users=myData[20 * page - 20:20 * page],
                           cur_page=cur_page,
                           tol_page=tol_page,
                           tol_user=tol_item)
Esempio n. 3
0
def userListByGamePage(page):
    gdusers = s_plat_fightbfs.query.join(s_plat_user).order_by(
        db.desc(s_plat_fightbfs.wins + s_plat_fightbfs.losts)).all()

    tol_item = len(gdusers)
    tol_page = int(math.ceil(tol_item / 10.0))
    cur_page = page
    return render_template('userListByGame.html',
                           users=gdusers[10 * page - 10:10 * page],
                           cur_page=cur_page,
                           tol_page=tol_page,
                           tol_user=tol_item)
Esempio n. 4
0
def dayUpUserListPage(page):
    refreshLocalDbDay()
    myData = s_data_numbyday.query.filter(
        s_data_numbyday.usertolnum > 0).order_by(db.desc(
            s_data_numbyday.time)).all()
    tol_item = len(myData)
    tol_page = int(math.ceil(tol_item / 20.0))
    cur_page = page
    return render_template('dayUpUserList.html',
                           users=myData[20 * page - 20:20 * page],
                           cur_page=cur_page,
                           tol_page=tol_page)