|
@@ -22,6 +22,8 @@ using TEAMModelOS.Filter;
|
|
|
using HTEXLib.COMM.Helpers;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using TEAMModelOS.SDK.DI.CoreAPI;
|
|
|
+using DocumentFormat.OpenXml.Wordprocessing;
|
|
|
+using static TEAMModelOS.Controllers.FixDataController;
|
|
|
|
|
|
namespace TEAMModelOS.Controllers
|
|
|
{
|
|
@@ -583,13 +585,13 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
|
|
|
List<KeyValuePair<string, int>> keys = new List<KeyValuePair<string, int>>();
|
|
|
- List<TmdInfo> ids = new List<TmdInfo>();
|
|
|
+ List<IdNameCode> ids = new List<IdNameCode>();
|
|
|
foreach (var obj in user_list.EnumerateArray())
|
|
|
{
|
|
|
obj.TryGetProperty("id", out JsonElement id);
|
|
|
obj.TryGetProperty("name", out JsonElement name);
|
|
|
obj.TryGetProperty("picture", out JsonElement picture);
|
|
|
- TmdInfo tmd = new TmdInfo { id = $"{id}", name = $"{name}" };
|
|
|
+ IdNameCode tmd = new IdNameCode { id = $"{id}", name = $"{name}" };
|
|
|
ids.Add(tmd);
|
|
|
//老師個人資料
|
|
|
var tresponse = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemStreamAsync(id.ToString(), new PartitionKey("Base"));
|
|
@@ -597,7 +599,8 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(tresponse.ContentStream);
|
|
|
Teacher teacher = json.ToObject<Teacher>();
|
|
|
- var school = teacher.schools.FirstOrDefault(x => x.schoolId.Equals(school_code.GetString(), StringComparison.OrdinalIgnoreCase));
|
|
|
+ tmd.code = teacher.lang;
|
|
|
+ var school = teacher.schools.FirstOrDefault(x => x.schoolId.Equals(school_code.GetString(), StringComparison.OrdinalIgnoreCase));
|
|
|
if (school != null)
|
|
|
{
|
|
|
school.time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
@@ -739,6 +742,9 @@ namespace TEAMModelOS.Controllers
|
|
|
var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
|
|
|
var location = _option.Location;
|
|
|
var code = await _notificationService.SendNotification(clientID, clientSecret, location, url, notification);
|
|
|
+
|
|
|
+ _coreAPIHttpService.PushNotify(ids, $"{bizcode}_school", Constant.NotifyType_IES5_Management,
|
|
|
+ new Dictionary<string, object> { { "tmdname", tname }, { "schooName", schname } }, _option.Location, _configuration, _dingDing, "");
|
|
|
return Ok(new { exist = keys });
|
|
|
}
|
|
|
catch (Exception ex)
|
|
@@ -905,7 +911,10 @@ namespace TEAMModelOS.Controllers
|
|
|
var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
|
|
|
var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
|
|
|
var location = _option.Location;
|
|
|
- var code = await _notificationService.SendNotification(clientID, clientSecret, location, url, notification);
|
|
|
+ var code = await _notificationService.SendNotification(clientID, clientSecret, location, url, notification);
|
|
|
+
|
|
|
+ _coreAPIHttpService.PushNotify(new List<IdNameCode> { new IdNameCode { id = teacher.id, name=teacher.name, code= teacher.lang} }, $"{bizcode}_school", Constant.NotifyType_IES5_Management,
|
|
|
+ new Dictionary<string, object> { { "tmdname", tname }, { "schooName", schname } }, _option.Location, _configuration, _dingDing, "");
|
|
|
return Ok(new { });
|
|
|
}
|
|
|
catch (Exception ex)
|
|
@@ -1020,6 +1029,9 @@ namespace TEAMModelOS.Controllers
|
|
|
var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
|
|
|
var location = _option.Location;
|
|
|
var code = await _notificationService.SendNotification(clientID, clientSecret, location, url, notification);
|
|
|
+
|
|
|
+ _coreAPIHttpService.PushNotify(new List<IdNameCode> { new IdNameCode { id = teacher.id, name = teacher.name, code = teacher.lang } }, $"remove_school", Constant.NotifyType_IES5_Management,
|
|
|
+ new Dictionary<string, object> { { "tmdname", tname }, { "schooName", schname } }, _option.Location, _configuration, _dingDing, "");
|
|
|
}
|
|
|
return Ok(new { });
|
|
|
}
|