我的家鄉是邯鄲市。邯鄲市我國為數不多的3000年沒有改變過名字城市。我的家鄉就是邯鄲。在我的家鄉有非常多的旅游景點和美食。為了讓更多的人了解到邯鄲的旅游景點和好吃的美食信息,我通過python+vue+elementUI開發了本次的邯鄲家鄉網紅旅游景點美食導游平台。希望可以通過本平台讓更多的人了解到這個三千多年歷史沉澱中的誕生的古城中的景點和美食
計算機畢業設計Python+djang邯鄲地標美食導游平台(源碼+系統+mysql數據庫+Lw文檔)
開發語言:Python
python框架:django
軟件版本:python3.7/python3.8
數據庫:mysql 5.7或更高版本
數據庫工具:Navicat11
開發軟件:PyCharm/vs code
前端框架:vue.js
可開發框架:ssm/Springboot/vue/python/PHP/小程序/安卓均可開發
def handanmeijing_register(request):
if request.method in ["POST", "GET"]:
msg = {
'code': normal_code, "msg": mes.normal_code}
req_dict = request.session.get("req_dict")
error = handanmeijing.createbyreq(handanmeijing, handanmeijing, req_dict)
if error != None:
msg['code'] = crud_error_code
msg['msg'] = "用戶已存在,請勿重復注冊!"
return JsonResponse(msg)
def handanmeijing_login(request):
if request.method in ["POST", "GET"]:
msg = {
'code': normal_code, "msg": mes.normal_code}
req_dict = request.session.get("req_dict")
datas = handanmeijing.getbyparams(handanmeijing, handanmeijing, req_dict)
if not datas:
msg['code'] = password_error_code
msg['msg'] = mes.password_error_code
return JsonResponse(msg)
try:
__sfsh__= handanmeijing.__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, handanmeijing, req_dict)
def handanmeijing_logout(request):
if request.method in ["POST", "GET"]:
msg = {
"msg": "登出成功",
"code": 0
}
return JsonResponse(msg)
def handanmeijing_resetPass(request):
'''
'''
if request.method in ["POST", "GET"]:
msg = {
"code": normal_code, "msg": mes.normal_code}
req_dict = request.session.get("req_dict")
columns= handanmeijing.getallcolumn( handanmeijing, handanmeijing)
try:
__loginUserColumn__= handanmeijing.__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'
eval('''handanmeijing.objects.filter({
}='{}').update({
}='{}')'''.format(username_str,username,password_str,init_pwd))
return JsonResponse(msg)
def handanmeijing_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'] = handanmeijing.getbyparams(handanmeijing, handanmeijing, req_dict)[0]
return JsonResponse(msg)
def handanmeijing_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=handanmeijing.getbyparams(handanmeijing, handanmeijing, req_dict)
if len(data)>0:
msg['data'] = data[0]
else:
msg['data'] = {
}
return JsonResponse(msg)
def handanmeijing_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= handanmeijing.getallcolumn( handanmeijing, handanmeijing)
#當前登錄用戶所在表
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__=handanmeijing.__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__=handanmeijing.__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 'handanmeijing'[:7]!='discuss'and "userid" in handanmeijing.getallcolumn(handanmeijing,handanmeijing):
req_dict["userid"] = request.session.get("params").get("id")