# -*- encoding: utf-8 -*-
from flask import Blueprint, request, redirect, jsonify
from common.libs.Helper import ops_render, iPagination, getCurrentDate
from common.libs.UrlManager import UrlManager
from common.libs.user.UserService import UserService
from common.models.User import User
from common.models.log.AppAccessLog import AppAccessLog
from application import app, db
from sqlalchemy import or_
route_account = Blueprint('account_page', __name__)
@route_account.route("/index")
def index():
resp_data = {}
query = User.query
req = request.values
page = int(req['p']) if ('p' in req and req['p']) else 1
if 'mix_kw' in req:
rule = or_(User.nickname.ilike("%{0}%".format(req['mix_kw'])), User.mobile.ilike("%{0}%".format(req['mix_kw'])))
query = query.filter(rule)
if 'status' in req and int(req['status']) > -1:
query = query.filter(User.status == int(req['status']))
page_params = {
'total': query.count(),
'page_size': app.config['PAGE_SIZE'],
'page': page,
'display': app.config['PAGE_DISPLAY'],
'url': request.full_path.replace("&p={}".format(page), "")
}
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
resp_data['search_con'] = req
resp_data['status_mapping'] = app.config['STATUS_MAPPING']
return ops_render("account/index.html", resp_data)
@route_account.route("/info")
def info():
resp_data = {}
req = request.args
app.logger.info(req)
uid = int(req.get('id', 0))
callback_url = UrlManager.buildUrl("/account/index")
if uid < 1:
return redirect(callback_url)
info = User.query.filter_by(uid=uid).first()
if not info:
return redirect(callback_url)
page = int(req['p']) if ('p' in req and req['p']) else 1
access_query = AppAccessLog.query
page_params = {
'total': access_query.count(),
'page_size': app.config['PAGE_SIZE'],
'page': page,
'display': app.config['PAGE_DISPLAY'],
'url': request.full_path.replace("&p={}".format(page), "")
}
pages = iPagination(page_params)
offset = (page - 1) * app.config['PAGE_SIZE']
limit = app.config['PAGE_SIZE'] * page
access_log_list = AppAccessLog.query.order_by(AppAccessLog.uid.desc()).all()[offset: limit]
resp_data['list'] = access_log_list
resp_data['pages'] = pages
resp_data['info'] = info
return ops_render("account/info.html", resp_data)
@route_account.route("/set", methods=['GET', 'POST'])
def set():
default_pwd = "******"
if request.method == 'GET':
resp_data = {}
req = request.args
uid = int(req.get('id', 0))
user_info = None
if uid:
user_info = User.query.filter_by(uid=uid).first()
resp_data['user_info'] = user_info
return ops_render('account/set.html', resp_data)
resp = {'code': 200, 'msg': "success", 'data': {}}
req = request.values
id = req['id'] if 'id' in req else 0
nickname = req['nickname'] if 'nickname' in req else ''
mobile = req['mobile'] if 'mobile' in req else ''
email = req['email'] if 'email' in req else ''
login_name = req['login_name'] if 'login_name' in req else ''
login_pwd = req['login_pwd'] if "login_pwd" in req else ''
if nickname is None or len(nickname) < 1:
resp['code'] = -1
resp['msg'] = '请输入符合规范的姓名~~'
return jsonify(resp)
if mobile is None or len(mobile) < 1:
resp['code'] = -1
resp['msg'] = "请输入符合规范的手机号~~"
return jsonify(resp)
if email is None or len(email) < 1:
resp['code'] = -1
resp['msg'] = "请输入符合规范的邮箱~~"
return jsonify(resp)
if login_name is None or len(login_name) < 1:
resp['code'] = -1
resp['msg'] = "请输入符合规范的登录用户名~~"
return jsonify(resp)
if login_pwd is None or len(login_pwd) < 6:
resp['code'] = -1
resp['msg'] = "请输入符合规范的登录密码~~"
return jsonify(resp)
has_in = User.query.filter(User.login_name == login_name, User.uid != id).first()
if has_in:
resp['code'] = -1
resp['msg'] = "该登录名已存在,请换一个试试~~"
return jsonify(resp)
user_info = User.query.filter_by(uid=id).first()
if user_info:
model_user = user_info
else:
model_user = User()
model_user.created_time = getCurrentDate()
model_user.login_salt = UserService.geneSalt()
model_user.nickname = nickname
model_user.mobile = mobile
model_user.email = email
model_user.login_name = login_name
if login_pwd != default_pwd:
model_user.login_pwd = UserService.genePwd(login_pwd, model_user.login_salt)
model_user.updated_time = getCurrentDate()
db.session.add(model_user)
db.session.commit()
return jsonify(resp)
@route_account.route("/ops", methods=['POST'])
def ops():
resp = {'code': 200, 'msg': "success", 'data': {}}
req = request.values
id = req['id'] if 'id' in req else 0
act = req['act'] if 'id' in req else ""
if not id:
resp['code'] = -1
resp['msg'] = "请选择要操作的账号~~"
return jsonify(resp)
if act not in ['remove', 'recover']:
resp['code'] = -1
resp['msg'] = "操作有误,请重试~~"
return jsonify(resp)
user_info = User.query.filter_by(uid=id).first()
if not user_info:
resp['code'] = -1
resp['msg'] = "指定账号不存在~~"
return jsonify(resp)
if act == "remove":
user_info.status = 0
elif act == "recover":
user_info.status = 1
user_info.update_time = getCurrentDate()
db.session.add(user_info)
db.session.commit()
return jsonify(resp)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
基于Python+Flask的点餐小程序-毕业设计源码+使用文档(高分优秀项目).zip 该项目是个人高分毕业设计项目源码,已获导师指导认可通过,答辩评审分达到97分,在window10/11测试环境严格调试,下载即用,确保可以运行,部署教程齐全,也可以作为课程设计 基于Python+Flask的点餐小程序-毕业设计源码+使用文档(高分优秀项目).zip 该项目是个人高分毕业设计项目源码,已获导师指导认可通过,答辩评审分达到97分,在window10/11测试环境严格调试,下载即用,确保可以运行,部署教程齐全,也可以作为课程设计 基于Python+Flask的点餐小程序-毕业设计源码+使用文档(高分优秀项目).zip 该项目是个人高分毕业设计项目源码,已获导师指导认可通过,答辩评审分达到97分,在window10/11测试环境严格调试,下载即用,确保可以运行,部署教程齐全,也可以作为课程设计 基于Python+Flask的点餐小程序-毕业设计源码+使用文档(高分优秀项目).zip 该项目是个人高分毕业设计项目源码,已获导师指导认可通过,答辩评审分达到97分,在window10/11测试环境严格调试,下载即用,确保可以运行,部署教程齐全,也可以作为课程设计 基于Python+Flask的点餐小程序-毕业设计源码+使用文档(高分优秀项目).zip 该项目是个人高分毕业设计项目源码,已获导师指导认可通过,答辩评审分达到97分,在window10/11测试环境严格调试,下载即用,确保可以运行,部署教程齐全,也可以作为课程设计
资源推荐
资源详情
资源评论
收起资源包目录
基于Python+Flask的点餐小程序-毕业设计源码+使用文档(高分优秀项目).zip (626个子文件)
style.css 155KB
bootstrap.min.css 118KB
bootstrap.min.css 118KB
ueditor.css 43KB
ueditor.min.css 34KB
font-awesome.css 28KB
font-awesome.min.css 23KB
video-js.css 21KB
image.css 18KB
jquery.datetimepicker.min.css 16KB
select2.min.css 16KB
video.css 15KB
layer.css 14KB
attachment.css 14KB
video-js.min.css 11KB
shCoreDefault.css 7KB
layer.css 5KB
scrawl.css 4KB
codemirror.css 3KB
charts.css 3KB
background.css 2KB
emotion.css 2KB
dialogbase.css 2KB
music.css 2KB
edittable.css 1KB
template.css 1KB
jquery.tagsinput.min.css 770B
webuploader.css 515B
help.css 389B
iframe.css 41B
fontawesome-webfont.eot 59KB
vjs.eot 3KB
loading.gif 82KB
wface.gif 49KB
jxface2.gif 40KB
yface.gif 28KB
bface.gif 27KB
icons.gif 20KB
file-icons.gif 20KB
file-icons.gif 20KB
tface.gif 19KB
fface.gif 18KB
35.gif 13KB
42.gif 13KB
40.gif 10KB
cface.gif 8KB
18.gif 8KB
19.gif 8KB
11.gif 8KB
32.gif 7KB
49.gif 6KB
29.gif 6KB
loading-0.gif 6KB
97.gif 5KB
65.gif 5KB
31.gif 5KB
46.gif 5KB
57.gif 5KB
45.gif 5KB
08.gif 5KB
43.gif 4KB
33.gif 4KB
68.gif 4KB
26.gif 4KB
14.gif 4KB
07.gif 4KB
icons-all.gif 4KB
51.gif 4KB
10.gif 4KB
47.gif 4KB
72.gif 4KB
06.gif 3KB
94.gif 3KB
84.gif 3KB
41.gif 3KB
17.gif 3KB
09.gif 3KB
28.gif 3KB
50.gif 3KB
95.gif 3KB
22.gif 3KB
27.gif 3KB
67.gif 3KB
90.gif 3KB
60.gif 3KB
58.gif 3KB
74.gif 2KB
25.gif 2KB
101.gif 2KB
54.gif 2KB
99.gif 2KB
24.gif 2KB
12.gif 2KB
73.gif 2KB
104.gif 2KB
103.gif 2KB
34.gif 2KB
88.gif 2KB
53.gif 2KB
04.gif 2KB
共 626 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
- 快乐775772024-06-12资源值得借鉴的内容很多,那就浅学一下吧,值得下载!
- 2301_817599602024-09-10资源很好用,有较大的参考价值,资源不错,支持一下。
不走小道
- 粉丝: 3331
- 资源: 5060
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功