diff --git a/BasePlatformDotnet/src/Yh.SchClass.OpenApi/SchClassOpenApi.cs b/BasePlatformDotnet/src/Yh.SchClass.OpenApi/SchClassOpenApi.cs
index f66e598..b67a514 100644
--- a/BasePlatformDotnet/src/Yh.SchClass.OpenApi/SchClassOpenApi.cs
+++ b/BasePlatformDotnet/src/Yh.SchClass.OpenApi/SchClassOpenApi.cs
@@ -30,6 +30,7 @@ public sealed class SchClassOpenApi
TeachInfo = new SchClassTeachInfoClient(httpClient, options);
SubInfo = new SchClassSubInfoClient(httpClient, options);
FamilyCompat = new SchClassFamilyCompatClient(httpClient, options);
+ SchTree = new SchClassSchTreeClient(httpClient, options);
}
/// 当前生效的配置。
@@ -69,6 +70,9 @@ public sealed class SchClassOpenApi
/// FamCom:家长兼容(/oapi/Common/FamCom/)。
public SchClassFamilyCompatClient FamilyCompat { get; }
+
+ /// SchTree:学校教师组树(/oapi/SchGroup/)。
+ public SchClassSchTreeClient SchTree { get; }
}
/// 的轻量工厂(不依赖 DI 容器)。
diff --git a/BasePlatformDotnet/tests/Yh.SchClass.OpenApi.Tests/DebugMain.cs b/BasePlatformDotnet/tests/Yh.SchClass.OpenApi.Tests/DebugMain.cs
index 54828b7..4078015 100644
--- a/BasePlatformDotnet/tests/Yh.SchClass.OpenApi.Tests/DebugMain.cs
+++ b/BasePlatformDotnet/tests/Yh.SchClass.OpenApi.Tests/DebugMain.cs
@@ -10,6 +10,7 @@
//
// 注意:csproj 已设 GenerateProgramFile=false(关掉 Test SDK 自动 Main),dotnet test 不受影响。
+using Microsoft.VisualStudio.TestPlatform.Utilities;
using System.Text;
namespace Yh.SchClass.OpenApi.Tests;
@@ -20,34 +21,38 @@ public static class DebugMain
{
Console.OutputEncoding = Encoding.UTF8;
- string? only = null;
- foreach (var arg in args)
- {
- if (arg.StartsWith("--only=", StringComparison.OrdinalIgnoreCase))
- {
- only = arg[7..].Trim();
- }
- else if (arg.Equals("--off", StringComparison.OrdinalIgnoreCase))
- {
- Console.WriteLine("跳过联调:--off(同 YH_SCHCLASS_DEBUG_OFF=1)");
- return 0;
- }
- }
+ var sch = "8d920c30-0f9b-4d8c-8a9f-2f9682899635";
+ var api = SchClassLiveDebug.Create();
+ var teachers = await api.TeaInfo.GetSchTeaInfoAsync(sch, null);
+ Console.WriteLine($"OATea[{sch}] 共 {teachers.Count} 名教师");
+ //string? only = null;
+ //foreach (var arg in args)
+ //{
+ // if (arg.StartsWith("--only=", StringComparison.OrdinalIgnoreCase))
+ // {
+ // only = arg[7..].Trim();
+ // }
+ // else if (arg.Equals("--off", StringComparison.OrdinalIgnoreCase))
+ // {
+ // Console.WriteLine("跳过联调:--off(同 YH_SCHCLASS_DEBUG_OFF=1)");
+ // return 0;
+ // }
+ //}
- if (Environment.GetEnvironmentVariable(SchClassLiveDebug.OffVar) is "1" or "true")
- {
- Console.WriteLine("跳过联调:已设置 " + SchClassLiveDebug.OffVar + "=1(清除该变量即可恢复联调)");
- return 0;
- }
+ //if (Environment.GetEnvironmentVariable(SchClassLiveDebug.OffVar) is "1" or "true")
+ //{
+ // Console.WriteLine("跳过联调:已设置 " + SchClassLiveDebug.OffVar + "=1(清除该变量即可恢复联调)");
+ // return 0;
+ //}
- Console.WriteLine("== SchClass OpenAPI 测试工程调试入口 ==");
- var failures = await SchClassLiveDebug.RunAllAsync(Console.WriteLine, only);
- if (failures.Count == 0)
- {
- Console.WriteLine("全部通过 ✅");
- return 0;
- }
- Console.WriteLine($"失败 {failures.Count} 个:{string.Join(", ", failures)}");
+ //Console.WriteLine("== SchClass OpenAPI 测试工程调试入口 ==");
+ //var failures = await SchClassLiveDebug.RunAllAsync(Console.WriteLine, only);
+ //if (failures.Count == 0)
+ //{
+ // Console.WriteLine("全部通过 ✅");
+ // return 0;
+ //}
+ //Console.WriteLine($"失败 {failures.Count} 个:{string.Join(", ", failures)}");
return 1;
}
}
diff --git a/BasePlatformDotnet/tests/Yh.SchClass.OpenApi.Tests/SchClassLiveDebug.cs b/BasePlatformDotnet/tests/Yh.SchClass.OpenApi.Tests/SchClassLiveDebug.cs
index 76e2c2c..e568cc7 100644
--- a/BasePlatformDotnet/tests/Yh.SchClass.OpenApi.Tests/SchClassLiveDebug.cs
+++ b/BasePlatformDotnet/tests/Yh.SchClass.OpenApi.Tests/SchClassLiveDebug.cs
@@ -28,7 +28,7 @@ internal static class SchClassLiveDebug
public const string DefaultHost = "http://base.yunhaixingtong.com";
/// 配置与配置文件都未提供时的兜底应用路径。
- public const string DefaultPath = "/bschclass";
+ public const string DefaultPath = "/userclass";
private static readonly IConfiguration? Config;
@@ -143,6 +143,7 @@ internal static class SchClassLiveDebug
("SchInfo.GetSchlist", async () => (await api.SchInfo.GetSchListAsync(null)).Count),
("OATea.GetSchTeainfo", async () => (await api.TeaInfo.GetSchTeaInfoAsync(sch, null)).Count),
("OATea.GetArrTeainfo", async () => (await api.TeaInfo.GetArrTeaInfoAsync(teaId.Value.ToString())).Count),
+ ("SchGroup.GetTeaTree", async () => (await api.SchTree.GetTeaTreeAsync(sch, null)).Count),
("OAStu.GetAllStulist", async () => (await api.StuInfo.GetAllStuListAsync()).Count),
("OAStu.GetSchStulist", async () => (await api.StuInfo.GetSchStuListAsync(sch, null)).Count),
("OAStu.GetClaStulist", async () => (await api.StuInfo.GetClaStuListAsync(classId, null)).Count),
diff --git a/BasePlatformDotnet/tests/Yh.SchClass.OpenApi.Tests/SchClassLiveDebugTests.cs b/BasePlatformDotnet/tests/Yh.SchClass.OpenApi.Tests/SchClassLiveDebugTests.cs
index 7589706..dbfc701 100644
--- a/BasePlatformDotnet/tests/Yh.SchClass.OpenApi.Tests/SchClassLiveDebugTests.cs
+++ b/BasePlatformDotnet/tests/Yh.SchClass.OpenApi.Tests/SchClassLiveDebugTests.cs
@@ -77,6 +77,28 @@ public class SchClassLiveDebugTests(ITestOutputHelper output)
}
}
+ [Fact]
+ public async Task 联调_教师组树()
+ {
+ if (!Live()) return;
+
+ var api = SchClassLiveDebug.Create();
+ var sch = SchClassLiveDebug.Sch
+ ?? (await api.SchInfo.AllListAsync()).FirstOrDefault()?.SchSerId;
+ if (string.IsNullOrEmpty(sch))
+ {
+ output.WriteLine("未取到学校序列号(设置 YH_SCHCLASS_DEBUG_SCH 或确认学校列表非空)");
+ return;
+ }
+
+ var tree = await api.SchTree.GetTeaTreeAsync(sch, null);
+ output.WriteLine($"SchTree[{sch}] 根节点 {tree.Count} 个");
+ foreach (var root in tree)
+ {
+ output.WriteLine($" {root.Id} / {root.Name} / type={root.Type} / 子节点 {root.Children?.Count ?? 0} 个");
+ }
+ }
+
[Fact]
public async Task 联调_一键跑通全部端点()
{
diff --git a/BasePlatformDotnet/tests/Yh.SchClass.OpenApi.Tests/appsettings.json b/BasePlatformDotnet/tests/Yh.SchClass.OpenApi.Tests/appsettings.json
index 4a6f4bd..81a31b3 100644
--- a/BasePlatformDotnet/tests/Yh.SchClass.OpenApi.Tests/appsettings.json
+++ b/BasePlatformDotnet/tests/Yh.SchClass.OpenApi.Tests/appsettings.json
@@ -4,7 +4,7 @@
"Enabled": true,
"BaseHost": "http://base.yunhaixingtong.com",
"BasePath": "/userbase",
- "SchClassPath": "/bschclass",
+ "SchClassPath": "/userclass",
"AppKey": "100002",
"AppSecret": "2314a3b158b24a838b2b9b69fd3db118"
}