Merge branch 'master' of https://bdgit.educoder.net/puf7keiya/aaaa into LvYH_branch

pull/11/head
233 2 years ago
commit 5b42f80a80

@ -1,2 +0,0 @@
# aaaa

@ -0,0 +1,53 @@
from codecs import ignore_errors
from pickle import TRUE
import turtle
from xmlrpc.client import boolean
import numpy as np
from asyncore import write
import xlrd
import pandas as pd
import openpyxl
from xlrd import Book
import datetime
import time
import time
from flask import Flask,request
from encodings import utf_8
import pymssql
import json
import base64
import jpype
class admin_log():
def admin_log1(c,a):
b={
'test1':[],
'text':'2'
}
# 把数据装载成json格式并回传
#a='{"a":{"test":1},"b":2,"c":3,"d":4,"e":5}'
conn =pymssql.connect(
server="LAPTOP-FLH9FTB4",#本地服务器
user="sa",password="as2799094948",
database="software_project",
charset="utf8"
)
if conn:
print('连接数据库成功!')#测试是否连接上
cursor =conn.cursor() #使用cursor()方法获取操作游标
a= request.json
username=a['username']
passwd=a['password']
sql_select="SELECT [password] FROM admin where username = '{}'".format(username) #数据库查询语句
cursor.execute(sql_select) #执行语句
results =cursor.fetchall() #获取所有记录列表
if len(results)==0:
b['text']=1
elif results[0][0]==passwd:
b['text']=2
else: b['text']=3
conn.commit()
cursor.close()
conn.close()
# 把数据装载成json格式并回传
a1=json.dumps(b,ensure_ascii=False)
return a1

@ -0,0 +1,16 @@
'''b={
'test1':[],
'text':'2',
'image':[]
}
b['test1'].append(['学号200340001','姓名:白雪健','电话13080337680','时间2020','校门:南','市:天津','区:东丽区','详细地址:中国民航大学'])
print(b)'''
b={
'test1':[],
'text':'2',
'image':[]
}
b['test1'].append([])
b['test1'][0].append('申请表类型')
b['test1'][0].append('申请表类型')
print(b)

@ -0,0 +1,88 @@
import time
import requests
import pymssql
import re
from bs4 import BeautifulSoup
cookies = {
'security_session_verify': '2b416949a891a8c262d984ce4252acc6',
'__yjs_duid': '1_0b113b04c0c0e5c875c1b9485d5285781666539190108',
'Hm_lvt_133c8ee1fed22328c57193e7ed6ce0c5': '1666539138,1666540035',
'Hm_lpvt_133c8ee1fed22328c57193e7ed6ce0c5': '1666540145',
}
headers = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Cache-Control': 'max-age=0',
'Connection': 'keep-alive',
# Requests sorts cookies= alphabetically
# 'Cookie': 'security_session_verify=2b416949a891a8c262d984ce4252acc6; __yjs_duid=1_0b113b04c0c0e5c875c1b9485d5285781666539190108; Hm_lvt_133c8ee1fed22328c57193e7ed6ce0c5=1666539138,1666540035; Hm_lpvt_133c8ee1fed22328c57193e7ed6ce0c5=1666540145',
'Referer': 'http://tj.bendibao.com/news/gelizhengce/fengxianmingdan.php?isqg=0',
'Upgrade-Insecure-Requests': '1',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36',
}
params = {
'isqg': '1',
'qu': '全部',
}
t=0
while True:
conn =pymssql.connect(
server="LAPTOP-FLH9FTB4",#本地服务器
user="sa",password="as2799094948",
database="software_project",
charset="utf8"
#这里设置全局的GBK如果设置的是UTF—8需要将数据库默认的GBK转化成UTF-8
)
if conn:
print('连接数据库成功!')#测试是否连接上
res = requests.get('http://tj.bendibao.com/news/gelizhengce/fengxianmingdan.php', params=params, cookies=cookies, headers=headers)
res.encoding='utf-8'
soup = BeautifulSoup(res.text, 'html.parser')
# 使用cursor()方法获取操作游标
cursor =conn.cursor()
# 高风险地区信息
# 清除原有数据
cursor.execute("truncate table height")
conn.commit()
# 存入新数据
content='#info > div.height.info-item > div > div > div > div'
a=soup.select(content)
for i in range(1,len(a)):
a[i] = a[i].text.strip().replace("\n", "")
if len(a[i])!=0:
area=re.search(r'.*?区',a[i]).group()
cursor.execute("insert into height values('{0}','{1}')".format(area,a[i]))
conn.commit()
# 中风险地区信息
# 清除原有数据
cursor.execute("truncate table middle")
conn.commit()
# 存入新数据
content='#info > div.middle.info-item > div > div > div > div'
a=soup.select(content)
for i in range(1,len(a)):
a[i] = a[i].text.strip().replace("\n", "")
if len(a[i])!=0:
area=re.search(r'.*?区',a[i]).group()
cursor.execute("insert into middle values('{0}','{1}')".format(area,a[i]))
conn.commit()
# 低风险地区信息
# 清除原有数据
cursor.execute("truncate table low")
conn.commit()
# 存入新数据
content='#info > div.low.info-item > div > div > div > div'
a=soup.select(content)
for i in range(1,len(a)):
a[i] = a[i].text.strip().replace("\n", "")
if len(a[i])!=0:
area=re.search(r'.*?区',a[i]).group()
cursor.execute("insert into low values('{0}','{1}')".format(area,a[i]))
conn.commit()
cursor.close()
# 断开数据库连接
conn.close()
# 设置休眠时间,定时执行
time.sleep(43200) #12小时

@ -0,0 +1,41 @@
import os
import jpype
jarpath = r"D:\tupian\OCR_baidu.jar" # jar包地址
jvmPath = jpype.getDefaultJVMPath()
jpype.startJVM(jvmPath, "-ea", "-Djava.class.path=%s" % (jarpath))
java1 = jpype.JClass("HealthCode")
java2 = jpype.JClass("TripCode")
java3 = jpype.JClass("CovidTestRep")
j1 = java1()
j2 = java2()
j3 = java3()
str1 = str(j1.Judge(r"D:\tupian\12.jpg")) # 健康码地址,不要包含中文 下同
str2 = str(j2.Judge(r"D:\tupian\13.jpg")) # 行程码地址
str3 = str(j3.Judge(r"D:\tupian\11.jpg")) # 核酸结果地址
# if str2==",," or str3==',,':图片有误
'''
Hst, Hname, Hdata 对应健康码颜色姓名日期
Tst, Ttel, Tdata, Tdis 对应行程码颜色电话日期去过的地方
Cst, Cname, Cdata 对应 核酸结果 姓名 核酸日期
'''
# 为方便分割Hst前加了一个大写字符S判断时应注意如绿码 Hst为S绿
Hst, Hname, Hdata = str1.split(',')
Tst, Ttel, Tdata, Tdis = str2.split(',')
Cst, Cname, Cdata = str3.split(',')
Hdata = Hdata[0:10] # 只要求精确到日,不考虑小时。
Tdata = Tdata[0:10]
Cdata = Cdata[0:10]
print(Hst)
print(Hname)
print(Hdata)
print(Tst)
print(Ttel)
print(Tdis)
print(Tdata)
print(Cst)
print(Cname)
print(Cdata)
jpype.shutdownJVM()

@ -0,0 +1,70 @@
from audioop import add
import base64
import os
import json
from unicodedata import name
from codecs import ignore_errors
from pickle import TRUE
import turtle
from xmlrpc.client import boolean
import numpy as np
from asyncore import write
import xlrd
import pandas as pd
import openpyxl
from xlrd import Book
import datetime
import time
from flask import Flask,request
from encodings import utf_8
import pymssql
import json
import base64
from out_school import out_school
from in_school import in_school
import time
class scan_the_code:
def scan_the_code1(p,data):
sno=data['sno']
res={
'result':[]
}
Conn = pymssql.connect(server="LAPTOP-FLH9FTB4",#本地服务器
user="sa",password="as2799094948",
database="software_project",
charset="utf8")
if Conn:
print ("连接成功")
cur = Conn.cursor()
#cur.execute("delete student where state='出' and pass='2' ")
#1在校2审批通过
if data['shuju']=='5YWl5qCh5LqM57u056CB':
cur.execute("select * from Form , [user] where state='出校' and pass='2' and sno='{}' and username=sno".format(sno))
results=cur.fetchall()
if(len(results)==0):
res['result'].append('您没有入校资格')
else:
cur.execute("update [user] set state='入校' where username='{}' ".format(sno))
cur.execute("delete from Form where sno='{}'".format(sno))
res['result'].append('入校成功')
elif data['shuju']=='5Ye65qCh5LqM57u056CB':
cur.execute("select * from Form , [user] where state='入校' and pass='2'and sno='{}' and username=sno".format(sno))
results=cur.fetchall()
if(len(results)==0):
print('无出校资格')
res['result'].append('您没有出校资格')
else:
# 测试时不更改数据
cur.execute("update [user] set state='出校' where username='{}' ".format(sno))
cur.execute("delete from Form where sno='{}'".format(sno))
print('出校成功')
res['result'].append('出校成功')
else:
print('二维码无效')
res['result'].append('二维码无效')
print ("成功")
Conn.commit()
cur.close()
Conn.close()
b=json.dumps(res,ensure_ascii=False)
return b

@ -0,0 +1,54 @@
from codecs import ignore_errors
from pickle import TRUE
import turtle
from xmlrpc.client import boolean
import numpy as np
from asyncore import write
import xlrd
import pandas as pd
import openpyxl
from xlrd import Book
import datetime
import time
import time
from flask import Flask,request
from encodings import utf_8
import pymssql
import json
import base64
import jpype
class user_log():
def user_log1(p,a):
b={
'test1':[],
'text':'2'
}
# 把数据装载成json格式并回传
#a='{"a":{"test":1},"b":2,"c":3,"d":4,"e":5}'
conn =pymssql.connect(
server="LAPTOP-FLH9FTB4",#本地服务器
user="sa",password="as2799094948",
database="software_project",
charset="utf8"
)
if conn:
print('连接数据库成功!')#测试是否连接上
cursor =conn.cursor() #使用cursor()方法获取操作游标
a= request.json
username=a['username']
passwd=a['password']
sql_select="SELECT password FROM [user] where username = '{}'".format(username) #数据库查询语句
cursor.execute(sql_select) #执行语句
results =cursor.fetchall() #获取所有记录列表
if len(results)==0:
b['text']=1
elif results[0][0]==passwd:
b['text']=2
else: b['text']=3
conn.commit()
cursor.close()
conn.close()
# 把数据装载成json格式并回传
a1=json.dumps(b,ensure_ascii=False)
#a='{"a":{"test":1},"b":2,"c":3,"d":4,"e":5}'
return a1
Loading…
Cancel
Save