在新增题目和添加关联题时新增了添加log的功能

This commit is contained in:
wangweiye7840 2024-04-15 09:31:04 +08:00
parent 0cb82eb577
commit 6710db3fd1
1 changed files with 7 additions and 0 deletions

View File

@ -409,6 +409,7 @@ def AddRelatedProblemToDB(id,content,oid,editor):
mydb = connect(hostname = "wwylss.synology.me", port = "13306", username="root", pwd="Wwy@0018705", db = "tikutest") mydb = connect(hostname = "wwylss.synology.me", port = "13306", username="root", pwd="Wwy@0018705", db = "tikutest")
mycursor = mydb.cursor() mycursor = mydb.cursor()
id = str(id).zfill(6) id = str(id).zfill(6)
content = content.strip()
if "blank" in content: if "blank" in content:
genre = "填空题" genre = "填空题"
space = "" space = ""
@ -431,6 +432,9 @@ def AddRelatedProblemToDB(id,content,oid,editor):
if id > oid: if id > oid:
val = (oid, id) val = (oid, id)
mycursor.execute(sql,val) mycursor.execute(sql,val)
sql = "INSERT INTO logs (DATE,TIME,username,action,id,db_content) VALUE (%s,%s,%s,%s,%s,%s);"
val = (GetDate(),GetTime(),get_git_username(),"加关联题",id,content)
mycursor.execute(sql,val)
mydb.commit() mydb.commit()
mydb.close() mydb.close()
return id return id
@ -470,6 +474,9 @@ def AddProblemstoDict2024(startingid,raworigin,problems,editor,indexed): #将来
sql = "INSERT INTO edit_history (ID,date,editor) VALUE (%s,%s,%s);" sql = "INSERT INTO edit_history (ID,date,editor) VALUE (%s,%s,%s);"
val = (pid,GetDate(),editor.strip()) val = (pid,GetDate(),editor.strip())
mycursor.execute(sql,val) mycursor.execute(sql,val)
sql = "INSERT INTO logs (DATE,TIME,username,action,id,db_content) VALUE (%s,%s,%s,%s,%s,%s);"
val = (GetDate(),GetTime(),get_git_username(),"新增题目",pid,p.strip())
mycursor.execute(sql,val)
if "same" in meta: if "same" in meta:
sql = "INSERT INTO same (ID,SAME_ID) VALUE (%s,%s);" sql = "INSERT INTO same (ID,SAME_ID) VALUE (%s,%s);"
for sid in meta["same"]: for sid in meta["same"]: