瀏覽代碼

class行政班/teach教学班 字段classType

CrazyIter_Bin 3 年之前
父節點
當前提交
96f9c85a01

+ 0 - 151
TEAMModelFunction/NoticeServiceBus.cs

@@ -1,151 +0,0 @@
-//using System;
-//using System.Collections.Generic;
-//using System.Text.Json;
-//using System.Threading.Tasks;
-//using Azure.Cosmos;
-//using Azure.Messaging.ServiceBus;
-//using Microsoft.Azure.WebJobs;
-//using Microsoft.Azure.WebJobs.Host;
-//using Microsoft.Extensions.Logging;
-//using StackExchange.Redis;
-//using TEAMModelOS.SDK.DI;
-//using TEAMModelOS.SDK.Extension;
-//using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
-//using TEAMModelOS.SDK.Models;
-//using TEAMModelOS.SDK.Models.Cosmos.Common;
-//namespace TEAMModelFunction
-//{
-//    public class NoticeServiceBus
-//    {
-//        private readonly AzureCosmosFactory _azureCosmos;
-//        private readonly DingDing _dingDing;
-//        private readonly AzureStorageFactory _azureStorage;
-//        private readonly AzureRedisFactory _azureRedis;
-//        private readonly AzureServiceBusFactory _serviceBus;
-//        public NoticeServiceBus(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus)
-//        {
-//            _azureCosmos = azureCosmos;
-//            _dingDing = dingDing;
-//            _azureStorage = azureStorage;
-//            _azureRedis = azureRedis;
-//            _serviceBus = serviceBus;
-//        }
-//        [FunctionName("Notice")]
-//        public async Task Notice([ServiceBusTrigger("%Azure:ServiceBus:ActiveTask%", "notice", Connection = "Azure:ServiceBus:ConnectionString")] string msg)
-//        {
-//            var client = _azureRedis.GetRedisClient(8);
-//            try
-//            {
-
-//                // List<Task<string>> tasks = new List<Task<string>>();
-//                //List<Task> sessionTasks = new List<Task>();
-//                var jsonMsg = JsonDocument.Parse(msg);
-//                Notice notice = msg.ToObject<Notice>();
-//                var blobcntr = "";
-//                if (notice.scope.Equals("school"))
-//                {
-//                    blobcntr = notice.school;
-//                }
-//                else
-//                {
-//                    blobcntr = notice.creatorId;
-//                }
-//                if (string.IsNullOrEmpty(blobcntr))
-//                {
-//                    return;
-//                }
-//#if DEBUG
-//                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-NoticeServiceBus-Notice:\n发起通知{msg}", GroupNames.成都开发測試群組);
-//#endif
-//                long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
-//                long day30 = 2592000L;
-//                //处理过期时间大于30天
-//                if (notice.expire - now > day30) {
-//                    notice.expire = now + day30;
-//                }
-//                //通知的主体内容
-//                var urlNotice = $"{notice.msgId}.json";
-//                var blobNotice = new
-//                {
-//                    notice.type,
-//                    notice.priority,
-//                    notice.from,
-//                    notice.toservice,
-//                    notice.creation,//创建时间
-//                    notice.expire,//到期时间
-//                    notice.msgId,
-//                    notice.creatorId,
-//                    notice.school,
-//                    notice.scope,
-//                    notice.body,
-//                };
-//                //通知的接收人的集合信息
-//                await _azureStorage.UploadFileByContainer(blobcntr, blobNotice.ToJsonString(), "notice", urlNotice);
-//                var urlReceiver = $"{notice.msgId}_receiver.json";
-//                var blobReceiver = new
-//                {
-//                    notice.stuids,
-//                    notice.tmdids
-//                };
-//                await _azureStorage.UploadFileByContainer(blobcntr, blobReceiver.ToJsonString(), "notice", urlReceiver);
-
-//                //发送通知给用户
-               
-//                // "ttl":2592000,不能超过30天(2592000),一天(3600),一周(25200)
-
-//                if (notice.stuids.IsNotEmpty())
-//                {
-//                    //  List<Receiver> receivers = new List<Receiver>();
-//                    foreach (var stu in notice.stuids)
-//                    {
-//                        Receiver receiver = new Receiver
-//                        {
-//                            id = notice.msgId,
-//                            status = 0,
-//                            ctime = now,
-//                            urlNotice = $"/notice/{urlNotice}",
-//                        };
-//                        var url = $"{stu.id}/receive/{notice.msgId}.json";
-//                        await client.HashSetAsync($"Notice:Receiver:{stu.schoolId}-{stu.id}", notice.msgId, $"/student/{url}");
-//                        // await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync<Receiver>(receiver,new Azure.Cosmos.PartitionKey(receiver.code));
-//                        //  /student/{stuid}/receive/{notice.sid}.json
-//                        //存放通知到学生容器空间
-
-//                        await _azureStorage.UploadFileByContainer(blobcntr, receiver.ToJsonString(), "student", url);
-//                        var messageBlob = new ServiceBusMessage(receiver.ToJsonString()) { SessionId = $"{stu.schoolId}-{stu.id}" };
-//                        // messageBlob.ApplicationProperties.Add("name", "Receiver");
-//                        await _serviceBus.GetServiceBusClient().SendMessageAsync("notice-task", messageBlob);
-//                    }
-//                }
-//                if (notice.tmdids.IsNotEmpty())
-//                {
-//                    foreach (var tmdid in notice.tmdids)
-//                    {
-//                        Receiver receiver = new Receiver
-//                        {
-//                            id = notice.msgId,
-//                            status = 0,
-//                            ctime = now,
-//                            urlNotice = $"/notice/{urlNotice}",
-//                        };
-//                        var url = $"{notice.msgId}.json";
-//                        await client.HashSetAsync($"Notice:Receiver:{tmdid}", notice.msgId, receiver.ToJsonString());
-//                        //await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync<Receiver>(receiver, new Azure.Cosmos.PartitionKey(receiver.code));
-//                        //  /student/{stuid}/receive/{notice.sid}.json
-//                        //存放通知到学生容器空间
-
-//                        await _azureStorage.UploadFileByContainer(blobcntr, receiver.ToJsonString(), "receive", url);
-//                        var messageBlob = new ServiceBusMessage(receiver.ToJsonString()) { SessionId = $"{tmdid}" };
-//                        //messageBlob.ApplicationProperties.Add("name", "Receiver");
-//                        await _serviceBus.GetServiceBusClient().SendMessageAsync("notice-task", messageBlob);
-//                    }
-//                }
-//            }
-//            catch (Exception ex)
-//            {
-//                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-NoticeServiceBus-Notice\n{ex.Message}{ex.StackTrace}", GroupNames.成都开发測試群組);
-//            }
-//        }
-
-//    }
-//}

+ 0 - 155
TEAMModelOS.SDK/Models/Cosmos/Common/Notice.cs

@@ -1,155 +0,0 @@
-using Microsoft.Azure.Cosmos.Table;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.SDK.Models.Cosmos.Common;
-
-namespace TEAMModelOS.SDK.Models
-{
-
-
-    /// <summary>
-    /// 前端多语言处理
-    /// </summary>
-    //public string title { get; set; }
-    /// <summary>
-    /// 前端多语言处理
-    /// </summary>
-    //public string content { get; set; }
-    /*
-     {
-        "title":"通知标题",
-        "type":"通知类型",
-        "level":"重要程度",
-        "content":"通知内容",
-        "data":"传输数据josn",
-        "stime":"发起时间戳",
-        "etime":"到期时间戳",
-        "id":"通知id",
-        "code":"发起人"
-        "pk":"notice"
-    }
-     */
-    /// <summary>
-    /// 通知主体存放位置:/notice/{业务id}.json
- 
-    /// 活跃通知放在CosmosDB  Common表中,并设置"ttl":2592000,不能超过30天(2592000),一天(3600),一周(25200),允许删除
-    /// 过期通知存放至blob中,存放位置, 允许被删除,直接删除记录
-    ///             stuid:/student/stuid/receiver/xxxx时间戳排序.json
-    ///             tmdid:/receiver/xxxx时间戳排序.json
-    /// </summary>
-    //public class Notice
-    //{ 
-    //    /// <summary>
-    //    ///  訊息種類 message:訊息,收取會另存至儲存體(blob or table) notice:通知,收取後不另存 
-    //    /// XXXX通知的业务类型,做什么事情用,具体业务类型再定义。 vote-join 
-    //    /// </summary>
-    //    public string type { get; set; }
-    //    /// <summary>
-    //    /// 重要等级 emergency、high、normal、low 1置顶,2非常重要,3重要,4普通消息,5不重要
-    //    /// </summary>
-    //    public string priority { get; set; }
-    //    /// <summary>
-    //    /// 發信源服務  IES5
-    //    /// </summary>
-    //    public string from { get; set; } = "IES5";
-    //    /// <summary>
-    //    /// 服務收信對象 若任一服務皆可收,則不填;指定某服務才收,則填服務名稱 例:HiT
-    //    /// </summary>
-    //    public string toservice { get; set; }
-    //    /// <summary>
-    //    /// 到期时间,发给接收者的cosmosDB ttl是从当前时间到结束时间为止
-    //    /// </summary>
-    //    public long expire { get; set; }
-    //    /// <summary>
-    //    /// 创建时间
-    //    /// </summary>
-    //    public long creation { get; set; }
-    //    /// <summary>
-    //    /// 消息id 
-    //    /// </summary>
-    //    public string msgId { get; set; }
-    //    /// <summary>
-    //    /// 正文內容
-    //    /// </summary>
-    //    public Body body { get; set; }
-    //    /// <summary>
-    //    /// 创建者
-    //    /// </summary>
-    //    public string creatorId { get; set; }
-    //    /// <summary>
-    //    /// 源数据的学校编码
-    //    /// </summary>
-    //    public string school { get; set; }
-    //    /// <summary>
-    //    /// 源数据的scope
-    //    /// </summary>
-    //    public string scope { get; set; }
-    //    /// 通知主体的被通知人存放位置:  /notice/{业务id}_receiver.json
-    //    /// <summary>
-    //    /// 被通知的醍摩豆账号
-    //    /// </summary>
-    //    public List<string> tmdids { get; set; }
-    //    /// <summary>
-    //    /// 被通知的学校学生账号
-    //    /// </summary>
-    //    public List<Students> stuids { get; set; }
-       
-    //}
-
-    /// <summary>
-    /// 传输数据josn
-    /// </summary>
-    public class Body {
-        /// <summary>
-        /// 业务类型  vote-join  exam-join  survey-join
-        /// </summary>
-        public string biztype { get; set; }
-        /// <summary>
-        /// 源数据的id
-        /// </summary>
-        public string sid { get; set; }
-        /// <summary>
-        /// 源数据的code
-        /// </summary>
-        public string scode { get; set; }
-        /// <summary>
-        /// 源数据的pk
-        /// </summary>
-        public string spk { get; set; }
-      
-    }
-    /*
-    {
-        "id":"通知id"
-        "code":"接收者1",
-        "status":"接收状态/已发送/已查看",
-        "pk":"receiver",
-        "ttl":2592000,不能超过30天(2592000),一天(3600),一周(25200)
-    }
-     */
-    /// <summary>
-    /// id  :源数据id
-    /// code:Receiver-{hbcn}-{rid}
-    /// ttl :Notice的etime-当前时间戳
-    /// pk  :Receiver
-    /// </summary>
-    /// /student/{stuid}/
-    public class Receiver  
-    {
-        public string id { get; set; }
-        /// <summary>
-        /// 0 已发送,1已查看,2已处理,-1已过期
-        /// </summary>
-        public int status { get; set; }=0;
-        /// <summary>
-        /// 创建时间
-        /// </summary>
-        public long ctime { get; set; }
-        /// <summary>
-        /// 通知url
-        /// </summary>
-        public string urlNotice { get; set; }
-
-    }
-}

+ 4 - 1
TEAMModelOS.SDK/Models/Cosmos/Common/Survey.cs

@@ -55,7 +55,10 @@ namespace TEAMModelOS.SDK.Models
 
 
         public List<string> tmdids { get; set; }
         public List<string> tmdids { get; set; }
         public List<string> classes { get; set; }
         public List<string> classes { get; set; }
-
+        /// <summary>
+        ///class行政班/teach教学班
+        /// </summary>
+        public string classType { get; set; }
         /// <summary>
         /// <summary>
         /// 开始时间
         /// 开始时间
         /// </summary>
         /// </summary>

+ 4 - 0
TEAMModelOS.SDK/Models/Cosmos/Common/Vote.cs

@@ -83,6 +83,10 @@ namespace TEAMModelOS.SDK.Models
         /// </summary>
         /// </summary>
         public List<string> classes { get; set; }
         public List<string> classes { get; set; }
         /// <summary>
         /// <summary>
+        ///class行政班/teach教学班
+        /// </summary>
+        public string classType{ get; set; }
+        /// <summary>
         /// 开始时间
         /// 开始时间
         /// </summary>
         /// </summary>
         public long startTime { get; set; }
         public long startTime { get; set; }

+ 4 - 0
TEAMModelOS.SDK/Models/Cosmos/School/ExamInfo.cs

@@ -64,6 +64,10 @@ namespace TEAMModelOS.SDK.Models
         /// 评测类型
         /// 评测类型
         /// </summary>
         /// </summary>
         public string source { get; set; }
         public string source { get; set; }
+        /// <summary>
+        ///class行政班/teach教学班
+        /// </summary>
+        public string classType { get; set; }
         public List<string> classes { get; set; }
         public List<string> classes { get; set; }
         public List<PaperSimple> papers { get; set; }
         public List<PaperSimple> papers { get; set; }
         ///考试类型 段考 stage  联考 union 平常考 normal 其他 other
         ///考试类型 段考 stage  联考 union 平常考 normal 其他 other