基于大数据的热门旅游景点数据分析系统的设计与实现 ...

打印 上一主题 下一主题

主题 917|帖子 917|积分 2751

 作者简介:Java范畴优质创作者、CSDN博客专家 、CSDN内容合伙人、掘金特邀作者、阿里云博客专家、51CTO特邀作者、多年架构师设计履历、多年校企互助履历,被多个学校常年聘为校外企业导师,指导学生毕业设计并到场学生毕业答辩指导,有较为丰富的相干履历。等待与各位高校教师、企业讲师以及偕行交换互助
  重要内容:Java项目、Python项目、前端项目、PHP、ASP.NET、人工智能与大数据、单片机开辟、物联网设计与开辟设计、简历模板、学习资料、面试题库、技术相助、就业指导等
  业务范围:免费功能设计、开题陈诉、任务书、中期查抄PPT、系统功能实现、代码编写、论文编写和辅导、论文降重、恒久答辩答疑辅导、腾讯会议一对一专业解说辅导答辩、模拟答辩演练、和明白代码逻辑思绪等
  收藏点赞不迷路  关注作者有利益
  文末获取源码 
  


项目编号:BS-BD-011

一,环境先容

语言环境:Java:  jdk1.8
数据库:Mysql: mysql5.7
应用服务器:Tomcat:  tomcat8.5.31
开辟工具:IDEA或eclipse
开辟技术:Spark+Hdfs+SpringBoot+Vue
二,项目简介

随着盘算机技术发展,盘算机系统的应用已延伸到社会的各个范畴,大量基于大数据的广泛应用给生存带来了十分的便利。以是把热门旅游景点数据分析管理与现在网络相联合,使用盘算机搭建热门旅游景点数据分析系统,实现热门旅游景点数据分析的信息化。则对于进一步提高热门旅游景点数据分析管剃头展,丰富热门旅游景点数据分析管理履历能起到不少的促进作用。
系统叙述的是使用热门旅游景点数据分析系统的设计与实现,对于Python、B/S结构、MySql举行了较为深入的学习与应用。重要针对系统的设计,描述,实现和分析与测试方面来表明开辟的过程。开辟中使用了 django框架和MySql数据库技术搭建系统的整体架构。使用这些技术联合实际需求开辟了具有个人中心、门票信息管理、名宿信息管理、系统管理等功能的系统,最后对系统举行相应的测试,测试系统有无存在题目以及测试用户权限来优化系统,最后系统达到预期目标。
中国在两千年左右就已经对盘算机这一块发展到相当的规模了,现在老百姓们越来越离不开盘算机网络、互联网所带来的利益了,现现在各种格式的网站系统遍地着花,现在差别于以往的老旧的管理方式了,只有跟上期间的发展才气不会被淘汰掉,以是对于热门旅游景点数据分析来说也是同样的,将传统的线下管理带到线上,能够大大提拔管理效率,利益也有很多,首先整体的美化、提拔了在新期间的背景之下新的样貌,更加生机蓬勃。一个好的系统能够把传统的热门旅游景点数据分析信息管理方式,带上一全新的方式,效率、可靠、安全稳固集合一身的系统,带来的体验是传统管理方式所没有办法实现的,信息的交换将达到顶峰,用户的沟通将会更加的便捷,有题目及时反馈提交,及时接收重要通知,将热门旅游景点数据分析管理正规化、公道化、高效化。


三,系统展示






四,核心代码展示

  1. # coding:utf-8
  2. __author__ = "ila"
  3. import logging, os, time
  4. from django.http import JsonResponse
  5. from django.apps import apps
  6. from wsgiref.util import FileWrapper
  7. from django.http import HttpResponse,HttpResponseRedirect
  8. from django.shortcuts import redirect
  9. from .config_model import config
  10. from util.codes import *
  11. from util import message as mes
  12. from util.baidubce_api import BaiDuBce
  13. from util.locate import geocoding
  14. from dj2.settings import dbName as schemaName
  15. from dj2.settings import hasHadoop
  16. from django.db import connection
  17. from hdfs.client import Client
  18. def schemaName_cal(request, tableName, columnName):
  19.     '''
  20.     计算规则接口
  21.     '''
  22.     if request.method in ["POST", "GET"]:
  23.         msg = {"code": normal_code, 'data': []}
  24.         allModels = apps.get_app_config('main').get_models()
  25.         for m in allModels:
  26.             if m.__tablename__ == tableName:
  27.                 data = m.getcomputedbycolumn(
  28.                     m,
  29.                     m,
  30.                     columnName
  31.                 )
  32.                 print(data)
  33.                 if data:
  34.                     try:
  35.                         sum='%.05f' % float(data.get("sum"))
  36.                     except:
  37.                         sum=0.00
  38.                     try:
  39.                         max='%.05f' % float(data.get("max"))
  40.                     except:
  41.                         max=0.00
  42.                     try:
  43.                         min='%.05f' % float(data.get("min"))
  44.                     except:
  45.                         min=0.00
  46.                     try:
  47.                         avg='%.05f' % float(data.get("avg"))
  48.                     except:
  49.                         avg=0.00
  50.                     msg['data'] = {
  51.                         "sum": sum,
  52.                         "max": max,
  53.                         "min": min,
  54.                         "avg": avg,
  55.                     }
  56.                 break
  57.         return JsonResponse(msg)
  58. def schemaName_file_upload(request):
  59.     '''
  60.     上传
  61.     '''
  62.     if request.method in ["POST", "GET"]:
  63.         msg = {"code": normal_code, "msg": "成功", "data": {}}
  64.         req_dict = request.session.get("req_dict")
  65.         type = req_dict.get("type")
  66.         file = request.FILES.get("file")
  67.         if file:
  68.             filename = file.name
  69.             filesuffix = filename.split(".")[-1]
  70.             file_name = "{}.{}".format(int(float(time.time()) * 1000), filesuffix)
  71.             if type != None and '_template' in type:
  72.                 file_name="{}.{}".format(type,filesuffix)
  73.             filePath = os.path.join(os.getcwd(), "templates/front", file_name)
  74.             print("filePath===========>", filePath)
  75.             with open(filePath, 'wb+') as destination:
  76.                 for chunk in file.chunks():
  77.                     destination.write(chunk)
  78.             msg["file"] = file_name
  79.             # 判断是否需要保存为人脸识别基础照片
  80.             req_dict = request.session.get("req_dict")
  81.             type1 = req_dict.get("type", 0)
  82.             print("type1=======>",type1)
  83.             type1 = str(type1)
  84.             if type1 == '1':
  85.                 params = {"name":"faceFile","value": file_name}
  86.                 config.createbyreq(config, config, params)
  87.             if '是' in hasHadoop or 'spark' in hasHadoop:
  88.                 try:
  89.                     client = Client("http://127.0.0.1:50070/")
  90.                     client.upload(hdfs_path=f'/{file_name}', local_path=filePath, chunk_size=2 << 19, overwrite=True)
  91.                 except Exception as e:
  92.                     print(f"hdfs upload error : {e}")
  93.         return JsonResponse(msg)
  94. def schemaName_file_download(request):
  95.     '''
  96.     下载
  97.     '''
  98.     if request.method in ["POST", "GET"]:
  99.         req_dict = request.session.get("req_dict")
  100.         filename = req_dict.get("fileName")
  101.         filePath = os.path.join(os.getcwd(), "templates/front", filename)
  102.         print("filePath===========>", filePath)
  103.         if '是' in hasHadoop or 'spark' in hasHadoop:
  104.             try:
  105.                 client = Client("http://127.0.0.1:50070/")
  106.                 client.download(hdfs_path=f'/{filename}', local_path=filename, overwrite=True)
  107.             except Exception as e:
  108.                 print(f"hdfs download error : {e}")
  109.         file = open(filePath, 'rb')
  110.         response = HttpResponse(file)
  111.         response['Content-Type'] = 'text/plain'
  112.         response['Content-Disposition'] = 'attachment; filename=%s' % os.path.basename(filePath)
  113.         response['Content-Length'] = os.path.getsize(filePath)
  114.         return response
  115. def schemaName_follow_level(request, tableName, columnName, level, parent):
  116.     '''
  117.     '''
  118.     if request.method in ["POST", "GET"]:
  119.         msg = {"code": normal_code, 'data': []}
  120.         # 组合查询参数
  121.         params = {
  122.             "level": level,
  123.             "parent": parent
  124.         }
  125.         allModels = apps.get_app_config('main').get_models()
  126.         for m in allModels:
  127.             if m.__tablename__ == tableName:
  128.                 data = m.getbyparams(
  129.                     m,
  130.                     m,
  131.                     params
  132.                 )
  133.                 # 只需要此列的数据
  134.                 for i in data:
  135.                     msg['data'].append(i.get(columnName))
  136.                 break
  137.         return JsonResponse(msg)
  138. def schemaName_follow(request, tableName, columnName):
  139.     '''
  140.     根据option字段值获取某表的单行记录接口
  141.     组合columnName和columnValue成dict,传入查询方法
  142.     '''
  143.     if request.method in ["POST", "GET"]:
  144.         msg = {"code": normal_code, 'data': []}
  145.         # 组合查询参数
  146.         params = request.session.get('req_dict')
  147.         columnValue = params.get("columnValue")
  148.         params = {columnName: columnValue}
  149.         allModels = apps.get_app_config('main').get_models()
  150.         for m in allModels:
  151.             if m.__tablename__ == tableName:
  152.                 data = m.getbyparams(
  153.                     m,
  154.                     m,
  155.                     params
  156.                 )
  157.                 if len(data)>0:
  158.                     msg['data'] = data[0]
  159.                 break
  160.         return JsonResponse(msg)
  161. def schemaName_location(request):
  162.     '''
  163.     定位
  164.     :return:
  165.     '''
  166.     if request.method in ["POST", "GET"]:
  167.         msg = {"code": normal_code, "msg": mes.normal_code, "address": ''}
  168.         req_dict = request.session.get('req_dict')
  169.         datas = config.getbyparams(config, config, {"name": "baidu_ditu_ak"})
  170.         if len(datas) > 0:
  171.             baidu_ditu_ak = datas[0].get("baidu_ditu_ak")
  172.         else:
  173.             baidu_ditu_ak = 'QvMZVORsL7sGzPyTf5ZhawntyjiWYCif'
  174.         lat = req_dict.get("lat", 24.2943350100)
  175.         lon = req_dict.get("lng", 116.1287866600)
  176.         msg['address'] = geocoding(baidu_ditu_ak, lat, lon)
  177.         return JsonResponse(msg)
  178. def schemaName_matchface(request):
  179.     '''
  180.     baidubce百度人脸识别
  181.     '''
  182.     if request.method in ["POST", "GET"]:
  183.         try:
  184.             msg = {"code": normal_code}
  185.             req_dict = request.session.get("req_dict")
  186.             face1 = req_dict.get("face1")
  187.             file_path1 = os.path.join(os.getcwd(),"templates/front",face1)
  188.             face2 = req_dict.get("face2")
  189.             file_path2 = os.path.join(os.getcwd(), "templates/front", face2)
  190.             data = config.getbyparams(config, config, {"name": "APIKey"})
  191.             client_id = data[0].get("value")
  192.             data = config.getbyparams(config, config, {"name": "SecretKey"})
  193.             client_secret = data[0].get("value")
  194.             bdb = BaiDuBce()
  195.             score = bdb.bd_check2pic(client_id, client_secret, file_path1, file_path2)
  196.             msg['score'] = score
  197.             return JsonResponse(msg)
  198.         except:
  199.             return JsonResponse({"code": 500, "msg": "匹配失败", "score": 0})
  200. def schemaName_option(request, tableName, columnName):
  201.     '''
  202.     获取某表的某个字段列表接口
  203.     :param request:
  204.     :param tableName:
  205.     :param columnName:
  206.     :return:
  207.     '''
  208.     if request.method in ["POST", "GET"]:
  209.         msg = {"code": normal_code, 'data': []}
  210.         new_params = {}
  211.         params = request.session.get("req_dict")
  212.         if params.get('conditionColumn') != None and params.get('conditionValue') != None:
  213.             new_params[params['conditionColumn']] = params['conditionValue']
  214.         allModels = apps.get_app_config('main').get_models()
  215.         for m in allModels:
  216.             if m.__tablename__ == tableName:
  217.                 data = m.getbyColumn(
  218.                     m,
  219.                     m,
  220.                     columnName,
  221.                     new_params
  222.                 )
  223.                 msg['data'] = data
  224.                 break
  225.         return JsonResponse(msg)
  226. def schemaName_remind_tablename_columnname_type(request, tableName, columnName, type)->int:
  227.     '''
  228.     前台提醒接口(通用接口,不需要登陆)
  229.     '''
  230.     if request.method in ["POST", "GET"]:
  231.         msg = {"code": normal_code, 'data': []}
  232.         # 组合查询参数
  233.         params = request.session.get("req_dict")
  234.         remindstart = int(params.get('remindstart')) if params.get('remindstart') != None else None
  235.         remindend = int(params.get('remindend')) if params.get('remindend') != None else None
  236.         if int(type) == 1:  # 数字
  237.             if remindstart == None and remindend != None:
  238.                 params['remindstart'] = 0
  239.             elif remindstart != None and remindend == None:
  240.                 params['remindend'] = 999999
  241.             elif remindstart == None and remindend == None:
  242.                 params['remindstart'] = 0
  243.                 params['remindend'] = 999999
  244.         elif int(type) == 2:  # 日期
  245.             current_time = int(time.time())
  246.             if remindstart == None and remindend != None:
  247.                 starttime = current_time - 60 * 60 * 24 * 365 * 2
  248.                 params['remindstart'] = time.strftime("%Y-%m-%d", time.localtime(starttime))
  249.                 endtime = current_time + 60 * 60 * 24 * remindend
  250.                 params['remindend'] = time.strftime("%Y-%m-%d", time.localtime(endtime))
  251.             elif remindstart != None and remindend == None:
  252.                 starttime = current_time - 60 * 60 * 24 * remindstart
  253.                 params['remindstart'] = time.strftime("%Y-%m-%d", time.localtime(starttime))
  254.                 endtime = current_time + 60 * 60 * 24 * 365 * 2
  255.                 params['remindend'] = time.strftime("%Y-%m-%d", time.localtime(endtime))
  256.             elif remindstart == None and remindend == None:
  257.                 starttime = current_time - 60 * 60 * 24 * 365 * 2
  258.                 params['remindstart'] = time.strftime("%Y-%m-%d", time.localtime(starttime))
  259.                 endtime = current_time + 60 * 60 * 24 * 365 * 2
  260.                 params['remindend'] = time.strftime("%Y-%m-%d", time.localtime(endtime))
  261.         allModels = apps.get_app_config('main').get_models()
  262.         for m in allModels:
  263.             if m.__tablename__ == tableName:
  264.                 data = m.getbetweenparams(
  265.                     m,
  266.                     m,
  267.                     columnName,
  268.                     params
  269.                 )
  270.                 msg['count'] = len(data)
  271.                 break
  272.         return JsonResponse(msg)
  273. def schemaName_tablename_remind_columnname_type(request, tableName, columnName, type):
  274.     '''
  275.     后台提醒接口,判断authSeparate和authTable的权限
  276.     '''
  277.     if request.method in ["POST", "GET"]:
  278.         print("schemaName_tablename_remind_columnname_type==============>")
  279.         msg = {"code": normal_code, 'data': []}
  280.         req_dict = request.session.get("req_dict")
  281.         remindstart = int(req_dict.get('remindstart')) if req_dict.get('remindstart')!=None else None
  282.         remindend = int(req_dict.get('remindend')) if req_dict.get('remindend')!=None else None
  283.         print("req_dict===================>",req_dict)
  284.         allModels = apps.get_app_config('main').get_models()
  285.         for m in allModels:
  286.             if m.__tablename__ == tableName:
  287.                 tableModel=m
  288.                 break
  289.         # 获取全部列名
  290.         columns = tableModel.getallcolumn(tableModel, tableModel)
  291.         # 当前登录用户所在表
  292.         tablename = request.session.get("tablename")
  293.         # 当列属性authTable有值(某个用户表)[该列的列名必须和该用户表的登陆字段名一致],则对应的表有个隐藏属性authTable为”是”,那么该用户查看该表信息时,只能查看自己的
  294.         try:
  295.             __authTables__ =tableModel.__authTables__
  296.         except:
  297.             __authTables__ = {}
  298.         if __authTables__ != {}:
  299.             for authColumn, authTable in __authTables__.items():
  300.                 if authTable == tablename:
  301.                     params = request.session.get("params")
  302.                     req_dict[authColumn] = params.get(authColumn)
  303.                     break
  304.         '''__authSeparate__此属性为真,params添加userid,后台只查询个人数据'''
  305.         try:
  306.             __authSeparate__ =tableModel.__authSeparate__
  307.         except:
  308.             __authSeparate__ = None
  309.         if __authSeparate__ == "是":
  310.             tablename = request.session.get("tablename")
  311.             if tablename != "users" and 'userid' in columns:
  312.                 try:
  313.                     pass
  314.                     # req_dict['userid'] = request.session.get("params").get("id")
  315.                 except:
  316.                     pass
  317.         # 组合查询参数
  318.         if int(type) == 1:  # 数字
  319.             if remindstart == None and remindend != None:
  320.                 req_dict['remindstart'] = 0
  321.             elif remindstart != None and remindend == None:
  322.                 req_dict['remindend'] = 999999
  323.             elif remindstart == None and remindend == None:
  324.                 req_dict['remindstart'] = 0
  325.                 req_dict['remindend'] = 999999
  326.         elif int(type) == 2:  # 日期
  327.             current_time = int(time.time())
  328.             if remindstart == None and remindend != None:
  329.                 starttime = current_time - 60 * 60 * 24 * 365 * 2
  330.                 req_dict['remindstart'] = time.strftime("%Y-%m-%d", time.localtime(starttime))
  331.                 endtime = current_time + 60 * 60 * 24 * remindend
  332.                 req_dict['remindend'] = time.strftime("%Y-%m-%d", time.localtime(endtime))
  333.             elif remindstart != None and remindend == None:
  334.                 starttime = current_time + 60 * 60 * 24 * remindstart
  335.                 req_dict['remindstart'] = time.strftime("%Y-%m-%d", time.localtime(starttime))
  336.                 endtime = current_time + 60 * 60 * 24 * 365 * 2
  337.                 req_dict['remindend'] = time.strftime("%Y-%m-%d", time.localtime(endtime))
  338.             elif remindstart == None and remindend == None:
  339.                 starttime = current_time - 60 * 60 * 24 * 365 * 2
  340.                 req_dict['remindstart'] = time.strftime("%Y-%m-%d", time.localtime(starttime))
  341.                 endtime = current_time + 60 * 60 * 24 * 365 * 2
  342.                 req_dict['remindend'] = time.strftime("%Y-%m-%d", time.localtime(endtime))
  343.             else:
  344.                 starttime = current_time + 60 * 60 * 24 * remindstart
  345.                 req_dict['remindstart'] = time.strftime("%Y-%m-%d", time.localtime(starttime))
  346.                 endtime = current_time + 60 * 60 * 24 * remindend
  347.                 req_dict['remindend'] = time.strftime("%Y-%m-%d", time.localtime(endtime))
  348.         print("req_dict==============>",req_dict)
  349.         allModels = apps.get_app_config('main').get_models()
  350.         for m in allModels:
  351.             if m.__tablename__ == tableName:
  352.                 data = m.getbetweenparams(
  353.                     m,
  354.                     m,
  355.                     columnName,
  356.                     req_dict
  357.                 )
  358.                 msg['count'] = len(data)
  359.                 break
  360.         return JsonResponse(msg)
  361. def schemaName_sh(request, tableName):
  362.     '''
  363.     根据主键id修改table表的sfsh状态接口
  364.     '''
  365.     if request.method in ["POST", "GET"]:
  366.         print('tableName=========>', tableName)
  367.         msg = {"code": normal_code, "msg": "成功", "data": {}}
  368.         req_dict = request.session.get("req_dict")
  369.         allModels = apps.get_app_config('main').get_models()
  370.         for m in allModels:
  371.             if m.__tablename__ == tableName:
  372.                 # 查询结果
  373.                 data1 = m.getbyid(
  374.                     m,
  375.                     m,
  376.                     req_dict.get('id')
  377.                 )
  378.                 if data1[0].get("sfsh") == '是':
  379.                     req_dict['sfsh'] = '否'
  380.                 else:
  381.                     req_dict['sfsh'] = '否'
  382.                 # 更新
  383.                 res = m.updatebyparams(
  384.                     m,
  385.                     m,
  386.                     req_dict
  387.                 )
  388.                 # logging.warning("schemaName_sh.res=====>{}".format(res))
  389.                 if res!=None:
  390.                     msg["code"]=crud_error_code
  391.                     msg["code"]=mes.crud_error_code
  392.                 break
  393.         return JsonResponse(msg)
  394. def schemaName_upload(request, fileName):
  395.     '''
  396.     '''
  397.     if request.method in ["POST", "GET"]:
  398.         return HttpResponseRedirect  ("/{}/front/{}".format(schemaName,fileName))
  399. def schemaName_group_quyu(request, tableName, columnName):
  400.     '''
  401.     {
  402.     "code": 0,
  403.     "data": [
  404.         {
  405.             "total": 2,
  406.             "shangpinleibie": "水果"
  407.         },
  408.         {
  409.             "total": 1,
  410.             "shangpinleibie": "蔬菜"
  411.         }
  412.     ]
  413.     }
  414.     '''
  415.     if request.method in ["POST", "GET"]:
  416.         msg = {"code": normal_code, "msg": "成功", "data": {}}
  417.         allModels = apps.get_app_config('main').get_models()
  418.         where = {}
  419.         for m in allModels:
  420.             if m.__tablename__ == tableName:
  421.                 for item in m.__authTables__.items():
  422.                     if request.session.get("tablename") == item[1]:
  423.                         where[item[0]] = request.session.get("params").get(item[0])
  424.                 msg['data'] = m.groupbycolumnname(
  425.                     m,
  426.                     m,
  427.                     columnName,
  428.                     where
  429.                 )
  430.                 break
  431.         return JsonResponse(msg)
  432. def schemaName_value_quyu(request, tableName, xColumnName, yColumnName):
  433.     '''
  434.     按值统计接口,
  435.     {
  436.     "code": 0,
  437.     "data": [
  438.         {
  439.             "total": 10.0,
  440.             "shangpinleibie": "aa"
  441.         },
  442.         {
  443.             "total": 20.0,
  444.             "shangpinleibie": "bb"
  445.         },
  446.         {
  447.             "total": 15.0,
  448.             "shangpinleibie": "cc"
  449.         }
  450.     ]
  451. }
  452.     '''
  453.     if request.method in ["POST", "GET"]:
  454.         msg = {"code": normal_code, "msg": "成功", "data": {}}
  455.         allModels = apps.get_app_config('main').get_models()
  456.         where = {}
  457.         for m in allModels:
  458.             if m.__tablename__ == tableName:
  459.                 for item in m.__authTables__.items():
  460.                     if request.session.get("tablename") == item[1]:
  461.                         where[item[0]] = request.session.get("params").get(item[0])
  462.                 msg['data'] = m.getvaluebyxycolumnname(
  463.                     m,
  464.                     m,
  465.                     xColumnName,
  466.                     yColumnName,
  467.                     where
  468.                 )
  469.                 break
  470.         return JsonResponse(msg)
  471. def schemaName_value_riqitj(request, tableName, xColumnName, yColumnName, timeStatType):
  472.     if request.method in ["POST", "GET"]:
  473.         msg = {"code": normal_code, "msg": "成功", "data": {}}
  474.         where = ' where 1 = 1 '
  475.         allModels = apps.get_app_config('main').get_models()
  476.         for m in allModels:
  477.             if m.__tablename__ == tableName:
  478.                 for item in m.__authTables__.items():
  479.                     if request.session.get("tablename") == item[1]:
  480.                         where = where + " and " + item[0] + " = '" +  request.session.get("params").get(item[0]) + "' "
  481.         sql = ''
  482.         if timeStatType == '日':
  483.             sql = "SELECT DATE_FORMAT({0}, '%Y-%m-%d') {0}, sum({1}) total FROM {3} {2} GROUP BY DATE_FORMAT({0}, '%Y-%m-%d')".format(xColumnName, yColumnName, where, tableName, '%Y-%m-%d')
  484.         if timeStatType == '月':
  485.             sql = "SELECT DATE_FORMAT({0}, '%Y-%m') {0}, sum({1}) total FROM {3} {2} GROUP BY DATE_FORMAT({0}, '%Y-%m')".format(xColumnName, yColumnName, where, tableName, '%Y-%m')
  486.         if timeStatType == '年':
  487.             sql = "SELECT DATE_FORMAT({0}, '%Y') {0}, sum({1}) total FROM {3} {2} GROUP BY DATE_FORMAT({0}, '%Y')".format(xColumnName, yColumnName, where, tableName, '%Y')
  488.         L = []
  489.         cursor = connection.cursor()
  490.         cursor.execute(sql)
  491.         desc = cursor.description
  492.         data_dict = [dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall()]
  493.         for online_dict in data_dict:
  494.             for key in online_dict:
  495.                 if 'datetime.datetime' in str(type(online_dict[key])):
  496.                     online_dict[key] = online_dict[key].strftime(
  497.                         "%Y-%m-%d %H:%M:%S")
  498.                 else:
  499.                     pass
  500.             L.append(online_dict)
  501.         msg['data'] = L
  502.         return JsonResponse(msg)
  503. def schemaName_spider(request, tableName):
  504.     if request.method in ["POST", "GET"]:
  505.         msg = {"code": normal_code, "msg": "成功", "data": []}
  506.         # Linux
  507.         cmd = "cd /yykj/python/9999/spider08375 && scrapy crawl "+tableName+"Spider -a databaseName=djangoqo04n"
  508.         # Windows
  509.         # cmd = "cd C:\\test1\\spider && scrapy crawl " + tableName + "Spider"
  510.         os.system(cmd)
  511.         return JsonResponse(msg)
复制代码


五,相干作品展示

基于Java开辟、Python开辟、PHP开辟、C#开辟等相干语言开辟的实战项目
基于Nodejs、Vue等前端技术开辟的前端实战项目
基于微信小步伐和安卓APP应用开辟的相干作品
基于51单片机等嵌入式物联网开辟应用
基于各类算法实现的AI智能应用
基于大数据实现的各类数据管理和保举系统





 


 







免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

西河刘卡车医

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表