当前位置:   article > 正文

python酒店住房管理系统源码_基于python的酒店管理系统算法

基于python的酒店管理系统算法

目录

一、程序介绍:

三、文档目录:

四、运行截图:

五、数据库表:

六、代码展示:

七、更多学习目录:

八、互动留言


一、程序介绍

  1. 文档:开发技术文档、参考LW、答辩PPT,部分项目另有其他文档
  2. 开发环境:Pytharm(python3.7以上)丨navicat12丨mysql5.7
  3. 配套工具:涉及项目开发运行的全部软件均提供
  4. 项目运行视频或截图:提供
  5. 运行电脑配置要求:内存≥8G,  CPU  i3及以上
  6. 运行教学:指导
  7. 项目修改教学:有
  8. 代码讲解:代码结构讲解

三、文档目录:

四、运行截图

 

五、数据库表

六、代码展示:

  1. #coding:utf-8
  2. __author__ = "ila"
  3. import base64, copy, logging, os, time, xlrd
  4. from django.http import JsonResponse
  5. from django.apps import apps
  6. from django.db.models.aggregates import Count,Sum
  7. from .models import kefangfenlei
  8. from util.codes import *
  9. from util.auth import Auth
  10. from util.common import Common
  11. import util.message as mes
  12. from django.db import connection
  13. import random
  14. from django.core.mail import send_mail
  15. from alipay import AliPayConfig, AliPay
  16. from django.conf import settings
  17. from django.shortcuts import redirect
  18. def kefangfenlei_register(request):
  19. if request.method in ["POST", "GET"]:
  20. msg = {'code': normal_code, "msg": mes.normal_code}
  21. req_dict = request.session.get("req_dict")
  22. error = kefangfenlei.createbyreq(kefangfenlei, kefangfenlei, req_dict)
  23. if error != None:
  24. msg['code'] = crud_error_code
  25. msg['msg'] = "用户已存在,请勿重复注册!"
  26. return JsonResponse(msg)
  27. def kefangfenlei_login(request):
  28. if request.method in ["POST", "GET"]:
  29. msg = {'code': normal_code, "msg": mes.normal_code}
  30. req_dict = request.session.get("req_dict")
  31. datas = kefangfenlei.getbyparams(kefangfenlei, kefangfenlei, req_dict)
  32. if not datas:
  33. msg['code'] = password_error_code
  34. msg['msg'] = mes.password_error_code
  35. return JsonResponse(msg)
  36. try:
  37. __sfsh__= kefangfenlei.__sfsh__
  38. except:
  39. __sfsh__=None
  40. if __sfsh__=='是':
  41. if datas[0].get('sfsh')=='否':
  42. msg['code']=other_code
  43. msg['msg'] = "账号已锁定,请联系管理员审核!"
  44. return JsonResponse(msg)
  45. req_dict['id'] = datas[0].get('id')
  46. return Auth.authenticate(Auth, kefangfenlei, req_dict)
  47. def kefangfenlei_logout(request):
  48. if request.method in ["POST", "GET"]:
  49. msg = {
  50. "msg": "登出成功",
  51. "code": 0
  52. }
  53. return JsonResponse(msg)
  54. def kefangfenlei_resetPass(request):
  55. '''
  56. '''
  57. if request.method in ["POST", "GET"]:
  58. msg = {"code": normal_code, "msg": mes.normal_code}
  59. req_dict = request.session.get("req_dict")
  60. columns= kefangfenlei.getallcolumn( kefangfenlei, kefangfenlei)
  61. try:
  62. __loginUserColumn__= kefangfenlei.__loginUserColumn__
  63. except:
  64. __loginUserColumn__=None
  65. username=req_dict.get(list(req_dict.keys())[0])
  66. if __loginUserColumn__:
  67. username_str=__loginUserColumn__
  68. else:
  69. username_str=username
  70. if 'mima' in columns:
  71. password_str='mima'
  72. else:
  73. password_str='password'
  74. init_pwd = '123456'
  75. eval('''kefangfenlei.objects.filter({}='{}').update({}='{}')'''.format(username_str,username,password_str,init_pwd))
  76. return JsonResponse(msg)
  77. def kefangfenlei_session(request):
  78. '''
  79. '''
  80. if request.method in ["POST", "GET"]:
  81. msg = {"code": normal_code,"msg": mes.normal_code, "data": {}}
  82. req_dict={"id":request.session.get('params').get("id")}
  83. msg['data'] = kefangfenlei.getbyparams(kefangfenlei, kefangfenlei, req_dict)[0]
  84. return JsonResponse(msg)
  85. def kefangfenlei_default(request):
  86. if request.method in ["POST", "GET"]:
  87. msg = {"code": normal_code,"msg": mes.normal_code, "data": {}}
  88. req_dict = request.session.get("req_dict")
  89. req_dict.update({"isdefault":"是"})
  90. data=kefangfenlei.getbyparams(kefangfenlei, kefangfenlei, req_dict)
  91. if len(data)>0:
  92. msg['data'] = data[0]
  93. else:
  94. msg['data'] = {}
  95. return JsonResponse(msg)
  96. def kefangfenlei_page(request):
  97. '''
  98. '''
  99. if request.method in ["POST", "GET"]:
  100. msg = {"code": normal_code, "msg": mes.normal_code, "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":10,"list":[]}}
  101. req_dict = request.session.get("req_dict")
  102. #获取全部列名
  103. columns= kefangfenlei.getallcolumn( kefangfenlei, kefangfenlei)
  104. #当前登录用户所在表
  105. tablename = request.session.get("tablename")
  106. #authColumn=list(__authTables__.keys())[0]
  107. #authTable=__authTables__.get(authColumn)
  108. # if authTable==tablename:
  109. #params = request.session.get("params")
  110. #req_dict[authColumn]=params.get(authColumn)
  111. '''__authSeparate__此属性为真,params添加userid,后台只查询个人数据'''
  112. try:
  113. __authSeparate__=kefangfenlei.__authSeparate__
  114. except:
  115. __authSeparate__=None
  116. if __authSeparate__=="是":
  117. tablename=request.session.get("tablename")
  118. if tablename!="users" and 'userid' in columns:
  119. try:
  120. req_dict['userid']=request.session.get("params").get("id")
  121. except:
  122. pass
  123. #当项目属性hasMessage为”是”,生成系统自动生成留言板的表messages,同时该表的表属性hasMessage也被设置为”是”,字段包括userid(用户id),username(用户名),content(留言内容),reply(回复)
  124. #接口page需要区分权限,普通用户查看自己的留言和回复记录,管理员查看所有的留言和回复记录
  125. try:
  126. __hasMessage__=kefangfenlei.__hasMessage__
  127. except:
  128. __hasMessage__=None
  129. if __hasMessage__=="是":
  130. tablename=request.session.get("tablename")
  131. if tablename!="users":
  132. req_dict["userid"]=request.session.get("params").get("id")
  133. # 判断当前表的表属性isAdmin,为真则是管理员表
  134. # 当表属性isAdmin=”是”,刷出来的用户表也是管理员,即page和list可以查看所有人的考试记录(同时应用于其他表)
  135. __isAdmin__ = None
  136. allModels = apps.get_app_config('main').get_models()
  137. for m in allModels:
  138. if m.__tablename__==tablename:
  139. try:
  140. __isAdmin__ = m.__isAdmin__
  141. except:
  142. __isAdmin__ = None
  143. break
  144. # 当前表也是有管理员权限的表
  145. if __isAdmin__ == "是":
  146. if req_dict.get("userid"):
  147. del req_dict["userid"]
  148. else:
  149. #非管理员权限的表,判断当前表字段名是否有userid
  150. if tablename!="users" and 'kefangfenlei'[:7]!='discuss'and "userid" in kefangfenlei.getallcolumn(kefangfenlei,kefangfenlei):
  151. req_dict["userid"] = request.session.get("params").get("id")
  152. #当列属性authTable有值(某个用户表)[该列的列名必须和该用户表的登陆字段名一致],则对应的表有个隐藏属性authTable为”是”,那么该用户查看该表信息时,只能查看自己的
  153. try:
  154. __authTables__=kefangfenlei.__authTables__
  155. except:
  156. __authTables__=None
  157. if __authTables__!=None and __authTables__!={}:
  158. try:
  159. del req_dict['userid']
  160. except:
  161. pass
  162. for authColumn,authTable in __authTables__.items():
  163. if authTable==tablename:
  164. params = request.session.get("params")
  165. req_dict[authColumn]=params.get(authColumn)
  166. break
  167. msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
  168. msg['data']['pageSize'] =kefangfenlei.page(kefangfenlei, kefangfenlei, req_dict, request)
  169. return JsonResponse(msg)
  170. def kefangfenlei_autoSort(request):
  171. '''
  172. .智能推荐功能(表属性:[intelRecom(是/否)],新增clicktime[前端不显示该字段]字段(调用info/detail接口的时候更新),按clicktime排序查询)
  173. 主要信息列表(如商品列表,新闻列表)中使用,显示最近点击的或最新添加的5条记录就行
  174. '''
  175. if request.method in ["POST", "GET"]:
  176. msg = {"code": normal_code, "msg": mes.normal_code, "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":10,"list":[]}}
  177. req_dict = request.session.get("req_dict")
  178. if "clicknum" in kefangfenlei.getallcolumn(kefangfenlei,kefangfenlei):
  179. req_dict['sort']='clicknum'
  180. else:
  181. req_dict['sort']='clicktime'
  182. req_dict['order']='desc'
  183. msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
  184. msg['data']['pageSize'] = kefangfenlei.page(kefangfenlei,kefangfenlei, req_dict)
  185. return JsonResponse(msg)
  186. def kefangfenlei_list(request):
  187. '''
  188. 前台分页
  189. '''
  190. if request.method in ["POST", "GET"]:
  191. msg = {"code": normal_code, "msg": mes.normal_code, "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":10,"list":[]}}
  192. req_dict = request.session.get("req_dict")
  193. #获取全部列名
  194. columns= kefangfenlei.getallcolumn( kefangfenlei, kefangfenlei)
  195. #表属性[foreEndList]前台list:和后台默认的list列表页相似,只是摆在前台,否:指没有此页,是:表示有此页(不需要登陆即可查看),前要登:表示有此页且需要登陆后才能查看
  196. try:
  197. __foreEndList__=kefangfenlei.__foreEndList__
  198. except:
  199. __foreEndList__=None
  200. if __foreEndList__=="前要登":
  201. tablename=request.session.get("tablename")
  202. if tablename!="users" and 'userid' in columns:
  203. try:
  204. req_dict['userid']=request.session.get("params").get("id")
  205. except:
  206. pass
  207. #forrEndListAuth
  208. try:
  209. __foreEndListAuth__=kefangfenlei.__foreEndListAuth__
  210. except:
  211. __foreEndListAuth__=None
  212. #authSeparate
  213. try:
  214. __authSeparate__=kefangfenlei.__authSeparate__
  215. except:
  216. __authSeparate__=None
  217. if __foreEndListAuth__ =="是" and __authSeparate__=="是":
  218. tablename=request.session.get("tablename")
  219. if tablename!="users":
  220. req_dict['userid']=request.session.get("params",{"id":0}).get("id")
  221. tablename = request.session.get("tablename")
  222. if tablename == "users" and req_dict.get("userid") != None:#判断是否存在userid列名
  223. del req_dict["userid"]
  224. else:
  225. __isAdmin__ = None
  226. allModels = apps.get_app_config('main').get_models()
  227. for m in allModels:
  228. if m.__tablename__==tablename:
  229. try:
  230. __isAdmin__ = m.__isAdmin__
  231. except:
  232. __isAdmin__ = None
  233. break
  234. if __isAdmin__ == "是":
  235. if req_dict.get("userid"):
  236. del req_dict["userid"]
  237. else:
  238. #非管理员权限的表,判断当前表字段名是否有userid
  239. if "userid" in columns:
  240. try:
  241. # 本接口可以匿名访问,所以try判断是否为匿名
  242. req_dict['userid']=request.session.get("params").get("id")
  243. except:
  244. pass
  245. #当列属性authTable有值(某个用户表)[该列的列名必须和该用户表的登陆字段名一致],则对应的表有个隐藏属性authTable为”是”,那么该用户查看该表信息时,只能查看自己的
  246. try:
  247. __authTables__=kefangfenlei.__authTables__
  248. except:
  249. __authTables__=None
  250. if __authTables__!=None and __authTables__!={} and __foreEndListAuth__=="是":
  251. try:
  252. del req_dict['userid']
  253. except:
  254. pass
  255. for authColumn,authTable in __authTables__.items():
  256. if authTable==tablename:
  257. params = request.session.get("params")
  258. req_dict[authColumn]=params.get(authColumn)
  259. break
  260. if kefangfenlei.__tablename__[:7]=="discuss":
  261. try:
  262. del req_dict['userid']
  263. except:
  264. pass
  265. msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
  266. msg['data']['pageSize'] = kefangfenlei.page(kefangfenlei, kefangfenlei, req_dict)
  267. return JsonResponse(msg)
  268. def kefangfenlei_save(request):
  269. '''
  270. 后台新增
  271. '''
  272. if request.method in ["POST", "GET"]:
  273. msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
  274. req_dict = request.session.get("req_dict")
  275. if 'clicktime' in req_dict.keys():
  276. del req_dict['clicktime']
  277. tablename=request.session.get("tablename")
  278. __isAdmin__ = None
  279. allModels = apps.get_app_config('main').get_models()
  280. for m in allModels:
  281. if m.__tablename__==tablename:
  282. try:
  283. __isAdmin__ = m.__isAdmin__
  284. except:
  285. __isAdmin__ = None
  286. break
  287. #获取全部列名
  288. columns= kefangfenlei.getallcolumn( kefangfenlei, kefangfenlei)
  289. if tablename!='users' and req_dict.get("userid")!=None and 'userid' in columns and __isAdmin__!='是':
  290. params=request.session.get("params")
  291. req_dict['userid']=params.get('id')
  292. error= kefangfenlei.createbyreq(kefangfenlei,kefangfenlei, req_dict)
  293. if error!=None:
  294. msg['code'] = crud_error_code
  295. msg['msg'] = error
  296. return JsonResponse(msg)
  297. def kefangfenlei_add(request):
  298. '''
  299. 前台新增
  300. '''
  301. if request.method in ["POST", "GET"]:
  302. msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
  303. req_dict = request.session.get("req_dict")
  304. #获取全部列名
  305. columns= kefangfenlei.getallcolumn( kefangfenlei, kefangfenlei)
  306. try:
  307. __authSeparate__=kefangfenlei.__authSeparate__
  308. except:
  309. __authSeparate__=None
  310. if __authSeparate__=="是":
  311. tablename=request.session.get("tablename")
  312. if tablename!="users" and 'userid' in columns:
  313. try:
  314. req_dict['userid']=request.session.get("params").get("id")
  315. except:
  316. pass
  317. try:
  318. __foreEndListAuth__=kefangfenlei.__foreEndListAuth__
  319. except:
  320. __foreEndListAuth__=None
  321. if __foreEndListAuth__ and __foreEndListAuth__!="否":
  322. tablename=request.session.get("tablename")
  323. if tablename!="users":
  324. req_dict['userid']=request.session.get("params").get("id")
  325. error= kefangfenlei.createbyreq(kefangfenlei,kefangfenlei, req_dict)
  326. if error!=None:
  327. msg['code'] = crud_error_code
  328. msg['msg'] = error
  329. return JsonResponse(msg)
  330. def kefangfenlei_thumbsup(request,id_):
  331. '''
  332. 点赞:表属性thumbsUp[是/否],刷表新增thumbsupnum赞和crazilynum踩字段,
  333. '''
  334. if request.method in ["POST", "GET"]:
  335. msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
  336. req_dict = request.session.get("req_dict")
  337. id_=int(id_)
  338. type_=int(req_dict.get("type",0))
  339. rets=kefangfenlei.getbyid(kefangfenlei,kefangfenlei,id_)
  340. update_dict={
  341. "id":id_,
  342. }
  343. if type_==1:#赞
  344. update_dict["thumbsupnum"]=int(rets[0].get('thumbsupnum'))+1
  345. elif type_==2:#踩
  346. update_dict["crazilynum"]=int(rets[0].get('crazilynum'))+1
  347. error = kefangfenlei.updatebyparams(kefangfenlei,kefangfenlei, update_dict)
  348. if error!=None:
  349. msg['code'] = crud_error_code
  350. msg['msg'] = error
  351. return JsonResponse(msg)
  352. def kefangfenlei_info(request,id_):
  353. '''
  354. '''
  355. if request.method in ["POST", "GET"]:
  356. msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
  357. data = kefangfenlei.getbyid(kefangfenlei,kefangfenlei, int(id_))
  358. if len(data)>0:
  359. msg['data']=data[0]
  360. #浏览点击次数
  361. try:
  362. __browseClick__= kefangfenlei.__browseClick__
  363. except:
  364. __browseClick__=None
  365. if __browseClick__=="是" and "clicknum" in kefangfenlei.getallcolumn(kefangfenlei,kefangfenlei):
  366. try:
  367. clicknum=int(data[0].get("clicknum",0))+1
  368. except:
  369. clicknum=0+1
  370. click_dict={"id":int(id_),"clicknum":clicknum}
  371. ret=kefangfenlei.updatebyparams(kefangfenlei,kefangfenlei,click_dict)
  372. if ret!=None:
  373. msg['code'] = crud_error_code
  374. msg['msg'] = ret
  375. return JsonResponse(msg)
  376. def kefangfenlei_detail(request,id_):
  377. '''
  378. '''
  379. if request.method in ["POST", "GET"]:
  380. msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
  381. data =kefangfenlei.getbyid(kefangfenlei,kefangfenlei, int(id_))
  382. if len(data)>0:
  383. msg['data']=data[0]
  384. #浏览点击次数
  385. try:
  386. __browseClick__= kefangfenlei.__browseClick__
  387. except:
  388. __browseClick__=None
  389. if __browseClick__=="是" and "clicknum" in kefangfenlei.getallcolumn(kefangfenlei,kefangfenlei):
  390. try:
  391. clicknum=int(data[0].get("clicknum",0))+1
  392. except:
  393. clicknum=0+1
  394. click_dict={"id":int(id_),"clicknum":clicknum}
  395. ret=kefangfenlei.updatebyparams(kefangfenlei,kefangfenlei,click_dict)
  396. if ret!=None:
  397. msg['code'] = crud_error_code
  398. msg['msg'] = retfo
  399. return JsonResponse(msg)
  400. def kefangfenlei_update(request):
  401. '''
  402. '''
  403. if request.method in ["POST", "GET"]:
  404. msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
  405. req_dict = request.session.get("req_dict")
  406. if req_dict.get("mima") and req_dict.get("password"):
  407. if "mima" not in kefangfenlei.getallcolumn(kefangfenlei,kefangfenlei) :
  408. del req_dict["mima"]
  409. if "password" not in kefangfenlei.getallcolumn(kefangfenlei,kefangfenlei) :
  410. del req_dict["password"]
  411. try:
  412. del req_dict["clicknum"]
  413. except:
  414. pass
  415. error = kefangfenlei.updatebyparams(kefangfenlei, kefangfenlei, req_dict)
  416. if error!=None:
  417. msg['code'] = crud_error_code
  418. msg['msg'] = error
  419. return JsonResponse(msg)
  420. def kefangfenlei_delete(request):
  421. '''
  422. 批量删除
  423. '''
  424. if request.method in ["POST", "GET"]:
  425. msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
  426. req_dict = request.session.get("req_dict")
  427. error=kefangfenlei.deletes(kefangfenlei,
  428. kefangfenlei,
  429. req_dict.get("ids")
  430. )
  431. if error!=None:
  432. msg['code'] = crud_error_code
  433. msg['msg'] = error
  434. return JsonResponse(msg)
  435. def kefangfenlei_vote(request,id_):
  436. '''
  437. 浏览点击次数(表属性[browseClick:是/否],点击字段(clicknum),调用info/detail接口的时候后端自动+1)、投票功能(表属性[vote:是/否],投票字段(votenum),调用vote接口后端votenum+1)
  438. 统计商品或新闻的点击次数;提供新闻的投票功能
  439. '''
  440. if request.method in ["POST", "GET"]:
  441. msg = {"code": normal_code, "msg": mes.normal_code}
  442. data= kefangfenlei.getbyid(kefangfenlei, kefangfenlei, int(id_))
  443. for i in data:
  444. votenum=i.get('votenum')
  445. if votenum!=None:
  446. params={"id":int(id_),"votenum":votenum+1}
  447. error=kefangfenlei.updatebyparams(kefangfenlei,kefangfenlei,params)
  448. if error!=None:
  449. msg['code'] = crud_error_code
  450. msg['msg'] = error
  451. return JsonResponse(msg)
  452. def kefangfenlei_importExcel(request):
  453. if request.method in ["POST", "GET"]:
  454. msg = {"code": normal_code, "msg": "成功", "data": {}}
  455. excel_file = request.FILES.get("file", "")
  456. file_type = excel_file.name.split('.')[1]
  457. if file_type in ['xlsx', 'xls']:
  458. data = xlrd.open_workbook(filename=None, file_contents=excel_file.read())
  459. table = data.sheets()[0]
  460. rows = table.nrows
  461. try:
  462. for row in range(1, rows):
  463. row_values = table.row_values(row)
  464. req_dict = {}
  465. kefangfenlei.createbyreq(kefangfenlei, kefangfenlei, req_dict)
  466. except:
  467. pass
  468. else:
  469. msg.code = 500
  470. msg.msg = "文件类型错误"
  471. return JsonResponse(msg)
  472. def kefangfenlei_sendemail(request):
  473. if request.method in ["POST", "GET"]:
  474. req_dict = request.session.get("req_dict")
  475. code = random.sample(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], 4)
  476. to = []
  477. to.append(req_dict['email'])
  478. send_mail('用户注册', '您的注册验证码是【'+''.join(code)+'】,请不要把验证码泄漏给其他人,如非本人请勿操作。', 'yclw9@qq.com', to, fail_silently = False)
  479. cursor = connection.cursor()
  480. cursor.execute("insert into emailregistercode(email,role,code) values('"+req_dict['email']+"','用户','"+''.join(code)+"')")
  481. msg = {
  482. "msg": "发送成功",
  483. "code": 0
  484. }
  485. return JsonResponse(msg)
  486. def kefangfenlei_autoSort2(request):
  487. if request.method in ["POST", "GET"]:
  488. req_dict = request.session.get("req_dict")
  489. cursor = connection.cursor()
  490. leixing = set()
  491. try:
  492. cursor.execute("select inteltype from storeup where userid = %d"%(request.session.get("params").get("id"))+" and tablename = 'kefangfenlei' order by addtime desc")
  493. rows = cursor.fetchall()
  494. for row in rows:
  495. for item in row:
  496. leixing.add(item)
  497. except:
  498. leixing = set()
  499. L = []
  500. cursor.execute("select * from kefangfenlei where $intelRecomColumn in ('%s"%("','").join(leixing)+"') union all select * from kefangfenlei where $intelRecomColumn not in('%s"%("','").join(leixing)+"')")
  501. desc = cursor.description
  502. data_dict = [dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall()]
  503. for online_dict in data_dict:
  504. for key in online_dict:
  505. if 'datetime.datetime' in str(type(online_dict[key])):
  506. online_dict[key] = online_dict[key].strftime(
  507. "%Y-%m-%d %H:%M:%S")
  508. else:
  509. pass
  510. L.append(online_dict)
  511. return JsonResponse({"code": 0, "msg": '', "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":5,"list": L[0:6]}})
  512. def kefangfenlei_value(request, xColumnName, yColumnName, timeStatType):
  513. if request.method in ["POST", "GET"]:
  514. msg = {"code": normal_code, "msg": "成功", "data": {}}
  515. where = ' where 1 = 1 '
  516. sql = ''
  517. if timeStatType == '日':
  518. sql = "SELECT DATE_FORMAT({0}, '%Y-%m-%d') {0}, sum({1}) total FROM kefangfenlei {2} GROUP BY DATE_FORMAT({0}, '%Y-%m-%d')".format(xColumnName, yColumnName, where, '%Y-%m-%d')
  519. if timeStatType == '月':
  520. sql = "SELECT DATE_FORMAT({0}, '%Y-%m') {0}, sum({1}) total FROM kefangfenlei {2} GROUP BY DATE_FORMAT({0}, '%Y-%m')".format(xColumnName, yColumnName, where, '%Y-%m')
  521. if timeStatType == '年':
  522. sql = "SELECT DATE_FORMAT({0}, '%Y') {0}, sum({1}) total FROM kefangfenlei {2} GROUP BY DATE_FORMAT({0}, '%Y')".format(xColumnName, yColumnName, where, '%Y')
  523. L = []
  524. cursor = connection.cursor()
  525. cursor.execute(sql)
  526. desc = cursor.description
  527. data_dict = [dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall()]
  528. for online_dict in data_dict:
  529. for key in online_dict:
  530. if 'datetime.datetime' in str(type(online_dict[key])):
  531. online_dict[key] = online_dict[key].strftime(
  532. "%Y-%m-%d %H:%M:%S")
  533. else:
  534. pass
  535. L.append(online_dict)
  536. msg['data'] = L
  537. return JsonResponse(msg)
  538. def kefangfenlei_o_value(request, xColumnName, yColumnName):
  539. if request.method in ["POST", "GET"]:
  540. msg = {"code": normal_code, "msg": "成功", "data": {}}
  541. where = ' where 1 = 1 '
  542. sql = "SELECT {0}, sum({1}) AS total FROM kefangfenlei {2} GROUP BY {0}".format(xColumnName, yColumnName, where)
  543. L = []
  544. cursor = connection.cursor()
  545. cursor.execute(sql)
  546. desc = cursor.description
  547. data_dict = [dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall()]
  548. for online_dict in data_dict:
  549. for key in online_dict:
  550. if 'datetime.datetime' in str(type(online_dict[key])):
  551. online_dict[key] = online_dict[key].strftime(
  552. "%Y-%m-%d %H:%M:%S")
  553. else:
  554. pass
  555. L.append(online_dict)
  556. msg['data'] = L
  557. return JsonResponse(msg)
  558. def kefangfenlei_alipay(request):
  559. if request.method in ["POST", "GET"]:
  560. alipay = AliPay(
  561. appid=settings.ALIPAY_APP_ID,
  562. app_notify_url=None,
  563. app_private_key_string=settings.APP_PRIVATE_KEY_STRING,
  564. alipay_public_key_string=settings.ALIPAY_PUBLIC_KEY_STRING,
  565. sign_type=settings.ALIPAY_SIGN_TYPE,
  566. debug=True,
  567. config=AliPayConfig(timeout=15)
  568. )
  569. req_dict = request.session.get("req_dict")
  570. order_string = alipay.api_alipay_trade_page_pay(
  571. out_trade_no=req_dict['tradeno'],
  572. total_amount=req_dict['totalamount'],
  573. subject=req_dict['subject'],
  574. return_url='http://localhost:8080/django9flsi/kefangfenlei/notify',
  575. #notify_url=''
  576. )
  577. pay_url = 'https://openapi.alipaydev.com/gateway.do?' + order_string
  578. pay_url = '<form name="punchout_form" method="post" action="{0}"><input type="hidden" name="biz_content" ><input type="submit" value="立即支付" style="display: none"></form>'.format(pay_url)
  579. return JsonResponse({'code': 0, "data": pay_url})
  580. def kefangfenlei_notify(request):
  581. if request.method in ["POST", "GET"]:
  582. req_dict = request.session.get("req_dict")
  583. out_trade_no = req_dict['out_trade_no']
  584. cursor = connection.cursor()
  585. return redirect('http://localhost:8080/django9flsi/admin/dist/index.html#/kefangfenlei')

七、更多学习目录:

1.基于ssm的甘肃旅游系统
2.基于SSM的旅游企业财务管理系统
3.基于SSM的疫情防疫项目(带爬虫)
4.基于springboot的人力资源管理系统
5.基于SSM的民生置业有限公司信息管理系统
6.基于ssm的在线挂号小程序系统
7.基于Java(spring boot框架)新冠疫苗预约管理系统
8.基于SSM的校园小助手系统
9.基于springboot的点餐小程序系统
10.基于ssm的健康食谱推荐小程序
11.基于ssm的健康食谱小程序
12.基于ssm的二手汽车拍卖系统小程序
13.基于ssm的二手汽车拍卖系统app
14.基于springboot的客户关系管理系统
15.基于SSM的校园活动管理小程序
16.基于SSM的个人健康饮食管理小程序系统
17.基于ssm的微信小程序水果商城
18.基于微信小程序的一起运动吧活动管理系统
19.基于springboot的微信小程序的在线商城系统(根据收藏类别推荐+点击率推荐)
20.基于SSM新闻网站
21.基于ssm的在线租房网站
22.基于springboot的中学校园管理微信小程序
23.基于Springboot学生在线考试系统
24.基于SSM的网上奶茶购买平台 
25.基于springboot的高校社团管理系统(多用户角色)
26.基于springboot个性化学习推荐网站
27.基于微信小程序的西藏特产在线商城系统
28.基于SSM的微信小程序的查寝系统
29.基于ssm的微信小程序的口袋故事系统
30.基于SSM的小区物业管理系统
31.基于SSM的小程序任务调度管理信息系统
32.基于SSM的团员信息管理系统
33.基于SSM框架的法律学习小程序
34.基于springboot的学校监考小程序
35.基于SSM的超市财务管理系统 
36.基于springboot的学生宿舍管理系统
37.基于SSM的课程设计管理系统
38.基于SSM的课设管理小程序
39.基于springboot的果蔬交易与物流微信小程序
40.基于ssm的果蔬交易与物流微信小程序
41.基于SSM的红色文化展示小程序系统
42.基于SSM的小区物业管理系统
43.基于javaweb的机械博物馆展品管理系统
44.基于springboot的实验室设备管理系统
45.基于SSM企业人力资源管理系统
46.基于springboot的实验室物资管理小程序
47.基于springboot的高校选课系统
48.基于SSM小程序蔬菜水果零食销售系统
49.基于SSM的园第二课堂小程序
50.基于ssm的全球地震数据信息管理系统
51.基于ssm的足球联赛管理系统
52.基于SSM的小程序的人工智能类竞赛管理系统
53.基于SSM的智慧医疗问诊小程序
54.基于SSM的微信小程序直播在线教育平台
55.基于springboot+爬虫的新闻网站系统
56.基于SSM的自驾游小程序
57.基于SSM的高校宿舍管理小程序系统
58.基于SSM的微信小程序在线学习平台
59.基于Android的防疫信息管理系统
60.基于springboot的患者术后康复的小程序
61.基于ssm微信小程序的校园换物系统
62.基于SSM微信小程序的智慧党史系统
63.基于SSM的家庭理财系统
64.基于SSM的高校学籍信息管理系统
65.基于SSM微信小程序的航班查询和订票系统
66.基于ssm的医院挂号系统
67.基于SSM的在线阅读系统
68.基于SSM的疫情社区物资配送系统
69.基于ssm的加油服务系统小程序系统
70.基于ssm的XX学院校友录小程序系统
71.基于ssm的药店管理系统微信小程序系统
72.基于ssm的装潢应用系统小程序系统
73.基于ssm的学生公寓生活管理系统
74.基于ssm的计算机维修服务微信小程序
75.基于ssm的微信音乐播放器小程序
76.基于ssm的中医药配方小程序
77.基于ssm的二手交易微信小程序
78.基于ssm的的家教信息小程序管理系统
79.基于ssm的鲜花销售小程序系统
80.基于ssm的预约挂号小程序系统
81.基于ssm的在线考试小程序系统
82.基于ssm的慢性疾病管理微信小程序
83.基于springboot的在线考试系统小程序
84.基于springboot的批发零售业商品管理小程序系统
85.基于ssm的图书借阅到期提醒小程序系统
86.基于springboot的服装企业人事管理小程序系统
87.基于nodejs的电商管理系统
88.基于nodejs的知识分享网站
89.基于nodejs的宠物医生预约平台
90.基于nodejs的外卖平台
91.基于nodejs的大学生心理咨询微信小程序
92.基于nodejs的房屋租赁管理系统
93.基于nodejs的拼车网站
94.基于nodejs的博客系统
95.基于nodejs的家政服务微信小程序
96.基于nodejs的物物交换平台
97.基于php的实验室安全系统
98.基于php的单招志愿采集系统
99.基于php的网上买卖管理系统
100.基于php的XX学院兼职小程序系统
101.基于php的计算机信息管理学院网站
102.基于python+Django图书馆智能推荐系统python3.85版本
103.基于Python的个性化电影推荐的算法
104.基于python+django图书推荐系统
105.基于Python的个性化电影推荐的算法
106.基于django的爬虫新闻网站系统
107.基于Python的人事档案管理系统 
108.基于python的汽车销售系统
109.基于python的《C语言程序设计》课程案例库研究
110.基于python的飞机票销售系统
111.基于python的旧衣物捐赠系统
112.基于python的超市进销存
113.基于python的在线办公系统
114.基于python的大学生职业推荐平台
115.基于python的个性化服装系统
116.基于python的酒店住房管理系统
117.基于python的三甲妇幼保健院网站
118.基于python的大学生生活信息交互平台
119.基于python的学生兼职平台系统
120.基于python的主机硬件配置推荐系统
121.基于python的本地健康宝微信小程序
122.基于python的鲜花销售小程序
123.基于JSP的网上订餐管理系统
124.基于jAVAWeb停车场管理系统
125.基于SSM幼儿园信息管理系统
126.基于Springboot电影订票系统
127.基于ssm人力资源考勤系统
128.基于javaweb作业管理系统
129.基于javaweb校园二手物品交易
130.基于javaweb的停车场管理系统
131.基于javaweb学生选课系统
132.基于SSM实现的人力资源管理系统
133.基于javaweb项目疫情宿舍管理
134.基于SSM的图书商城系统
135.基于ssm的微信小程序家教系统
136.基于ssm的旅游管理系统travel
137.基于SSM的微信小程序图书借阅系统
138.基于web的微信小程序家政预约系统
139.基于web的微信小程序菜谱系统
140.基于web的微信小程序服装商城系统
141.基于web的微信小程序校园活动管理系统
142.基于web的微信小程序记事本系统
143.基于ssm的基于微信小程序的农产品销售系统
144.基于ssm的微信小程序旅游服务系统
145.基于springboot的微信小程序在线考试管理系统
146.基于ssm的微信小程序电影院购票系统
147.基于ssm的微信小程序房屋交易系统
148.基于ssm的微信小程序培训机构管理系统
149.基于web的微信小程序电影购票系统
150.基于ssm的酒店管理系统
151.基于javaweb点餐系统
152.基于javaweb宿舍管理系统
153.基于springboot的信息化管理系统
154.基于SSM的美妆商城系统
155.基于javaweb学生成绩管理系
156.基于SSM的新闻发布系统
157.基于SSM实现的小区物业管理系统
158.基于SSH的城市公交查询系统
159.基于S2SH的人力资源管理系统
160.基于S2SH酒店点餐收款系统
161.基于JSP的在线调查问卷系统
162.基于JSP的网上订餐管理系统
163.基于JSP实现的飞机票售票管理系统
164.基于SSM农场信息管理系统
165.基于javaweb花店管理系统
166.基于javaweb药房库存管理系统
167.基于SSM的甜品店系统
168.基于S2SH的药膳馆会员管理系统
169.基于javaweb的学籍管理系统
170.基于web的网上书城系统
171.基于web的学生成绩系统
172.基于SSH的客运站网上售票系统
173.基于S2SH校园论坛系统
174.基于javaweb旅游管理系统
175.基于SSH的旅游管理系统
176.基于SSM垃圾分类管理系统
177.基于ssm宠物销售系统
178.基于javaweb的在线人才招聘系统
179.基于S2SH小区物业系统
180.基于ssm人事管理系统
181.基于web的淘淘商城系统

八、互动留言

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/391188
推荐阅读
相关标签
  

闽ICP备14008679号