v1.0.0 高考志愿门户完整修复
变更摘要: - [fix] 清理根目录 index.html 遗留代码(questionnaire-error + retryLoad 移除) - [fix] 副标题同步更新为自估591分 + 候选志愿546条数据校准 - [fix] 页脚注入版本号 v1.0.0 - [fix] 部署版 index.html: 取消家长标签,统一 filler-tianheng - [fix] Dashboard 文案修正(4份→2份线上问卷) - [fix] 清理冗余部署脚本(v1-v4归档至 archived_scripts/) - [fix] 等效位次工具纳入 deploy 目录 - [chore] .gitignore 初始化 - [init] Git 仓库初始化
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import paramiko, time, json
|
||||
|
||||
NAS_HOST = "100.85.152.112"
|
||||
NAS_PORT = 22
|
||||
NAS_USER = "simon"
|
||||
NAS_PASS = "Nas82829330"
|
||||
|
||||
def exec_and_read(c, cmd, wait=3):
|
||||
"""执行命令并等待输出"""
|
||||
stdin, stdout, stderr = c.exec_command(cmd)
|
||||
time.sleep(wait)
|
||||
# 确保命令完成
|
||||
while not stdout.channel.exit_status_ready():
|
||||
time.sleep(0.2)
|
||||
out = stdout.read().decode("utf-8", errors="replace")
|
||||
err = stderr.read().decode("utf-8", errors="replace")
|
||||
return out, err
|
||||
|
||||
def main():
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(NAS_HOST, NAS_PORT, NAS_USER, NAS_PASS, timeout=15)
|
||||
|
||||
# 1. 删除数据库
|
||||
exec_and_read(c, "rm -f /volume1/docker/gaokao-portal/backend/data/gaokao.db", wait=2)
|
||||
print(" [删除] gaokao.db")
|
||||
|
||||
# 2. 重启后端
|
||||
docker = "echo 'Nas82829330' | sudo -S /usr/local/bin/docker"
|
||||
exec_and_read(c, f"{docker} restart gaokao-portal-backend-1", wait=3)
|
||||
print(" [重启] 后端容器")
|
||||
|
||||
# 等待后端完全启动
|
||||
print(" 等待启动...")
|
||||
time.sleep(12)
|
||||
|
||||
# 3. 查询问卷列表
|
||||
out, err = exec_and_read(c, "curl -s http://localhost:8080/api/questionnaires", wait=3)
|
||||
|
||||
try:
|
||||
data = json.loads(out)
|
||||
print(f"\n问卷数量: {len(data)}")
|
||||
for i, q in enumerate(data, 1):
|
||||
print(f" {i}. {q['title']}")
|
||||
except Exception as ex:
|
||||
print(f" 解析: {ex}")
|
||||
print(f" 结果: {out[:300]}")
|
||||
|
||||
c.close()
|
||||
print("\n MBTI 问卷已添加!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user