From efcfbf596bfd9f5f623e2e05a92e140fd27f1838 Mon Sep 17 00:00:00 2001
From: hyb <kk_huangyangbo@163.com>
Date: Thu, 08 Jan 2026 08:57:48 +0000
Subject: [PATCH] 新增认证校验工具类,可实现将明文加密后,直接获取token,避免认证过期 已更新华东师范大学二期的压测脚本实现自动获取最新token功能,其他脚本后续更新

---
 测试组/脚本/造数脚本2/齐鲁/pda更新笼位.py |   28 +++++++++++-----------------
 1 files changed, 11 insertions(+), 17 deletions(-)

diff --git "a/\346\265\213\350\257\225\347\273\204/\350\204\232\346\234\254/\351\200\240\346\225\260\350\204\232\346\234\2542/\351\275\220\351\262\201/pda\346\233\264\346\226\260\347\254\274\344\275\215.py" "b/\346\265\213\350\257\225\347\273\204/\350\204\232\346\234\254/\351\200\240\346\225\260\350\204\232\346\234\2542/\351\275\220\351\262\201/pda\346\233\264\346\226\260\347\254\274\344\275\215.py"
index 431d64b..67a1e92 100644
--- "a/\346\265\213\350\257\225\347\273\204/\350\204\232\346\234\254/\351\200\240\346\225\260\350\204\232\346\234\2542/\351\275\220\351\262\201/pda\346\233\264\346\226\260\347\254\274\344\275\215.py"
+++ "b/\346\265\213\350\257\225\347\273\204/\350\204\232\346\234\254/\351\200\240\346\225\260\350\204\232\346\234\2542/\351\275\220\351\262\201/pda\346\233\264\346\226\260\347\254\274\344\275\215.py"
@@ -1,18 +1,5 @@
-"""
-pad笼位更新压测脚本(带压测报告生成并通过钉钉发送摘要)
-
-说明:
- - 该脚本模拟多个饲养员同时对笼位进行频繁更新操作
- - 从userinfo.xlsx读取多个用户token实现多用户并发压测
- - 从数据库动态获取笼位ID、用户ID和课题组ID
- - 运行后会记录每条请求的时间、状态码和延迟
- - 运行结束后会生成压测报告并通过钉钉发送摘要
-"""
-
 import sys
 import os
-# 将上一级目录加入模块搜索路径
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 import asyncio
 import aiohttp
 import time
@@ -22,10 +9,17 @@
 import pymysql
 import random
 from tqdm import tqdm
-from Util.dingtalk_helper import DingTalkHelper
 
-# 将上一级目录加入模块搜索路径
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+def get_parent_directory(file_path, levels=1):
+    """获取指定层级的父目录"""
+    path = os.path.abspath(file_path)
+    for _ in range(levels):
+        path = os.path.dirname(path)
+    return path
+parent_dir = get_parent_directory(__file__, 5)  # 获取上五级目录
+sys.path.append(parent_dir)
+
+from 测试组.脚本.造数脚本2.Util.dingtalk_helper import DingTalkHelper
 
 # --- 配置 ---
 ACCESS_TOKEN = '4625f6690acd9347fae5b3a05af598be63e73d604b933a9b3902425b8f136d4d'
@@ -264,7 +258,7 @@
         import importlib.util
 
         # 使用您提供的绝对路径
-        report_path = 'H:\\项目\\造数脚本\\Util\\stress_test_report_generator.py'
+        report_path = 'H:\\项目\\archive\\测试组\\脚本\\造数脚本2\\Util\\stress_test_report_generator.py'
 
         if os.path.exists(report_path):
             spec = importlib.util.spec_from_file_location('report_module', report_path)

--
Gitblit v1.9.1