|
@@ -43,13 +43,19 @@ namespace TEAMModelBI.Tool.CosmosBank
|
|
|
/// <param name="schoolIds"></param>
|
|
|
/// <param name="busy"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async static Task<List<string>> SchoolAdviser(CosmosClient cosmosClient, DingDingUserInfo ddUserInfo,List<string> schoolIds ,string busy)
|
|
|
+ public async static Task<List<string>> SchoolAdviser(CosmosClient cosmosClient, DingDingUserInfo ddUserInfo,List<string> schoolIds ,string role,string busy)
|
|
|
{
|
|
|
Teacher teacher = null;
|
|
|
bool isReadTec = false;
|
|
|
bool isAddUpd = false;
|
|
|
List<string> noSchool = new();
|
|
|
- var tecResponse = await cosmosClient.GetContainer("TEAMModelOS", "Teacher").ReadItemStreamAsync(ddUserInfo.tmdId, new PartitionKey($"Base"));
|
|
|
+ string joinStatus = "";
|
|
|
+ if (role.Equals("assist"))
|
|
|
+ joinStatus = "顾问";
|
|
|
+ if (role.Equals("sales"))
|
|
|
+ joinStatus = "销售";
|
|
|
+
|
|
|
+ var tecResponse = await cosmosClient.GetContainer("TEAMModelOS", "Teacher").ReadItemStreamAsync(ddUserInfo.tmdId, new PartitionKey($"Base"));
|
|
|
if (tecResponse.Status == 200)
|
|
|
{
|
|
|
JsonDocument jsonDocument = JsonDocument.Parse(tecResponse.Content);
|
|
@@ -89,9 +95,9 @@ namespace TEAMModelBI.Tool.CosmosBank
|
|
|
|
|
|
if ($"{busy}".Equals("add"))
|
|
|
{
|
|
|
- if (!schoolTeacher.roles.Contains("assist"))
|
|
|
+ if (!schoolTeacher.roles.Contains($"{role}"))
|
|
|
{
|
|
|
- schoolTeacher.roles.Add("assist");
|
|
|
+ schoolTeacher.roles.Add($"{role}");
|
|
|
addSchoolTeache.Add(cosmosClient.GetContainer("TEAMModelOS", "School").ReplaceItemAsync<SchoolTeacher>(schoolTeacher, schoolTeacher.id, new PartitionKey($"Teacher-{schoolId}")));
|
|
|
}
|
|
|
else
|
|
@@ -99,9 +105,9 @@ namespace TEAMModelBI.Tool.CosmosBank
|
|
|
}
|
|
|
if ($"{busy}".Equals("del"))
|
|
|
{
|
|
|
- if (schoolTeacher.roles.Contains("assist"))
|
|
|
+ if (schoolTeacher.roles.Contains($"{role}"))
|
|
|
{
|
|
|
- schoolTeacher.roles.Remove("assist");
|
|
|
+ schoolTeacher.roles.Remove($"{role}");
|
|
|
teacher.schools.Remove(teacher.schools.Find(x => x.schoolId == schoolId));
|
|
|
updSchoolTeache.Add(cosmosClient.GetContainer("TEAMModelOS", "School").ReplaceItemAsync<SchoolTeacher>(schoolTeacher, schoolTeacher.id, new PartitionKey($"Teacher-{schoolId}")));
|
|
|
}
|
|
@@ -116,9 +122,9 @@ namespace TEAMModelBI.Tool.CosmosBank
|
|
|
id = ddUserInfo.tmdId,
|
|
|
name = ddUserInfo.tmdName,
|
|
|
picture = ddUserInfo.picture,
|
|
|
- job = "顾问",
|
|
|
+ job = joinStatus,
|
|
|
subjectIds = new List<string>(),
|
|
|
- roles = new List<string> { "assist" },
|
|
|
+ roles = new List<string> { $"{role}" },
|
|
|
permissions = new List<string>(),
|
|
|
status = "join",
|
|
|
code = $"Teacher-{schoolId}",
|