|
@@ -232,6 +232,8 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
try
|
|
try
|
|
{
|
|
{
|
|
|
|
+
|
|
|
|
+ List<KeyValuePair<string, int>> keys = new List<KeyValuePair<string, int>>();
|
|
List<TmdInfo> ids = new List<TmdInfo>();
|
|
List<TmdInfo> ids = new List<TmdInfo>();
|
|
foreach (var obj in user_list.EnumerateArray())
|
|
foreach (var obj in user_list.EnumerateArray())
|
|
{
|
|
{
|
|
@@ -249,6 +251,16 @@ namespace TEAMModelOS.Controllers
|
|
if (school != null)
|
|
if (school != null)
|
|
{
|
|
{
|
|
school.time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
school.time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
|
+ if (school.status.Equals("invite") && grant_type.ToString().Equals("invite"))
|
|
|
|
+ {
|
|
|
|
+ keys.Add(new KeyValuePair<string, int>($"{id}", 1));
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ if (school.status.Equals("join") && grant_type.ToString().Equals("invite"))
|
|
|
|
+ {
|
|
|
|
+ keys.Add(new KeyValuePair<string, int>($"{id}", 2));
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
school.status = grant_type.GetString();
|
|
school.status = grant_type.GetString();
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -285,12 +297,22 @@ namespace TEAMModelOS.Controllers
|
|
await client.GetContainer(Constant.TEAMModelOS, "Teacher").CreateItemStreamAsync(stream, new PartitionKey("Base"));
|
|
await client.GetContainer(Constant.TEAMModelOS, "Teacher").CreateItemStreamAsync(stream, new PartitionKey("Base"));
|
|
}
|
|
}
|
|
//學校老師資料
|
|
//學校老師資料
|
|
|
|
+
|
|
var sresponse = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemStreamAsync(id.ToString(), new PartitionKey($"Teacher-{school_code}"));
|
|
var sresponse = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemStreamAsync(id.ToString(), new PartitionKey($"Teacher-{school_code}"));
|
|
//SchoolTeacher schteacher = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<SchoolTeacher>(id.ToString(), new PartitionKey($"Teacher-{school_code}"));
|
|
//SchoolTeacher schteacher = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<SchoolTeacher>(id.ToString(), new PartitionKey($"Teacher-{school_code}"));
|
|
if (sresponse.Status == 200)
|
|
if (sresponse.Status == 200)
|
|
{
|
|
{
|
|
using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
|
|
using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
|
|
SchoolTeacher schteacher = json.ToObject<SchoolTeacher>();
|
|
SchoolTeacher schteacher = json.ToObject<SchoolTeacher>();
|
|
|
|
+ if (schteacher.status.Equals("invite") && grant_type.ToString().Equals("invite")) {
|
|
|
|
+ keys.Add(new KeyValuePair<string, int>($"{id}", 1));
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ if (schteacher.status.Equals("join") && grant_type.ToString().Equals("invite"))
|
|
|
|
+ {
|
|
|
|
+ keys.Add(new KeyValuePair<string, int>($"{id}", 2));
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
schteacher.status = grant_type.ToString();
|
|
schteacher.status = grant_type.ToString();
|
|
schteacher.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
schteacher.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
await client.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<SchoolTeacher>(schteacher, id.ToString(), new PartitionKey($"Teacher-{school_code}"));
|
|
await client.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<SchoolTeacher>(schteacher, id.ToString(), new PartitionKey($"Teacher-{school_code}"));
|
|
@@ -353,7 +375,7 @@ namespace TEAMModelOS.Controllers
|
|
var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
|
|
var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
|
|
var location = _option.Location;
|
|
var location = _option.Location;
|
|
var code = await _notificationService.SendNotification(clientID, clientSecret, location, url, notification);
|
|
var code = await _notificationService.SendNotification(clientID, clientSecret, location, url, notification);
|
|
- return Ok(new { });
|
|
|
|
|
|
+ return Ok(new { exist = keys }) ;
|
|
}
|
|
}
|
|
catch(Exception ex)
|
|
catch(Exception ex)
|
|
{
|
|
{
|