Bläddra i källkod

删除无用的代码及对站内通知数据结构进行设计。

CrazyIter_Bin 4 år sedan
förälder
incheckning
75548830ba
31 ändrade filer med 250 tillägg och 588 borttagningar
  1. 89 1
      TEAMModelFunction/ActivityHttpTrigger.cs
  2. 2 2
      TEAMModelGrpc/Startup.cs
  3. 0 20
      TEAMModelOS.SDK/Extension/DataResult/JsonRequest/AzureJsonRequest.cs
  4. 0 16
      TEAMModelOS.SDK/Extension/DataResult/JsonRequest/BaseJosnRequest.cs
  5. 0 14
      TEAMModelOS.SDK/Extension/DataResult/JsonRequest/JosnRequest.cs
  6. 0 15
      TEAMModelOS.SDK/Extension/DataResult/JsonRequest/PaginationRequest.cs
  7. 0 13
      TEAMModelOS.SDK/Extension/DataResult/JsonResponse/BaseResponse.cs
  8. 0 19
      TEAMModelOS.SDK/Extension/DataResult/JsonResponse/DataJsonResponse.cs
  9. 0 14
      TEAMModelOS.SDK/Extension/DataResult/JsonResponse/EmptyJosnResponse.cs
  10. 0 19
      TEAMModelOS.SDK/Extension/DataResult/JsonResponse/ErrorJosnResponse.cs
  11. 0 15
      TEAMModelOS.SDK/Extension/DataResult/JsonResponse/ErrorModel.cs
  12. 0 16
      TEAMModelOS.SDK/Extension/DataResult/JsonResponse/JsonRPCResult.cs
  13. 0 20
      TEAMModelOS.SDK/Extension/DataResult/JsonResponse/PageJosnResponse.cs
  14. 0 15
      TEAMModelOS.SDK/Extension/DataResult/JsonResponse/PageJsonResult.cs
  15. 0 175
      TEAMModelOS.SDK/Extension/DataResult/JsonResponse/ResponseBuilder.cs
  16. 0 20
      TEAMModelOS.SDK/Extension/DataResult/JsonResponse/TokenJosnResponse.cs
  17. 0 18
      TEAMModelOS.SDK/Extension/DataResult/JsonResponse/TokenJsonResult.cs
  18. 0 13
      TEAMModelOS.SDK/Extension/DataResult/PageToken/AzurePagination.cs
  19. 0 17
      TEAMModelOS.SDK/Extension/DataResult/PageToken/AzureTableToken.cs
  20. 0 31
      TEAMModelOS.SDK/Extension/DataResult/PageToken/Pagination.cs
  21. 0 13
      TEAMModelOS.SDK/Extension/DataResult/RequestData/AzureTokenRequest.cs
  22. 0 12
      TEAMModelOS.SDK/Extension/DataResult/RequestData/BaseRequest.cs
  23. 0 10
      TEAMModelOS.SDK/Extension/DataResult/RequestData/PaginationRequest.cs
  24. 0 38
      TEAMModelOS.SDK/Extension/Language/Implements/LanguageService.cs
  25. 0 12
      TEAMModelOS.SDK/Extension/Language/Interfaces/ILanguageService.cs
  26. 0 18
      TEAMModelOS.SDK/Extension/Language/LanguageExtension.cs
  27. 0 10
      TEAMModelOS.SDK/Extension/Language/Model/SmsCountryCode.cs
  28. 93 0
      TEAMModelOS.SDK/Models/Cosmos/Common/Notice.cs
  29. 1 1
      TEAMModelOS/Controllers/School/CourseController.cs
  30. 1 1
      TEAMModelOS/Controllers/School/SchoolTeacherController.cs
  31. 64 0
      TEAMModelOS/Controllers/XTest/TestController.cs

+ 89 - 1
TEAMModelFunction/ActivityHttpTrigger.cs

@@ -35,6 +35,83 @@ namespace TEAMModelFunction
             _azureStorage = azureStorage;
             _azureRedis = azureRedis;
         }
+
+        /// <summary>
+        /// 修复已存在的课程且未初始化学生课程列表的业务。
+        /// </summary>
+        /// <param name="req"></param>
+        /// <param name="log"></param>
+        /// <returns></returns>
+        [FunctionName("fix-stu-course")]
+        public async Task<IActionResult> StuCourse([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req, ILogger log)
+        {
+            log.LogInformation("fix-stu-course...");
+            string originCode = await new StreamReader(req.Body).ReadToEndAsync();
+            List<Course> courses = new List<Course>();
+            var client = _azureCosmos.GetCosmosClient();
+            var query = $"select  *  from c ";
+            await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<Course>(queryText: query,
+                    requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Course-{originCode}") }))
+            {
+                courses.Add(item);
+            }
+            await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<Course>(queryText: query,
+                    requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Course-{originCode}") }))
+            {
+                courses.Add(item);
+            }
+            //2.获取课程的id 并尝试添加或移除对应的学生课程记录StuCourse。
+            foreach (var course in courses)
+            {
+                if (course.schedule.IsNotEmpty())
+                {
+                    foreach (var sc in course.schedule)
+                    {
+                        if (!string.IsNullOrEmpty(sc.stulist))
+                        {
+                            (List<string> tmdids, List<Students> studentss) = await TriggerStuActivity.GetStuList(client, new List<string>() { sc.stulist }, course.school);
+                            foreach (var addStu in studentss)
+                            {
+                                var stuCourse = new StuCourse
+                                {
+                                    id = course.id,
+                                    scode = course.code,
+                                    name = course.name,
+                                    code = $"StuCourse-{course.school}-{addStu.id}",
+                                    scope = course.scope,
+                                    school = course.school,
+                                    creatorId = course.creatorId,
+                                    pk = "StuCourse"
+                                };
+                                await client.GetContainer("TEAMModelOS", "Student").UpsertItemAsync(stuCourse, new PartitionKey(stuCourse.code));
+                            }
+                            foreach (var addTmd in tmdids)
+                            {
+                                var tmdCourse = new StuCourse
+                                {
+                                    id = course.id,
+                                    scode = course.code,
+                                    name = course.name,
+                                    code = $"StuCourse-{addTmd}",
+                                    scope = course.scope,
+                                    //school = courseChange.school,
+                                    creatorId = course.creatorId,
+                                    pk = "StuCourse"
+                                };
+                                await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync(tmdCourse, new PartitionKey(tmdCourse.code));
+                            }
+                        }
+                    }
+                }
+            }
+            return new OkObjectResult(new { });
+        }
+        /// <summary>
+        /// 设置评测未初始化学生列表的
+        /// </summary>
+        /// <param name="req"></param>
+        /// <param name="log"></param>
+        /// <returns></returns>
         [FunctionName("fix-exam-activity")]
         public   async Task<IActionResult> ExamActivity([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req,ILogger log)
         {
@@ -121,7 +198,12 @@ namespace TEAMModelFunction
             }
             return new OkObjectResult(new { });
         }
-
+        /// <summary>
+        /// 设置投票未初始化学生列表的业务
+        /// </summary>
+        /// <param name="req"></param>
+        /// <param name="log"></param>
+        /// <returns></returns>
         [FunctionName("fix-vote-activity")]
         public async Task<IActionResult> VoteActivity(
             [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
@@ -208,6 +290,12 @@ namespace TEAMModelFunction
             }
             return new OkObjectResult(new { });
         }
+        /// <summary>
+        /// 设置问卷调查未初始化学生列表的业务
+        /// </summary>
+        /// <param name="req"></param>
+        /// <param name="log"></param>
+        /// <returns></returns>
         [FunctionName("fix-survey-activity")]
         public async Task<IActionResult> SurveyActivity(
             [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,

+ 2 - 2
TEAMModelGrpc/Startup.cs

@@ -77,8 +77,8 @@ namespace TEAMModelGrpc
             //    .AddCosmosSerializer(new SystemTextJsonCosmosSerializer(new JsonSerializerOptions() { IgnoreNullValues = true }));
  
             //注入CSRedis
-            var csredis = new CSRedis.CSRedisClient(_conf.GetSection("Azure:Redis:ConnectionString").Get<string>());
-            RedisHelper.Initialization(csredis);
+           // var csredis = new CSRedis.CSRedisClient(_conf.GetSection("Azure:Redis:ConnectionString").Get<string>());
+           // RedisHelper.Initialization(csredis);
 
             //全局扫描基于IBusinessService接口的实现类
             //services.Scan(scan => scan.FromApplicationDependencies()

+ 0 - 20
TEAMModelOS.SDK/Extension/DataResult/JsonRequest/AzureJsonRequest.cs

@@ -1,20 +0,0 @@
-using TEAMModelOS.SDK;
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK
-{
-    /// <summary>
-    /// 
-    /// </summary>
-    /// <typeparam name="T"></typeparam>
-    public class AzureJsonRequest<T> : BaseJosnRequest
-    {
-
-        public AzureJsonRequest (){
-            @params = new AzureTokenRequest<T>();
-        }
-        public AzureTokenRequest<T> @params { get; set; }
-    }
-}

+ 0 - 16
TEAMModelOS.SDK/Extension/DataResult/JsonRequest/BaseJosnRequest.cs

@@ -1,16 +0,0 @@
-
-using System;
-
-namespace TEAMModelOS.SDK
-{
-    
-    public abstract class BaseJosnRequest
-    {
-      //  public long requestTime { get; set; } = DateTime.Now.ToUniversalTime().Ticks - 621355968000000000;
-       // public string jsonrpc { get; set; } = "2.0";
-        public string method { get; set; }
-    //    public int id { get; set; } = 1;
-      //  public int timeOffset { get; set; }
-        public string lang { get; set; } = "zh-CN";
-    }
-}

+ 0 - 14
TEAMModelOS.SDK/Extension/DataResult/JsonRequest/JosnRequest.cs

@@ -1,14 +0,0 @@
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK
-{
-    
-    public class JosnRequest<T>:BaseJosnRequest
-    {
-
-        public T @params { get; set; }
-    }
-}

+ 0 - 15
TEAMModelOS.SDK/Extension/DataResult/JsonRequest/PaginationRequest.cs

@@ -1,15 +0,0 @@
-
-
-using TEAMModelOS.SDK;
-
-namespace TEAMModelOS.SDK
-{
-    public  class PaginationJsonRequest<T> : BaseJosnRequest
-    {
-        public PaginationJsonRequest()
-        {
-            @params = new PaginationRequest<T>();
-        }
-        public PaginationRequest<T> @params { get; set; }
-    }
-}

+ 0 - 13
TEAMModelOS.SDK/Extension/DataResult/JsonResponse/BaseResponse.cs

@@ -1,13 +0,0 @@
-
-using Microsoft.VisualBasic;
-
-namespace TEAMModelOS.SDK
-{
-    
-    public class BaseResponse 
-    {
-      //  public string jsonrpc { get; set; } = "2.0";
-       // public double id { get; set; } = 1;
-       
-    }
-}

+ 0 - 19
TEAMModelOS.SDK/Extension/DataResult/JsonResponse/DataJsonResponse.cs

@@ -1,19 +0,0 @@
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK
-{
-    
-    public class DataJsonResponse<T> : BaseResponse
-    {
-		public DataJsonResponse() { 
-		  result=  new JsonRPCResult<T>();
-		}
-        public Dictionary<string, object> error { get; set; } = null;
-        public   JsonRPCResult<T> result { get; set; }
-        public int code { get; set; } = 0;
-        public string message { get; set; } = "Success";
-    }
-}

+ 0 - 14
TEAMModelOS.SDK/Extension/DataResult/JsonResponse/EmptyJosnResponse.cs

@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK
-{
-    public class EmptyJosnResponse :BaseResponse
-    {
-        public object result { get; set; } = null;
-        public Dictionary<string,object> error { get; set; } = null;
-        public int code { get; set; } = 1;
-        public string message { get; set; } = "Empty";
-    }
-}

+ 0 - 19
TEAMModelOS.SDK/Extension/DataResult/JsonResponse/ErrorJosnResponse.cs

@@ -1,19 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK
-{
-
-    public class ErrorJosnResponse : BaseResponse
-    {
-        public ErrorJosnResponse()
-        {
-            error = new Dictionary<string, object>();
-        }
-        public object result { get; set; } = null;
-        public Dictionary<string, object> error { get; set; }
-        public int code { get; set; } = 0;
-        public string message { get; set; } = "Error";
-    }
-}

+ 0 - 15
TEAMModelOS.SDK/Extension/DataResult/JsonResponse/ErrorModel.cs

@@ -1,15 +0,0 @@
-
-
-using System.Collections.Generic;
-
-namespace TEAMModelOS.SDK
-{
-    
-   
-
-    public class ErrorModel {
-        public int code { get; set; }
-        public string message { get; set; }
-        public Dictionary<string, object> data { get; set; } = null;
-    }
-}

+ 0 - 16
TEAMModelOS.SDK/Extension/DataResult/JsonResponse/JsonRPCResult.cs

@@ -1,16 +0,0 @@
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK
-{
-    
-    public class JsonRPCResult<T>
-    {
-        public Dictionary<string, object> extend { get; set; } = null;
-     //   public long responseTime { get; set; } = DateTime.Now.ToUniversalTime().Ticks - 621355968000000000;
-        public T data { get; set; }
-       
-    }
-}

+ 0 - 20
TEAMModelOS.SDK/Extension/DataResult/JsonResponse/PageJosnResponse.cs

@@ -1,20 +0,0 @@
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK
-{
-    
-    public class PageJosnResponse<T> : BaseResponse
-    {
-		public PageJosnResponse()
-		{
-			result = new PageJsonResult<T>();
-		}
-		public   PageJsonResult<T> result { get; set; }
-		public Dictionary<string, object> error { get; set; } = null;
-		public int code { get; set; } = 0;
-		public string message { get; set; } = "Success";
-	}
-}

+ 0 - 15
TEAMModelOS.SDK/Extension/DataResult/JsonResponse/PageJsonResult.cs

@@ -1,15 +0,0 @@
-using TEAMModelOS.SDK;
-
-
-namespace TEAMModelOS.SDK
-{
-    
-    public class PageJsonResult<T> : JsonRPCResult<T>
-    {
-        public Pagination page { get; set; }
-
-        public PageJsonResult()
-        {
-        }
-    }
-}

+ 0 - 175
TEAMModelOS.SDK/Extension/DataResult/JsonResponse/ResponseBuilder.cs

@@ -1,175 +0,0 @@
-using TEAMModelOS.SDK;
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK
-{
-    
-    public  class ResponseBuilder
-    {
-        private string message="Success";
-        private object data;
-        private long total;
-        private int currPage;
-        private int pageSize;
-        private int totalPage;
-        private Dictionary<string, object> extend;
-        private Pagination page;
-        private AzureTableToken token;
-        private ErrorModel error =null;
-        
-        public ResponseBuilder()
-        {
-        }
-        public ResponseBuilder Success()
-        {
-            error = null;
-            return this;
-        }
-
-        public ResponseBuilder Success(String message)
-        {
-            this.message = message;
-            return this;
-        }
-        public static ResponseBuilder custom()
-        {
-            return new ResponseBuilder();
-        }
-
-        public ResponseBuilder Data(object data)
-        {
-            this.data = data;
-            return this;
-        }
-		public ResponseBuilder Error( int code, string message)
-		{
-			
-			this.error = new ErrorModel { code=code, message=message, data = null };
-			return this;
-		}
-        public ResponseBuilder Error(int code, Dictionary<string,object> errorData)
-        {
-           
-            this.error = new ErrorModel { code = code, message = message ,data= errorData };
-            return this;
-        }
-        public ResponseBuilder Error( int code)
-		{
-
-            this.error = new ErrorModel { code = code, message = "Error", data = null };
-            return this;
-		}
-        public ResponseBuilder Error(int code, string message, Dictionary<string, object> errorData)
-        {
-
-            this.error = new ErrorModel { code = code, message = message, data = errorData };
-            return this;
-        }
-
-        public ResponseBuilder Extend(Dictionary<String, object> extend)
-        {
-            this.extend = extend;
-            return this;
-        }
-        public ResponseBuilder Token(AzureTableToken token)
-        {
-            this.token = token;
-            return this;
-        }
-        public ResponseBuilder Page(Pagination page)
-        {
-            this.pageSize = page.pageSize;
-            this.currPage = page.currPage;
-            this.total = page.total;
-            this.page = page;
-            this.totalPage = (int)Math.Ceiling((double)this.total / (double)this.pageSize);
-            return this;
-        }
-        public ResponseBuilder totalCount(int totalCount)
-        {
-            this.total = totalCount;
-            return this;
-        }
-
-        public ResponseBuilder CurrPage(int currPage)
-        {
-            this.currPage = currPage;
-            return this;
-        }
-
-        public ResponseBuilder PageSize(int pageSize)
-        {
-            this.pageSize = pageSize;
-            return this;
-        }
-
-        public ResponseBuilder TotalPage(int totalPage)
-        {
-            this.totalPage = totalPage;
-            return this;
-        }
-        public BaseResponse build()
-        {
-
-            object baseResponse = null;
-            if (error != null) {
-                ErrorJosnResponse errorJosnRPCResponse = new ErrorJosnResponse();
-                errorJosnRPCResponse.error = error.data;
-                errorJosnRPCResponse.code = error.code;
-                errorJosnRPCResponse.message = error.message;
-                return errorJosnRPCResponse;
-            }
-            if (this.total > 0 && this.pageSize > 0)
-            {
-                this.totalPage = (int)Math.Ceiling((double)this.total / (double)this.pageSize);
-            }
-            if (null != this.data && this.token != null)
-            {
-                TokenJosnResponse<object> response = new TokenJosnResponse<object>();
-                response.result.data = this.data;
-                response.result.extend = this.extend;
-                response.result.azureToken = this.token;
-                response.code = 0;
-                response.message = message;
-
-                baseResponse = response;
-            }
-            else if (null != this.data && this.total > 0 && this.currPage > 0 && this.pageSize > 0 && this.totalPage > 0)
-            {
-                PageJosnResponse<object> response = new PageJosnResponse<object>();
-                response.result.data = this.data;
-                response.result.page = new Pagination(this.total, this.currPage, this.pageSize, this.totalPage);
-                response.result.extend = this.extend;
-                response.message = message;
-                response.code = 0;
-                baseResponse = response;
-            }
-            else if (this.data != null)
-            {
-                DataJsonResponse<object> response = new DataJsonResponse<object>();
-                response.result.data = this.data;
-                response.result.extend = this.extend;
-                response.message = message;
-                response.code = 0;
-                baseResponse = response;
-            }
-            else if (this.data == null) {
-                DataJsonResponse<object> response = new DataJsonResponse<object>();
-                response.result.data = this.data;
-                response.result.extend = this.extend;
-                response.message = message;
-                response.code = 0;
-                baseResponse = response;
-            }
-            else
-            {
-                return new EmptyJosnResponse() ;
-            }
-            return (BaseResponse)baseResponse;
-        }
-         
-    }
-}

+ 0 - 20
TEAMModelOS.SDK/Extension/DataResult/JsonResponse/TokenJosnResponse.cs

@@ -1,20 +0,0 @@
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK
-{
-    
-    public class TokenJosnResponse<T>: BaseResponse
-    {
-		public TokenJosnResponse()
-		{
-			result = new TokenJsonResult<T>();
-		}
-		public  TokenJsonResult<T> result { get; set; }
-		public Dictionary<string, object> error { get; set; } = null;
-		public int code { get; set; } = 0;
-		public string message { get; set; } = "Success";
-	}
-}

+ 0 - 18
TEAMModelOS.SDK/Extension/DataResult/JsonResponse/TokenJsonResult.cs

@@ -1,18 +0,0 @@
-using TEAMModelOS.SDK;
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK
-{
-    
-    public class TokenJsonResult<T> : JsonRPCResult<T>
-    {
-       
-        public AzureTableToken azureToken { get; set; }
-        public TokenJsonResult() { }
-       // public int code { get; set; } = 0;
-      //  public string message { get; set; } = "Success";
-    }
-}

+ 0 - 13
TEAMModelOS.SDK/Extension/DataResult/PageToken/AzurePagination.cs

@@ -1,13 +0,0 @@
-
-using System.Collections.Generic;
-
-namespace TEAMModelOS.SDK
-{
-    
-    public class AzurePagination<T>
-    {
-        public AzurePagination(){}
-        public List<T> data { get; set; }
-        public AzureTableToken token { get; set; }
-    }
-}

+ 0 - 17
TEAMModelOS.SDK/Extension/DataResult/PageToken/AzureTableToken.cs

@@ -1,17 +0,0 @@
-
-using System.ComponentModel.DataAnnotations;
-
-namespace TEAMModelOS.SDK
-{
-    
-    public class AzureTableToken
-    {
-        //[Required]
-        public string NextPartitionKey { get; set; }
-        //[Required]
-        public string NextRowKey { get; set; }
-        public string NextTableName { get; set; }
-        //[Required]
-        public int? TargetLocation { get; set; }
-    }
-}

+ 0 - 31
TEAMModelOS.SDK/Extension/DataResult/PageToken/Pagination.cs

@@ -1,31 +0,0 @@
-
-using System;
-using System.Collections.Generic;
-
-namespace TEAMModelOS.SDK
-{
-    
-    public class Pagination
-    {
-        public long total { get; set; }
-        public int currPage { get; set; }
-        public int pageSize { get; set; } 
-        public int totalPage { get; set; }
-      
-        public Pagination() { }
-        public Pagination(long total, int currPage, int pageSize)
-        {
-            this.total = total;
-            this.currPage = currPage;
-            this.pageSize = pageSize;
-            this.totalPage = (int)Math.Ceiling((double)this.total / (double)this.pageSize);
-        }
-        public Pagination(long total, int currPage, int pageSize, int totalPage)
-        {
-            this.total = total;
-            this.currPage = currPage;
-            this.pageSize = pageSize;
-            this.totalPage = totalPage;
-        }
-    }
-}

+ 0 - 13
TEAMModelOS.SDK/Extension/DataResult/RequestData/AzureTokenRequest.cs

@@ -1,13 +0,0 @@
-using TEAMModelOS.SDK;
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK
-{
-   public class AzureTokenRequest<T> :BaseRequest
-   {
-        public T data { get; set; }
-        public AzureTableToken azureToken { get; set; }
-   }
-}

+ 0 - 12
TEAMModelOS.SDK/Extension/DataResult/RequestData/BaseRequest.cs

@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace TEAMModelOS.SDK
-{
-    public class BaseRequest
-    {
-        public long requestTime { get; set; } = DateTime.Now.ToUniversalTime().Ticks - 621355968000000000;
-        public string method { get; set; }
-        public string repeatToken { get; set; }
-    }
-}

+ 0 - 10
TEAMModelOS.SDK/Extension/DataResult/RequestData/PaginationRequest.cs

@@ -1,10 +0,0 @@
-using TEAMModelOS.SDK;
-
-namespace TEAMModelOS.SDK
-{
-    public class PaginationRequest<T> : BaseRequest
-    {
-        public T data { get; set; }
-        public Pagination  page{ get; set; }
-    }
-}

+ 0 - 38
TEAMModelOS.SDK/Extension/Language/Implements/LanguageService.cs

@@ -1,38 +0,0 @@
-using TEAMModelOS.SDK.Extension.Language.Interfaces;
-using TEAMModelOS.SDK.Extension.Language.Model;
-using Microsoft.Extensions.Options;
-using System.Collections.Generic;
-
-namespace TEAMModelOS.SDK.Extension.Language.Implements
-{
-    public class LanguageService : ILanguageService
-    {
-        private Dictionary<string, SmsCountryCode> smsMap { get; set; }
-        public List<SmsCountryCode> countryCodes;
-
-        public LanguageService(IOptions<List<SmsCountryCode>> _option)
-        {
-            countryCodes = _option.Value;
-           
-        }
-        private LanguageService SmsLanguage()
-        {
-            foreach (SmsCountryCode sms in countryCodes) {
-                if (this.smsMap == null)
-                {
-                    smsMap = new Dictionary<string, SmsCountryCode>();
-                }
-                if (!smsMap.ContainsKey(sms.CountryCode))
-                {
-                    smsMap.Add(sms.CountryCode, sms);
-                }
-            }
-            return this;
-        }
-        public Dictionary<string, SmsCountryCode> GetSmsLanguage()
-        {
-            SmsLanguage();
-            return smsMap;
-        }
-    }
-}

+ 0 - 12
TEAMModelOS.SDK/Extension/Language/Interfaces/ILanguageService.cs

@@ -1,12 +0,0 @@
-using TEAMModelOS.SDK.Extension.Language.Model;
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK.Extension.Language.Interfaces
-{
-    public interface ILanguageService
-    {
-        Dictionary<string, SmsCountryCode> GetSmsLanguage();
-    }
-}

+ 0 - 18
TEAMModelOS.SDK/Extension/Language/LanguageExtension.cs

@@ -1,18 +0,0 @@
-using TEAMModelOS.SDK.Extension.Language.Implements;
-using TEAMModelOS.SDK.Extension.Language.Interfaces;
-using TEAMModelOS.SDK.Extension.Language.Model;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using System.Collections.Generic;
-
-namespace TEAMModelOS.SDK.Extension.Language
-{
-    public static class RedisExtension
-    {
-        public static void AddLanguage(this IServiceCollection services, IConfigurationSection LangConfiguration)
-        {
-            services.Configure<List<SmsCountryCode>>(LangConfiguration);
-            services.AddScoped<ILanguageService, LanguageService>();
-        }
-    }
-}

+ 0 - 10
TEAMModelOS.SDK/Extension/Language/Model/SmsCountryCode.cs

@@ -1,10 +0,0 @@
-namespace TEAMModelOS.SDK.Extension.Language.Model
-{
-    public  class SmsCountryCode
-    {
-        public string Name { get; set; }
-        public string CountryCode { get; set; }
-        public string Language { get; set; }
-        public string SmsLang { get; set; }
-    }
-}

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

@@ -0,0 +1,93 @@
+using Microsoft.Azure.Cosmos.Table;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Models.Table
+{
+
+
+    /// <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
+    /// 通知主体存放位置:  /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>
+        /// 业务的id
+        /// </summary>
+        public string id { get; set; }
+        /// <summary>
+        /// Notice-{hbcn/tmdid}
+        /// </summary>
+        public string code { get; set; }
+        public string scode { get; set; }
+        public string school { get; set; }
+        public string scope { get; set; }
+        public string spk { get; set; }
+        /// <summary>
+        /// 通知
+        /// </summary>
+        public string pk { get; set; } = "Notice";
+        /// <summary>
+        /// 类型
+        /// </summary>
+        public string type { get; set; }
+        public int level { get; set; }
+        public string data { get; set; }
+        public int stime { get; set; }
+        public int etime { get; set; }
+        /// <summary>
+        /// 被通知的醍摩豆账号
+        /// </summary>
+        public List<string> tmdids { get; set; }
+        /// <summary>
+        /// 被通知的学校学生账号
+        /// </summary>
+        public List<string> stuids { get; set; }
+    }
+    /*
+    {
+        "id":"通知id"
+        "code":"接收者1",
+        "status":"接收状态/已发送/已查看",
+        "pk":"receiver",
+        "ttl":2592000,不能超过30天(2592000),一天(3600),一周(25200)
+    }
+     */
+    public class Receiver : CosmosEntity
+    {
+        public string pk { get; set; } = "Receiver";
+        /// <summary>
+        /// 0 已发送,1已查看,2已处理,-1已过期
+        /// </summary>
+        public int status { get; set; }=0;
+
+    }
+}

+ 1 - 1
TEAMModelOS/Controllers/School/CourseController.cs

@@ -1362,7 +1362,7 @@ namespace TEAMModelOS.Controllers
         [HttpPost("find-teach-class")]
         public async Task<IActionResult> FindPlanClass(JsonElement request)
         {
-            ResponseBuilder builder = ResponseBuilder.custom();
+            
             HashSet<string> data = new HashSet<string>();
             if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
             if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();

+ 1 - 1
TEAMModelOS/Controllers/School/SchoolTeacherController.cs

@@ -103,7 +103,7 @@ namespace TEAMModelOS.Controllers
         [HttpPost("get-teacher-authoritylist")]
         public async Task<IActionResult> GetSchoolAuthorityList()
         {
-            ResponseBuilder builder = ResponseBuilder.custom();
+             
             Dictionary<string, object> dict = new Dictionary<string, object>
             {
                 { "PartitionKey",  "authority"}

+ 64 - 0
TEAMModelOS/Controllers/XTest/TestController.cs

@@ -118,7 +118,71 @@ namespace TEAMModelOS.Controllers.XTest
 
 
 
+        [ProducesDefaultResponseType]
+        //[AuthToken(Roles = "teacher")]
+        [HttpPost("fix-stu-course")]
+        public async Task<IActionResult> fixStuCourse(JsonElement request) {
 
+            string originCode = request.GetProperty("originCode").GetString();
+            List<Course> courses = new List<Course>();
+            var client = _azureCosmos.GetCosmosClient();
+            var query = $"select  *  from c ";
+            await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<Course>(queryText: query,
+                    requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Course-{originCode}") }))
+            {
+                courses.Add(item);
+            }
+            await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<Course>(queryText: query,
+                    requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Course-{originCode}") }))
+            {
+                courses.Add(item);
+            }
+            //2.获取课程的id 并尝试添加或移除对应的学生课程记录StuCourse。
+            foreach (var course in courses)
+            {
+                if (course.schedule.IsNotEmpty())
+                {
+                    foreach (var sc in course.schedule)
+                    {
+                        if (!string.IsNullOrEmpty(sc.stulist))
+                        {
+                            (List<string> tmdids, List<Students> studentss) = await TriggerStuActivity.GetStuList(client, new List<string>() { sc.stulist }, course.school);
+                            foreach (var addStu in studentss)
+                            {
+                                var stuCourse = new StuCourse
+                                {
+                                    id = course.id,
+                                    scode = course.code,
+                                    name = course.name,
+                                    code = $"StuCourse-{course.school}-{addStu.id}",
+                                    scope = course.scope,
+                                    school = course.school,
+                                    creatorId = course.creatorId,
+                                    pk = "StuCourse"
+                                };
+                                await client.GetContainer("TEAMModelOS", "Student").UpsertItemAsync(stuCourse, new PartitionKey(stuCourse.code));
+                            }
+                            foreach (var addTmd in tmdids)
+                            {
+                                var tmdCourse = new StuCourse
+                                {
+                                    id = course.id,
+                                    scode = course.code,
+                                    name = course.name,
+                                    code = $"StuCourse-{addTmd}",
+                                    scope = course.scope,
+                                    //school = courseChange.school,
+                                    creatorId = course.creatorId,
+                                    pk = "StuCourse"
+                                };
+                                await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync(tmdCourse, new PartitionKey(tmdCourse.code));
+                            }
+                        }
+                    }
+                }
+            }
+            return new OkObjectResult(new { });
+        }