This commit is contained in:
2025-01-07 20:18:34 +08:00
parent 6f3a7c2ecc
commit 540d8c4e5b
10 changed files with 42 additions and 42 deletions

View File

@ -26,3 +26,5 @@ $query_string = "create table patient_90(patient_id char(50),patient_name char(5
mysqli_query($link,$query_string);
$query_string = "insert into patient_90 values('123456','王某','1','1')";
mysqli_query($link,$query_string);
echo "表创建成功"

View File

@ -1,3 +1,5 @@
映射URL路径
主配置类
标识一个Java 类是一个控制器
用于标识服务层组件
注入对象

Binary file not shown.

Before

Width:  |  Height:  |  Size: 699 B

After

Width:  |  Height:  |  Size: 602 B

2
ftp.py
View File

@ -64,7 +64,7 @@ def upload_directory_to_ftp(server, username, password, local_directory, remote_
local_file_path = os.path.join(root, filename) # 本地文件的完整路径
relative_path = os.path.relpath(local_file_path, local_directory) # 计算相对路径
remote_file_path = os.path.join(remote_directory, relative_path).replace("\\", "/") # 计算远程文件路径
upload_file_to_ftp(server, username, password, local_file_path, remote_file_path, proxy_url) # 上传文件
upload_file_to_ftp(server, username, password, local_file_path, remote_file_path) # 上传文件
except ftplib.all_errors as e:
print(f"上传目录时发生错误: {e}")

78
main.py
View File

@ -12,34 +12,34 @@ import time
import re
import os
import tkinter as tk
from tkinter import messagebox # 单独导入 messagebox
from ftp import set_proxy
from ftp import upload_file_to_ftp
from ftp import upload_directory_to_ftp
from ftp import create_remote_directory
import requests
def launch_proxy():
print("开启代理...")
cmd = "start ./Shadowsocks-4.4.1.0/Shadowsocks.exe"
os.system('chcp 65001')
os.system(cmd)
def close_proxy():
print("杀死代理进程")
cmd = "taskkill /f /im Shadowsocks.exe"
os.system('chcp 65001')
os.system(cmd)
cmd = """
reg add "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
"""
print(cmd)
os.system(cmd)
# def launch_proxy():
# print("开启代理...")
# cmd = "start ./Shadowsocks-4.4.1.0/Shadowsocks.exe"
# os.system('chcp 65001')
# os.system(cmd)
#
# def close_proxy():
# print("杀死代理进程")
# cmd = "taskkill /f /im Shadowsocks.exe"
# os.system('chcp 65001')
# os.system(cmd)
# cmd = """
# reg add "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
# """
# print(cmd)
# os.system(cmd)
def shot(chromedriver_path ,chrome_path):
options = Options()
options.add_experimental_option("detach", True)
options.binary_location = chrome_path
options.add_argument("--no-sandbox")
# 初始化 WebDriver
@ -48,8 +48,6 @@ def shot(chromedriver_path ,chrome_path):
driver.get("http://125.64.9.222:8022/login_exam.php")
try:
launch_proxy()
time.sleep(5)
exam_id = name_entry.get()
@ -137,28 +135,27 @@ def shot(chromedriver_path ,chrome_path):
print(response.text)
time.sleep(5)
driver.get("http://125.64.9.222:8022/paper/paper.php")
# 等待页面加载
wait = WebDriverWait(driver, 30)
for fillingQ_id in fillingQ_ids:
textarea = wait.until(EC.presence_of_element_located((By.ID, fillingQ_id)))
with open (fillingQ_path + f"/{fillingQ_id}", "r", encoding="utf-8") as f:
textarea.send_keys(f.read()) # 填写题目
for save in fillingQ_save_ids:
driver.execute_script(f"{save}")
print(f"已保存 {save} 题目")
time.sleep(1)
tk.messagebox.showinfo("提示","执行成功!请手动进入网站点击调试")
except Exception as e:
print(f"发生错误: {e}")
tk.messagebox.showerror("错误", f"发生错误: {e}")
#
# driver.get("http://125.64.9.222:8022/paper/paper.php")
#
# # 等待页面加载
# wait = WebDriverWait(driver, 20)
# for fillingQ_id in fillingQ_ids:
# textarea = wait.until(EC.presence_of_element_located((By.ID, fillingQ_id)))
# with open (fillingQ_path + f"/{fillingQ_id}"+".txt", "r", encoding="utf-8") as f:
# textarea.send_keys(f.read()) # 填写题目
#
# for save in fillingQ_save_ids:
# driver.execute_script(f"{save}")
# print(f"已保存 {save} 题目")
# time.sleep(1)
#
# tk.messagebox.showinfo("提示","执行成功!请手动进入网站点击调试")
# except Exception as e:
# print(f"发生错误: {e}")
# tk.messagebox.showerror("错误", f"发生错误: {e}")
finally:
close_proxy()
driver.quit()
if __name__ == "__main__":
@ -230,5 +227,4 @@ if __name__ == "__main__":
submit_button.pack(side=tk.BOTTOM)
submit_button.config(width=10, height=1)
root.mainloop()
close_proxy()
root.mainloop()