import datetime
import gzip
import json
import time
import urllib
import requests
from django.http import HttpResponse, Http404
from django.shortcuts import render
# 首页 查询数据库名
import pymysql
from dbutils.pooled_db import PooledDB
from tool.exportion_history import Insert_exportion_history,Select_exportion_history
import aiohttp
import asyncio
# CONCURRENCY = 5
# semaphore = asyncio.Semaphore(CONCURRENCY)
from hbzk_show.settings import DB
MYSQL_HOST = DB['MYSQL_HOST']
USER = DB['USER']
PASSWORD = DB['PASSWORD']
DB = DB['DB']
PORT = 3306
pool = PooledDB(pymysql, 10, host=MYSQL_HOST, user=USER, passwd=PASSWORD, db=DB, port=PORT) # 5为连接池里的最少连接数
# 登录
def login(request):
if request.method == 'GET':
return render(request, 'login.html')
if request.method == 'POST':
user = request.POST.get('name', '')
password = request.POST.get('password', '')
db = pool.connection()
cursor = db.cursor()
try:
sql = 'select password,name from user where user = "{}"'.format(user)
print(sql)
cursor.execute(sql)
password1,name= cursor.fetchall()[0]
cursor.close()
db.close()
if password == password1:
request.session['name'] = name
return HttpResponse('200')
else:
return HttpResponse('400')
except:
return HttpResponse('400')
# 退出登录
def logout(request):
request.session.flush()
if not request.session.get('nickname'):
return render(request,'login.html')
def query(request):
if request.method == 'GET':
name = request.session.get('name')
return render(request, 'select.html',locals())
def get_count(request):
name = request.session.get('name')
if name:
if request.method == 'GET':
db = pool.connection()
cursor = db.cursor()
tablename = request.GET['data']
keyword = request.GET['keyword']
tim = request.GET['time']
period = request.GET['time_period']
discipline = request.GET['discipline']
subdiscipline = request.GET['subdiscipline']
is_ch = request.GET['is_ch']
classify = request.GET['classify']
if discipline:
discipline_ = " and discipline in ('" + urllib.parse.unquote_plus(discipline.replace('check_box_discipline=','').replace("&","','")) + "') "
else:
discipline_ = ''
if subdiscipline:
subdiscipline_ = " and subdiscipline in ('" + urllib.parse.unquote_plus(subdiscipline.replace('check_box_subdiscipline=','').replace("&","','")) + "') "
else:
subdiscipline_ = ''
if classify:
classify_ = " and classify in ('" + urllib.parse.unquote_plus(classify.replace('check_box_classify=','').replace("&","','")) + "') "
else:
classify_ = ''
if period:
print("period",period)
start = str(period).split("-")[0:3]
s_tim = ""
for times,i in enumerate(start):
s_tim += i.strip() if times == 2 else i.strip()+"-"
print("start",s_tim)
end = str(period).split("-")[-3:]
e_tim = ""
for times,j in enumerate(end):
e_tim += j.strip() if times == 2 else j.strip()+"-"
print("end", e_tim)
period_ = 'and create_date >= "{}" and create_date <= "{}"'.format(s_tim,e_tim)
else:
period_ = ''
is_ch_ = ' and is_ch = ' + '"'+ is_ch + '"' if is_ch else ''
keyword_ = ' and ( keyword like "%{}%" or article like "%{}%" ) '.format(keyword,keyword) if keyword else ''
tim_ = ' and time = '+ '"'+ tim +'"' if tim else ''
_sql = 'SELECT count(id) from ' + tablename + ' where 1=1 ' + discipline_ + is_ch_ + classify_ + subdiscipline_ + keyword_ + tim_ + period_
print(_sql)
cursor.execute(_sql)
# total = len(cursor.fetchall())
total = cursor.fetchall()[0]
return HttpResponse(total)
# 返回查询数据列表
def data(request):
global a,sql,_sql
name = request.session.get('name')
if name:
if request.method == 'GET':
tablename = request.GET['data']
keyword = request.GET['keyword']
tim = request.GET['time']
period = request.GET['time_period']
discipline = request.GET['discipline']
subdiscipline = request.GET['subdiscipline']
is_ch = request.GET['is_ch']
classify = request.GET['classify']
print("classify", classify)
pagesize = int(request.GET['offset']) - 1
pagenumber = int(request.GET['pagesize'])
if discipline:
discipline_ = " and discipline in ('" + urllib.parse.unquote_plus(discipline.replace('check_box_discipline=','').replace("&","','")) + "') "
else:
discipline_ = ''
if subdiscipline:
subdiscipline_ = " and subdiscipline in ('" + urllib.parse.unquote_plus(subdiscipline.replace('check_box_subdiscipline=','').replace("&","','")) + "') "
else:
subdiscipline_ = ''
if classify:
classify_ = " and classify in ('" + urllib.parse.unquote_plus(classify.replace('check_box_classify=','').replace("&","','")) + "') "
else:
classify_ = ''
if period:
print("peropd",period)
start = str(period).split("-")[0:3]
s_tim = ""
for times,i in enumerate(start):
s_tim += i.strip() if times == 2 else i.strip()+"-"
print("start",s_tim)
end = str(period).split("-")[-3:]
e_tim = ""
for times,j in enumerate(end):
e_tim += j.strip() if times == 2 else j.strip()+"-"
print("end", e_tim)
period_ = 'and create_date >= "{}" and create_date <= "{}"'.format(s_tim,e_tim)
else:
period_ = ''
is_ch_ = ' and is_ch = ' + '"'+ is_ch + '"' if is_ch else ''
keyword_ = ' and ( keyword like "%{}%" or article like "%{}%" ) '.format(keyword,keyword) if keyword else ''
tim_ = ' and time = '+ '"'+ tim +'"' if tim else ''
db = pool.connection()
cursor = db.cursor()
sql_judge = f"SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = '{DB}' AND TABLE_NAME = '{tablename}'"
cursor.execute(sql_judge)
data = cursor.fetchall()
# print(data)
a = ('discipline', 'subdiscipline', 'classify', 'email', 'name', 'article', 'is_ch', 'is_qikan',
'keyword', 'conference', 'time') if "conference" in str(data[-1]) else ('discipline', 'subdiscipline', 'classify', 'email','name','article','is_ch','is_qikan','keyword','','time')
sql = 'SELECT discipline,subdiscipline,classify,email,name,article,is_ch,is_qikan,keyword,conference,time from ' + tablename + ' where 1=1 ' + discipline_ + is_ch_ + classify_ + subdiscipline_ + keyword_ + tim_ + period_ +' limit {},{}'.format(
pagesize * pagenumber, pagenumber) if "conference" in str(data[-1]) else 'SELECT discipline,subdiscipline,classify,email,name,article,is_ch,is_qikan,keyword,NULL,time from '+tablename +' where 1=1 ' + discipline_ + is_ch_ + classify_ + subdiscipline_ + keyword_ + tim_ + per
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【资源说明】 物联网课程设计基于Django框架的校园卡管理系统Python源码.zip物联网课程设计基于Django框架的校园卡管理系统Python源码.zip物联网课程设计基于Django框架的校园卡管理系统Python源码.zip物联网课程设计基于Django框架的校园卡管理系统Python源码.zip物联网课程设计基于Django框架的校园卡管理系统Python源码.zip物联网课程设计基于Django框架的校园卡管理系统Python源码.zip 物联网课程设计基于Django框架的校园卡管理系统Python源码.zip物联网课程设计基于Django框架的校园卡管理系统Python源码.zip物联网课程设计基于Django框架的校园卡管理系统Python源码.zip 物联网课程设计基于Django框架的校园卡管理系统Python源码.zip 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载,沟通交流,互相学习,共同进步!
资源推荐
资源详情
资源评论
收起资源包目录
物联网课程设计基于Django框架的校园卡管理系统Python源码.zip (422个子文件)
bootstrap.css 174KB
bootstrap.css 143KB
bootstrap.min.css 118KB
layui.css 78KB
font-awesome.css 37KB
font-awesome.min.css 30KB
bootstrap-theme.css 26KB
bootstrap-theme.min.css 23KB
bootstrap-table.css 18KB
bootstrap-table.min.css 16KB
layer.css 14KB
bootstrap-table-bulma.css 11KB
style.css 11KB
bootstrap-table-semantic.css 11KB
bootstrap-table-foundation.css 10KB
bootstrap-table-materialize.css 10KB
bootstrap-table-bulma.min.css 10KB
bootstrap-table-semantic.min.css 10KB
bootstrap-table.css 9KB
bootstrap-table-foundation.min.css 9KB
bootstrap-table-materialize.min.css 9KB
bootstrap-table.min.css 9KB
fileinput.min.css 8KB
style.css 8KB
laydate.css 7KB
daterangepicker-bs3.css 5KB
code.css 1KB
bootstrap-table-reorder-rows.min.css 1KB
unspider_index.css 819B
bootstrap-table-reorder-rows.css 802B
bootstrap-table-fixed-columns.min.css 647B
bootstrap-table-page-jump-to.min.css 644B
bootstrap-table-sticky-header.min.css 558B
bootstrap-table-group-by.min.css 468B
bootstrap-table-filter-control.min.css 429B
bootstrap-table-fixed-columns.css 370B
bootstrap-table-sticky-header.css 360B
bootstrap-table-page-jump-to.css 336B
bootstrap-table-filter-control.css 204B
bootstrap-table-group-by.css 151B
fontawesome-webfont.eot 162KB
fontawesome-webfont.eot 162KB
iconfont.eot 46KB
glyphicons-halflings-regular.eot 20KB
bootstrap-table.eot 7KB
loading-0.gif 6KB
loading-2.gif 2KB
index.gif 989B
loading-1.gif 701B
.gitignore 213B
select.html 35KB
dataspider_index.html 14KB
data_view.html 10KB
dataspider_index.html 5KB
login.html 4KB
person.html 4KB
exportion_history.html 4KB
unspider_index.html 4KB
ei_index.html 3KB
scispider_index.html 2KB
hbzk_show.iml 1KB
banner1.jpg 622KB
banner.jpg 528KB
bg.jpg 93KB
bg.jpg 93KB
g3.jpg 89KB
g6.jpg 74KB
g2.jpg 68KB
g1.jpg 53KB
g5.jpg 51KB
g4.jpg 45KB
admin.jpg 32KB
echarts.min.js 760KB
JsonExportExcel.min.js 305KB
layui.js 284KB
jquery.js 274KB
bootstrap-table.js 259KB
bootstrap-table-locale-all.js 205KB
bootstrap-table.min.js 118KB
bootstrap-table-locale-all.min.js 111KB
bootstrap-table-cookie.js 104KB
bootstrap-table-filter-control.js 99KB
bootstrap-table-export.js 92KB
bootstrap-table-toolbar.js 91KB
fileinput.min.js 90KB
bootstrap-table-multiple-sort.js 87KB
bootstrap-table-editable.js 83KB
utils.js 79KB
bootstrap-table-vue.js 77KB
moment.js 76KB
bootstrap-table-print.js 75KB
bootstrap-table-vue.esm.js 75KB
bootstrap.js 68KB
bootstrap-table-treegrid.js 65KB
bootstrap-table-group-by.js 60KB
bootstrap-table-addrbar.js 53KB
bootstrap-table-custom-view.js 53KB
bootstrap-table-fixed-columns.js 49KB
bootstrap-table-key-events.js 44KB
bootstrap-table-reorder-columns.js 43KB
共 422 条
- 1
- 2
- 3
- 4
- 5
资源评论
Make程序设计
- 粉丝: 7020
- 资源: 3582
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功