Files
order/web/controllers/account/Account.py

39 lines
1.1 KiB
Python
Raw Normal View History

2019-07-21 18:20:01 +08:00
# -*- coding: utf-8 -*-
2019-07-22 17:58:38 +08:00
from flask import Blueprint,request,redirect
from common.libs.Helper import ops_render,iPagination
2019-07-22 17:41:42 +08:00
from common.models.User import User
2019-07-21 18:20:01 +08:00
route_account = Blueprint( 'account_page',__name__ )
2019-07-22 17:58:38 +08:00
from application import app,db
2019-07-21 18:20:01 +08:00
@route_account.route( "/index" )
def index():
2019-07-22 17:58:38 +08:00
resp_data = {}
req = request.values
page = int(req['p']) if ('p' in req and req['p']) else 1
query = User.query
page_params = {
'total': query.count(),
'page_size': app.config['PAGE_SIZE'],
'page': page,
'display': app.config['PAGE_DISPLAY'],
'url': '/account/index'
}
pages = iPagination(page_params)
offset = (page - 1) * app.config['PAGE_SIZE']
limit = app.config['PAGE_SIZE'] * page
list = query.order_by(User.uid.desc()).all()[offset:limit]
resp_data['list'] = list
resp_data['pages'] = pages
return ops_render("account/index.html", resp_data)
2019-07-21 18:20:01 +08:00
@route_account.route( "/info" )
def info():
2019-07-22 14:50:06 +08:00
return ops_render( "account/info.html" )
2019-07-21 18:20:01 +08:00
@route_account.route( "/set" )
def set():
2019-07-22 14:50:06 +08:00
return ops_render( "account/set.html" )