Prechádzať zdrojové kódy

update .移除NotificationService

CrazyIter_Bin 2 rokov pred
rodič
commit
e9130298b9

+ 5 - 58
TEAMModelBI/Controllers/BINormal/BatchAreaController.cs

@@ -27,7 +27,6 @@ using System.Net.Http.Json;
 using System.Net;
 using TEAMModelOS.SDK;
 using TEAMModelOS.SDK.Context.BI;
-using TEAMModelOS.SDK.DI.CoreAPI;
 using System.Text;
 using DocumentFormat.OpenXml.Bibliography;
 using Microsoft.Extensions.Hosting;
@@ -47,20 +46,18 @@ namespace TEAMModelBI.Controllers.BINormal
         private readonly Option _option;
         private readonly AzureStorageFactory _azureStorage;
         private readonly IConfiguration _configuration;
-        private readonly NotificationService _notificationService;
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly IHttpClientFactory _http;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly IWebHostEnvironment _environment; //读取文件
 
-        public BatchAreaController(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, IConfiguration configuration, NotificationService notificationService, AzureServiceBusFactory serviceBus, IHttpClientFactory http, CoreAPIHttpService coreAPIHttpService, IWebHostEnvironment hostingEnvironment) 
+        public BatchAreaController(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, IConfiguration configuration,   AzureServiceBusFactory serviceBus, IHttpClientFactory http, CoreAPIHttpService coreAPIHttpService, IWebHostEnvironment hostingEnvironment) 
         {
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
             _azureStorage = azureStorage;
             _option = option?.Value;
             _configuration = configuration;
-            _notificationService = notificationService;
             _serviceBus = serviceBus;
             _http = http;
             _coreAPIHttpService = coreAPIHttpService;
@@ -609,25 +606,10 @@ namespace TEAMModelBI.Controllers.BINormal
                 {
                     return Ok(new { state = 201, msg = "能力点复制成功,复制能力点的文件失败," });
                 }
+ 
 
-                //发送消息实体
-                Notification notification = new Notification
-                {
-                    hubName = "hita",
-                    type = "msg",
-                    from = $"BI:{_option.Location}:private",
-                    to = new List<string> { $"{ _tmdId}" },
-                    label = $"{partitionCode}_start",
-                    body = new { location = _option.Location, biz = partitionCode, tmdid = $"{_tmdId}", tmdname = $"{_tmdName}", status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
-                    expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                };
-
-                var notiUrl = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
-                var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-                var location = _option.Location;
-                await _notificationService.SendNotification(clientID, clientSecret, location, notiUrl, notification); //站内发送消息
-
+            
+              
                 //保存操作记录
                 //await _azureStorage.SaveBILog("area-add", $"{_tmdName}【{_tmdId}】已操作创区功能模块:{name},当前标准【{standard}】,复制的微能力点:{tempStandard}", _dingDing, httpContext: HttpContext);
                 await AzureStorageBlobExtensions.SaveBILog(blobClient, tableClient, "area-add", $"{_tmdName}【{_tmdId}】已操作创区功能模块:{name},当前标准【{standard}】,复制的微能力点:{tempStandard}", _dingDing, httpContext: HttpContext);
@@ -880,24 +862,7 @@ namespace TEAMModelBI.Controllers.BINormal
                     return Ok(new { state = 201 ,msg = "能力点复制成功,复制能力点的文件失败," });
                 }
 
-                //发送消息实体
-                Notification notification = new()
-                {
-                    hubName = "hita",
-                    type = "msg",
-                    from = $"BI:{_option.Location}:private",
-                    to = new List<string> { $"{ _tmdId}" },
-                    label = $"{partitionCode}_start",
-                    body = new { location = _option.Location, biz = partitionCode, tmdid = $"{_tmdId}", tmdname = $"{_tmdName}", status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
-                    expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                };
-
-                var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
-                var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-                var location = _option.Location;
-                await _notificationService.SendNotification(clientID, clientSecret, location, url, notification); //发送站内发送消息
-
+              
                 //保存操作记录
                 await AzureStorageBlobExtensions.SaveBILog(blobClient, tableClient, "area-cut", $"{_tmdName}【{_tmdId}】已操作【{_oldStandard}】切换至{_newStandard}微能力点,复制标准:{_newStandard}", _dingDing, httpContext: HttpContext);
                 return Ok(new { state = 200 });
@@ -1230,24 +1195,6 @@ namespace TEAMModelBI.Controllers.BINormal
                         {
                             return Ok(new { state = 201, msg = "能力点复制成功,复制能力点的文件失败," });
                         }
-
-                        //发送消息实体
-                        Notification notification = new()
-                        {
-                            hubName = "hita",
-                            type = "msg",
-                            from = $"BI:{_option.Location}:private",
-                            to = new List<string> { $"{_tmdId}" },
-                            label = $"{partitionCode}_start",
-                            body = new { location = _option.Location, biz = partitionCode, tmdid = $"{_tmdId}", tmdname = $"{_tmdName}", status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
-                            expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                        };
-
-                        var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                        var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
-                        var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-                        var location = _option.Location;
-                        await _notificationService.SendNotification(clientID, clientSecret, location, url, notification); //发送站内发送消息
                     }
 
                     StandardFile saveFile = new();

+ 1 - 24
TEAMModelBI/Controllers/BISchool/SchoolController.cs

@@ -29,7 +29,6 @@ using TEAMModelOS.SDK;
 using TEAMModelOS.SDK.Context.BI;
 using TEAMModelOS.SDK.Context.Constant;
 using TEAMModelOS.SDK.DI;
-using TEAMModelOS.SDK.DI.CoreAPI;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models.Cosmos.BI;
@@ -48,12 +47,11 @@ namespace TEAMModelBI.Controllers.BISchool
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureRedisFactory _azureRedis;
         private readonly IConfiguration _configuration;
-        private readonly NotificationService _notificationService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly IWebHostEnvironment _environment; //读取文件
         private readonly IHttpClientFactory _httpClient;
 
-        public SchoolController(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, AzureRedisFactory azureRedis, IConfiguration configuration, NotificationService notificationService, CoreAPIHttpService coreAPIHttpService, IHttpClientFactory httpClient, IWebHostEnvironment hostingEnvironment)
+        public SchoolController(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, AzureRedisFactory azureRedis, IConfiguration configuration,   CoreAPIHttpService coreAPIHttpService, IHttpClientFactory httpClient, IWebHostEnvironment hostingEnvironment)
         {
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
@@ -61,7 +59,6 @@ namespace TEAMModelBI.Controllers.BISchool
             _option = option?.Value;
             _azureRedis = azureRedis;
             _configuration = configuration;
-            _notificationService = notificationService;
             _coreAPIHttpService = coreAPIHttpService;
             _httpClient = httpClient;
             _environment = hostingEnvironment;
@@ -2191,26 +2188,6 @@ namespace TEAMModelBI.Controllers.BISchool
 
                 //发送消息实体
                 string shiftCode = "shift-assist";
-                Notification notification = new Notification
-                {
-                    hubName = "hita",
-                    type = "msg",
-                    from = $"BI:{_option.Location}:{_school}",
-                    to = new List<string> { $"{_shiftTeacher}" },
-                    label = $"{shiftCode}_school",
-                    body = new { location = _option.Location, biz = shiftCode, tmdid = $"{_tmdId}", tmdname = $"{_tmdName}", status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
-                    expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                };
-
-                if (notification != null)
-                {
-                    var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                    var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
-                    var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-                    var location = _option.Location;
-                    await _notificationService.SendNotification(clientID, clientSecret, location, url, notification);//站内发送消息
-                }
-
                 //保存操作记录
                 await AzureStorageBlobExtensions.SaveBILog(blobClient, tableClient, "schoolTeacher-add", $"{_tmdName}【{_tmdId}】移交顾问给{newSchoolTeacher.name}【{newSchoolTeacher.id}】", _dingDing, httpContext: HttpContext);
                 return Ok(new { state = 200 });

+ 2 - 22
TEAMModelBI/Controllers/RepairApi/InitialAreaController.cs

@@ -13,7 +13,6 @@ using Azure.Messaging.ServiceBus;
 using TEAMModelBI.Tool.Extension;
 using TEAMModelOS.SDK.Extension;
 using Microsoft.AspNetCore.Hosting;
-using TEAMModelOS.SDK.DI.CoreAPI;
 using TEAMModelOS.SDK.Models;
 using Azure.Cosmos;
 using System;
@@ -37,20 +36,18 @@ namespace TEAMModelBI.Controllers.RepairApi
         private readonly Option _option;
         private readonly AzureStorageFactory _azureStorage;
         private readonly IConfiguration _configuration;
-        private readonly NotificationService _notificationService;
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly IHttpClientFactory _http;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly IWebHostEnvironment _environment; //读取文件
 
-        public InitialAreaController(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, IConfiguration configuration, NotificationService notificationService, AzureServiceBusFactory serviceBus, IHttpClientFactory http, CoreAPIHttpService coreAPIHttpService, IWebHostEnvironment hostingEnvironment)
+        public InitialAreaController(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, IConfiguration configuration,   AzureServiceBusFactory serviceBus, IHttpClientFactory http, CoreAPIHttpService coreAPIHttpService, IWebHostEnvironment hostingEnvironment)
         {
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
             _azureStorage = azureStorage;
             _option = option?.Value;
             _configuration = configuration;
-            _notificationService = notificationService;
             _serviceBus = serviceBus;
             _http = http;
             _coreAPIHttpService = coreAPIHttpService;
@@ -286,24 +283,7 @@ namespace TEAMModelBI.Controllers.RepairApi
                 {
                     return Ok(new { state = 201, msg = "能力点复制成功,复制能力点的文件失败," });
                 }
-
-                //发送消息实体
-                Notification notification = new()
-                {
-                    hubName = "hita",
-                    type = "msg",
-                    from = $"BI:{_option.Location}:private",
-                    to = new List<string> { $"{_tmdId}" },
-                    label = $"{partitionCode}_start",
-                    body = new { location = _option.Location, biz = partitionCode, tmdid = $"{_tmdId}", tmdname = $"{_tmdName}", status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
-                    expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                };
-
-                var notiUrl = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
-                var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-                var location = _option.Location;
-                await _notificationService.SendNotification(clientID, clientSecret, location, notiUrl, notification); //站内发送消息
+ 
             }
 
             if (AreaS2 != null)

+ 1 - 4
TEAMModelBI/Controllers/RepairApi/NormalController.cs

@@ -12,7 +12,6 @@ using TEAMModelOS.Models;
 using TEAMModelOS.SDK;
 using TEAMModelOS.SDK.Context.Constant;
 using TEAMModelOS.SDK.DI;
-using TEAMModelOS.SDK.DI.CoreAPI;
 using TEAMModelOS.SDK.Models;
 
 namespace TEAMModelBI.Controllers.RepairApi
@@ -27,20 +26,18 @@ namespace TEAMModelBI.Controllers.RepairApi
         private readonly Option _option;
         private readonly AzureStorageFactory _azureStorage;
         private readonly IConfiguration _configuration;
-        private readonly NotificationService _notificationService;
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly IHttpClientFactory _http;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly IWebHostEnvironment _environment; //读取文件
 
-        public NormalController(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, IConfiguration configuration, NotificationService notificationService, AzureServiceBusFactory serviceBus, IHttpClientFactory http, CoreAPIHttpService coreAPIHttpService, IWebHostEnvironment hostingEnvironment)
+        public NormalController(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, IConfiguration configuration,  AzureServiceBusFactory serviceBus, IHttpClientFactory http, CoreAPIHttpService coreAPIHttpService, IWebHostEnvironment hostingEnvironment)
         {
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
             _azureStorage = azureStorage;
             _option = option?.Value;
             _configuration = configuration;
-            _notificationService = notificationService;
             _serviceBus = serviceBus;
             _http = http;
             _coreAPIHttpService = coreAPIHttpService;

+ 0 - 2
TEAMModelBI/Startup.cs

@@ -25,7 +25,6 @@ using TEAMModelOS.SDK.Filter;
 using TEAMModelOS.SDK.Helper.Common.ReflectorExtensions;
 using TEAMModelOS.SDK.Models;
 using VueCliMiddleware;
-using TEAMModelOS.SDK.DI.CoreAPI;
 
 namespace TEAMModelBI
 {
@@ -127,7 +126,6 @@ namespace TEAMModelBI
             services.AddSnowflakeId(Convert.ToInt64(Configuration.GetValue<string>("Option:LocationNum")), 1);
             services.AddHttpClient();
             services.AddHttpClient<DingDing>(); 
-            services.AddHttpClient<NotificationService>();
             services.AddCoreAPIHttpService(Configuration);
             services.AddHttpClient<HttpTrigger>();
             services.AddMemoryCache();

+ 0 - 2
TEAMModelOS.FunctionV4/Program.cs

@@ -19,7 +19,6 @@ using System.Threading.Tasks;
 using TEAMModelOS.Models;
 using TEAMModelOS.SDK;
 using TEAMModelOS.SDK.DI;
-using TEAMModelOS.SDK.DI.CoreAPI;
 using TEAMModelOS.SDK.DI.Multiple;
 
 namespace TEAMModelOS.FunctionV4
@@ -48,7 +47,6 @@ namespace TEAMModelOS.FunctionV4
                //services.Configure<Option>(options => context. Configuration.GetSection("Option").Bind(options));
                services.AddHttpClient();
                services.AddHttpClient<DingDing>();
-               services.AddHttpClient<NotificationService>();
                services.AddCoreAPIHttpService(context.Configuration);
                services.AddAzureCosmos(context.Configuration.GetSection("Azure:Cosmos:ConnectionString").Get<string>());
                services.AddAzureServiceBus(context.Configuration.GetSection("Azure:ServiceBus:ConnectionString").Get<string>());

+ 4 - 81
TEAMModelOS.FunctionV4/ServiceBus/ActiveTaskTopic.cs

@@ -29,7 +29,6 @@ using static TEAMModelOS.SDK.Models.Service.LessonService;
 using DinkToPdf.Contracts;
 using TEAMModelOS.SDK.Helper.Common.DateTimeHelper;
 using static TEAMModelOS.SDK.StatisticsService;
-using TEAMModelOS.SDK.DI.CoreAPI;
 using DocumentFormat.OpenXml.Office2010.Excel;
 using DocumentFormat.OpenXml.Wordprocessing;
 using System.Xml.Linq;
@@ -57,7 +56,6 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly Option _option;
-        private readonly NotificationService _notificationService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly IConfiguration _configuration;
         private readonly IConverter _converter;
@@ -66,7 +64,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
         public ActiveTaskTopic(SnowflakeId snowflakeId, IConverter converter, CoreAPIHttpService coreAPIHttpService,
             AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis,
             AzureServiceBusFactory serviceBus, IOptionsSnapshot<Option> option,
-            NotificationService notificationService, IConfiguration configuration, IHttpClientFactory httpClient)
+             IConfiguration configuration, IHttpClientFactory httpClient)
         {
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
@@ -74,7 +72,6 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
             _azureRedis = azureRedis;
             _serviceBus = serviceBus;
             _option = option?.Value;
-            _notificationService = notificationService;
             _configuration = configuration;
             _coreAPIHttpService = coreAPIHttpService;
             _converter = converter;
@@ -1260,23 +1257,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                 var result = await BatchCopyFileService.CopyFile(_dingDing, _azureStorage, bIBatchCopyFile);
                 if (result == 200)
                 {
-                    //发送消息实体
-                    Notification notification = new Notification
-                    {
-                        hubName = "hita",
-                        type = "msg",
-                        from = $"BI:{_option.Location}:private",
-                        to = bIBatchCopyFile.tmdIds,
-                        label = $"{bIBatchCopyFile.codeKey}_finish",
-                        body = new { location = $"{Environment.GetEnvironmentVariable("Option:Location")}", biz = $"{bIBatchCopyFile.codeKey}", tmdid = $"{bIBatchCopyFile.tmdid}", tmdname = $"{bIBatchCopyFile.tmdName}", status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
-                        expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                    };
-
-                    var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                    var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
-                    var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-                    var location = $"{Environment.GetEnvironmentVariable("Option:Location")}";
-                    await _notificationService.SendNotification(clientID, clientSecret, location, url, notification); //站内发送消息
+                  
 
                 }
             }
@@ -1565,7 +1546,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                                     lessonRecord.upload = 1;
                                     // await _dingDing.SendBotMsg($"{_option.Location},课堂id:{_lessonId} 更新完成", GroupNames.醍摩豆服務運維群組);
 
-                                    LessonService.DoAutoDeleteSchoolLessonRecord(lessonRecord, scope, client, school, tmdid, teacher, _notificationService, _serviceBus, _azureStorage, _configuration,_coreAPIHttpService,_dingDing, _azureRedis);
+                                    LessonService.DoAutoDeleteSchoolLessonRecord(lessonRecord, scope, client, school, tmdid, teacher, _serviceBus, _azureStorage, _configuration,_coreAPIHttpService,_dingDing, _azureRedis);
                                     long? size = await _azureStorage.GetBlobContainerClient(blobname).GetBlobsSize($"records/{_lessonId}");
                                     Bloblog bloblog = new Bloblog
                                     {
@@ -1588,7 +1569,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                                     //await _dingDing.SendBotMsg($"{_option.Location},课堂id:{_lessonId} blob刷新完成!", GroupNames.醍摩豆服務運維群組);
                                     msgs.Add(update);
 
-                                    DoLessonStudentRecord(_dingDing, _snowflakeId, lessonRecord, scope, client, school, tmdid, teacher, _notificationService, _serviceBus, _azureStorage, _configuration, lessonBase);
+                                    DoLessonStudentRecord(_dingDing, _snowflakeId, lessonRecord, scope, client, school, tmdid, teacher,   _serviceBus, _azureStorage, _configuration, lessonBase);
                                 }
                                 catch (Exception ex)
                                 {
@@ -1849,35 +1830,6 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                                                     //result.Add(Constant.private_lesson_expire, lessonRecordExpire.expire);
                                                     result.Add(Constant.private_lesson_expire, new ExpireTag { expire = lessonRecordExpire.expire, tag = "delete" });
                                                     string biz = "expire";
-                                                    Notification notification = new Notification
-                                                    {
-                                                        hubName = "hita",
-                                                        type = "msg",
-                                                        from = $"ies5:{Environment.GetEnvironmentVariable("Option:Location")}:private",
-                                                        to = new List<string> { tmdid },
-                                                        label = $"{biz}_lessonRecord",
-                                                        body = new
-                                                        {
-                                                            location = $"{Environment.GetEnvironmentVariable("Option:Location")}",
-                                                            biz = biz,
-                                                            tmdid = teacher.id,
-                                                            tmdname = teacher.name,
-                                                            sid = lessonRecordExpire.id,
-                                                            sname = lessonRecordExpire.name,
-                                                            scope = scope,
-                                                            stime = lessonRecordExpire.startTime,
-                                                            expire = lessonRecordExpire.expire,
-                                                            status = 1,
-                                                            //day = Constant.private_lesson_expire,
-                                                            time = now
-                                                        }.ToJsonString(),
-                                                        expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                                                    };
-                                                    var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                                                    var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
-                                                    var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-                                                    var location = $"{Environment.GetEnvironmentVariable("Option:Location")}";
-                                                    await _notificationService.SendNotification(clientID, clientSecret, location, url, notification); //站内发送消息
                                                     string expireTime= DateTimeOffset.FromUnixTimeMilliseconds(lessonRecordExpire.expire).ToString("yyyy-MM-dd HH:mm:ss");
                                                     _coreAPIHttpService.PushNotify(new List<IdNameCode> { new IdNameCode { id = teacher.id, name = teacher.name, code = teacher.lang } }, "expire-private_lessonRecord", Constant.NotifyType_IES5_Course,
                                                                  new Dictionary<string, object> { { "tmdname", teacher.name }, { "tmdid", teacher.name }, { "expireTime", expireTime }, { "lessonId", lessonRecordExpire.id }, { "lessonName", lessonRecordExpire. name } }, $"{Environment.GetEnvironmentVariable("Option:Location")}", _configuration, _dingDing, "");
@@ -2014,35 +1966,6 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                     }
                 }
                 string biz = "expire";
-                Notification notification = new Notification
-                {
-                    hubName = "hita",
-                    type = "msg",
-                    from = $"ies5:{_option.Location}:private",
-                    to = new List<string> { $"{tmdid}" },
-                    label = $"{biz}_lessonRecord",
-                    body = new
-                    {
-                        location = $"{Environment.GetEnvironmentVariable("Option:Location")}",
-                        biz = biz,
-                        tmdid = $"{tmdid}",
-                        tmdname = tmdname,
-                        sid = $"{id}",
-                        sname = $"{name}",
-                        stime = long.Parse($"{startTime}"),
-                        expire = long.Parse($"{expire}"),
-                        status = 1,
-                        //day = Constant.private_lesson_expire,
-                        time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
-                    }.ToJsonString(),
-                    expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                };
-                var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
-                var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-                var location = $"{Environment.GetEnvironmentVariable("Option:Location")}";
-                await _notificationService.SendNotification(clientID, clientSecret, location, url, notification); //站内发送消息
-
                 Teacher targetTeacher = await client.GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<Teacher>($"{tmdid}", new PartitionKey($"Base"));
                 string expireTime = DateTimeOffset.FromUnixTimeMilliseconds(long.Parse($"{expire}")).ToString("yyyy-MM-dd HH:mm:ss");
                 _coreAPIHttpService.PushNotify(new List<IdNameCode> { new IdNameCode { id = targetTeacher.id, name = targetTeacher.name, code = targetTeacher.lang } }, "expire-private_lessonRecord", Constant.NotifyType_IES5_Course,

+ 0 - 1
TEAMModelOS.SDK/DI/CoreAPI/CoreAPIHttpService.cs

@@ -19,7 +19,6 @@ using System.Text.Json;
 using System.Threading.Tasks;
 using TEAMModelOS.Models;
 using TEAMModelOS.SDK.DI;
-using TEAMModelOS.SDK.DI.CoreAPI;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models;
 

+ 0 - 89
TEAMModelOS.SDK/DI/CoreAPI/NotificationService.cs

@@ -1,89 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Net;
-using System.Net.Http;
-using System.Net.Http.Json;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.SDK.Extension;
-
-namespace TEAMModelOS.SDK.DI.CoreAPI
-{
-    public class NotificationService
-    {
-        private readonly HttpClient _httpClient;
-        public NotificationService(HttpClient httpClient)
-        {
-            _httpClient = httpClient;
-        }
-        public async Task<int> SendNotification(string clientID, string clientSecret, string location, string url, Notification notification)
-        {
-            try
-            {
-                if (location.Contains("China"))
-                {
-                    location = "China";
-                }
-                else if (location.Contains("Global"))
-                {
-                    location = "Global";
-                }
-                var client = _httpClient;
-                var token = await CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location);
-                client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
-                HttpResponseMessage responseMessage = await client.PostAsJsonAsync(url, notification);
-                if (responseMessage.StatusCode == HttpStatusCode.OK)
-                {
-                    return 200;
-                }
-                else if (responseMessage.StatusCode == HttpStatusCode.Unauthorized)
-                {
-                    return 401;
-                }
-                else
-                {
-                    return 500;
-                }
-            }
-            catch (Exception)
-            {
-                return 500;
-            }
-        }
-    }
-
-    public class Notification
-    {
-        /// <summary>
-        /// App name (hita) 小寫
-        /// </summary>
-        public string hubName { get; set; }
-        /// <summary>
-        /// 通知訊息種類,分為msg,info及notice。       
-        /// msg : 一般訊息,會存Redis,拿了就刪。
-        /// info : 公告訊息或給多人讀取的訊息,會存Redis,拿了不刪,只能等時間到期或透過API刪除。
-        /// notice : 屬於系統層級訊息,不存Redis,直接裸送訊息。
-        /// </summary>
-        public string type { get; set; }
-        /// <summary>
-        /// 送訊息的來源端 格式為"{服務}:{類別}: ..." 如"ies5:hbrd","ies5:hbrd:hb0901"
-        /// </summary>
-        public string from { get; set; }
-        /// <summary>
-        /// 接收對象或手機註冊的tag,ID或服務等...
-        /// </summary>
-        public List<string> to { get; set; }
-        /// <summary>
-        /// 	標題。
-        /// </summary>
-        public string label { get; set; }
-        /// <summary>
-        /// 正文。
-        /// </summary>
-        public string body { get; set; }
-        /// <summary>
-        /// 該訊息到期時間(UTC),單位為秒,且必須大於現在時間。
-        /// </summary>
-        public long expires { get; set; }
-    }
-}

+ 3 - 34
TEAMModelOS.SDK/Models/Service/LessonService.cs

@@ -13,7 +13,6 @@ using System.Text;
 using System.Text.Json;
 using System.Threading.Tasks;
 using TEAMModelOS.SDK.DI;
-using TEAMModelOS.SDK.DI.CoreAPI;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Helper.Common.DateTimeHelper;
 using TEAMModelOS.SDK.Models.Cosmos.Common;
@@ -165,7 +164,7 @@ namespace TEAMModelOS.SDK.Models.Service
             return dict;
         }
         public static async void DoLessonStudentRecord(DingDing _dingding, SnowflakeId snowflakeId, LessonRecord lessonRecord, string scope, CosmosClient client, string school, string tmdid,
-            Teacher teacher, NotificationService _notificationService, AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, IConfiguration _configuration, LessonBase lessonBase)
+            Teacher teacher,   AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, IConfiguration _configuration, LessonBase lessonBase)
         {
 
             try
@@ -374,7 +373,7 @@ namespace TEAMModelOS.SDK.Models.Service
         }
 
         public static async void DoAutoDeleteSchoolLessonRecord(LessonRecord lessonRecord, string scope, CosmosClient client, string school, string tmdid,
-            Teacher teacher, NotificationService _notificationService, AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, IConfiguration _configuration, CoreAPIHttpService _coreAPIHttpService,DingDing _dingDing,AzureRedisFactory _azureRedis)
+            Teacher teacher,   AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, IConfiguration _configuration, CoreAPIHttpService _coreAPIHttpService,DingDing _dingDing,AzureRedisFactory _azureRedis)
         {
             if (lessonRecord.scope.Equals("school"))
             {
@@ -648,37 +647,7 @@ namespace TEAMModelOS.SDK.Models.Service
                     result.Add(school_lesson_expire, new ExpireTag { expire = lessonRecord.expire, tag = "delete" });
                     // result.Add(school_lesson_expire, lessonRecord.expire);
                     string biz = "expire";
-                    Notification notification = new Notification
-                    {
-                        hubName = "hita",
-                        type = "msg",
-                        from = $"ies5:{Environment.GetEnvironmentVariable("Option:Location")}:private",
-                        to = new List<string> { tmdid },
-                        label = $"{biz}_lessonRecord",
-                        body = new
-                        {
-                            location = $"{Environment.GetEnvironmentVariable("Option:Location")}",
-                            biz = biz,
-                            tmdid = tmdid,
-                            tmdname = teacher.name,
-                            scope = scope,
-                            school = school,
-                            schoolName = schoolBase.name,
-                            sid = lessonRecord.id,
-                            sname = lessonRecord.name,
-                            stime = lessonRecord.startTime,
-                            expire = lessonRecord.expire,
-                            status = 1,
-                            //day = school_lesson_expire,
-                            time = now
-                        }.ToJsonString(),
-                        expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                    };
-                    var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                    var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
-                    var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-                    var location = $"{Environment.GetEnvironmentVariable("Option:Location")}";
-                    await _notificationService.SendNotification(clientID, clientSecret, location, url, notification); //站内发送消息
+                     
                     string expireTime = DateTimeOffset.FromUnixTimeMilliseconds(lessonRecord.expire).ToString("yyyy-MM-dd HH:mm:ss");
                     Teacher targetTeacher = await client.GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<Teacher>($"{tmdid}", new PartitionKey($"Base"));
                     _coreAPIHttpService.PushNotify(new List<IdNameCode> { new IdNameCode { id = targetTeacher.id, name = targetTeacher.name, code = targetTeacher.lang } }, "expire-school_lessonRecord", Constant.NotifyType_IES5_Course,

+ 3 - 44
TEAMModelOS/Controllers/Both/GroupListController.cs

@@ -21,7 +21,6 @@ using TEAMModelOS.Filter;
 using HTEXLib.COMM.Helpers;
 using System.Text;
 using Microsoft.AspNetCore.Authorization;
-using TEAMModelOS.SDK.DI.CoreAPI;
 using Microsoft.Extensions.Hosting;
 using OpenXmlPowerTools;
 using TEAMModelOS.SDK.Models.Dtos;
@@ -41,12 +40,11 @@ namespace TEAMModelOS.Controllers
         private readonly Option _option;
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureStorageFactory _azureStorage;
-        private readonly NotificationService _notificationService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly IWebHostEnvironment _environment;
         private const string SummarySql = " c.id,c.code,c.name,c.no,c.periodId,c.scope,c.school,c.creatorId,c.type,c.year,c.tcount,c.scount,c.leader ,c.froms ,c.joinLock ,c.expire ,c.grades  ";
         public IConfiguration _configuration { get; set; }
-        public GroupListController(IWebHostEnvironment environment,CoreAPIHttpService coreAPIHttpService, AzureCosmosFactory azureCosmos, DingDing dingDing, IOptionsSnapshot<Option> option, AzureServiceBusFactory serviceBus, AzureStorageFactory azureStorage, IConfiguration configuration, NotificationService notificationService)
+        public GroupListController(IWebHostEnvironment environment,CoreAPIHttpService coreAPIHttpService, AzureCosmosFactory azureCosmos, DingDing dingDing, IOptionsSnapshot<Option> option, AzureServiceBusFactory serviceBus, AzureStorageFactory azureStorage, IConfiguration configuration)
         {
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
@@ -54,7 +52,6 @@ namespace TEAMModelOS.Controllers
             _serviceBus = serviceBus;
             _configuration = configuration;
             _azureStorage = azureStorage;
-            _notificationService = notificationService;
             _coreAPIHttpService = coreAPIHttpService;
             _environment = environment;
         }
@@ -155,30 +152,6 @@ namespace TEAMModelOS.Controllers
                 if (ids.IsNotEmpty())
                 {
                     string bizcode = "scan-join";
-                    Notification notification = new Notification
-                    {
-                        hubName = "hita",
-                        type = "msg",
-                        from = $"ies5:{_option.Location}:private",
-                        to = ids.Select(x => x).ToList(),
-                        label = $"{bizcode}_groupList",
-                        body = new { 
-                            location = _option.Location,
-                            biz = bizcode,
-                            tmdid = id,
-                            tmdname = name,
-                            groupListName = $"{data.stuList.name}",
-                            status = 1,
-                            time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
-                        }.ToJsonString(),
-                        expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                    };
-                    var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                    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);
-
                     string sql = $"select c.id, c.name ,c.lang as code from c where c.id in ({string.Join(",", ids .Select(x => $"'{x}'"))})";
                     List<IdNameCode> idNameCodes = new List<IdNameCode>();
                     await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher)
@@ -256,21 +229,7 @@ namespace TEAMModelOS.Controllers
                 if (ids.IsNotEmpty())
                 {
                     string bizcode = "scan-join";
-                    Notification notification = new Notification
-                    {
-                        hubName = "hita",
-                        type = "msg",
-                        from = $"ies5:{_option.Location}:private",
-                        to = ids.Select(x => x).ToList(),
-                        label = $"{bizcode}_groupList",
-                        body = new { location = _option.Location, biz = bizcode, tmdid = userid, tmdname = _name, groupListName = $"{data.stuList.name}", status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
-                        expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                    };
-                    var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                    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);
+                 
 
                     string sql = $"select c.id, c.name ,c.lang as code from c where c.id in ({string.Join(",", ids.Select(x => $"'{x}'"))})";
                     List<IdNameCode> idNameCodes = new List<IdNameCode>();
@@ -279,7 +238,7 @@ namespace TEAMModelOS.Controllers
                     {
                         idNameCodes.Add(item);
                     }
-                    _coreAPIHttpService.PushNotify(idNameCodes, $"{code}_school", Constant.NotifyType_IES5_Course,
+                    _coreAPIHttpService.PushNotify(idNameCodes, $"{bizcode}_school", Constant.NotifyType_IES5_Course,
                               new Dictionary<string, object> { { "tmdid",userid },{ "tmdname", _name }, { "groupListName", data.stuList.name } , { "groupListId", data.stuList.id } }, _option.Location, _configuration, _dingDing, _environment.ContentRootPath);
                 }
                 return Ok(new { data.stuList, data.status });

+ 4 - 57
TEAMModelOS/Controllers/Both/ShareController.cs

@@ -17,7 +17,6 @@ using TEAMModelOS.Filter;
 using TEAMModelOS.Models;
 using TEAMModelOS.SDK;
 using TEAMModelOS.SDK.DI;
-using TEAMModelOS.SDK.DI.CoreAPI;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models.Cosmos;
@@ -39,17 +38,15 @@ namespace TEAMModelOS.Controllers
         private readonly DingDing _dingDing;
         private readonly Option _option;
         private readonly IConfiguration _configuration;
-        private readonly NotificationService _notificationService;
         private readonly IWebHostEnvironment _environment;
         private readonly CoreAPIHttpService _coreAPIHttpService;
-        public ShareController(CoreAPIHttpService coreAPIHttpServic,IWebHostEnvironment environment,AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, NotificationService notificationService)
+        public ShareController(CoreAPIHttpService coreAPIHttpServic,IWebHostEnvironment environment,AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration)
         {
             _azureCosmos = azureCosmos;
             _snowflakeId = snowflakeId;
             _dingDing = dingDing;
             _option = option?.Value;
             _configuration = configuration;
-            _notificationService = notificationService;
             _environment=environment;
             _coreAPIHttpService = coreAPIHttpServic;
         }
@@ -153,34 +150,8 @@ namespace TEAMModelOS.Controllers
                                         continue;
                                     }
                                     string tmdid = x.code.Replace("Share-", "").Replace($"{x.type}-", "");
-                                    Notification notification = new Notification
-                                    {
-                                        hubName = "hita",
-                                        type = "msg",
-                                        from = $"ies5:{_option.Location}:{request.school}",
-                                        to = new List<string>() { tmdid },
-                                        label = $"{x.type}_syllabus",
-                                        body = new {
-                                            location = _option.Location,
-                                            biz = x.type,
-                                            tmdid = x.issuer,
-                                            tmdname = x.issuerName,
-                                            schoolcode = $"{request.school}",
-                                            schoolname = $"{schname}",
-                                            sid = x.id,
-                                            sname = x.syllabusName,
-                                            vid = x.volumeId,
-                                            vname = x.volumeName,
-                                            status = 1,
-                                            time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
-                                        }.ToJsonString(),
-                                        expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                                    };
-                                    var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                                    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);
+                                   
+                                   
                                     if (x.type.Equals("coedit")) {
                                         School school = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>(request.school, new Azure.Cosmos.PartitionKey("Base"));
                                         Teacher targetTeacher = await client.GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<Teacher>($"{tmdid}", new PartitionKey($"Base"));
@@ -255,31 +226,7 @@ namespace TEAMModelOS.Controllers
                                         continue;
                                     }
                                     string tmdid = x.code.Replace("Share-", "").Replace($"{x.type}-", "");
-                                    Notification notification = new Notification
-                                    {
-                                        hubName = "hita",
-                                        type = "msg",
-                                        from = $"ies5:{_option.Location}:private",
-                                        to = new List<string>() { tmdid },
-                                        label = $"{x.type}_syllabus",
-                                        body = new { location = _option.Location,
-                                            biz = x.type,
-                                            tmdid = x.issuer,
-                                            tmdname = x.issuerName,
-                                            sid = x.id,
-                                            sname = x.syllabusName,
-                                            vid = x.volumeId,
-                                            vname = x.volumeName,
-                                            status = 1,
-                                            time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
-                                        }.ToJsonString(),
-                                        expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                                    };
-                                    var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                                    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);
+                                    
                                     Teacher targetTeacher = await client.GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<Teacher>($"{tmdid}", new PartitionKey($"Base"));
                                     _coreAPIHttpService.PushNotify(new List<IdNameCode> { new IdNameCode { id = targetTeacher.id, name = targetTeacher.name, code = targetTeacher.lang } }, $"{x.type}_syllabus", Constant.NotifyType_IES5_Contect,
                                                  new Dictionary<string, object> { { "tmdname", x.issuerName } , { "tmdid", x.issuer },  { "volumeId", x.volumeId }, { "syllabusId", x.id }, { "volumeName", x.volumeName }, { "syllabusName", x.syllabusName } }, _option.Location, _configuration, _dingDing, _environment.ContentRootPath);

+ 1 - 20
TEAMModelOS/Controllers/Client/HiTAControlller.cs

@@ -20,7 +20,6 @@ using System.Threading.Tasks;
 using TEAMModelOS.Models;
 using TEAMModelOS.SDK;
 using TEAMModelOS.SDK.DI;
-using TEAMModelOS.SDK.DI.CoreAPI;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models.Dtos;
@@ -41,7 +40,6 @@ namespace TEAMModelOS.Controllers.Client
         private readonly Option _option;
         private readonly SnowflakeId _snowflakeId;
         private readonly IConfiguration _configuration;
-        private readonly NotificationService _notificationService;
         private readonly IPSearcher _searcher;
         private readonly HttpTrigger _httpTrigger;
         private readonly CoreAPIHttpService _coreAPIHttpService;
@@ -53,7 +51,7 @@ namespace TEAMModelOS.Controllers.Client
             AzureCosmosFactory azureCosmos,
             DingDing dingDing,
             SnowflakeId snowflakeId,
-            IOptionsSnapshot<Option> option, IConfiguration configuration, NotificationService notificationService, IPSearcher searcher, HttpTrigger httpTrigger)
+            IOptionsSnapshot<Option> option, IConfiguration configuration,   IPSearcher searcher, HttpTrigger httpTrigger)
         {
             _azureStorage = azureStorage;
             _azureRedis = azureRedis;
@@ -62,7 +60,6 @@ namespace TEAMModelOS.Controllers.Client
             _snowflakeId = snowflakeId;
             _option = option?.Value;
             _configuration = configuration;
-            _notificationService = notificationService;
             _searcher = searcher;
             _httpTrigger = httpTrigger;
             _coreAPIHttpService = coreAPIHttpService;
@@ -207,22 +204,6 @@ namespace TEAMModelOS.Controllers.Client
                 ids.Add(item);
             }
             string bizcode = "scan-join";
-            Notification notification = new Notification
-            {
-                hubName = "hita",
-                type = "msg",
-                from = $"ies5:{_option.Location}:private",
-                to = ids.Select(x => x).ToList(),
-                label = $"{bizcode}_school",
-                body = new { location = _option.Location, biz = bizcode, tmdid = teacher.id, tmdname = teacher.name, schoolcode = $"{school}", schoolname = $"{schoolInfo.name}", status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
-                expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-            };
-            var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-            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);
-
             string tsql = $"select c.id, c.name ,c.lang as code from c where c.id in ({string.Join(",", ids.Select(x => $"'{x}'"))})";
             List<IdNameCode> idNameCodes = new List<IdNameCode>();
             await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher)

+ 2 - 46
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -23,7 +23,6 @@ using TEAMModelOS.SDK.Models.Cosmos;
 using HTEXLib.COMM.Helpers;
 using Microsoft.AspNetCore.Authorization;
 using System.Net.Http;
-using TEAMModelOS.SDK.DI.CoreAPI;
 using Microsoft.AspNetCore.Hosting;
 using static TEAMModelOS.SDK.SchoolService;
 using Azure.Core;
@@ -50,11 +49,10 @@ namespace TEAMModelOS.Controllers
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureRedisFactory _azureRedis;
         public IConfiguration _configuration { get; set; }
-        private readonly NotificationService _notificationService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly IWebHostEnvironment _environment;
         public ExamController(IWebHostEnvironment environment, CoreAPIHttpService coreAPIHttpService, AzureCosmosFactory azureCosmos, AzureServiceBusFactory serviceBus, SnowflakeId snowflakeId, DingDing dingDing,
-            IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, NotificationService notificationService, IConfiguration configuration)
+            IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis,   IConfiguration configuration)
         {
             _azureCosmos = azureCosmos;
             _serviceBus = serviceBus;
@@ -64,7 +62,6 @@ namespace TEAMModelOS.Controllers
             _azureStorage = azureStorage;
             _azureRedis = azureRedis;
             _configuration = configuration;
-            _notificationService = notificationService;
             _coreAPIHttpService = coreAPIHttpService;
             _environment = environment;
         }
@@ -2986,32 +2983,7 @@ namespace TEAMModelOS.Controllers
                                             ids = sub.arb;
                                         }
                                         //request.subs.Select(r => r.markers).ToList();
-                                        Notification notification = new Notification
-                                        {
-                                            hubName = "hita",
-                                            type = "msg",
-                                            from = $"ies5:{_option.Location}:private",
-                                            to = ids,
-                                            label = $"{bizcode}_school",
-                                            body = new
-                                            {
-                                                location = _option.Location,
-                                                biz = bizcode,
-                                                tmdid = userid,
-                                                tmdname = name.ToString(),
-                                                schoolcode = school,
-                                                schoolname = $"{schname}",
-                                                examname = correct.name,
-                                                status = 1,
-                                                time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
-                                            }.ToJsonString(),
-                                            expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                                        };
-                                        var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                                        var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
-                                        var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-                                        var location = _option.Location;
-                                        await _notificationService.SendNotification(clientID, clientSecret, location, url, notification);
+                                        
                                         await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync(scoring, scoring.id, new PartitionKey(scoring.code));
                                         string sql = $"select c.id, c.name ,c.lang as code from c where c.id in ({string.Join(",", ids.Select(x => $"'{x}'"))})";
                                         List<IdNameCode> idNameCodes = new List<IdNameCode>();
@@ -3162,22 +3134,6 @@ namespace TEAMModelOS.Controllers
                     ids = sub.err;
                 }
                 //request.subs.Select(r => r.markers).ToList();
-                Notification notification = new Notification
-                {
-                    hubName = "hita",
-                    type = "msg",
-                    from = $"ies5:{_option.Location}:private",
-                    to = ids,
-                    label = $"{bizcode}_school",
-                    body = new { location = _option.Location, biz = bizcode, tmdid = userid, tmdname = name.ToString(), schoolcode = school, schoolname = $"{schname}", examname = correct.name, status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
-                    expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                };
-                var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
-                var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-                var location = _option.Location;
-                await _notificationService.SendNotification(clientID, clientSecret, location, url, notification);
-
                 string sql = $"select c.id, c.name ,c.lang as code from c where c.id in ({string.Join(",", ids.Select(x => $"'{x}'"))})";
                 List<IdNameCode> idNameCodes = new List<IdNameCode>();
                 await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher)

+ 1 - 27
TEAMModelOS/Controllers/Common/HomeworkController.cs

@@ -24,7 +24,6 @@ using System.IO;
 using System.Linq;
 using HTEXLib.COMM.Helpers;
 using Microsoft.AspNetCore.Authorization;
-using TEAMModelOS.SDK.DI.CoreAPI;
 using Microsoft.AspNetCore.Hosting;
 using Azure.Storage.Blobs.Models;
 using static TEAMModelOS.SDK.SchoolService;
@@ -53,10 +52,9 @@ namespace TEAMModelOS.Controllers.Learn
         private readonly AzureStorageFactory _azureStorage;
         private readonly IHttpClientFactory _clientFactory;
         private readonly CoreAPIHttpService _coreAPIHttpService;
-         private readonly NotificationService _notificationService;
         private readonly IWebHostEnvironment _environment;
         public IConfiguration _configuration { get; set; }
-        public HomeworkController(IWebHostEnvironment  environment,CoreAPIHttpService coreAPIHttpService, NotificationService notificationService, AzureCosmosFactory azureCosmos, AzureServiceBusFactory serviceBus, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option,
+        public HomeworkController(IWebHostEnvironment  environment,CoreAPIHttpService coreAPIHttpService, AzureCosmosFactory azureCosmos, AzureServiceBusFactory serviceBus, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option,
             AzureRedisFactory azureRedis, AzureStorageFactory azureStorage, IHttpClientFactory clientFactory, IConfiguration configuration)
         {
             _environment = environment;
@@ -70,7 +68,6 @@ namespace TEAMModelOS.Controllers.Learn
             _clientFactory = clientFactory;
             _configuration = configuration;
             _coreAPIHttpService = coreAPIHttpService; 
-            _notificationService = notificationService;
         }
 
         /// <summary>
@@ -785,29 +782,6 @@ namespace TEAMModelOS.Controllers.Learn
                                 string bizcode = "submitanswer";
                                 if (!string.IsNullOrWhiteSpace(homework.creatorId))
                                 {
-                                    Notification notification = new Notification
-                                    {
-                                        hubName = "hita",
-                                        type = "msg",
-                                        from = $"ies5:{_option.Location}:private",
-                                        to = new List<string> { homework.creatorId },
-                                        label = $"{bizcode}_homework",
-                                        body = new { location = _option.Location,
-                                            biz = bizcode,
-                                            tmdid = userid,
-                                            tmdname = name,
-                                            sid = homework.id,
-                                            sname = homework.name,
-                                            status = 1,
-                                            time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
-                                        }.ToJsonString(),
-                                        expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                                    };
-                                    var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                                    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);
                                   Teacher teacherData= await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<Teacher>(homework.creatorId, new PartitionKey("Base"));
                                     if (!string.IsNullOrWhiteSpace(homework.school))
                                     {

+ 1 - 4
TEAMModelOS/Controllers/OpenApi/IRS/TianboController.cs

@@ -13,7 +13,6 @@ using System.Net.Http;
 using Microsoft.Extensions.Configuration;
 using System.Threading;
 using TEAMModelOS.SDK.Extension;
-using TEAMModelOS.SDK.DI.CoreAPI;
 
 namespace TEAMModelOS.Controllers
 {
@@ -33,9 +32,8 @@ namespace TEAMModelOS.Controllers
         private readonly Option _option;
         private readonly IConfiguration _configuration;
         private readonly CoreAPIHttpService _coreAPIHttpService;
-        private readonly NotificationService _notificationService;
         private readonly IHttpClientFactory _httpClient;
-        public TianboController(CoreAPIHttpService coreAPIHttpService, NotificationService notificationService, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, AzureSignalRFactory azureSignalR, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, IHttpClientFactory httpClient)
+        public TianboController(CoreAPIHttpService coreAPIHttpService,  AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, AzureSignalRFactory azureSignalR, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, IHttpClientFactory httpClient)
         {
             _azureCosmos = azureCosmos;
             _azureStorage = azureStorage;
@@ -45,7 +43,6 @@ namespace TEAMModelOS.Controllers
             _option = option?.Value;
             _configuration = configuration;
             _coreAPIHttpService = coreAPIHttpService;
-            _notificationService = notificationService;
             _httpClient = httpClient;
         }
         /// <summary>

+ 2 - 29
TEAMModelOS/Controllers/School/CorrectController.cs

@@ -26,7 +26,6 @@ using TEAMModelOS.SDK.Models.Cosmos.Common.Inner;
 using TEAMModelOS.SDK.Models.Service;
 using Microsoft.Extensions.Configuration;
 using HTEXLib.COMM.Helpers;
-using TEAMModelOS.SDK.DI.CoreAPI;
 using TEAMModelOS.SDK.Models.Dtos;
 using Microsoft.Extensions.Hosting;
 using Microsoft.AspNetCore.Hosting;
@@ -49,10 +48,9 @@ namespace TEAMModelOS.Controllers
         private readonly Option _option;
         private readonly AzureStorageFactory _azureStorage;
         private readonly IConfiguration _configuration;
-        private readonly NotificationService _notificationService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly IWebHostEnvironment _environment;
-        public CorrectController(IWebHostEnvironment environment,CoreAPIHttpService coreAPIHttpService,AzureCosmosFactory azureCosmos, AzureServiceBusFactory serviceBus, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, NotificationService notificationService,
+        public CorrectController(IWebHostEnvironment environment,CoreAPIHttpService coreAPIHttpService,AzureCosmosFactory azureCosmos, AzureServiceBusFactory serviceBus, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration,  
             AzureRedisFactory azureRedis, AzureStorageFactory azureStorage)
         {
             _environment = environment;
@@ -64,7 +62,6 @@ namespace TEAMModelOS.Controllers
             _azureRedis = azureRedis;
             _azureStorage = azureStorage;
             _configuration = configuration;
-            _notificationService = notificationService;
             _coreAPIHttpService = coreAPIHttpService;
         }
 
@@ -228,31 +225,7 @@ namespace TEAMModelOS.Controllers
                         ids.Add(tmd.id);
                     }
                 }
-                Notification notification = new Notification
-                {
-                    hubName = "hita",
-                    type = "msg",
-                    from = $"ies5:{_option.Location}:private",
-                    to = ids,
-                    label = $"{bizcode}_school",
-                    body = new { location = _option.Location,
-                        biz = bizcode,
-                        tmdid = userid,
-                        tmdname = name.ToString(),
-                        schoolcode = school,
-                        schoolname = $"{schname}",
-                        examname = request.name,
-                        status = 1,
-                        time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
-                    }.ToJsonString(),
-                    expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                };
-                var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
-                var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-                var location = _option.Location;
-                await _notificationService.SendNotification(clientID, clientSecret, location, url, notification);
-
+                 
                 string sql = $"select c.id, c.name ,c.lang as code from c where c.id in ({string.Join(",", ids.Select(x => $"'{x}'"))})";
                 List<IdNameCode> idNameCodes = new List<IdNameCode>();
                 await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher)

+ 1 - 28
TEAMModelOS/Controllers/School/SchoolController.cs

@@ -26,7 +26,6 @@ using System.Net.Http.Headers;
 using System.Net.Http.Json;
 using HTEXLib.COMM.Helpers;
 using System.IdentityModel.Tokens.Jwt;
-using TEAMModelOS.SDK.DI.CoreAPI;
 using Microsoft.AspNetCore.Hosting;
 using DocumentFormat.OpenXml.Office2010.Excel;
 using static TEAMModelOS.SDK.SchoolService;
@@ -52,11 +51,10 @@ namespace TEAMModelOS.Controllers
         private readonly int redisAclassoneDbNum = 8; //AclassOne Redis DB號
         private readonly IConfiguration _configuration;
         private readonly CoreAPIHttpService _coreAPIHttpService;
-        private readonly NotificationService _notificationService;
         private readonly IHttpClientFactory _httpClient;
         private readonly HttpTrigger _httpTrigger;
         private readonly IWebHostEnvironment _environment;
-        public SchoolController(IWebHostEnvironment environment,HttpTrigger httpTrigger,CoreAPIHttpService coreAPIHttpService, NotificationService notificationService, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, IHttpClientFactory httpClient)
+        public SchoolController(IWebHostEnvironment environment,HttpTrigger httpTrigger,CoreAPIHttpService coreAPIHttpService,   AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, IHttpClientFactory httpClient)
         {
             _azureCosmos = azureCosmos;
             _azureStorage = azureStorage;
@@ -65,7 +63,6 @@ namespace TEAMModelOS.Controllers
             _option = option?.Value;
             _configuration = configuration;
             _coreAPIHttpService = coreAPIHttpService;
-            _notificationService = notificationService;
             _httpClient = httpClient;
             _httpTrigger = httpTrigger;
             _environment = environment;
@@ -1809,30 +1806,6 @@ namespace TEAMModelOS.Controllers
                     if (inviteids.Any())
                     {
                         string bizcode = "invite";
-                        Notification notification = new Notification
-                        {
-                            hubName = "hita",
-                            type = "msg",
-                            from = $"ies5:{_option.Location}:private",
-                            to = inviteids.Select(x => x.id).ToList(),
-                            label = $"{bizcode}_school",
-                            body = new { location = _option.Location,
-                                biz = bizcode,
-                                tmdid = adminId,
-                                tmdname = adminName,
-                                schoolcode = $"{_schoolId}",
-                                schoolname = $"{schoolBase.name}",
-                                status = 1,
-                                time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
-                            }.ToJsonString(),
-                            expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                        };
-                        var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                        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);
-
                         _coreAPIHttpService.PushNotify(inviteids, $"{bizcode}_school", Constant.NotifyType_IES5_Management,
                         new Dictionary<string, object> { { "tmdname", adminName }, { "schoolName", schoolBase.name }, { "schoolId", $"{_schoolId}" }, { "tmdid", adminId } }, _option.Location, _configuration, _dingDing, _environment.ContentRootPath);
                     }

+ 3 - 60
TEAMModelOS/Controllers/School/SchoolTeacherController.cs

@@ -21,7 +21,6 @@ using Microsoft.Extensions.Configuration;
 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;
 using Microsoft.Extensions.Hosting;
@@ -43,21 +42,19 @@ namespace TEAMModelOS.Controllers
         private readonly AzureStorageFactory _azureStorage;
         private readonly Option _option;
         private readonly IConfiguration _configuration;
-        private readonly NotificationService _notificationService;
         private readonly AzureServiceBusFactory _azureServiceBus;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly IWebHostEnvironment _environment;
         private readonly DingDing _dingDing;
 
         
-        public SchoolTeacherController(IWebHostEnvironment  environment,DingDing dingDing, CoreAPIHttpService coreAPIHttpService, AzureServiceBusFactory azureServiceBus, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, IConfiguration configuration, NotificationService notificationService)
+        public SchoolTeacherController(IWebHostEnvironment  environment,DingDing dingDing, CoreAPIHttpService coreAPIHttpService, AzureServiceBusFactory azureServiceBus, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, IConfiguration configuration)
         {
             _dingDing = dingDing;
             _azureCosmos = azureCosmos;
             _azureStorage = azureStorage;
             _option = option?.Value;
             _configuration = configuration;
-            _notificationService = notificationService;
             _azureServiceBus = azureServiceBus;
             _coreAPIHttpService = coreAPIHttpService;
             _environment = environment;
@@ -771,31 +768,7 @@ namespace TEAMModelOS.Controllers
                 {
                     bizcode = "request-join";
                 }
-                Notification notification = new Notification
-                {
-                    hubName = "hita",
-                    type = "msg",
-                    from = $"ies5:{_option.Location}:private",
-                    to = ids.Select(x => x.id).ToList(),
-                    label = $"{bizcode}_school",
-                    body = new {
-                        location = _option.Location,
-                        biz = bizcode,
-                        tmdid = tid,
-                        tmdname = tname.ToString(),
-                        schoolcode = $"{school_code}",
-                        schoolname = $"{schname}",
-                        status = 1,
-                        time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
-                    }.ToJsonString(),
-                    expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                };
-                var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                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);
-
+                 
                 _coreAPIHttpService.PushNotify(ids, $"{bizcode}_school", Constant.NotifyType_IES5_Management,
                                  new Dictionary<string, object> { { "tmdname", tname }, { "schoolName", schname }, { "schoolId", $"{school_code}" } , { "tmdid",tid} }, _option.Location, _configuration, _dingDing, _environment.ContentRootPath);
                 return Ok(new { exist = keys });
@@ -950,22 +923,7 @@ namespace TEAMModelOS.Controllers
                         }
                     }
                 }
-                Notification notification = new Notification
-                {
-                    hubName = "hita",
-                    type = "msg",
-                    from = $"ies5:{_option.Location}:private",
-                    to = new List<string> { teacher.id },
-                    label = $"{bizcode}_school",
-                    body = new { location = _option.Location, biz = bizcode, tmdid = tid, tmdname = tname, schoolcode = $"{school_code}", schoolname = $"{schname}", status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
-                    expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                };
-                var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                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); 
-
+                
                 _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 }, { "schoolName", schname }, { "schoolId", $"{school_code}" },   { "tmdid", tid } }, _option.Location, _configuration, _dingDing, _environment.ContentRootPath);
                 return Ok(new { });
@@ -1077,21 +1035,6 @@ namespace TEAMModelOS.Controllers
                     {
                         return BadRequest();
                     }
-                    Notification notification = new Notification
-                    {
-                        hubName = "hita",
-                        type = "msg",
-                        from = $"ies5:{_option.Location}:private",
-                        to = new List<string> { teacher.id },
-                        label = $"remove_school",
-                        body = new { location = _option.Location, biz = "remove", tmdid = tid, tmdname = tname, schoolcode = $"{school_code}", schoolname = $"{schname}", status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
-                        expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                    };
-                    var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                    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);
                     if (needNotify) {
                         _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 }, { "schoolName", schname }, { "schoolId", $"{school_code}" }, { "tmdid", tid } }, _option.Location, _configuration, _dingDing, _environment.ContentRootPath);

+ 2 - 57
TEAMModelOS/Controllers/Teacher/InitController.cs

@@ -30,7 +30,6 @@ using System.Diagnostics;
 using Microsoft.Extensions.Logging;
 using System.Text;
 using Microsoft.Azure.Cosmos.Table;
-using TEAMModelOS.SDK.DI.CoreAPI;
 using Microsoft.AspNetCore.Hosting;
 using DocumentFormat.OpenXml.Office2010.Excel;
 using DocumentFormat.OpenXml.Drawing.Charts;
@@ -50,14 +49,13 @@ namespace TEAMModelOS.Controllers
         private readonly DingDing _dingDing;
         private readonly Option _option;
         private readonly IConfiguration _configuration;
-        private readonly NotificationService _notificationService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly IPSearcher _searcher;
         private readonly ILogger<InitController> _logger;
         private readonly HttpTrigger _httpTrigger;
         private readonly IWebHostEnvironment _environment;
 
-        public InitController(IWebHostEnvironment environment,ILogger<InitController> logger, IPSearcher searcher, CoreAPIHttpService coreAPIHttpService, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, NotificationService notificationService, HttpTrigger httpTrigger)
+        public InitController(IWebHostEnvironment environment,ILogger<InitController> logger, IPSearcher searcher, CoreAPIHttpService coreAPIHttpService, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration,  HttpTrigger httpTrigger)
         {
             _searcher = searcher;
             _azureCosmos = azureCosmos;
@@ -66,7 +64,6 @@ namespace TEAMModelOS.Controllers
             _dingDing = dingDing;
             _option = option?.Value;
             _configuration = configuration;
-            _notificationService = notificationService;
             _coreAPIHttpService = coreAPIHttpService;
             _logger = logger;
             _httpTrigger = httpTrigger;
@@ -244,35 +241,7 @@ namespace TEAMModelOS.Controllers
                                 string code = "transfer-admin";
                                 School schoolBase = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>(school, new PartitionKey($"Base"));
                                 strMsg.Append($"学校{schoolBase.name}[{schoolBase.id}] 的管理员权限移交给");
-                                Notification notification = new Notification
-                                {
-                                    hubName = "hita",
-                                    type = "msg",
-                                    from = $"ies5:{_option.Location}:{school}",
-                                    to = new List<string> { $"{_targetTecher}" },
-                                    label = $"{code}_school",
-                                    body = new
-                                    {
-                                        location = _option.Location,
-                                        biz = code,
-                                        tmdid = userid,
-                                        tmdname = name,
-                                        schoolcode = $"{school}",
-                                        schoolname = $"{schoolBase.name}",
-                                        status = 1,
-                                        time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
-                                    }.ToJsonString(),
-                                    expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                                };
-
-                                if (notification != null)
-                                {
-                                    var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                                    var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
-                                    var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-                                    var location = _option.Location;
-                                    await _notificationService.SendNotification(clientID, clientSecret, location, url, notification);
-                                }
+                              
                                 Teacher targetTeacher = await client.GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<Teacher>($"{_targetTecher}", new PartitionKey($"Base"));
                                 strMsg.Append($"{targetTeacher.name}[{targetTeacher.id}]");
                                 _coreAPIHttpService.PushNotify(new List<IdNameCode> { new IdNameCode { id= targetTeacher.id,name= targetTeacher.name,code=targetTeacher.lang} }, "transfer-admin_school", Constant.NotifyType_IES5_Management,
@@ -1183,7 +1152,6 @@ namespace TEAMModelOS.Controllers
                         }
 
                     }
-                    Notification notification = null;
 
                     List<SchoolTeacher> teachers = new List<SchoolTeacher>();
                     var queryslt = $"SELECT  value(c)  FROM c join A1 in c.roles   where  A1 in ('admin')";
@@ -1196,29 +1164,6 @@ namespace TEAMModelOS.Controllers
                     {
                         code = "invite-join";
                     }
-                    if (teachers.IsNotEmpty())
-                    {
-
-                        notification = new Notification
-                        {
-                            hubName = "hita",
-                            type = "msg",
-                            from = $"ies5:{_option.Location}:private",
-                            to = teachers.Select(x => x.id).ToList(),
-                            label = $"{code}_school",
-                            body = new { location = _option.Location, biz = code, tmdid = id, tmdname = name.ToString(), schoolcode = $"{school_code}", schoolname = $"{school_name}", status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
-                            expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                        };
-                    }
-
-                    if (notification != null)
-                    {
-                        var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                        var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
-                        var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-                        var location = _option.Location;
-                        var val = await _notificationService.SendNotification(clientID, clientSecret, location, url, notification);
-                    }
                     if (teachers.IsNotEmpty()) {
                         string sql = $"select c.id, c.name ,c.lang as code from c where c.id in ({string.Join(",", teachers.Select(x => $"'{x.id}'"))})";
                         List<IdNameCode> idNameCodes = new List<IdNameCode>();

+ 0 - 2
TEAMModelOS/Startup.cs

@@ -33,7 +33,6 @@ using TEAMModelOS.Models;
 using TEAMModelOS.SDK;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.DI;
-using TEAMModelOS.SDK.DI.CoreAPI;
 using TEAMModelOS.SDK.Extension;
 using VueCliMiddleware;
 
@@ -109,7 +108,6 @@ namespace TEAMModelOS
             services.AddSnowflakeId(Convert.ToInt64(Configuration.GetValue<string>("Option:LocationNum")), 1);
             services.AddHttpClient();
             services.AddHttpClient<DingDing>();
-            services.AddHttpClient<NotificationService>();
             services.AddCoreAPIHttpService(Configuration);
            //services.AddHttpClient<CoreAPIHttpService>();
             services.AddSingleton <ScsStudyApisService>();