You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.6 KiB
53 lines
1.6 KiB
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 |