文末获取资源,收藏关注不迷路
文章目录
- 前言
- 一、研究背景
- 二、研究意义
- 三、主要使用技术
- 四、研究内容
- 五、核心代码
- 六、文章目录
前言
随着科技和网络的进步,计算机技术与网络、生活贴和的更加紧密。需要依靠客户端的单机系统逐渐被淘汰,利用互联网可以处理大量数据的新型系统如雨后春笋般迅速发展起来。这类系统和信息化时代的同步发展对传统的办公管理方式造成了很大的压力。当今时代,信息数据是一切的根本,是基础,想要做出决策都需要充分考虑数据,可见信息的重要性。然而传统的办公管理方式对于信息的操控越来越艰难。如何才可以改变局面,使信息数据重新为用户服务,体现价值是现在所有行业所面临的重要问题。
本基于Python的旅游景点推荐系统正是采用计算机技术和网络设计的新型系统,可以有效的把旅游信息与网络相结合,为用户提供旅游帮助和管理需求。本系统采用Mysql数据库存储数据,兼容性更强,可跨越多种平台。主要设计的内容包括景点信息、门票预订信息,用户可以分享攻略。为了可以给用户更多的权利,在系统中加入了在线留言功能。管理员在系统中可以更新景点、修改登录密码信息,管理用户的门票预订信息、资料信息等。本系统是信息化社会发展的必然产物,可以为用户提供更为高效的管理以及辅助,同时也可以改变旅游行业的局面,增加营业额。
一、研究背景
网络和科技的进步以及人们生活条件的提高都让计算机技术越来越平民化,深入日常生活中。网络更是成为生活的必备条件,大到国家单位、科研项目,小到大街小巷都充斥着网络的身影。在日常办公中,计算机起到了文字编辑、打印、信息检索、统计等的作用。使用计算机可以使日常繁杂的信息进行科学的加工,使信息变得更加的有序、可利用。计算机技术已成为热门。
正是因为网络、科技、计算机技术使现代人的生活和工作变得便利、轻松,给实体行业带来了巨大的冲击。旅游行业也遇到了前所未有的挑战。现如今,对于旅游信息的管理有很多的局限性,究其原因是因为旅游行业的根本是资金的运动。在新时代的环境下,传统的管理方式不再满足用户的需求,难以管理现代的工作。传统的管理方式不仅跟不上时代的发展,还不能实现最基本的工作要求,例如对于景点的宣传还停留在花费大量的资金打广告,制作宣传单页,这种方式辐射范围非常有限,效果也非常不好。对于基本工作信息的管理也还是采用人工管理,人工管理出错率大,效率低。对于信息的传递都需要经过多人审核才可以完成,想要定期进行分析和总结更是难上加难。因为每种信息之间的关系错综复杂,在定期的统计和查询中就会出现重复出现的问题,对工作人员来说工作压力非常大。
二、研究意义
现在旅游行业已有一些商家使用了基本的管理软件,这些软件都是依靠客户端,只可以特定人员使用,不能实现信息的共享。虽然可以帮助工作人员减少工作量,但从根本上还是无法满足用户的需求。这些软件都还是基于网络发展之初的要求,没有利用现代网络的技术,体现不了更为实用的功能。依靠客户端的系统开发时没有考虑园际化的问题,所以也满足不了国际化的要求。最近几年来,我国网络快速发展,传统的管理方式也越来越适应不了新时代的要求,在处理大量信息时表现不足,开发一个依托现代技术、网络技术的基于Python的旅游景点推荐系统迫在眉捷。这类系统将会改变旅游行业的现状。
想要改变旅游行业的现状,就需要采用更为先进的管理方式。本网上基于Python的旅游景点推荐系统就是在新时代发展下开发的。本系统的开发非常有意义,体现了行业的创新。本系统是以信息管理为主导,而信息管理就是行业最大的问题,可以极大的提高工作效率。景点信息的信息化管理是目前旅游行业的核心,解决了信息化的问题就可以使旅游行业更进一步。开发本系统可以使旅游信息更加的清晰、透明,便于管理人员操作。使用本系统可以使管理工作实现部分自动化,减少人工,提高正确率。
本系统是将网络技术和现代的管理理念相结合,根据旅游信息的特点进行重新分配、整合形成动态的、分类明确的信息资源,实现了旅游信息的自动化,减少人工管理过程,为管理人员的决策提供帮助。使用新型的管理系统已成为时代的标志,本系统可以提高旅游行业的竞争力,提高景点的宣传效果,使工作人员的管理工作更加轻松。
三、主要使用技术
使用说明
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
使用PyCharm 导入项目,修改配置,运行项目;
将项目中config.ini配置文件中的数据库配置改为自己的配置,然后运行;
运行成功后,在浏览器中输入:http://localhost:8080/项目名
本python+django+vue+Elementui+mysql系统可以定制,采用pycharm开发,基于web的B/S架构设计完成,充分保证了系统代码的良好可读性、实用性、易扩展性、通用性、便于后期维护、操作方便以及页面简洁等特点,覆盖知识面大,非常适合作为计算机专业的同学参考资料进行学习.主要编程语言为python和mysql,框架是django,有代码视频讲解参考,包安装调试,包本地部署成功.
四、研究内容
本课题的主要内容包括管理员和用户两个部分,管理员负责旅游相关信息的管理,包括景点信息、用户的预订信息以及用户信息的管理;用户可以浏览景点,进行门票的预订,可以分享攻略,也可以管理预订信息和个人资料信息等。本基于Python的旅游景点推荐系统满足了用户和管理人员双方的要求,符合了信息化现代的要求。
本系统的主要角色为管理员和用户,管理员的用例包括在线留言管理、攻略分享管理、用户管理、景点管理、门票预订管理、景点分类管理。
用户的用例包括浏览景点信息,查询景点以及门票预订,分享攻略等。
五、核心代码
#coding:utf-8
__author__ = "ila"
import base64, copy, logging, os, time, xlrd
from django.http import JsonResponse
from django.apps import apps
from django.db.models.aggregates import Count,Sum
from .models import huiyuan
from util.codes import *
from util.auth import Auth
from util.common import Common
import util.message as mes
from django.db import connection
import random
from django.core.mail import send_mail
from django.conf import settings
from django.shortcuts import redirect
def huiyuan_register(request):
if request.method in ["POST", "GET"]:
msg = {'code': normal_code, "msg": mes.normal_code}
req_dict = request.session.get("req_dict")
error = huiyuan.createbyreq(huiyuan, huiyuan, req_dict)
if error != None:
msg['code'] = crud_error_code
msg['msg'] = "用户已存在,请勿重复注册!"
return JsonResponse(msg)
def huiyuan_login(request):
if request.method in ["POST", "GET"]:
msg = {'code': normal_code, "msg": mes.normal_code}
req_dict = request.session.get("req_dict")
datas = huiyuan.getbyparams(huiyuan, huiyuan, req_dict)
if not datas:
msg['code'] = password_error_code
msg['msg'] = mes.password_error_code
return JsonResponse(msg)
try:
__sfsh__= huiyuan.__sfsh__
except:
__sfsh__=None
if __sfsh__=='是':
if datas[0].get('sfsh')=='否':
msg['code']=other_code
msg['msg'] = "账号已锁定,请联系管理员审核!"
return JsonResponse(msg)
req_dict['id'] = datas[0].get('id')
return Auth.authenticate(Auth, huiyuan, req_dict)
def huiyuan_logout(request):
if request.method in ["POST", "GET"]:
msg = {
"msg": "登出成功",
"code": 0
}
return JsonResponse(msg)
def huiyuan_resetPass(request):
'''
'''
if request.method in ["POST", "GET"]:
msg = {"code": normal_code, "msg": mes.normal_code}
req_dict = request.session.get("req_dict")
columns= huiyuan.getallcolumn( huiyuan, huiyuan)
try:
__loginUserColumn__= huiyuan.__loginUserColumn__
except:
__loginUserColumn__=None
username=req_dict.get(list(req_dict.keys())[0])
if __loginUserColumn__:
username_str=__loginUserColumn__
else:
username_str=username
if 'mima' in columns:
password_str='mima'
else:
password_str='password'
init_pwd = '123456'
recordsParam = {}
recordsParam[username_str] = req_dict.get("username")
records=huiyuan.getbyparams(huiyuan, huiyuan, recordsParam)
if len(records)<1:
msg['code'] = 400
msg['msg'] = '用户不存在'
return JsonResponse(msg)
eval('''huiyuan.objects.filter({}='{}').update({}='{}')'''.format(username_str,username,password_str,init_pwd))
return JsonResponse(msg)
def huiyuan_session(request):
'''
'''
if request.method in ["POST", "GET"]:
msg = {"code": normal_code,"msg": mes.normal_code, "data": {}}
req_dict={"id":request.session.get('params').get("id")}
msg['data'] = huiyuan.getbyparams(huiyuan, huiyuan, req_dict)[0]
return JsonResponse(msg)
def huiyuan_default(request):
if request.method in ["POST", "GET"]:
msg = {"code": normal_code,"msg": mes.normal_code, "data": {}}
req_dict = request.session.get("req_dict")
req_dict.update({"isdefault":"是"})
data=huiyuan.getbyparams(huiyuan, huiyuan, req_dict)
if len(data)>0:
msg['data'] = data[0]
else:
msg['data'] = {}
return JsonResponse(msg)
def huiyuan_page(request):
'''
'''
if request.method in ["POST", "GET"]:
msg = {"code": normal_code, "msg": mes.normal_code, "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":10,"list":[]}}
req_dict = request.session.get("req_dict")
#获取全部列名
columns= huiyuan.getallcolumn( huiyuan, huiyuan)
#当前登录用户所在表
tablename = request.session.get("tablename")
#authColumn=list(__authTables__.keys())[0]
#authTable=__authTables__.get(authColumn)
# if authTable==tablename:
#params = request.session.get("params")
#req_dict[authColumn]=params.get(authColumn)
'''__authSeparate__此属性为真,params添加userid,后台只查询个人数据'''
try:
__authSeparate__=huiyuan.__authSeparate__
except:
__authSeparate__=None
if __authSeparate__=="是":
tablename=request.session.get("tablename")
if tablename!="users" and 'userid' in columns:
try:
req_dict['userid']=request.session.get("params").get("id")
except:
pass
#当项目属性hasMessage为”是”,生成系统自动生成留言板的表messages,同时该表的表属性hasMessage也被设置为”是”,字段包括userid(用户id),username(用户名),content(留言内容),reply(回复)
#接口page需要区分权限,普通用户查看自己的留言和回复记录,管理员查看所有的留言和回复记录
try:
__hasMessage__=huiyuan.__hasMessage__
except:
__hasMessage__=None
if __hasMessage__=="是":
tablename=request.session.get("tablename")
if tablename!="users":
req_dict["userid"]=request.session.get("params").get("id")
# 判断当前表的表属性isAdmin,为真则是管理员表
# 当表属性isAdmin=”是”,刷出来的用户表也是管理员,即page和list可以查看所有人的考试记录(同时应用于其他表)
__isAdmin__ = None
allModels = apps.get_app_config('main').get_models()
for m in allModels:
if m.__tablename__==tablename:
try:
__isAdmin__ = m.__isAdmin__
except:
__isAdmin__ = None
break
# 当前表也是有管理员权限的表
if __isAdmin__ == "是":
if req_dict.get("userid"):
del req_dict["userid"]
else:
#非管理员权限的表,判断当前表字段名是否有userid
if tablename!="users" and 'huiyuan'[:7]!='discuss'and "userid" in huiyuan.getallcolumn(huiyuan,huiyuan):
req_dict["userid"] = request.session.get("params").get("id")
#当列属性authTable有值(某个用户表)[该列的列名必须和该用户表的登陆字段名一致],则对应的表有个隐藏属性authTable为”是”,那么该用户查看该表信息时,只能查看自己的
try:
__authTables__=huiyuan.__authTables__
except:
__authTables__=None
if __authTables__!=None and __authTables__!={}:
try:
del req_dict['userid']
except:
pass
for authColumn,authTable in __authTables__.items():
if authTable==tablename:
params = request.session.get("params")
req_dict[authColumn]=params.get(authColumn)
break
msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
msg['data']['pageSize'] =huiyuan.page(huiyuan, huiyuan, req_dict, request)
return JsonResponse(msg)
def huiyuan_autoSort(request):
'''
.智能推荐功能(表属性:[intelRecom(是/否)],新增clicktime[前端不显示该字段]字段(调用info/detail接口的时候更新),按clicktime排序查询)
主要信息列表(如商品列表,新闻列表)中使用,显示最近点击的或最新添加的5条记录就行
'''
if request.method in ["POST", "GET"]:
msg = {"code": normal_code, "msg": mes.normal_code, "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":10,"list":[]}}
req_dict = request.session.get("req_dict")
if "clicknum" in huiyuan.getallcolumn(huiyuan,huiyuan):
req_dict['sort']='clicknum'
else:
req_dict['sort']='clicktime'
req_dict['order']='desc'
msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
msg['data']['pageSize'] = huiyuan.page(huiyuan,huiyuan, req_dict)
return JsonResponse(msg)
def huiyuan_list(request):
'''
前台分页
'''
if request.method in ["POST", "GET"]:
msg = {"code": normal_code, "msg": mes.normal_code, "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":10,"list":[]}}
req_dict = request.session.get("req_dict")
#获取全部列名
columns= huiyuan.getallcolumn( huiyuan, huiyuan)
#表属性[foreEndList]前台list:和后台默认的list列表页相似,只是摆在前台,否:指没有此页,是:表示有此页(不需要登陆即可查看),前要登:表示有此页且需要登陆后才能查看
try:
__foreEndList__=huiyuan.__foreEndList__
except:
__foreEndList__=None
if __foreEndList__=="前要登":
tablename=request.session.get("tablename")
if tablename!="users" and 'userid' in columns:
try:
req_dict['userid']=request.session.get("params").get("id")
except:
pass
#forrEndListAuth
try:
__foreEndListAuth__=huiyuan.__foreEndListAuth__
except:
__foreEndListAuth__=None
#authSeparate
try:
__authSeparate__=huiyuan.__authSeparate__
except:
__authSeparate__=None
if __foreEndListAuth__ =="是" and __authSeparate__=="是":
tablename=request.session.get("tablename")
if tablename!="users":
req_dict['userid']=request.session.get("params",{"id":0}).get("id")
tablename = request.session.get("tablename")
if tablename == "users" and req_dict.get("userid") != None:#判断是否存在userid列名
del req_dict["userid"]
else:
__isAdmin__ = None
allModels = apps.get_app_config('main').get_models()
for m in allModels:
if m.__tablename__==tablename:
try:
__isAdmin__ = m.__isAdmin__
except:
__isAdmin__ = None
break
if __isAdmin__ == "是":
if req_dict.get("userid"):
del req_dict["userid"]
else:
#非管理员权限的表,判断当前表字段名是否有userid
if "userid" in columns:
try:
pass
# 本接口可以匿名访问,所以try判断是否为匿名
#req_dict['userid']=request.session.get("params").get("id")
except:
pass
#当列属性authTable有值(某个用户表)[该列的列名必须和该用户表的登陆字段名一致],则对应的表有个隐藏属性authTable为”是”,那么该用户查看该表信息时,只能查看自己的
try:
__authTables__=huiyuan.__authTables__
except:
__authTables__=None
if __authTables__!=None and __authTables__!={} and __foreEndListAuth__=="是":
try:
del req_dict['userid']
except:
pass
for authColumn,authTable in __authTables__.items():
if authTable==tablename:
params = request.session.get("params")
req_dict[authColumn]=params.get(authColumn)
break
if huiyuan.__tablename__[:7]=="discuss":
try:
del req_dict['userid']
except:
pass
msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
msg['data']['pageSize'] = huiyuan.page(huiyuan, huiyuan, req_dict)
return JsonResponse(msg)
def huiyuan_save(request):
'''
后台新增
'''
if request.method in ["POST", "GET"]:
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
req_dict = request.session.get("req_dict")
if 'clicktime' in req_dict.keys():
del req_dict['clicktime']
tablename=request.session.get("tablename")
__isAdmin__ = None
allModels = apps.get_app_config('main').get_models()
for m in allModels:
if m.__tablename__==tablename:
try:
__isAdmin__ = m.__isAdmin__
except:
__isAdmin__ = None
break
#获取全部列名
columns= huiyuan.getallcolumn( huiyuan, huiyuan)
if tablename!='users' and req_dict.get("userid")!=None and 'userid' in columns and __isAdmin__!='是':
params=request.session.get("params")
req_dict['userid']=params.get('id')
error= huiyuan.createbyreq(huiyuan,huiyuan, req_dict)
if error!=None:
msg['code'] = crud_error_code
msg['msg'] = error
return JsonResponse(msg)
def huiyuan_add(request):
'''
前台新增
'''
if request.method in ["POST", "GET"]:
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
req_dict = request.session.get("req_dict")
#获取全部列名
columns= huiyuan.getallcolumn( huiyuan, huiyuan)
try:
__authSeparate__=huiyuan.__authSeparate__
except:
__authSeparate__=None
if __authSeparate__=="是":
tablename=request.session.get("tablename")
if tablename!="users" and 'userid' in columns:
try:
req_dict['userid']=request.session.get("params").get("id")
except:
pass
try:
__foreEndListAuth__=huiyuan.__foreEndListAuth__
except:
__foreEndListAuth__=None
if __foreEndListAuth__ and __foreEndListAuth__!="否":
tablename=request.session.get("tablename")
if tablename!="users":
req_dict['userid']=request.session.get("params").get("id")
error= huiyuan.createbyreq(huiyuan,huiyuan, req_dict)
if error!=None:
msg['code'] = crud_error_code
msg['msg'] = error
return JsonResponse(msg)
def huiyuan_thumbsup(request,id_):
'''
点赞:表属性thumbsUp[是/否],刷表新增thumbsupnum赞和crazilynum踩字段,
'''
if request.method in ["POST", "GET"]:
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
req_dict = request.session.get("req_dict")
id_=int(id_)
type_=int(req_dict.get("type",0))
rets=huiyuan.getbyid(huiyuan,huiyuan,id_)
update_dict={
"id":id_,
}
if type_==1:#赞
update_dict["thumbsupnum"]=int(rets[0].get('thumbsupnum'))+1
elif type_==2:#踩
update_dict["crazilynum"]=int(rets[0].get('crazilynum'))+1
error = huiyuan.updatebyparams(huiyuan,huiyuan, update_dict)
if error!=None:
msg['code'] = crud_error_code
msg['msg'] = error
return JsonResponse(msg)
def huiyuan_info(request,id_):
'''
'''
if request.method in ["POST", "GET"]:
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
data = huiyuan.getbyid(huiyuan,huiyuan, int(id_))
if len(data)>0:
msg['data']=data[0]
#浏览点击次数
try:
__browseClick__= huiyuan.__browseClick__
except:
__browseClick__=None
if __browseClick__=="是" and "clicknum" in huiyuan.getallcolumn(huiyuan,huiyuan):
try:
clicknum=int(data[0].get("clicknum",0))+1
except:
clicknum=0+1
click_dict={"id":int(id_),"clicknum":clicknum}
ret=huiyuan.updatebyparams(huiyuan,huiyuan,click_dict)
if ret!=None:
msg['code'] = crud_error_code
msg['msg'] = ret
return JsonResponse(msg)
def huiyuan_detail(request,id_):
'''
'''
if request.method in ["POST", "GET"]:
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
data =huiyuan.getbyid(huiyuan,huiyuan, int(id_))
if len(data)>0:
msg['data']=data[0]
#浏览点击次数
try:
__browseClick__= huiyuan.__browseClick__
except:
__browseClick__=None
if __browseClick__=="是" and "clicknum" in huiyuan.getallcolumn(huiyuan,huiyuan):
try:
clicknum=int(data[0].get("clicknum",0))+1
except:
clicknum=0+1
click_dict={"id":int(id_),"clicknum":clicknum}
ret=huiyuan.updatebyparams(huiyuan,huiyuan,click_dict)
if ret!=None:
msg['code'] = crud_error_code
msg['msg'] = retfo
return JsonResponse(msg)
def huiyuan_update(request):
'''
'''
if request.method in ["POST", "GET"]:
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
req_dict = request.session.get("req_dict")
if req_dict.get("mima") and req_dict.get("password"):
if "mima" not in huiyuan.getallcolumn(huiyuan,huiyuan) :
del req_dict["mima"]
if "password" not in huiyuan.getallcolumn(huiyuan,huiyuan) :
del req_dict["password"]
try:
del req_dict["clicknum"]
except:
pass
error = huiyuan.updatebyparams(huiyuan, huiyuan, req_dict)
if error!=None:
msg['code'] = crud_error_code
msg['msg'] = error
return JsonResponse(msg)
def huiyuan_delete(request):
'''
批量删除
'''
if request.method in ["POST", "GET"]:
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
req_dict = request.session.get("req_dict")
error=huiyuan.deletes(huiyuan,
huiyuan,
req_dict.get("ids")
)
if error!=None:
msg['code'] = crud_error_code
msg['msg'] = error
return JsonResponse(msg)
def huiyuan_vote(request,id_):
'''
浏览点击次数(表属性[browseClick:是/否],点击字段(clicknum),调用info/detail接口的时候后端自动+1)、投票功能(表属性[vote:是/否],投票字段(votenum),调用vote接口后端votenum+1)
统计商品或新闻的点击次数;提供新闻的投票功能
'''
if request.method in ["POST", "GET"]:
msg = {"code": normal_code, "msg": mes.normal_code}
data= huiyuan.getbyid(huiyuan, huiyuan, int(id_))
for i in data:
votenum=i.get('votenum')
if votenum!=None:
params={"id":int(id_),"votenum":votenum+1}
error=huiyuan.updatebyparams(huiyuan,huiyuan,params)
if error!=None:
msg['code'] = crud_error_code
msg['msg'] = error
return JsonResponse(msg)
def huiyuan_importExcel(request):
if request.method in ["POST", "GET"]:
msg = {"code": normal_code, "msg": "成功", "data": {}}
excel_file = request.FILES.get("file", "")
file_type = excel_file.name.split('.')[1]
if file_type in ['xlsx', 'xls']:
data = xlrd.open_workbook(filename=None, file_contents=excel_file.read())
table = data.sheets()[0]
rows = table.nrows
try:
for row in range(1, rows):
row_values = table.row_values(row)
req_dict = {}
huiyuan.createbyreq(huiyuan, huiyuan, req_dict)
except:
pass
else:
msg.code = 500
msg.msg = "文件类型错误"
return JsonResponse(msg)
def huiyuan_sendemail(request):
if request.method in ["POST", "GET"]:
req_dict = request.session.get("req_dict")
code = random.sample(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], 4)
to = []
to.append(req_dict['email'])
send_mail('用户注册', '您的注册验证码是【'+''.join(code)+'】,请不要把验证码泄漏给其他人,如非本人请勿操作。', 'yclw9@qq.com', to, fail_silently = False)
cursor = connection.cursor()
cursor.execute("insert into emailregistercode(email,role,code) values('"+req_dict['email']+"','用户','"+''.join(code)+"')")
msg = {
"msg": "发送成功",
"code": 0
}
return JsonResponse(msg)
def huiyuan_autoSort2(request):
if request.method in ["POST", "GET"]:
req_dict = request.session.get("req_dict")
cursor = connection.cursor()
leixing = set()
try:
cursor.execute("select inteltype from storeup where userid = %d"%(request.session.get("params").get("id"))+" and tablename = 'huiyuan' order by addtime desc")
rows = cursor.fetchall()
for row in rows:
for item in row:
if item != None:
leixing.add(item)
except:
leixing = set()
L = []
cursor.execute("select * from huiyuan where $intelRecomColumn in ('%s"%("','").join(leixing)+"') union all select * from huiyuan where $intelRecomColumn not in('%s"%("','").join(leixing)+"')")
desc = cursor.description
data_dict = [dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall()]
for online_dict in data_dict:
for key in online_dict:
if 'datetime.datetime' in str(type(online_dict[key])):
online_dict[key] = online_dict[key].strftime(
"%Y-%m-%d %H:%M:%S")
else:
pass
L.append(online_dict)
return JsonResponse({"code": 0, "msg": '', "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":5,"list": L[0:6]}})
def huiyuan_value(request, xColumnName, yColumnName, timeStatType):
if request.method in ["POST", "GET"]:
msg = {"code": normal_code, "msg": "成功", "data": {}}
where = ' where 1 = 1 '
sql = ''
if timeStatType == '日':
sql = "SELECT DATE_FORMAT({0}, '%Y-%m-%d') {0}, sum({1}) total FROM huiyuan {2} GROUP BY DATE_FORMAT({0}, '%Y-%m-%d')".format(xColumnName, yColumnName, where, '%Y-%m-%d')
if timeStatType == '月':
sql = "SELECT DATE_FORMAT({0}, '%Y-%m') {0}, sum({1}) total FROM huiyuan {2} GROUP BY DATE_FORMAT({0}, '%Y-%m')".format(xColumnName, yColumnName, where, '%Y-%m')
if timeStatType == '年':
sql = "SELECT DATE_FORMAT({0}, '%Y') {0}, sum({1}) total FROM huiyuan {2} GROUP BY DATE_FORMAT({0}, '%Y')".format(xColumnName, yColumnName, where, '%Y')
L = []
cursor = connection.cursor()
cursor.execute(sql)
desc = cursor.description
data_dict = [dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall()]
for online_dict in data_dict:
for key in online_dict:
if 'datetime.datetime' in str(type(online_dict[key])):
online_dict[key] = online_dict[key].strftime(
"%Y-%m-%d %H:%M:%S")
else:
pass
L.append(online_dict)
msg['data'] = L
return JsonResponse(msg)
def huiyuan_o_value(request, xColumnName, yColumnName):
if request.method in ["POST", "GET"]:
msg = {"code": normal_code, "msg": "成功", "data": {}}
where = ' where 1 = 1 '
sql = "SELECT {0}, sum({1}) AS total FROM huiyuan {2} GROUP BY {0}".format(xColumnName, yColumnName, where)
L = []
cursor = connection.cursor()
cursor.execute(sql)
desc = cursor.description
data_dict = [dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall()]
for online_dict in data_dict:
for key in online_dict:
if 'datetime.datetime' in str(type(online_dict[key])):
online_dict[key] = online_dict[key].strftime(
"%Y-%m-%d %H:%M:%S")
else:
pass
L.append(online_dict)
msg['data'] = L
return JsonResponse(msg)
六、文章目录
摘 要 1
Abstract 2
第1章 绪论 5
1.1课题开发背景 5
1.2课题研究现状 5
1.3课题开发目的与意义 6
1.4课题开发主要内容 6
1.5论文结构安排 6
第2章 系统分析 8
2.1系统使用相关技术分析介绍 8
2.1.1Pycharm环境介绍 8
2.1.2Python语言介绍 9
2.1.3Mysql数据库介绍 10
2.2系统需求分析 10
2.2.1系统性能要求分析 10
2.3系统可行性分析 10
2.3.1技术可行性 11
2.3.2法律可行性 11
2.3.3操作可行性 11
2.4系统流程分析 11
2.5系统用例分析 13
第3章 系统设计 15
3.1系统总体结构设计 15
3.2系统开发步骤 15
3.3数据库设计 15
3.3.1数据库概念结构设计 15
3.3.2数据库逻辑结构设计 17
第4章 系统实现 25
4.1登录功能模块的实现 25
4.2 系统首页界面的实现 25
4.3密码信息管理模块实现 26
4.4 用户信息管理功能的实现 27
4.5 景点信息管理功能的实现 27
4.6 门票预订功能的界面设计实现 28
4.7攻略交流功能的界面实现 29
第5章 系统测试 31
5.1系统测试的目的 31
5.2系统测试的困难 31
5.3系统测试的方法 32
5.4具体测试 32
5.4.1测试步骤 32
5.4.2测试用例 32
5.5测试总结 33
总 结 35
致 谢 36
参考文献 37
文章出处登录后可见!