CrazyIter 5 rokov pred
rodič
commit
74f832140f
28 zmenil súbory, kde vykonal 172 pridanie a 90 odobranie
  1. 133 73
      TEAMModelOS.SDK/Module/AzureCosmosDBV3/AzureCosmosDBV3Repository.cs
  2. 1 0
      TEAMModelOS.SDK/Module/AzureCosmosDBV3/ID.cs
  3. 2 1
      TEAMModelOS.SDK/Module/AzureTable/Implements/AzureTableDBRepository.cs
  4. 4 4
      TEAMModelOS.SDK/TEAMModelOS.SDK.csproj
  5. 1 0
      TEAMModelOS.Service/Models/Core/ClassRoomStudent.cs
  6. 1 0
      TEAMModelOS.Service/Models/Core/Classroom.cs
  7. 1 0
      TEAMModelOS.Service/Models/Core/School.cs
  8. 8 7
      TEAMModelOS.Service/Models/Core/Student.cs
  9. 1 0
      TEAMModelOS.Service/Models/Core/Teacher.cs
  10. 1 1
      TEAMModelOS.Service/Models/Courses/Course.cs
  11. 1 0
      TEAMModelOS.Service/Models/Exam/ExamAnswer.cs
  12. 1 0
      TEAMModelOS.Service/Models/Exam/ExamInfo.cs
  13. 1 0
      TEAMModelOS.Service/Models/Exam/ExamItem.cs
  14. 1 0
      TEAMModelOS.Service/Models/Exam/ExamPaper.cs
  15. 1 0
      TEAMModelOS.Service/Models/Exam/ExamResult.cs
  16. 1 0
      TEAMModelOS.Service/Models/Exam/SimpleExam.cs
  17. 1 0
      TEAMModelOS.Service/Models/Learn/HomeWork.cs
  18. 1 0
      TEAMModelOS.Service/Models/Learn/HomeWorkStudent.cs
  19. 1 1
      TEAMModelOS.Service/Models/Learn/LeanProcess.cs
  20. 1 0
      TEAMModelOS.Service/Models/Learn/LeanRecord.cs
  21. 1 0
      TEAMModelOS.Service/Models/Learn/LearnUnit.cs
  22. 1 1
      TEAMModelOS.Service/Models/Learn/LearningAutonomous.cs
  23. 1 0
      TEAMModelOS.Service/Models/Syllabus/Knowledge.cs
  24. 1 1
      TEAMModelOS.Service/Models/Syllabus/SyllabusResource.cs
  25. 2 0
      TEAMModelOS.Service/Models/Syllabus/SyllabusVolume.cs
  26. 1 0
      TEAMModelOS.Service/Models/Syllabus/Syllabuses.cs
  27. 1 0
      TEAMModelOS/Models/Family.cs
  28. 1 1
      TEAMModelOS/appsettings.Development.json

+ 133 - 73
TEAMModelOS.SDK/Module/AzureCosmosDBV3/AzureCosmosDBV3Repository.cs

@@ -45,7 +45,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
         private const string CacheCosmosPrefix = "cosmos:";
         private string[] ScanModel { get; set; }
         private const int timeoutSeconds = 86400;
-
+        private const int ttl = 10;
         private string leaseId = "AleaseContainer";
         public AzureCosmosDBV3Repository(AzureCosmosDBOptions options, CosmosSerializer cosmosSerializer)
         {
@@ -167,7 +167,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                     }
                     else
                     {
-                        ContainerProperties containerProperties = new ContainerProperties { Id = CollectionName };
+                        ContainerProperties containerProperties = new ContainerProperties { Id = CollectionName ,DefaultTimeToLive=-1 };
 
                         if (!string.IsNullOrEmpty(PartitionKey))
                         {
@@ -183,7 +183,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                 }
                 if (isMonitor)
                 {
-                    ContainerProperties leaseProperties = new ContainerProperties { Id = leaseId, PartitionKeyPath = "/id" };
+                    ContainerProperties leaseProperties = new ContainerProperties { Id = leaseId, PartitionKeyPath = "/id", DefaultTimeToLive = -1 };
                     Container leaseContainer = await database.CreateContainerIfNotExistsAsync(leaseProperties, throughput: CollectionThroughput);
                     DocumentCollectionDict.TryAdd(leaseId, new CosmosModelInfo { container = leaseContainer, cache = false, monitor = false });
                 }
@@ -275,99 +275,138 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                 return cosmosModel;
             }
         }
-
-
+        /// <summary>
+        /// 按TTL删除
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="list"></param>
+        /// <returns></returns>
+        private async Task<List<T>> DeleteTTL<T>(List<T> list)where T:ID {
+            CosmosModelInfo container = await InitializeCollection<T>();
+            list.ForEach(x=> { x.ttl = ttl; });
+            list= await SaveOrUpdateAll(list);
+            if (container.cache && RedisHelper.Instance != null)
+            {
+                list.ForEach(async x => {
+                    await RedisHelper.HDelAsync(CacheCosmosPrefix + container.container.Id, x.id);
+                });
+            }
+            return list;
+        }
         public async Task<List<IdPk>> DeleteAll<T>(List<IdPk> ids) where T : ID
         {
             CosmosModelInfo container = await InitializeCollection<T>();
-            //string partitionKey = GetPartitionKey<T>();
-            //await Task.Run(() => Parallel.ForEach(ids, new ParallelOptions { MaxDegreeOfParallelism = 2 }, (item) =>
-            //{
-            //    Task.WaitAll(DeleteAsync<T>(item.Value, item.Key));
-            //}));
-
             List<IdPk> idPks = new List<IdPk>();
-            int pages = (int)Math.Ceiling((double)ids.Count / pageSize);
-            Stopwatch stopwatch = Stopwatch.StartNew();
-            for (int i = 0; i < pages; i++)
+            if (container.monitor)
             {
-                List<IdPk> lists = ids.Skip((i) * pageSize).Take(pageSize).ToList();
-                List<Task> tasks = new List<Task>(lists.Count);
-                lists.ForEach(item =>
+                List<T> list= await FindByDict<T>(new Dictionary<string, object>() { { "id", ids.Select(x => x.id).ToArray() } });
+                list= await DeleteTTL(list);
+                return ids;
+            }
+            else {
+                int pages = (int)Math.Ceiling((double)ids.Count / pageSize);
+                Stopwatch stopwatch = Stopwatch.StartNew();
+                for (int i = 0; i < pages; i++)
                 {
-                    tasks.Add(container.container.DeleteItemStreamAsync(item.id, new PartitionKey(item.pk))
-                        .ContinueWith((Task<ResponseMessage> task) =>
-                        {
-                            using (ResponseMessage response = task.Result)
+                    List<IdPk> lists = ids.Skip((i) * pageSize).Take(pageSize).ToList();
+                    List<Task> tasks = new List<Task>(lists.Count);
+                    lists.ForEach(item =>
+                    {
+                        tasks.Add(container.container.DeleteItemStreamAsync(item.id, new PartitionKey(item.pk))
+                            .ContinueWith((Task<ResponseMessage> task) =>
                             {
-                                idPks.Add(new IdPk { id = item.id, pk = item.pk.ToString(), StatusCode = response.StatusCode });
+                                using (ResponseMessage response = task.Result)
+                                {
+                                    idPks.Add(new IdPk { id = item.id, pk = item.pk.ToString(), StatusCode = response.StatusCode });
                                 //    if (!response.IsSuccessStatusCode)
                                 //    {
                                 //    }
                             }
-                        }
-                        ));
-                });
-                await Task.WhenAll(tasks);
-                if (container.cache && RedisHelper.Instance != null)
-                {
-                    lists.ForEach(async x => {
-                        await RedisHelper.HDelAsync(CacheCosmosPrefix + container.container.Id, x.id);
+                            }
+                            ));
                     });
+                    await Task.WhenAll(tasks);
+                    if (container.cache && RedisHelper.Instance != null)
+                    {
+                        lists.ForEach(async x => {
+                            await RedisHelper.HDelAsync(CacheCosmosPrefix + container.container.Id, x.id);
+                        });
+                    }
                 }
+                stopwatch.Stop();
+                return idPks;
             }
-            stopwatch.Stop();
-            return idPks;
+
+           
         }
+
         public async Task<List<IdPk>> DeleteAll<T>(Dictionary<string, object> dict) where T : ID
         {
-            List<T> list = await FindByDict<T>(dict);
-            return await DeleteAll(list);
+            if (dict.Keys.Count > 0)
+            {
+                List<T> list = await FindByDict<T>(dict);
+                return await DeleteAll(list);
+            }
+            else {
+                throw new  BizException("参数为空", 500);
+            }
+           
         }
         public async Task<List<IdPk>> DeleteAll<T>(List<T> enyites) where T : ID
         {
-
-            List<IdPk> idPks = new List<IdPk>();
-            CosmosModelInfo container = await InitializeCollection<T>();
-            string pk = GetPartitionKey<T>();
             Type type = typeof(T);
-            int pages = (int)Math.Ceiling((double)enyites.Count / pageSize);
-            Stopwatch stopwatch = Stopwatch.StartNew();
-            for (int i = 0; i < pages; i++)
+            string pk = GetPartitionKey<T>();
+            CosmosModelInfo container = await InitializeCollection<T>();
+            List<IdPk> idPks = new List<IdPk>();
+
+            if (container.monitor)
             {
-                List<T> lists = enyites.Skip((i) * pageSize).Take(pageSize).ToList();
-                List<KeyValuePair<PartitionKey, string>> itemsToInsert = new List<KeyValuePair<PartitionKey, string>>();
-                lists.ForEach(x =>
+                enyites = await DeleteTTL(enyites);
+                foreach (T t in enyites) {
+                    object o = type.GetProperty(pk).GetValue(t, null);
+                    idPks.Add(new IdPk { id = t.id, pk =o.ToString(), StatusCode = HttpStatusCode .NoContent});
+                }
+                return idPks;
+            }
+            else {
+                int pages = (int)Math.Ceiling((double)enyites.Count / pageSize);
+                Stopwatch stopwatch = Stopwatch.StartNew();
+                for (int i = 0; i < pages; i++)
                 {
-                    object o = type.GetProperty(pk).GetValue(x, null);
-                    KeyValuePair<PartitionKey, string> keyValue = new KeyValuePair<PartitionKey, string>(new PartitionKey(o.ToString()), x.id);
-                    itemsToInsert.Add(keyValue);
-                });
+                    List<T> lists = enyites.Skip((i) * pageSize).Take(pageSize).ToList();
+                    List<KeyValuePair<PartitionKey, string>> itemsToInsert = new List<KeyValuePair<PartitionKey, string>>();
+                    lists.ForEach(x =>
+                    {
+                        object o = type.GetProperty(pk).GetValue(x, null);
+                        KeyValuePair<PartitionKey, string> keyValue = new KeyValuePair<PartitionKey, string>(new PartitionKey(o.ToString()), x.id);
+                        itemsToInsert.Add(keyValue);
+                    });
 
-                List<Task> tasks = new List<Task>(lists.Count);
-                itemsToInsert.ForEach(item =>
-                {
-                    tasks.Add(container.container.DeleteItemStreamAsync(item.Value, item.Key)
-                    .ContinueWith((Task<ResponseMessage> task) =>
+                    List<Task> tasks = new List<Task>(lists.Count);
+                    itemsToInsert.ForEach(item =>
                     {
-                        using (ResponseMessage response = task.Result)
+                        tasks.Add(container.container.DeleteItemStreamAsync(item.Value, item.Key)
+                        .ContinueWith((Task<ResponseMessage> task) =>
                         {
+                            using (ResponseMessage response = task.Result)
+                            {
 
-                            idPks.Add(new IdPk { id = item.Value, pk = item.Key.ToString(), StatusCode = response.StatusCode });
+                                idPks.Add(new IdPk { id = item.Value, pk = item.Key.ToString(), StatusCode = response.StatusCode });
 
+                            }
                         }
-                    }
-                    ));
-                });
-                await Task.WhenAll(tasks); if (container.cache && RedisHelper.Instance != null)
-                {
-                    lists.ForEach(async x => {
-                        await RedisHelper.HDelAsync(CacheCosmosPrefix + container.container.Id, x.id);
+                        ));
                     });
+                    await Task.WhenAll(tasks); if (container.cache && RedisHelper.Instance != null)
+                    {
+                        lists.ForEach(async x => {
+                            await RedisHelper.HDelAsync(CacheCosmosPrefix + container.container.Id, x.id);
+                        });
+                    }
                 }
+                stopwatch.Stop();
+                return idPks;
             }
-            stopwatch.Stop();
-            return idPks;
         }
 
         public async Task<IdPk> DeleteAsync<T>(IdPk idPk) where T : ID
@@ -377,12 +416,27 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
         public async Task<IdPk> DeleteAsync<T>(string id, string pk) where T : ID
         {
             CosmosModelInfo container = await InitializeCollection<T>();
-            ResponseMessage response = await container.container.DeleteItemStreamAsync(id: id, partitionKey: new PartitionKey(pk));
-            if (container.cache && RedisHelper.Instance != null)
+            if (container.monitor)
             {
-                await RedisHelper.HDelAsync(CacheCosmosPrefix + container.container.Id, id);
+                List<T> list=  await FindByDict<T>(new Dictionary<string, object>() { { "id", id } });
+                if (list.Count > 0)
+                {
+                    await DeleteTTL<T>(list);
+                    return new IdPk { id = id, pk = pk, StatusCode = HttpStatusCode.NoContent };
+                }
+                else {
+                    throw new BizException("未找到ID匹配的数据,删除失败");
+                }
             }
-            return new IdPk { id = id, pk = pk, StatusCode = response.StatusCode };
+            else {
+                ResponseMessage response = await container.container.DeleteItemStreamAsync(id: id, partitionKey: new PartitionKey(pk));
+                if (container.cache && RedisHelper.Instance != null)
+                {
+                    await RedisHelper.HDelAsync(CacheCosmosPrefix + container.container.Id, id);
+                }
+                return new IdPk { id = id, pk = pk, StatusCode = response.StatusCode };
+            }
+            
         }
 
         public async Task<IdPk> DeleteAsync<T>(T entity) where T : ID
@@ -391,13 +445,19 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             string partitionKey = GetPartitionKey<T>();
             Type type = typeof(T);
             object o = type.GetProperty(partitionKey).GetValue(entity, null);
-            ResponseMessage response = await container.container.DeleteItemStreamAsync(id: entity.id, partitionKey: new PartitionKey(o.ToString()));
-            if (container.cache && RedisHelper.Instance != null)
+            if (container.monitor)
             {
-                await RedisHelper.HDelAsync(CacheCosmosPrefix + container.container.Id, entity.id);
+                await DeleteTTL<T>(new List<T>() { entity});
+                return new IdPk { id = entity.id, pk = o.ToString(), StatusCode = HttpStatusCode.NoContent };
+            }
+            else {
+                ResponseMessage response = await container.container.DeleteItemStreamAsync(id: entity.id, partitionKey: new PartitionKey(o.ToString()));
+                if (container.cache && RedisHelper.Instance != null)
+                {
+                    await RedisHelper.HDelAsync(CacheCosmosPrefix + container.container.Id, entity.id);
+                }
+                return new IdPk { id = entity.id, pk = o.ToString(), StatusCode = response.StatusCode };
             }
-            return new IdPk { id = entity.id, pk = o.ToString(), StatusCode = response.StatusCode };
-
         }
         //public async Task<T> DeleteAsync<T>(string id) where T : ID
         //{

+ 1 - 0
TEAMModelOS.SDK/Module/AzureCosmosDBV3/ID.cs

@@ -7,5 +7,6 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
     public interface ID
     {
         string id { get; set; }
+        int? ttl { get; set; }
     }
 }

+ 2 - 1
TEAMModelOS.SDK/Module/AzureTable/Implements/AzureTableDBRepository.cs

@@ -159,7 +159,8 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Implements
                 var result = await CloudTableClient.GetTableReference(TableName).ExecuteQuerySegmentedAsync(exQuery, continuationToken);
                 if (result.Results.Count > 0)
                 {
-                    entity = result.ToList().Single();
+                    entity= result.ToList()[0];
+                    break;
                 }
                 continuationToken = result.ContinuationToken;
             } while (continuationToken != null);

+ 4 - 4
TEAMModelOS.SDK/TEAMModelOS.SDK.csproj

@@ -2,10 +2,10 @@
 
   <PropertyGroup>
     <TargetFramework>netcoreapp3.1</TargetFramework>
-    <Version>3.0.416</Version>
-    <AssemblyVersion>3.0.416.0</AssemblyVersion>
-    <FileVersion>3.0.416.0</FileVersion>
-    <PackageReleaseNotes>集成Grpc</PackageReleaseNotes>
+    <Version>3.0.515</Version>
+    <AssemblyVersion>3.0.515.0</AssemblyVersion>
+    <FileVersion>3.0.515.0</FileVersion>
+    <PackageReleaseNotes>修改Table单个查询</PackageReleaseNotes>
   </PropertyGroup>
 
   <ItemGroup>

+ 1 - 0
TEAMModelOS.Service/Models/Core/ClassRoomStudent.cs

@@ -10,6 +10,7 @@ namespace TEAMModelOS.Service.Models.Core
     [CosmosDB(RU = 400, Name = "CoreClassroomStudent",Cache = true)]
     public class ClassroomStudent:ID
     {
+        public int? ttl { get; set; } = -1;
         /// <summary>
         /// classroomCode
         /// </summary>

+ 1 - 0
TEAMModelOS.Service/Models/Core/Classroom.cs

@@ -11,6 +11,7 @@ namespace TEAMModelOS.Service.Models.Core
     [CosmosDB(RU = 400, Name = "CoreClassroom")]
     public class Classroom:ID
     {
+        public int? ttl { get; set; } = -1;
         public Classroom()
         {
             point = new Point();

+ 1 - 0
TEAMModelOS.Service/Models/Core/School.cs

@@ -9,6 +9,7 @@ namespace TEAMModelOS.Service.Models.Core
     [CosmosDB(RU = 400, Name = "CoreSchool")]
     public class School:ID
     {
+        public int? ttl { get; set; } = -1;
         public School()
         {
             period = new List<Period>();

+ 8 - 7
TEAMModelOS.Service/Models/Core/Student.cs

@@ -12,13 +12,14 @@ namespace TEAMModelOS.Service.Models.Core
     [CosmosDB(RU = 400, Name = "CoreStudent")]
     public class Student :ID
     {
-   public Student()
-    {
-      password = new Password();
-      productToken = new List<ProductToken>();
-      oauth = new List<Oauth>();
-      //classroom = new Classroom();
-    }
+        public int? ttl { get; set; } = -1;
+        public Student()
+        {
+          password = new Password();
+          productToken = new List<ProductToken>();
+          oauth = new List<Oauth>();
+          //classroom = new Classroom();
+        }
         public string id { get; set; }
         /// <summary>
         /// 0 动态id  透過第三方申請,未認證手機號,TEAMModelId暫時為virtualId但是不顯示在介面上,當使用者驗證手機號後TEAMModelId會變為手機號。

+ 1 - 0
TEAMModelOS.Service/Models/Core/Teacher.cs

@@ -12,6 +12,7 @@ namespace TEAMModelOS.Service.Models.Core
     [CosmosDB(RU = 400, Name = "CoreTeacher")]
     public class Teacher:ID
     {
+        public int? ttl { get; set; } = -1;
         public string id { get; set; }
         /// <summary>
         /// 0 动态id  透過第三方申請,未認證手機號,TEAMModelId暫時為virtualId但是不顯示在介面上,當使用者驗證手機號後TEAMModelId會變為手機號。

+ 1 - 1
TEAMModelOS.Service/Models/Courses/Course.cs

@@ -17,7 +17,7 @@ namespace TEAMModelOS.Service.Models.Courses
     [ProtoContract]
     public class Course : ID
     {
-   
+        public int? ttl { get; set; } = -1;
 
         /// <summary>
         /// 学校编码 如果是教师私人知识点 则为 personal(写死) 否则为学校编码 

+ 1 - 0
TEAMModelOS.Service/Models/Exam/ExamAnswer.cs

@@ -13,6 +13,7 @@ namespace TEAMModelOS.Service.Models.Exam.Models
     [CosmosDB(RU = 400, Name = "ExamAnswer")]
     public class ExamAnswer :ID
     {
+        public int? ttl { get; set; } = -1;
         public ExamAnswer()
         {
             Answer = new List<List<string>>();

+ 1 - 0
TEAMModelOS.Service/Models/Exam/ExamInfo.cs

@@ -14,6 +14,7 @@ namespace TEAMModelOS.Service.Models.Exam.Models
     [CosmosDB(RU = 400, Name = "ExamInfo")]
     public class ExamInfo :ID
     {
+        public int? ttl { get; set; } = -1;
         public ExamInfo() {
         }
         [JsonProperty(PropertyName = "id")]

+ 1 - 0
TEAMModelOS.Service/Models/Exam/ExamItem.cs

@@ -14,6 +14,7 @@ namespace TEAMModelOS.Service.Models.Exam.Models
     [CosmosDB(RU = 400, Name = "ExamItem",Cache =true)]
     public class ExamItem :ID
     {
+        public int? ttl { get; set; } = -1;
         public ExamItem()
         {
             children = new List<ExamItem>();

+ 1 - 0
TEAMModelOS.Service/Models/Exam/ExamPaper.cs

@@ -13,6 +13,7 @@ namespace TEAMModelOS.Service.Models.Exam.Models
     [CosmosDB(RU = 400, Name = "ExamPaper")]
     public class ExamPaper : ID
     {
+        public int? ttl { get; set; } = -1;
         public ExamPaper() {
             item = new List<ExamItem>();
         }

+ 1 - 0
TEAMModelOS.Service/Models/Exam/ExamResult.cs

@@ -12,6 +12,7 @@ namespace TEAMModelOS.Service.Models.Exam.Models
     [CosmosDB(RU = 400, Name = "ExamResult")]
     public  class ExamResult:ID
     {
+        public int? ttl { get; set; } = -1;
         public ExamResult()
         {
             classes = new List<Dictionary<string, int[]>>();

+ 1 - 0
TEAMModelOS.Service/Models/Exam/SimpleExam.cs

@@ -13,6 +13,7 @@ namespace TEAMModelOS.Service.Model.Exam.Models
     [CosmosDB(RU = 400, Name = "SimpleExam")]
     public class SimpleExam :ID
     {
+        public int? ttl { get; set; } = -1;
         public SimpleExam()
         {
             Classes = new List<Dictionary<string, int[]>>();

+ 1 - 0
TEAMModelOS.Service/Models/Learn/HomeWork.cs

@@ -14,6 +14,7 @@ namespace TEAMModelOS.Service.Models.Learn
     [CosmosDB(RU = 400, Name = "HomeWork")]
     public class HomeWork:ID
     {
+        public int? ttl { get; set; } = -1;
         public HomeWork()
         {
             target = new List<Target>();

+ 1 - 0
TEAMModelOS.Service/Models/Learn/HomeWorkStudent.cs

@@ -14,6 +14,7 @@ namespace TEAMModelOS.Service.Models.Learn
     [CosmosDB(RU = 400, Name = "HomeWorkStudent")]
     public class HomeWorkStudent : ID
     {
+        public int? ttl { get; set; } = -1;
         public HomeWorkStudent() {
             content = new List<HomeWorkContent>();
             comments = new List<HomeWorkComment>();

+ 1 - 1
TEAMModelOS.Service/Models/Learn/LeanProcess.cs

@@ -15,7 +15,7 @@ namespace TEAMModelOS.Service.Models.Learn
     [CosmosDB(RU = 400, Name = "LeanProcess")]
     public class LeanProcess : ID
     {
-
+        public int? ttl { get; set; } = -1;
         public LeanProcess() {
             steps = new List<LearnUnit>();
         }

+ 1 - 0
TEAMModelOS.Service/Models/Learn/LeanRecord.cs

@@ -11,6 +11,7 @@ namespace TEAMModelOS.Service.Models.Learn
     [CosmosDB(RU = 400, Name = "LeanRecord")]
     public class LeanRecord : ID
     {
+        public int? ttl { get; set; } = -1;
         public LeanRecord() {
             steps = new List<RecordStep>();
         }

+ 1 - 0
TEAMModelOS.Service/Models/Learn/LearnUnit.cs

@@ -12,6 +12,7 @@ namespace TEAMModelOS.Service.Models.Learn
     [CosmosDB(RU = 400, Name = "LearnUnit")]
     public class LearnUnit:ID
     {
+        public int? ttl { get; set; } = -1;
         public LearnUnit() {
             //syllabus = new List<string>();
             resource = new List<string>();

+ 1 - 1
TEAMModelOS.Service/Models/Learn/LearningAutonomous.cs

@@ -14,7 +14,7 @@ namespace TEAMModelOS.Service.Models.Learn
     [CosmosDB(RU = 400, Name = "LearningAutonomous")]
     public class LearningAutonomous:ID
     {
-
+        public int? ttl { get; set; } = -1;
         public LearningAutonomous()
         {
             target = new List<Target>();

+ 1 - 0
TEAMModelOS.Service/Models/Syllabus/Knowledge.cs

@@ -17,6 +17,7 @@ namespace TEAMModelOS.Service.Models.Syllabus
     [ProtoContract]
     public class Knowledge: ID
     {
+        public int? ttl { get; set; } = -1;
         [ProtoMember(1)]
         public string id { get; set; }
         /// <summary>

+ 1 - 1
TEAMModelOS.Service/Models/Syllabus/SyllabusResource.cs

@@ -12,7 +12,7 @@ namespace TEAMModelOS.Service.Models.Syllabus
     [CosmosDB(RU = 400, Name = "SyllabusResource",Cache = true)]
     public class SyllabusResource : ID
     {
-
+        public int? ttl { get; set; } = -1;
         public string id { get; set; }
 
         /// <summary>

+ 2 - 0
TEAMModelOS.Service/Models/Syllabus/SyllabusVolume.cs

@@ -14,6 +14,8 @@ namespace TEAMModelOS.Service.Models.Syllabus
     [ProtoContract]
     public class SyllabusVolume :ID
     {
+
+        public int? ttl { get; set; } = -1;
         /// <summary>
         /// id生成规则
         /// </summary>

+ 1 - 0
TEAMModelOS.Service/Models/Syllabus/Syllabuses.cs

@@ -10,6 +10,7 @@ namespace TEAMModelOS.Service.Models.Syllabus
     [CosmosDB(RU = 400, Name = "Syllabus")]
     public class Syllabuses : ID
     {
+        public int? ttl { get; set; } = -1;
         /// <summary>
         /// 
         /// </summary>

+ 1 - 0
TEAMModelOS/Models/Family.cs

@@ -10,6 +10,7 @@ namespace TEAMModelOS.Controllers.Test
     [CosmosDB(RU = 400, Name = "Family")]
     public class Family : ID
     {
+        public int? ttl { get; set; } = -1;
         // public string Id { get; set; }
         public int FamilyOrder { get; set; }
         public string LastName { get; set; }

+ 1 - 1
TEAMModelOS/appsettings.Development.json

@@ -18,7 +18,7 @@
     "CosmosDB": {
       "ConnectionString": "https://192.168.8.128:8081",
       "ConnectionKey": "ddwAeGSf8Lsf1kxPXmdqnyzzi3CkJ0KW2BTPZ7Zq1N7qbJic5j7AaQ+WbF86F3rnzuDgGM1yg8O7BUFo93iA8w==",
-      "Database": "TEAMModelOS",
+      "Database": "TEAMModelOSTest",
       "CollectionThroughput": 400,
       "ScanModel": [ "TEAMModelOS.Service" ]
     },