项目介绍
随着现在网络的快速发展,网上管理系统也逐渐快速发展起来,网上管理模式很快融入到了许多网站的之中,随之就产生了“校园博客系统”,这样就让校园博客系统更加方便简单。
对于本校园博客系统的设计来说,系统开发主要是采用python语言技术,前端采用vue技术,在整个系统的设计中应用MySQL数据库来完成数据存储,具体根据校园博客系统的现状来进行开发的,具体根据现实的需求来实现校园博客系统网络化的管理,各类信息有序地进行存储,进入校园博客系统页面之后,方可开始操作主控界面,主要功能包括管理员:首页、个人中心、博主管理、文章分类管理、文章信息管理、举报投诉管理、系统管理,博主;首页、个人中心、文章信息管理、举报投诉管理、我的收藏管理,前台首页;首页、文章信息、系统公告、个人中心、后台管理、在线客服等功能。
开发环境
开发语言:Python
数据库 :MySQL
系统架构:B/S
后端框架:Django
前端框架:Vue
开发工具:Pycharm
支持定做:Java/PHP/Python/Android/小程序/Vue/爬虫/C#/Asp.net
系统截图
部分代码
def yonghu_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= yonghu.getallcolumn( yonghu, yonghu)
#表属性[foreEndList]前台list:和后台默认的list列表页相似,只是摆在前台,否:指没有此页,是:表示有此页(不需要登陆即可查看),前要登:表示有此页且需要登陆后才能查看
try:
__foreEndList__=yonghu.__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__=yonghu.__foreEndListAuth__
except:
__foreEndListAuth__=None
#authSeparate
try:
__authSeparate__=yonghu.__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:
# 本接口可以匿名访问,所以try判断是否为匿名
req_dict['userid']=request.session.get("params").get("id")
except:
pass
#当列属性authTable有值(某个用户表)[该列的列名必须和该用户表的登陆字段名一致],则对应的表有个隐藏属性authTable为”是”,那么该用户查看该表信息时,只能查看自己的
try:
__authTables__=yonghu.__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 yonghu.__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'] = yonghu.page(yonghu, yonghu, req_dict)
return JsonResponse(msg)
def yonghu_save(request):
'''
后台新增
'''
if request.method in ["POST", "GET"]:
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
req_dict = request.session.get("req_dict")
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= yonghu.getallcolumn( yonghu, yonghu)
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= yonghu.createbyreq(yonghu,yonghu, req_dict)
if error!=None:
msg['code'] = crud_error_code
msg['msg'] = error
return JsonResponse(msg)
def yonghu_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= yonghu.getallcolumn( yonghu, yonghu)
try:
__authSeparate__=yonghu.__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__=yonghu.__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= yonghu.createbyreq(yonghu,yonghu, req_dict)
if error!=None:
msg['code'] = crud_error_code
msg['msg'] = error
return JsonResponse(msg)