修改 寻找空闲题号 的spareIDs函数为无参数函数
This commit is contained in:
parent
aa343a9cdc
commit
a26be89655
|
|
@ -22,6 +22,9 @@ BuildFullScheme = {
|
|||
}
|
||||
}
|
||||
|
||||
def connect(hostname,port,username,pwd,db):
|
||||
mydb = mysql.connector.connect(host = hostname, port = port, user = username, password = pwd, database = db)
|
||||
return mydb
|
||||
|
||||
def GetDate(): #获得当前日期
|
||||
currentdate = str(time.localtime().tm_year)+str(time.localtime().tm_mon).zfill(2)+str(time.localtime().tm_mday).zfill(2)
|
||||
|
|
@ -254,8 +257,8 @@ def extractIDs(filePath): #提取.txt,.tex或.pdf文件中的题号, 返回含
|
|||
return generate_exp(ids)
|
||||
|
||||
|
||||
def spareIDs(host,port,username,password): #返回空闲题号
|
||||
mydb = mysql.connector.connect(host = host, port = port, user=username, password=password, database = "tikutest")
|
||||
def spareIDs(): #返回空闲题号, 已更新为适合mariadb的版本
|
||||
mydb = connect(hostname = "wwylss.synology.me", port = "13306", username="root", pwd="Wwy@0018705", db = "tikutest")
|
||||
mycursor = mydb.cursor()
|
||||
mycursor.execute("SELECT ID FROM problems;")
|
||||
idlist = [ret[0] for ret in mycursor.fetchall()]
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class MyWindow(QWidget,Ui_Form):
|
|||
|
||||
|
||||
def ShowAvailable(self):
|
||||
self.label_Available.setText(spareIDs("wwylss.synology.me","13306","root","Wwy@0018705"))
|
||||
self.label_Available.setText(spareIDs())
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Reference in New Issue