From dfd42870a2902981eb613b105275ca16b8833c12 Mon Sep 17 00:00:00 2001
From: hyb <kk_huangyangbo@163.com>
Date: Thu, 08 Jan 2026 02:03:14 +0000
Subject: [PATCH] 更新所有压测脚本,实现项目中运行和单独运行都可启动脚本 修复单独运行脚本时路径错误问题

---
 测试组/脚本/造数脚本2/华东师范大学二期/新建技术服务费.py |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 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/\345\215\216\344\270\234\345\270\210\350\214\203\345\244\247\345\255\246\344\272\214\346\234\237/\346\226\260\345\273\272\346\212\200\346\234\257\346\234\215\345\212\241\350\264\271.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/\345\215\216\344\270\234\345\270\210\350\214\203\345\244\247\345\255\246\344\272\214\346\234\237/\346\226\260\345\273\272\346\212\200\346\234\257\346\234\215\345\212\241\350\264\271.py"
index 3f8d6bc..ffdba6c 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/\345\215\216\344\270\234\345\270\210\350\214\203\345\244\247\345\255\246\344\272\214\346\234\237/\346\226\260\345\273\272\346\212\200\346\234\257\346\234\215\345\212\241\350\264\271.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/\345\215\216\344\270\234\345\270\210\350\214\203\345\244\247\345\255\246\344\272\214\346\234\237/\346\226\260\345\273\272\346\212\200\346\234\257\346\234\215\345\212\241\350\264\271.py"
@@ -12,16 +12,24 @@
 import os
 import random
 import pymysql
-# 将上一级目录加入模块搜索路径
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 import asyncio
 import aiohttp
 import time
 import traceback
 import datetime
 from tqdm import tqdm
-from Util.random_util import RandomUtil
-from Util.dingtalk_helper import DingTalkHelper
+
+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.random_util import RandomUtil
+from 测试组.脚本.造数脚本2.Util.dingtalk_helper import DingTalkHelper
 
 
 # --- 配置 ---
@@ -258,7 +266,7 @@
     try:
         import importlib.util
         script_dir = os.path.dirname(os.path.abspath(__file__))
-        report_path = os.path.join(script_dir, r'H:\项目\造数脚本\Util\stress_test_report_generator.py')
+        report_path = os.path.join(script_dir, r'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)
             report_module = importlib.util.module_from_spec(spec)

--
Gitblit v1.9.1