Browse Source

清理知识点,学习活动,作业活动,缓存模块没有用到的代码。

CrazyIter_Bin 4 years ago
parent
commit
54b1b9aaca
31 changed files with 15 additions and 2524 deletions
  1. 1 4
      TEAMModelFunction/TriggerStuActivity.cs
  2. 0 88
      TEAMModelOS.SDK/Models/Cosmos/Common/ActivityData.cs
  3. 3 5
      TEAMModelOS.SDK/Models/Cosmos/Common/Homework.cs
  4. 0 25
      TEAMModelOS.SDK/Models/Cosmos/Common/Inner/Target.cs
  5. 0 303
      TEAMModelOS.SDK/Module/Cache/CSRedisCacheService.cs
  6. 0 205
      TEAMModelOS.SDK/Module/Cache/ICacheService.cs
  7. 0 311
      TEAMModelOS.SDK/Module/Cache/MemoryCacheService.cs
  8. 0 26
      TEAMModelOS/Controllers/Common/SurveyController.cs
  9. 0 30
      TEAMModelOS/Controllers/Common/VoteController.cs
  10. 0 23
      TEAMModelOS/Controllers/School/StudentCommonController.cs
  11. 1 47
      TEAMModelOS/Controllers/Teacher/TeacherCommonController.cs
  12. 0 537
      TEAMModelOS/Controllers/knowledge/KnowledgeController.cs
  13. 0 170
      TEAMModelOS/JsonFile/Core/LangConfig.json
  14. 0 14
      TEAMModelOS/JsonFile/Core/cosmosdb.cer
  15. 0 27
      TEAMModelOS/JwtRsaFile/private.pem
  16. 0 9
      TEAMModelOS/JwtRsaFile/public.pem
  17. 0 18
      TEAMModelOS/Models/Dto/AzureBlobSASDto.cs
  18. 0 51
      TEAMModelOS/Models/Dto/BlockPointDto.cs
  19. 0 18
      TEAMModelOS/Models/Dto/CommentsDto.cs
  20. 0 14
      TEAMModelOS/Models/Dto/CommonQuery.cs
  21. 0 29
      TEAMModelOS/Models/Dto/CoursePlanDto.cs
  22. 0 51
      TEAMModelOS/Models/Dto/HomeWorkCommentDto.cs
  23. 0 18
      TEAMModelOS/Models/Dto/HomeWorkDto.cs
  24. 0 22
      TEAMModelOS/Models/Dto/HomeWorkFindDto.cs
  25. 0 42
      TEAMModelOS/Models/Dto/HomeWorkScoringDto.cs
  26. 0 20
      TEAMModelOS/Models/Dto/KnowledgeDto.cs
  27. 0 31
      TEAMModelOS/Models/Dto/PointDto.cs
  28. 3 348
      TEAMModelOS/Services/Common/ActivityStudentService.cs
  29. 7 2
      TEAMModelOS/TEAMModelOS.csproj
  30. 0 27
      TEAMModelOS/private.pem
  31. 0 9
      TEAMModelOS/public.pem

+ 1 - 4
TEAMModelFunction/TriggerStuActivity.cs

@@ -25,16 +25,13 @@ namespace TEAMModelFunction
                 {
                     await client.GetContainer("TEAMModelOS", "Student").UpsertItemAsync(x, new PartitionKey(x.code));
                 }
-
-
             }
             if (tmdActivities.IsNotEmpty())
             {
                 foreach (var x in tmdActivities)
                 {
-                    await client.GetContainer("TEAMModelOS", "Student").UpsertItemAsync(x, new PartitionKey(x.code));
+                    await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync(x, new PartitionKey(x.code));
                 }
-
             }
             return ""; 
         }

+ 0 - 88
TEAMModelOS.SDK/Models/Cosmos/Common/ActivityData.cs

@@ -1,88 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK.Models.Cosmos
-{
-
-    /// <summary>
-    /// 
-    /// [
-    //      Activity|-----问卷调查
-    //        |-----投票活动
-    //        |-----评测活动
-    //        |-----作业活动
-    //        |-----学习活动
-    //]
-    //[
-    //    {
-    //        "type": "vote",//"vote"/"exam"/"homework"/"learn"/"survey"
-    //        "name": "第一届紫藤小学人气教师投票",
-    //        "startTime": 1608274766154,
-    //        "endTime": 1608912000000,
-    //        "scode": "Vote-hbcn",
-    //        "id": "aaaaaaaaaaaaaaaaaaa",
-    //        "code": "Activity-hbcn",
-    //        "pk": "Activity",
-    //        "scope":"private/school/teacher",
-    //        "classes":["S-C-00001","S-C-00002","S-C-00003","S-C-00004"],
-    //        "tmdids":["TMDID0001","TMDID0002","TMDID0003","TMDID0004",]//只有问卷调查和投票活动设置,且分区键必须为学校的
-    //},
-    //    {
-    //        "type": "vote",//"vote"/"exam"/"homework"/"learn"/"survey"
-    //        "name": "第一届醍摩豆杯人气教师投票",
-    //        "startTime": 1608274766154,
-    //        "endTime": 1608912000000,
-    //        "scode": "Vote-TMDID0001",
-    //        "id": "bbbbbbbbbbbbbbbbbbbbb",
-    //        "code": "Activity-Common",//教师个人发布的活动统一使用Common,用班级子查询
-    //        "pk": "Activity",
-    //        "scope":"private/school/teacher",
-    //        "classes":["P-C-00004","S-C-00001"],//如果是醍摩豆ID则直接搜寻加入的私人教师编码,如果是校内学生则需要多搜寻一次。
-    //        "tmdids":[]
-    //    }
-    //]
-    ///简单阐述说明:
-    /// 1.  对于学校产生的活动 即scope=school  或scope=teacher  则对应活动原本的数据的owner 则直接为学校的编码,且ActivityData的code为Activity-学校编码 ActivityData数据存在School表
-    ///     如果scope=private,则活动是老师个人活动,owner=tmdid  ,ActivityData的code则为Activity-Common ActivityData且数据存在Teacher表
-    ///     
-    /// 2.  学生端查询包含 tmdid登录者(可能包含加入学校的教师)以学生身份登入学生端,
-    ///     则需要知道 登录人加入的私人教室id  则输入条件是classes=['私人教室id'],!!!
-    ///     或者用id身份去查询是否存在于tmdids 表示是否是单独被邀请加入活动的。!!!但是这种情况只存在于加入学校的教师,因为私人教室不允许随意邀请别的tmdid,只能加入私人教室。
-    ///     如果是学校学生以学生身份登入,则需要知道该学生加入的学校的班级和私人教室的班级 则classes=['私人教室id','学校教室id']
-    ///     
-    /// 3.  教师端查询ActivityData,则 查询权限为班主任或任课教师等,且这种查询只会存在于校园内的活动,包含scope=school,teacher 发布对象为校园班级班级
-    ///     则需要知道班主任,任课教室管理的班级 则classes=["学校班级id1","学校班级id2"]
-    ///     查询条件 code=Activity-hbcn   classes=["学校班级id1","学校班级id2"]  任课教师的科目id  subjects=["科目id1","科目id2"]
-    /// </summary>
-    public class ActivityData : CosmosEntity
-    {
-       
-        public ActivityData() {
-            pk = "Activity";
-        }
-        /// <summary>
-        /// 业务类型  vote投票 survey问卷 exam评测 learn学习活动 homework作业活动
-        /// </summary>
-        public string type { get; set; }
-        public string name { get; set; }
-        public long  startTime { get; set; }
-        public long endTime { get; set; }
-        /// <summary>
-        /// pending 待发布|going 已发布|finish 已结束
-        /// </summary>
-        public string progress { get; set; }
-        /// <summary>
-        /// 活动的分区键 Vote-hbcn/Vote-1606294378
-        /// </summary>
-        public string scode { get; set; }
-        /// <summary>
-        /// private/school/teacher
-        /// </summary>
-        public string scope { get; set; }
-        public List<string> classes { get; set; } = new List<string> { "" };
-        public List<string> tmdids { get; set; } = new List<string> { "" };
-        //public string owner { get; set; }
-        public List<string> subjects { get; set; } = new List<string> { "" };
-    }
-}

+ 3 - 5
TEAMModelOS.SDK/Models/Cosmos/Common/Homework.cs

@@ -15,7 +15,8 @@ namespace TEAMModelOS.SDK.Models
     {        
         public Homework()
         {
-            target = new List<Target>();
+           
+
             resource = new List<ProcessRes>();
         }   
 
@@ -24,10 +25,7 @@ namespace TEAMModelOS.SDK.Models
         /// </summary>
         public string name { get; set; }
 
-        /// <summary>
-        /// 作业发布对象
-        /// </summary>
-        public List<Target> target { get; set; }
+       
 
         /// <summary>
         /// 发布模式 0 立即发布 1 定时

+ 0 - 25
TEAMModelOS.SDK/Models/Cosmos/Common/Inner/Target.cs

@@ -1,25 +0,0 @@
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Text;
-
-namespace TEAMModelOS.SDK.Models
-{
-    /// <summary>
-    /// 发布对象
-    /// </summary>
-    
-    public class Target
-    {
-        [Required(ErrorMessage = "{0} 必须填写")]
-        
-        public string classroomCode { get; set; }
-        //[Required(ErrorMessage = "{0} 必须填写")]
-        //[ProtoMember(2)]
-        //public string code { get; set; }
-        
-        public string classroomName { get; set; }
-
-    }
-}

+ 0 - 303
TEAMModelOS.SDK/Module/Cache/CSRedisCacheService.cs

@@ -1,303 +0,0 @@
-using Microsoft.Extensions.Caching.Distributed;
-using Microsoft.Extensions.Caching.Redis;
- 
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Text.Json;
-using System.Threading.Tasks;
-
-namespace TEAMModelOS.SDK.Module.Cache
-{
-    public class CSRedisCacheService :ICacheService//,IDisposable
-    {
-        protected IDistributedCache _cache;
-
-        public CSRedisCacheService(IDistributedCache cache  )
-        {
-            _cache = cache;
-        }
-
-    
-     /// <summary>
-     /// 验证缓存项是否存在
-     /// </summary>
-     /// <param name="key">缓存Key</param>
-     /// <returns></returns>
-    public bool Exists(string key)
-    {
-        if (key == null)
-        {
-            throw new ArgumentNullException(nameof(key));
-        }
-          return  RedisHelper.Instance.Exists(key);
-          //  return _cache.KeyExists(GetKeyForRedis(key));
-    }/// <summary>
-     /// 添加缓存
-     /// </summary>
-     /// <param name="key">缓存Key</param>
-     /// <param name="value">缓存Value</param>
-     /// <returns></returns>
-    public bool Add(string key, object value)
-    {
-        if (key == null)
-        {
-            throw new ArgumentNullException(nameof(key));
-        }
-         _cache.Set(key, Encoding.UTF8.GetBytes(JsonSerializer.Serialize(value)));
-        return Exists(key);
-    }
-    /// <summary>
-    /// 添加缓存
-    /// </summary>
-    /// <param name="key">缓存Key</param>
-    /// <param name="value">缓存Value</param>
-    /// <param name="expiresSliding">滑动过期时长(如果在过期时间内有操作,则以当前时间点延长过期时间,Redis中无效)</param>
-    /// <param name="expiressAbsoulte">绝对过期时长</param>
-    /// <returns></returns>
-    public bool Add(string key, object value, TimeSpan expiresSliding, TimeSpan expiressAbsoulte)
-    {
-        if (key == null)
-        {
-            throw new ArgumentNullException(nameof(key));
-        }
-             _cache.Set(key, Encoding.UTF8.GetBytes(JsonSerializer.Serialize(value)), new DistributedCacheEntryOptions() { AbsoluteExpirationRelativeToNow=expiressAbsoulte,SlidingExpiration=expiresSliding});
-            return Exists(key);
-        }
-    /// <summary>
-    /// 添加缓存
-    /// </summary>
-    /// <param name="key">缓存Key</param>
-    /// <param name="value">缓存Value</param>
-    /// <param name="expiresIn">缓存时长</param>
-    /// <param name="isSliding">是否滑动过期(如果在过期时间内有操作,则以当前时间点延长过期时间,Redis中无效)</param>
-    /// <returns></returns>
-    public bool Add(string key, object value, TimeSpan expiresIn, bool isSliding = false)
-    {
-        if (key == null)
-        {
-            throw new ArgumentNullException(nameof(key));
-        }
-            _cache.Set(key, Encoding.UTF8.GetBytes(JsonSerializer.Serialize(value)), new DistributedCacheEntryOptions() { SlidingExpiration = expiresIn });
-            return Exists(key);
-          //  return _cache.StringSet(GetKeyForRedis(key), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), expiresIn);
-    }/// <summary>
-     /// 删除缓存
-     /// </summary>
-     /// <param name="key">缓存Key</param>
-     /// <returns></returns>
-    public bool Remove(string key)
-    {
-        if (key == null)
-        {
-            throw new ArgumentNullException(nameof(key));
-        }
-         _cache.Remove(key);
-        return !Exists(key);
-     }
-    /// <summary>
-    /// 批量删除缓存
-    /// </summary>
-    /// <param name="key">缓存Key集合</param>
-    /// <returns></returns>
-    public void RemoveAll(IEnumerable<string> keys)
-    {
-        if (keys == null)
-        {
-            throw new ArgumentNullException(nameof(keys));
-        }
-
-        keys.ToList().ForEach(item => Remove(item));
-    }
-
-
-    /// <summary>
-    /// 获取缓存
-    /// </summary>
-    /// <param name="key">缓存Key</param>
-    /// <returns></returns>
-    public T Get<T>(string key) where T : class
-    {
-        if (key == null)
-        {
-            throw new ArgumentNullException(nameof(key));
-        }
-
-        var value = _cache.GetString(key);
-
-        if ( string.IsNullOrEmpty(value))
-        {
-            return default(T);
-        }
-
-            return JsonSerializer.Deserialize<T>(value);
-    }
-
-    /// <summary>
-    /// 获取缓存
-    /// </summary>
-    /// <param name="key">缓存Key</param>
-    /// <returns></returns>
-    public object Get(string key)
-    {
-        if (key == null)
-        {
-            throw new ArgumentNullException(nameof(key));
-        }
-
-        var value = _cache.GetString(key);
-
-        if (string.IsNullOrEmpty(value))
-        {
-            return null;
-        }
-        return JsonSerializer.Deserialize<object>(value);
-    }   /// <summary>
-        /// 获取缓存集合
-        /// </summary>
-        /// <param name="keys">缓存Key集合</param>
-        /// <returns></returns>
-    public IDictionary<string, object> GetAll(IEnumerable<string> keys)
-    {
-        if (keys == null)
-        {
-            throw new ArgumentNullException(nameof(keys));
-        }
-        var dict = new Dictionary<string, object>();
-
-        keys.ToList().ForEach(item => dict.Add(item, Get(item)));
-
-        return dict;
-    }
-
-    /// <summary>
-    /// 修改缓存
-    /// </summary>
-    /// <param name="key">缓存Key</param>
-    /// <param name="value">新的缓存Value</param>
-    /// <returns></returns>
-    public bool Replace(string key, object value)
-    {
-        if (key == null)
-        {
-            throw new ArgumentNullException(nameof(key));
-        }
-
-        if (Exists(key))
-            if (!Remove(key))
-                return false;
-
-        return Add(key, value);
-
-    }
-    /// <summary>
-    /// 修改缓存
-    /// </summary>
-    /// <param name="key">缓存Key</param>
-    /// <param name="value">新的缓存Value</param>
-    /// <param name="expiresSliding">滑动过期时长(如果在过期时间内有操作,则以当前时间点延长过期时间)</param>
-    /// <param name="expiressAbsoulte">绝对过期时长</param>
-    /// <returns></returns>
-    public bool Replace(string key, object value, TimeSpan expiresSliding, TimeSpan expiressAbsoulte)
-    {
-        if (key == null)
-        {
-            throw new ArgumentNullException(nameof(key));
-        }
-
-        if (Exists(key))
-            if (!Remove(key))
-                return false;
-
-        return Add(key, value, expiresSliding, expiressAbsoulte);
-    }
-    /// <summary>
-    /// 修改缓存
-    /// </summary>
-    /// <param name="key">缓存Key</param>
-    /// <param name="value">新的缓存Value</param>
-    /// <param name="expiresIn">缓存时长</param>
-    /// <param name="isSliding">是否滑动过期(如果在过期时间内有操作,则以当前时间点延长过期时间)</param>
-    /// <returns></returns>
-    public bool Replace(string key, object value, TimeSpan expiresIn, bool isSliding = false)
-    {
-        if (key == null)
-        {
-            throw new ArgumentNullException(nameof(key));
-        }
-
-        if (Exists(key))
-            if (!Remove(key)) return false;
-
-        return Add(key, value, expiresIn, isSliding);
-    }
-    //public void Dispose()
-    //{
-    //    if (_connection != null)
-    //        _connection.Dispose();
-    //    GC.SuppressFinalize(this);
-    //}
-
-
-    public async Task<bool> ExistsAsync(string key)
-    {
-        return await Task.Run(() => Exists(key));
-    }
-
-    public async Task<bool> AddAsync(string key, object value)
-    {
-        return await Task.Run(() => Add(key, value));
-    }
-
-    public async Task<bool> AddAsync(string key, object value, TimeSpan expiresSliding, TimeSpan expiressAbsoulte)
-    {
-        return await Task.Run(() => Add(key, value, expiresSliding, expiressAbsoulte));
-    }
-
-    public async Task<bool> AddAsync(string key, object value, TimeSpan expiresIn, bool isSliding = false)
-    {
-        return await Task.Run(() => Add(key, value, expiresIn, isSliding));
-    }
-
-    public async Task<bool> RemoveAsync(string key)
-    {
-        return await Task.Run(() => Remove(key));
-    }
-
-    public async Task RemoveAllAsync(IEnumerable<string> keys)
-    {
-        await Task.Run(() => RemoveAll(keys));
-    }
-
-    public async Task<T> GetAsync<T>(string key) where T : class
-    {
-        return await Task.Run(() => Get<T>(key));
-    }
-
-    public async Task<object> GetAsync(string key)
-    {
-        return await Task.Run(() => Get(key));
-    }
-
-    public async Task<IDictionary<string, object>> GetAllAsync(IEnumerable<string> keys)
-    {
-        return await Task.Run(() => GetAll(keys));
-    }
-
-    public async Task<bool> ReplaceAsync(string key, object value)
-    {
-        return await Task.Run(() => Replace(key, value));
-    }
-
-    public async Task<bool> ReplaceAsync(string key, object value, TimeSpan expiresSliding, TimeSpan expiressAbsoulte)
-    {
-        return await Task.Run(() => Replace(key, value, expiresSliding, expiressAbsoulte));
-    }
-
-    public async Task<bool> ReplaceAsync(string key, object value, TimeSpan expiresIn, bool isSliding = false)
-    {
-        return await Task.Run(() => Replace(key, value, expiresIn, isSliding));
-    }
-}
-}

+ 0 - 205
TEAMModelOS.SDK/Module/Cache/ICacheService.cs

@@ -1,205 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace TEAMModelOS.SDK.Module.Cache
-{
-    public interface ICacheService
-    {
-        /// <summary>
-        /// 验证缓存项是否存在
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <returns></returns>
-        bool Exists(string key);
-
-        /// <summary>
-        /// 验证缓存项是否存在(异步方式)
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <returns></returns>
-        Task<bool> ExistsAsync(string key);
-        /// <summary>
-        /// 添加缓存
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <param name="value">缓存Value</param>
-        /// <returns></returns>
-        bool Add(string key, object value);
-
-        /// <summary>
-        /// 添加缓存(异步方式)
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <param name="value">缓存Value</param>
-        /// <returns></returns>
-        Task<bool> AddAsync(string key, object value);
-
-        /// <summary>
-        /// 添加缓存
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <param name="value">缓存Value</param>
-        /// <param name="expiresSliding">滑动过期时长(如果在过期时间内有操作,则以当前时间点延长过期时间)</param>
-        /// <param name="expiressAbsoulte">绝对过期时长</param>
-        /// <returns></returns>
-        bool Add(string key, object value, TimeSpan expiresSliding, TimeSpan expiressAbsoulte);
-
-        /// <summary>
-        /// 添加缓存(异步方式)
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <param name="value">缓存Value</param>
-        /// <param name="expiresSliding">滑动过期时长(如果在过期时间内有操作,则以当前时间点延长过期时间)</param>
-        /// <param name="expiressAbsoulte">绝对过期时长</param>
-        /// <returns></returns>
-        Task<bool> AddAsync(string key, object value, TimeSpan expiresSliding, TimeSpan expiressAbsoulte);
-
-        /// <summary>
-        /// 添加缓存
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <param name="value">缓存Value</param>
-        /// <param name="expiresIn">缓存时长</param>
-        /// <param name="isSliding">是否滑动过期(如果在过期时间内有操作,则以当前时间点延长过期时间)</param>
-        /// <returns></returns>
-        bool Add(string key, object value, TimeSpan expiresIn, bool isSliding = false);
-
-        /// <summary>
-        /// 添加缓存(异步方式)
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <param name="value">缓存Value</param>
-        /// <param name="expiresIn">缓存时长</param>
-        /// <param name="isSliding">是否滑动过期(如果在过期时间内有操作,则以当前时间点延长过期时间)</param>
-        /// <returns></returns>
-        Task<bool> AddAsync(string key, object value, TimeSpan expiresIn, bool isSliding = false);
-        /// <summary>
-        /// 删除缓存
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <returns></returns>
-        bool Remove(string key);
-
-        /// <summary>
-        /// 删除缓存(异步方式)
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <returns></returns>
-        Task<bool> RemoveAsync(string key);
-
-        /// <summary>
-        /// 批量删除缓存
-        /// </summary>
-        /// <param name="key">缓存Key集合</param>
-        /// <returns></returns>
-        void RemoveAll(IEnumerable<string> keys);
-
-        /// <summary>
-        /// 批量删除缓存(异步方式)
-        /// </summary>
-        /// <param name="key">缓存Key集合</param>
-        /// <returns></returns>
-        Task RemoveAllAsync(IEnumerable<string> keys);
-
-        /// <summary>
-        /// 获取缓存
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <returns></returns>
-        T Get<T>(string key) where T : class;
-
-        /// <summary>
-        /// 获取缓存(异步方式)
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <returns></returns>
-        Task<T> GetAsync<T>(string key) where T : class;
-
-        /// <summary>
-        /// 获取缓存
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <returns></returns>
-        object Get(string key);
-
-        /// <summary>
-        /// 获取缓存(异步方式)
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <returns></returns>
-        Task<object> GetAsync(string key);
-
-        /// <summary>
-        /// 获取缓存集合
-        /// </summary>
-        /// <param name="keys">缓存Key集合</param>
-        /// <returns></returns>
-        IDictionary<string, object> GetAll(IEnumerable<string> keys);
-
-        /// <summary>
-        /// 获取缓存集合(异步方式)
-        /// </summary>
-        /// <param name="keys">缓存Key集合</param>
-        /// <returns></returns>
-        Task<IDictionary<string, object>> GetAllAsync(IEnumerable<string> keys);
-
-        /// <summary>
-        /// 修改缓存
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <param name="value">新的缓存Value</param>
-        /// <returns></returns>
-        bool Replace(string key, object value);
-
-        /// <summary>
-        /// 修改缓存(异步方式)
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <param name="value">新的缓存Value</param>
-        /// <returns></returns>
-        Task<bool> ReplaceAsync(string key, object value);
-
-        /// <summary>
-        /// 修改缓存
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <param name="value">新的缓存Value</param>
-        /// <param name="expiresSliding">滑动过期时长(如果在过期时间内有操作,则以当前时间点延长过期时间)</param>
-        /// <param name="expiressAbsoulte">绝对过期时长</param>
-        /// <returns></returns>
-        bool Replace(string key, object value, TimeSpan expiresSliding, TimeSpan expiressAbsoulte);
-
-        /// <summary>
-        /// 修改缓存(异步方式)
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <param name="value">新的缓存Value</param>
-        /// <param name="expiresSliding">滑动过期时长(如果在过期时间内有操作,则以当前时间点延长过期时间)</param>
-        /// <param name="expiressAbsoulte">绝对过期时长</param>
-        /// <returns></returns>
-        Task<bool> ReplaceAsync(string key, object value, TimeSpan expiresSliding, TimeSpan expiressAbsoulte);
-
-        /// <summary>
-        /// 修改缓存
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <param name="value">新的缓存Value</param>
-        /// <param name="expiresIn">缓存时长</param>
-        /// <param name="isSliding">是否滑动过期(如果在过期时间内有操作,则以当前时间点延长过期时间)</param>
-        /// <returns></returns>
-        bool Replace(string key, object value, TimeSpan expiresIn, bool isSliding = false);
-
-        /// <summary>
-        /// 修改缓存(异步方式)
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <param name="value">新的缓存Value</param>
-        /// <param name="expiresIn">缓存时长</param>
-        /// <param name="isSliding">是否滑动过期(如果在过期时间内有操作,则以当前时间点延长过期时间)</param>
-        /// <returns></returns>
-        Task<bool> ReplaceAsync(string key, object value, TimeSpan expiresIn, bool isSliding = false);
-
-    }
-}

+ 0 - 311
TEAMModelOS.SDK/Module/Cache/MemoryCacheService.cs

@@ -1,311 +0,0 @@
-using Microsoft.Extensions.Caching.Memory;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace TEAMModelOS.SDK.Module.Cache
-{
-    public class MemoryCacheService : ICacheService ,IDisposable
-    {
-        protected IMemoryCache _cache;
-
-        public MemoryCacheService(IMemoryCache cache)
-        {
-            _cache = cache;
-        }/// <summary>
-         /// 验证缓存项是否存在
-         /// </summary>
-         /// <param name="key">缓存Key</param>
-         /// <returns></returns>
-        public bool Exists(string key)
-        {
-            if (key == null)
-            {
-                throw new ArgumentNullException(nameof(key));
-            }
-            object cached;
-            return _cache.TryGetValue(key, out cached);
-        }/// <summary>
-         /// 添加缓存
-         /// </summary>
-         /// <param name="key">缓存Key</param>
-         /// <param name="value">缓存Value</param>
-         /// <returns></returns>
-        public bool Add(string key, object value)
-        {
-            if (key == null)
-            {
-                throw new ArgumentNullException(nameof(key));
-            }
-            if (value == null)
-            {
-                throw new ArgumentNullException(nameof(value));
-            }
-            _cache.Set(key, value);
-            return Exists(key);
-        }
-        /// <summary>
-        /// 添加缓存
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <param name="value">缓存Value</param>
-        /// <param name="expiresSliding">滑动过期时长(如果在过期时间内有操作,则以当前时间点延长过期时间)</param>
-        /// <param name="expiressAbsoulte">绝对过期时长</param>
-        /// <returns></returns>
-        public bool Add(string key, object value, TimeSpan expiresSliding, TimeSpan expiressAbsoulte)
-        {
-            if (key == null)
-            {
-                throw new ArgumentNullException(nameof(key));
-            }
-            if (value == null)
-            {
-                throw new ArgumentNullException(nameof(value));
-            }
-            _cache.Set(key, value,
-                    new MemoryCacheEntryOptions()
-                    .SetSlidingExpiration(expiresSliding)
-                    .SetAbsoluteExpiration(expiressAbsoulte)
-                    );
-
-            return Exists(key);
-        }
-        /// <summary>
-        /// 添加缓存
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <param name="value">缓存Value</param>
-        /// <param name="expiresIn">缓存时长</param>
-        /// <param name="isSliding">是否滑动过期(如果在过期时间内有操作,则以当前时间点延长过期时间)</param>
-        /// <returns></returns>
-        public bool Add(string key, object value, TimeSpan expiresIn, bool isSliding = false)
-        {
-            if (key == null)
-            {
-                throw new ArgumentNullException(nameof(key));
-            }
-            if (value == null)
-            {
-                throw new ArgumentNullException(nameof(value));
-            }
-            if (isSliding)
-                _cache.Set(key, value,
-                    new MemoryCacheEntryOptions()
-                    .SetSlidingExpiration(expiresIn)
-                    );
-            else
-                _cache.Set(key, value,
-                new MemoryCacheEntryOptions()
-                .SetAbsoluteExpiration(expiresIn)
-                );
-
-            return Exists(key);
-        }/// <summary>
-         /// 删除缓存
-         /// </summary>
-         /// <param name="key">缓存Key</param>
-         /// <returns></returns>
-        public bool Remove(string key)
-        {
-            if (key == null)
-            {
-                throw new ArgumentNullException(nameof(key));
-            }
-            _cache.Remove(key);
-
-            return !Exists(key);
-        }
-        /// <summary>
-        /// 批量删除缓存
-        /// </summary>
-        /// <param name="key">缓存Key集合</param>
-        /// <returns></returns>
-        public void RemoveAll(IEnumerable<string> keys)
-        {
-            if (keys == null)
-            {
-                throw new ArgumentNullException(nameof(keys));
-            }
-
-            keys.ToList().ForEach(item => _cache.Remove(item));
-        }/// <summary>
-         /// 获取缓存
-         /// </summary>
-         /// <param name="key">缓存Key</param>
-         /// <returns></returns>
-        public T Get<T>(string key) where T : class
-        {
-            if (key == null)
-            {
-                throw new ArgumentNullException(nameof(key));
-            }
-            return _cache.Get(key) as T;
-        }
-        /// <summary>
-        /// 获取缓存
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <returns></returns>
-        public object Get(string key)
-        {
-            if (key == null)
-            {
-                throw new ArgumentNullException(nameof(key));
-            }
-            return _cache.Get(key);
-        }
-        /// <summary>
-        /// 获取缓存集合
-        /// </summary>
-        /// <param name="keys">缓存Key集合</param>
-        /// <returns></returns>
-        public IDictionary<string, object> GetAll(IEnumerable<string> keys)
-        {
-            if (keys == null)
-            {
-                throw new ArgumentNullException(nameof(keys));
-            }
-
-            var dict = new Dictionary<string, object>();
-
-            keys.ToList().ForEach(item => dict.Add(item, _cache.Get(item)));
-
-            return dict;
-        }/// <summary>
-         /// 修改缓存
-         /// </summary>
-         /// <param name="key">缓存Key</param>
-         /// <param name="value">新的缓存Value</param>
-         /// <returns></returns>
-        public bool Replace(string key, object value)
-        {
-            if (key == null)
-            {
-                throw new ArgumentNullException(nameof(key));
-            }
-            if (value == null)
-            {
-                throw new ArgumentNullException(nameof(value));
-            }
-            if (Exists(key))
-                if (!Remove(key)) return false;
-
-            return Add(key, value);
-
-        }
-        /// <summary>
-        /// 修改缓存
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <param name="value">新的缓存Value</param>
-        /// <param name="expiresSliding">滑动过期时长(如果在过期时间内有操作,则以当前时间点延长过期时间)</param>
-        /// <param name="expiressAbsoulte">绝对过期时长</param>
-        /// <returns></returns>
-        public bool Replace(string key, object value, TimeSpan expiresSliding, TimeSpan expiressAbsoulte)
-        {
-            if (key == null)
-            {
-                throw new ArgumentNullException(nameof(key));
-            }
-            if (value == null)
-            {
-                throw new ArgumentNullException(nameof(value));
-            }
-            if (Exists(key))
-                if (!Remove(key)) return false;
-
-            return Add(key, value, expiresSliding, expiressAbsoulte);
-        }
-        /// <summary>
-        /// 修改缓存
-        /// </summary>
-        /// <param name="key">缓存Key</param>
-        /// <param name="value">新的缓存Value</param>
-        /// <param name="expiresIn">缓存时长</param>
-        /// <param name="isSliding">是否滑动过期(如果在过期时间内有操作,则以当前时间点延长过期时间)</param>
-        /// <returns></returns>
-        public bool Replace(string key, object value, TimeSpan expiresIn, bool isSliding = false)
-        {
-            if (key == null)
-            {
-                throw new ArgumentNullException(nameof(key));
-            }
-            if (value == null)
-            {
-                throw new ArgumentNullException(nameof(value));
-            }
-            if (Exists(key))
-                if (!Remove(key)) return false;
-
-            return Add(key, value, expiresIn, isSliding);
-        }
-        public void Dispose()
-        {
-            if (_cache != null)
-                _cache.Dispose();
-            GC.SuppressFinalize(this);
-        }
-
-        public async Task<bool> ExistsAsync(string key)
-        {
-            return await Task.Run(() => Exists(key));
-        }
-
-        public async Task<bool> AddAsync(string key, object value)
-        {
-            return await Task.Run(() => Add(key, value));
-        }
-
-        public async Task<bool> AddAsync(string key, object value, TimeSpan expiresSliding, TimeSpan expiressAbsoulte)
-        {
-            return await Task.Run(() => Add(key, value, expiresSliding, expiressAbsoulte));
-        }
-
-        public async Task<bool> AddAsync(string key, object value, TimeSpan expiresIn, bool isSliding = false)
-        {
-            return await Task.Run(() => Add(key, value, expiresIn, isSliding));
-        }
-
-        public async Task<bool> RemoveAsync(string key)
-        {
-            return await Task.Run(() => Remove(key));
-        }
-
-        public async Task RemoveAllAsync(IEnumerable<string> keys)
-        {
-            await Task.Run(() => RemoveAll(keys));
-        }
-
-        public async  Task<T> GetAsync<T>(string key) where T : class
-        {
-          return  await Task.Run(() => Get<T>(key));
-        }
-
-        public async Task<object> GetAsync(string key)
-        {
-            return await Task.Run(() => Get(key));
-        }
-
-        public async Task<IDictionary<string, object>> GetAllAsync(IEnumerable<string> keys)
-        {
-            return await Task.Run(() => GetAll(keys));
-        }
-
-        public async Task<bool> ReplaceAsync(string key, object value)
-        {
-            return await Task.Run(() => Replace(key,value));
-        }
-
-        public async Task<bool> ReplaceAsync(string key, object value, TimeSpan expiresSliding, TimeSpan expiressAbsoulte)
-        {
-            return await Task.Run(() => Replace(key, value, expiresSliding, expiressAbsoulte));
-        }
-
-        public async Task<bool> ReplaceAsync(string key, object value, TimeSpan expiresIn, bool isSliding = false)
-        {
-            return await Task.Run(() => Replace(key, value, expiresIn, isSliding));
-        }
-    }
-}

+ 0 - 26
TEAMModelOS/Controllers/Common/SurveyController.cs

@@ -302,34 +302,8 @@ namespace TEAMModelOS.Controllers
                     survey.ttl = 1;
                     survey.status = 404;
                     survey = await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync(survey, new PartitionKey($"{survey.code}"));
-                    var adid = survey.id;
-                    var adcode = $"Activity-{survey.school}";
-                    ActivityData data = null;
-                    try
-                    {
-                        if (survey.scope == "school")
-                        {
-                            data = await client.GetContainer("TEAMModelOS", "School").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
-                        }
-                        else if (survey.scope == "private")
-                        {
-                            data = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
-                        }
-                    }
-                    catch { data = null; }
                     _azureRedis.GetRedisClient(8).KeyDelete($"Survey:Record:{survey.id}");
                     _azureRedis.GetRedisClient(8).KeyDelete($"Survey:Submit:{survey.id}");
-                    if (data != null)
-                    {
-                        if (survey.scope == "school")
-                        {
-                            data = await client.GetContainer("TEAMModelOS", "School").DeleteItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{data.code}"));
-                        }
-                        else if (survey.scope == "private")
-                        {
-                            data = await client.GetContainer("TEAMModelOS", "Teacher").DeleteItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{data.code}"));
-                        }
-                    }
                     await _dingDing.SendBotMsg($"问卷调查【{survey.name}-{survey.id}】被删除", GroupNames.成都开发測試群組);
                     return Ok(new { flag });
                 }

+ 0 - 30
TEAMModelOS/Controllers/Common/VoteController.cs

@@ -301,39 +301,9 @@ namespace TEAMModelOS.Controllers.Learn
                     vote.ttl = 1;
                     vote.status = 404;
                     vote = await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync(vote,  new PartitionKey($"{vote.code}"));
-                    var adid = vote.id;
-                    var adcode = $"Activity-{vote.school}";
-                    ActivityData data = null;
-                    try
-                    {
-                        if (vote.scope == "school")
-                        {
-                            data = await client.GetContainer("TEAMModelOS", "School").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
-                        }
-                        else if (vote.scope == "private")
-                        {
-                            data = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
-                        }
-                    }
-                    catch
-                    {
-                        data = null;
-                    }
                     await _dingDing.SendBotMsg($"投票活动【{vote.name}-{vote.id}-ttl={vote.ttl}】正在操作", GroupNames.成都开发測試群組);
                     _azureRedis.GetRedisClient(8).KeyDelete($"Vote:Record:{vote.id}");
                     _azureRedis.GetRedisClient(8).KeyDelete($"Vote:Count:{vote.id}");
-                    if (data != null)
-                    {
-                        data.ttl = 1;
-                        if (vote.scope == "school")
-                        {
-                            data = await client.GetContainer("TEAMModelOS", "School").DeleteItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{data.code}"));
-                        }
-                        else if (vote.scope == "private")
-                        {
-                            data = await client.GetContainer("TEAMModelOS", "Teacher").DeleteItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{data.code}"));
-                        }
-                    }
                     await _dingDing.SendBotMsg($"投票活动【{vote.name}-{vote.id}】被删除", GroupNames.成都开发測試群組);
                     return Ok(new { flag });
                 }

+ 0 - 23
TEAMModelOS/Controllers/School/StudentCommonController.cs

@@ -30,29 +30,6 @@ namespace TEAMModelOS.Controllers
             _azureCosmos = azureCosmos;
             _azureRedis = azureRedis;
         }
-        /// <summary>
-        /// 查询活动所有活动类型的列表,学生端
-        /// </summary>
-        /// <param name="request">
-        ///加入的班级信息                      ?classes:[{"classid":"S-C-00001","scope":"school"},{"classid":"P-C-00004","scope":"private"}]
-        ///活动类型                            ?"type":"vote"/"exam"/"homework"/"learn"/"survey"" // vote投票 survey问卷 exam评测 learn学习活动 homework作业活动
-        ///时间筛选范围开始时间 默认30天之前   ?"stime":1608274766154  
-        ///时间筛选范围结束时间 默认当前时间   ?"etime":1608274766666 
-        ///是否展示列表的 Tips                 ? "tips":true/false
-        ///每页大小     ?"count":10/null/Undefined  
-        ///分页Token    ?"continuationToken":Undefined/null/"[{\"token\":\"+RID:~omxMAP3ipcSEEwAAAAAAAA==#RT:2#TRC:20#ISV:2#IEO:65551#QCF:1#FPC:AYQTAAAAAAAAiRMAAAAAAAA=\",\"range\":{\"min\":\"\",\"max\":\"FF\"}}]"
-        /// 当前状态    ?"progress":Undefined/null/"" 表示两种状态都要查询/ "going"/"finish" 表示查询进行中/ 或者已完成 学生端只能查询正在进行或已经结束 going 已发布|finish 已结束  
-        /// </param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("stu-find-activity")]
-       // [AuthToken(Roles = "student")]
-        public async Task<IActionResult> FindStu(JsonElement request)
-        {
-            var (id, name, pic,school) = HttpContext.GetAuthTokenInfo();
-            (List<ActivityData> datas, string continuationTokenSchool,string continuationTokenTeacher) = await ActivityStudentService.FindAsStu( request, id,  school, _azureCosmos,_azureRedis);
-            return Ok(new { datas, continuationTokenSchool,continuationTokenTeacher });
-        }
 
         /// <summary>
         /// 查询活动所有活动类型的列表,学生端

+ 1 - 47
TEAMModelOS/Controllers/Teacher/TeacherCommonController.cs

@@ -32,53 +32,7 @@ namespace TEAMModelOS.Controllers
             _azureCosmos = azureCosmos;
             _azureRedis = azureRedis;
         }
-        /// <summary>
-        /// 学生端查询活动所有活动类型的列表,教师以学生身份登入学生端获取活动列表接口
-        /// </summary>
-        /// <param name="request">
-        ///加入的班级信息                      ?classes:[{"classid":"S-C-00001","scope":"school"},{"classid":"P-C-00004","scope":"private"}]
-        ///活动类型                            ?"type":"vote"/"exam"/"homework"/"learn"/"survey"" // vote投票 survey问卷 exam评测 learn学习活动 homework作业活动
-        ///时间筛选范围开始时间 默认30天之前   ?"stime":1608274766154  
-        ///时间筛选范围结束时间 默认当前时间   ?"etime":1608274766666 
-        ///是否展示列表的 Tips                 ? "tips":true/false
-        ///每页大小     ?"count":10/null/Undefined  
-        ///分页Token    ?"continuationToken":Undefined/null/"[{\"token\":\"+RID:~omxMAP3ipcSEEwAAAAAAAA==#RT:2#TRC:20#ISV:2#IEO:65551#QCF:1#FPC:AYQTAAAAAAAAiRMAAAAAAAA=\",\"range\":{\"min\":\"\",\"max\":\"FF\"}}]"
-        /// 当前状态    ?"progress":Undefined/null/"" 表示两种状态都要查询/ "going"/"finish" 表示查询进行中/ 或者已完成 学生端只能查询正在进行或已经结束 going 已发布|finish 已结束  
-        /// </param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("stu-find-activity")]
-        [AuthToken(Roles = "teacher")] 
-        public async Task<IActionResult> FindStu(JsonElement requert)
-        {
-            var (id, _, _, school) = HttpContext.GetAuthTokenInfo();
-            (List<ActivityData> datas, string continuationTokenSchool, string continuationTokenTeacher) = await ActivityStudentService.FindAsStu( requert, id, school, _azureCosmos,_azureRedis);
-            return Ok(new { datas, continuationTokenSchool,continuationTokenTeacher });
-        }
-        /// <summary>
-        /// 教师端,查询活动所有活动类型的列表,班主任,任课教师等
-        /// 执教班级
-        /// </summary>
-        /// <param name="request">
-        ///执教的班级信息                      !classes:[{"classid":"S-C-00001","scope":"school"},{"classid":"P-C-00004","scope":"private"}]   TODO  需要排查 对象和班级字符串id设计原因 {"classid":"S-C-00001","scope":"school"}
-        ///执教的科目                          ?subjects:["subjectid1","subjectid2"]
-        ///活动类型                            ?"type":"vote"/"exam"/"homework"/"learn"/"survey"" // vote投票 survey问卷 exam评测 learn学习活动 homework作业活动
-        ///时间筛选范围开始时间 默认30天之前   ?"stime":1608274766154  
-        ///时间筛选范围结束时间 默认当前时间   ?"etime":1608274766666 
-        ///是否展示列表的 Tips                 ? "tips":true/false
-        ///每页大小     ?"count":10/null/Undefined  
-        ///分页Token    ?"continuationToken":Undefined/null/"[{\"token\":\"+RID:~omxMAP3ipcSEEwAAAAAAAA==#RT:2#TRC:20#ISV:2#IEO:65551#QCF:1#FPC:AYQTAAAAAAAAiRMAAAAAAAA=\",\"range\":{\"min\":\"\",\"max\":\"FF\"}}]"
-        ///当前状态     ?"progress":Undefined/null/"" 表示两种状态都要查询/ "going"/"finish" 表示查询进行中/ 或者已完成 学生端只能查询正在进行或已经结束 going 已发布|finish 已结束  
-        /// </param>
-        /// <returns></returns>
-        //[ProducesDefaultResponseType]
-        //[HttpPost("tch-find-activity")]
-        //public async Task<IActionResult> FindTch(JsonElement requert)
-        //{
-        //    var (id, _, _, school) = HttpContext.GetAuthTokenInfo();
-        //    (List<ActivityData> datas, string continuationToken) = await ActivityTeacherService.FindAsTch(  requert, school, _azureCosmos, _azureRedis);
-        //    return Ok(new { datas, continuationToken });
-        //}
+        
 
         /// <summary>
         /// 教师端,查询活动所有活动类型的列表,班主任,任课教师等

+ 0 - 537
TEAMModelOS/Controllers/knowledge/KnowledgeController.cs

@@ -1,537 +0,0 @@
-using Azure.Cosmos;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Options;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.Json;
-using System.Threading.Tasks;
-using TEAMModelOS.Models;
-using TEAMModelOS.SDK.Models;
-using TEAMModelOS.Models.Dto;
-
-using TEAMModelOS.SDK;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.SDK.Extension;
-using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
-using TEAMModelOS.SDK.Helper.Common.StringHelper;
-
-namespace TEAMModelOS.Controllers
-{
-    [ProducesResponseType(StatusCodes.Status200OK)]
-    [ProducesResponseType(StatusCodes.Status400BadRequest)]
-    //[Authorize(Roles = "IES5")]
-    //[Route("knowledge")]
-    //[ApiController]
-    //[Authorize]
-    public class KnowledgeController : ControllerBase
-    {       
-        private readonly AzureStorageFactory _azureStorage;
-        private readonly AzureCosmosFactory _azureCosmos;
-        private readonly SnowflakeId _snowflakeId;
-        private readonly DingDing _dingDing;
-        private readonly Option _option;
-
-        public KnowledgeController(AzureStorageFactory azureStorage, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId,DingDing dingDing, IOptionsSnapshot<Option> option)
-        {
-            _snowflakeId = snowflakeId;
-            _azureStorage = azureStorage;
-            _azureCosmos = azureCosmos;
-            _dingDing = dingDing;
-            _option = option?.Value;
-
-        }
-
-        /// <summary>
-        /// 删除学校 知识点 或 知识块 代理
-        /// </summary>
-        /// <typeparam name="T"></typeparam>
-        /// <param name="request"></param>
-        /// <param name="builder"></param>
-        /// <returns></returns>
-        delegate Task<List<T>> DeleteDelegate<T>(JsonElement request) where T : CosmosEntity;
-
-        /// <summary>
-        /// 保存或者更新学校 知识点 或者 知识块 代理
-        /// </summary>
-        /// <typeparam name="T"></typeparam>
-        /// <param name="schoolBlock"></param>
-        /// <param name="_azureCosmos"></param>
-        /// <returns></returns>
-        delegate Task<string> SchoolSaveOrUpdate<T>(dynamic schoolBlock, AzureCosmosFactory _azureCosmos);
-
-        //  private delegate dynamic SaveOrUpdate(dynamic t);
-
-        /// <summary>
-        /// 获取标准知识点
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("find-std-point")]
-        public async Task<IActionResult> FindStdPoint(KnowledgeDto request)
-        {
-            // request.@params.PointParams.TryAdd("PartitionKey", request.lang);
-            ResponseBuilder builder = ResponseBuilder.custom();
-            List<KnowledgePoint> data = new List<KnowledgePoint>();
-            if (request != null && request.PointParams.TryGetValue("SubjectCode", out _))
-            {
-                List<KnowledgePoint> points = await _azureStorage.FindListByDict<KnowledgePoint>(request.PointParams);
-                if (request.Periods.IsNotEmpty())
-                {
-                    HashSet<KnowledgePoint> knowledges = new HashSet<KnowledgePoint>();
-                    foreach (string period in request.Periods)
-                    {
-                        if (!string.IsNullOrEmpty(period))
-                        {
-                            knowledges.UnionWith(points.Where(x => x.AdvicePeriodCode.Contains(period)).ToHashSet());
-                        }
-                    }
-                    data = knowledges.OrderBy(x => x.Order).ToList();
-                }
-                else
-                {
-                    data = points.OrderBy(x => x.Order).ToList();
-                }
-            }
-            else
-            {
-                return Ok(new { ResponseCode.PARAMS_ERROR, V = "SubjectCode is null or empty!" });
-                 
-            }
-            //return builder.Data(data).Extend(new Dictionary<string, object> { { "count", data.Count } }).build();
-            return Ok(new { data , data.Count});
-        }
-
-
-        /// <summary>
-        /// 获取标准的知识块及包含的知识点
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("find-std-block-point")]
-        public async Task<IActionResult> FindStdBlockPoint(KnowledgeDto request)
-        {
-            //request.@params.PointParams.TryAdd("PartitionKey", request.lang);
-            ResponseBuilder builder = ResponseBuilder.custom();
-            List<BlockPointDto> data = new List<BlockPointDto>();
-            if (request != null && request.PointParams.TryGetValue("SubjectCode", out _))
-            {
-                List<KnowledgeBlockPoint> blockPoints = await _azureStorage.FindListByDict<KnowledgeBlockPoint>(request.PointParams);
-                List<KnowledgeBlock> blocks = await _azureStorage.FindListByDict<KnowledgeBlock>(request.PointParams);
-                if (request.Periods.IsNotEmpty())
-                {
-                    HashSet<KnowledgeBlock> knowledges = new HashSet<KnowledgeBlock>();
-                    HashSet<KnowledgeBlockPoint> knowledgeBlocks = new HashSet<KnowledgeBlockPoint>();
-                    foreach (string period in request.Periods)
-                    {
-                        if (!string.IsNullOrEmpty(period))
-                        {
-                            knowledges.UnionWith(blocks.Where(x => x.AdvicePeriodCode.Contains(period)).ToHashSet());
-                            knowledgeBlocks.UnionWith(blockPoints.Where(x => x.AdvicePeriodCode.Contains(period)).ToHashSet());
-                        }
-                    }
-                    blocks = knowledges.OrderBy(x => x.Order).ToList();
-                    blockPoints = knowledgeBlocks.OrderBy(x => x.Order).ToList();
-                }
-                List<BlockPointDto> blockPointDtos = new List<BlockPointDto>();
-                data = FindTree(ListToTree(blocks, blockPoints), request.BlockId, blockPointDtos);
-            }
-            else
-            {
-                //return builder.Error(ResponseCode.PARAMS_ERROR, "SubjectCode is null or empty!").build();
-                return Ok(new { ResponseCode.PARAMS_ERROR, V = "SubjectCode is null or empty!" });
-            }
-            //return builder.Data(data).Extend(new Dictionary<string, object> { { "count", data.Count } }).build();
-            return Ok(new { data, data.Count });
-        }
-
-        /// <summary>
-        /// 获取知识
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("find")]
-        public async Task<IActionResult> Find(JsonElement requert)
-        {
-            var client = _azureCosmos.GetCosmosClient();
-            if (!requert.TryGetProperty("code", out JsonElement school_code)) return BadRequest();
-            if (!requert.TryGetProperty("type", out JsonElement type)) return BadRequest();
-            if (!requert.TryGetProperty("periodId", out JsonElement period)) return BadRequest();
-            if (!requert.TryGetProperty("subjectId", out JsonElement subjectCode)) return BadRequest();
-            //if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
-            List<object> Knowledges = new List<object>();
-            List<Dictionary<string, object>> roles = new List<Dictionary<string, object>>();
-            /* var response = await client.GetContainer("TEAMModelOSTemp", "Common").ReadItemStreamAsync(id + "", new PartitionKey($"Knowledge-{school_code}"));
-             if (response.Status == 200)
-             {
-                 using var json = await JsonDocument.ParseAsync(response.ContentStream);
-                 foreach (var obj in json.RootElement.GetProperty("points").EnumerateArray())
-                 {
-                     roles.Add(obj.GetString());
-                 }
-             }*/
-            var query = $"select c.id,c.type,c.code, c.name,c.alias,c.subjectId,c.points,c.knowledgeId,c.periodId from c where c.type = {type} and c.periodId = '{period}' and c.subjectId = '{subjectCode}'";
-            await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Knowledge-{school_code}") }))
-            {
-                using var json = await JsonDocument.ParseAsync(item.ContentStream);
-                
-                if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
-                {
-                    foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
-                    {
-                        Dictionary<string, object> keyValues = new Dictionary<string, object>();
-                        foreach (var obj_ in obj.EnumerateObject()) {
-                            if ((obj_.Name + "").Equals("type")) {
-                                keyValues.Add("type", obj_.Value + "");
-                            }
-                             if ((obj_.Name+"").Equals("points")) {
-                                keyValues.Add("points", obj_.Value +"");
-                            }                          
-                        }
-                        roles.Add(keyValues);
-                        Knowledges.Add(obj.ToObject<object>());
-                    }
- 
-                }
-            }
-            return Ok(new { Knowledges, roles, Knowledges.Count });
-            // request.@params.TryAdd("PartitionKey", request.lang);
-            /* ResponseBuilder builder = ResponseBuilder.custom();
-             List<Knowledge> data = new List<Knowledge>();
-             if (StringHelper.getKeyCount(request) > 0)
-             {
-                 data = await _azureCosmos.FindByDict<Knowledge>(request);
-                 data.ForEach(d =>
-                 {
-                     if (d.type == 1) {
-                         if (d.code.Equals("habook#0001"))
-                         {
-                             d.ownCount = d.points.Count;
-                         }
-                         else {
-                             d.openCount = d.points.Count;
-                         }
-                     }
-                 });
-             }
-             else
-             {
-                 return builder.Error(ResponseCode.PARAMS_ERROR, "参数异常!").build();
-
-             }
-             return builder.Data(data.OrderBy(m => m.order)).Extend(new Dictionary<string, object> { { "count", data.Count } }).build();*/
-        }
-
-        /// <summary>
-        /// 保存或更新知识
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("upsert-all")]
-        public async Task<IActionResult> UpsertAll(List<Knowledge> request)
-        {
-            try
-            {
-                var client = _azureCosmos.GetCosmosClient();
-                List<Knowledge> Knowledges = new List<Knowledge>();
-                if (request.IsNotEmpty())
-                {
-
-                    foreach (Knowledge knowledge in request) {
-                        knowledge.code = "Knowledge-" + knowledge.code;
-                        Knowledge kno = new Knowledge();
-                        if (knowledge.id == null)
-                        {
-                            knowledge.id = Guid.NewGuid().ToString();
-                            kno = await client.GetContainer("TEAMModelOS", "School").CreateItemAsync(knowledge, new PartitionKey($"{knowledge.code}"));
-                            Knowledges.Add(kno);
-                        }
-                        else {
-                            kno = await client.GetContainer("TEAMModelOS", "School").ReplaceItemAsync(knowledge, knowledge.id, new PartitionKey($"{knowledge.code}"));
-                            Knowledges.Add(kno);
-                        }
-                    }
-                    //Knowledges = await SaveOrUpdateKnowledge(request);
-                    /*if (ts.Count > 0) builder.Data(ts).Extend(new Dictionary<string, object> { { "count", ts.Count } });
-                    else {
-                        return Ok(new { ResponseCode.FAILED, V = "失败!" });
-                    };  */
-                }
-                return Ok(new { Knowledges });
-            }
-            catch (Exception ex)
-            {
-                await _dingDing.SendBotMsg($"knowledge,{_option.Location},upsert-all()\n{ex.Message}", GroupNames.醍摩豆服務運維群組);
-                return BadRequest();
-            }
-        }
-
-
-        // TODO 代码优化
-
-        /// <summary>
-        /// 删除知识
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("delete")]
-        public async Task<IActionResult> Delete(JsonElement request)
-        {
-            try {
-                var client = _azureCosmos.GetCosmosClient();
-                if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
-                if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
-                await client.GetContainer("TEAMModelOS", "School").DeleteItemStreamAsync(id.ToString(), new PartitionKey($"Knowledge-{code}"));
-                return Ok(id);
-            } catch (Exception ex) {
-                await _dingDing.SendBotMsg($"knowledge,{_option.Location},delete()\n{ex.Message}", GroupNames.醍摩豆服務運維群組);
-                return BadRequest();
-            }
-            return Ok();
-            //ResponseBuilder builder = ResponseBuilder.custom();
-            //DeleteDelegate<Knowledge> deleteDelegate1 = Delete<Knowledge>;
-            //List<Knowledge> Knowledges = await deleteDelegate1(request);
-            //if(Knowledges.Count >0) {
-            //    foreach (Knowledge Knowledge in Knowledges)
-            //    {
-            //        if (Knowledge.type == 1)
-            //        {
-            //            List<Knowledge> knowledges = await _azureCosmos.FindSQL<Knowledge>("SELECT value(c) FROM c join a in c.points where c.pk='Knowledge'and  Contains(a, '" + Knowledge.id + "') = true ");
-            //            List<Resource> Resources = await _azureCosmos.FindSQL<Resource>("SELECT value(c) FROM c join a in c.points where c.pk='Resources' and  Contains(a, '" + Knowledge.id + "') = true ");
-            //            //select value(c) from c join A0  in c.points where 1=1  and A0 =  @points0
-            //            foreach (Knowledge knowledge in knowledges) knowledge.points.Remove(Knowledge.id);
-            //            foreach (Resource Resource in Resources) Resource.points.Remove(Knowledge.id);
-            //            await _azureCosmos.SaveOrUpdateAll(Resources);
-            //            await _azureCosmos.SaveOrUpdateAll(knowledges);
-            //        }
-            //    }
-            //    return Ok(new { Knowledges });
-            //}else
-            //{
-            //    return Ok(new { erro = ResponseCode.FAILED, v = "删除失败!" });
-
-            //}
-            
-        }
-
-        /// <summary>
-        /// 统计个数
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("count")]
-        public async Task<IActionResult> Count(JsonElement request)
-        {
-            List<List<List<int>>> sCount = new List<List<List<int>>>();
-            //List<List<List<List<int>>>> allCount = new List<List<List<List<int>>>>();
-            ResponseBuilder builder = ResponseBuilder.custom();
-            request.TryGetProperty("code",out JsonElement code);
-            if (StringHelper.getKeyCount(request) > 0) {
-                /*List<School> sc = await _azureCosmos.FindByDict<School>(new Dictionary<string, object>() { { "id", code.ToString()}});*/
-                List<School> sc = new List<School>();
-                var client = _azureCosmos.GetCosmosClient();
-                //List<object> schools = new List<object>();
-                var query = $"select c.id,c.pk,c.code, c.name,c.region,c.province,c.city,c.timeZone,c.picture,c.size,c.period,c.campuses from c where c.id ='{code}'";
-                await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
-                {
-                    using var json = await JsonDocument.ParseAsync(item.ContentStream);
-
-                    if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
-                    {
-                        foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
-                        {
-                            sc.Add(obj.ToObject<School>());
-                        }
-                    }
-                }
-               /* //查询校本所有知识块
-                Dictionary<string, object> scMap = new Dictionary<string, object>
-            {
-                 { "type", 0},
-                 { "status", 1}
-            };
-                List<Knowledge> knowlegeo = await _azureCosmos.FindByDict<Knowledge>(scMap);*/
-
-                List<Knowledge> knowlegeo = new List<Knowledge>();
-                var queryOne = $"select c.id,c.type,c.code, c.name,c.alias,c.subjectId,c.points,c.knowledgeId,c.periodId from c  where c.type = 0 and c.status = 1";
-                await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: queryOne, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Knowledge-{code}") }))
-                {
-                    using var json = await JsonDocument.ParseAsync(item.ContentStream);
-
-                    if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
-                    {
-                        foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
-                        {
-                            knowlegeo.Add(obj.ToObject<Knowledge>());
-                        }
-                    }
-                }
-
-
-
-                for (int i = 0; i < sc.Count; i++)
-                {
-                    for (int j = 0; j < sc[i].period.Count; j++)
-                    {
-                        List<List<int>> pCount = new List<List<int>>();
-                        for (int k = 0; k < sc[i].period[j].subjects.Count; k++)
-                        {
-                            List<int> listCount = new List<int>() { 0, 0 };
-                            //查询校本知识块
-                            //计数校本知识块与个人知识块
-                            int n = 0;
-                            int s = 0;
-                            for (int m = 0; m < knowlegeo.Count; m++)
-                            {
-                                if (sc[i].period[j].id.Equals(knowlegeo[m].periodId) &&
-                                    sc[i].period[j].subjects[k].id.Equals(knowlegeo[m].subjectId))
-                                {
-                                    n++;
-                                }
-                                if (knowlegeo[m].code.Equals("habook#0001") &&
-                                    sc[i].period[j].id.Equals(knowlegeo[m].periodId) &&
-                                    sc[i].period[j].subjects[k].id.Equals(knowlegeo[m].subjectId))
-                                {
-                                    s++;
-                                }
-                            }
-                            //册别数量
-                            listCount[0] = n;
-                            listCount[1] = s;
-                            pCount.Add(listCount);
-                        }
-                        sCount.Add(pCount);
-                    }
-                }
-            }
-            //return builder.Data(sCount).build();
-            return Ok(sCount);
-        }
-           
-
-
-        #region private
-        private List<BlockPointDto> ListToTree(List<KnowledgeBlock> blocks, List<KnowledgeBlockPoint> points)
-        {
-            List<PointDto> pointList = points.ToJsonString().ToObject<List<PointDto>>();
-            List<BlockPointDto> blockList = points.ToJsonString().ToObject<List<BlockPointDto>>();
-            Dictionary<string, List<PointDto>> pointDict = new Dictionary<string, List<PointDto>>();
-            List<string> keys = (pointList.GroupBy(c => c.BlockId).Select(group => group.Key)).ToList();
-            foreach (string key in keys)
-            {
-                pointDict.Add(key, pointList.Where(x => x.BlockId.Equals(key)).ToList());
-            }
-            //var blockDict = blockList.ToDictionary(n => n.RowKey, n => n);
-
-            var res = from r in blockList group r by r.RowKey into g select g;
-            Dictionary<string, BlockPointDto> blockDict = new Dictionary<string, BlockPointDto>();
-            foreach (var s in res)
-            {
-                blockDict.TryAdd(s.First().RowKey, s.First());
-            }
-            return GetChild(blockList, blockDict, pointDict);
-        }
-        private List<BlockPointDto> GetChild(List<BlockPointDto> list, Dictionary<string, BlockPointDto> blockDict, Dictionary<string, List<PointDto>> pointDict)
-        {
-            List<PointDto> empt = new List<PointDto>();
-            list = list.OrderBy(m => m.Order).ToList();
-            List<BlockPointDto> trees = new List<BlockPointDto>();
-            foreach (BlockPointDto node in list)
-            {
-                node.Type = 0;
-                bool fl = pointDict.TryGetValue(node.RowKey, out List<PointDto> points);
-                if (fl && points.IsNotEmpty())
-                {
-                    points.ForEach(m =>
-                    {
-                        node.Children.Add(new BlockPointDto
-                        {
-                            PartitionKey = m.PartitionKey,
-                            Pid = m.BlockId,
-                            RowKey = m.PointId,
-                            Type = 1,
-                            Order = m.Order,
-                            Name = m.Name,
-                            SubjectCode = m.SubjectCode,
-                            AdvicePeriodCode = m.AdvicePeriodCode,
-                            //Timestamp = m.Timestamp
-                        });
-                    });
-                }
-                bool flag = blockDict.TryGetValue(node.Pid, out BlockPointDto syllabus);
-                if (flag && syllabus != null)
-                {
-                    syllabus.Children.Add(node);
-                }
-                else
-                {
-                    trees.Add(node);
-                }
-            }
-            return trees.OrderBy(x => x.Order).ToList();
-        }
-        private List<BlockPointDto> FindTree(List<BlockPointDto> trees, String rowKey, List<BlockPointDto> blockPoints)
-        {
-            if (!string.IsNullOrEmpty(rowKey))
-            {
-                foreach (BlockPointDto tree in trees)
-                {
-                    if (tree.RowKey.Equals(rowKey))
-                    {
-                        blockPoints.Add(tree);
-                    }
-
-                    if (null != tree.Children && tree.Children.Count > 0)
-                    {
-                        FindTree(tree.Children, rowKey, blockPoints);
-                    }
-                }
-            }
-            else
-            {
-                blockPoints = trees;
-            }
-            return blockPoints;
-        }        
-
-        // TODO 代码优化
-
-        private async Task<List<Knowledge>> SaveOrUpdateKnowledge(List<Knowledge> request)
-        {
-            return new List<Knowledge>();
-            //foreach (Knowledge item in request)
-            //{
-            //    if (item.id == null)
-            //    {
-            //        item.id = _snowflakeId.NextId() + "";
-            //    }
-            //    if (item.type == 1 && item.points.Count > 0)
-            //    {
-            //        List<string> vs = item.points;
-            //        foreach (string s in vs)
-            //        {
-            //            List<Knowledge> knowledges = await _azureCosmos.FindByDict<Knowledge>(new Dictionary<string, object>() { { "id", s } });
-            //            foreach (Knowledge knowledge in knowledges)
-            //            {
-            //                knowledge.points.Remove(item.id);
-            //                knowledge.points.Add(item.id);
-            //            }
-            //            await _azureCosmos.SaveOrUpdateAll(knowledges);
-            //        }
-            //        item.points.Clear();
-            //    }
-            //}
-            //List<Knowledge> ts = await _azureCosmos.SaveOrUpdateAll(request);
-            //return ts;
-        }
-
-        #endregion
-    }
-}

+ 0 - 170
TEAMModelOS/JsonFile/Core/LangConfig.json

@@ -1,170 +0,0 @@
-[
-  {
-    "Lang": "zh-cn",
-    "Name": "大陆",
-    "Alias": "简体中文",
-    "Item": {
-      "Type": {
-        "compose": "综合题",
-        "single": "单选题",
-        "multiple": "多选题",
-        "judge": "判断题",
-        "complete": "填空题",
-        "subjective": "问答题",
-        "connector": "连线题",
-        "correct": "改错题"
-      },
-      "Answer": "答案",
-      "Analysis": "解析",
-      "Score": "配分",
-      "Point": "知识点",
-      "Filed": "知识|理解|应用|分析|综合|评鉴",
-      "Judge": "对|错",
-      "Ended": "结束",
-      "Level": "难度",
-      "Options": "ABCDEFGHIJKLMN",
-      "Start": "{",
-      "End": "}"
-    }
-  },
-  {
-    "Lang": "zh-hk",
-    "Name": "香港",
-    "Alias": "繁體中文",
-    "Item": {
-      "Type": {
-        "compose": "綜合題",
-        "single": "單選題",
-        "multiple": "多選題",
-        "judge": "判斷題",
-        "complete": "填充題",
-        "subjective": "問答題",
-        "connector": "連綫題",
-        "correct": "改錯題"
-      },
-      "Answer": "答案",
-      "Analysis": "解析",
-      "Score": "配分",
-      "Point": "知識點",
-      "Filed": "知識|理解|應用|分析|綜合|評鑒",
-      "Judge": "對|錯",
-      "Ended": "結束",
-      "Level": "難度",
-      "Options": "ABCDEFGHIJKLMN",
-      "Start": "{",
-      "End": "}"
-    }
-  },
-  {
-    "Lang": "zh-mo",
-    "Name": "澳門",
-    "Alias": "繁體中文",
-    "Item": {
-      "Type": {
-        "compose": "綜合題",
-        "single": "單選題",
-        "multiple": "多選題",
-        "judge": "判斷題",
-        "complete": "填充題",
-        "subjective": "問答題",
-        "connector": "連綫題",
-        "correct": "改錯題"
-      },
-      "Answer": "答案",
-      "Analysis": "解析",
-      "Score": "配分",
-      "Point": "知識點",
-      "Filed": "知識|理解|應用|分析|綜合|評鑒",
-      "Judge": "對|錯",
-      "Ended": "結束",
-      "Level": "難度",
-      "Options": "ABCDEFGHIJKLMN",
-      "Start": "{",
-      "End": "}"
-    }
-  },
-  {
-    "Lang": "zh-tw",
-    "Name": "台灣",
-    "Alias": "繁體中文",
-    "Item": {
-      "Type": {
-        "compose": "綜合題",
-        "single": "選擇題",
-        "multiple": "複選題",
-        "judge": "是非題",
-        "complete": "填充題",
-        "subjective": "問答題",
-        "connector": "連綫題",
-        "correct": "改錯題"
-      },
-      "Answer": "答案",
-      "Analysis": "解析",
-      "Score": "配分",
-      "Point": "知識點",
-      "Filed": "知識|理解|應用|分析|綜合|評鑒",
-      "Judge": "對|錯",
-      "Ended": "結束",
-      "Level": "難度",
-      "Options": "ABCDEFGHIJKLMN",
-      "Start": "{",
-      "End": "}"
-    }
-  },
-  {
-    "Lang": "en-uk",
-    "Name": "United Kingdom",
-    "Alias": "English",
-    "Item": {
-      "Type": {
-        "compose": "QuestionGroup",
-        "single": "MultipleChoice",
-        "multiple": "MultipleAnswers",
-        "judge": "TrueFalse",
-        "complete": "Blank",
-        "subjective": "Essay",
-        "connector": "Connector",
-        "correct": "Correct"
-      },
-      "Answer": "Answer",
-      "Analysis": "Explain",
-      "Score": "Score",
-      "Point": "Point",
-      "Filed": "knowledge|understand|using|analyse|synthesize|discern",
-      "Judge": "true|false",
-      "Ended": "Ended",
-      "Level": "Level",
-      "Options": "ABCDEFGHIJKLMN",
-      "Start": "{",
-      "End": "}"
-    }
-  },
-  {
-    "Lang": "en-us",
-    "Name": "United States",
-    "Alias": "English",
-    "Item": {
-      "Type": {
-        "compose": "QuestionGroup",
-        "single": "MultipleChoice",
-        "multiple": "MultipleAnswers",
-        "judge": "TrueFalse",
-        "complete": "Blank",
-        "subjective": "Essay",
-        "connector": "Connector",
-        "correct": "Correct"
-      },
-      "Answer": "Answer",
-      "Analysis": "Explain",
-      "Score": "Score",
-      "Point": "Point",
-      "Filed": "knowledge|understand|using|analyse|synthesize|discern",
-      "Judge": "true|false",
-      "Ended": "Ended",
-      "Level": "Level",
-      "Options": "ABCDEFGHIJKLMN",
-      "Start": "{",
-      "End": "}"
-    }
-  }
-]

+ 0 - 14
TEAMModelOS/JsonFile/Core/cosmosdb.cer

@@ -1,14 +0,0 @@
------BEGIN CERTIFICATE-----
-MIICGzCCAYSgAwIBAgIQTM27yJ7IJI9BJoKCaO4jbTANBgkqhkiG9w0BAQUFADAU
-MRIwEAYDVQQDEwlsb2NhbGhvc3QwHhcNMTkxMTE4MDMwMDAyWhcNMjQxMTE2MDMw
-MDAyWjAUMRIwEAYDVQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0A
-MIGJAoGBAPQEcozqL9uY8/qFdcOJLH7KsSNdQNDGhf+f7DtxfFrL7etKcLBhfAc8
-4r4mIZ2V9JRGx077uRcjcx7+juxWMvPWWzC2W9SfkwKrxQzBfXagQs9mShMpMPGU
-qD4typ4ZfH/Rl3/WJpDttb0I1t5WZlsHQ+zjPqN8scOm0AJWK0URAgMBAAGjbjBs
-MGoGA1UdEQEB/wRgMF6CD0RFU0tUT1AtMFZWRDMzUYIJbG9jYWxob3N0hwTAqAiA
-hwR/AAABgg0xOTIuMTY4LjguMTI4ggkxMjcuMC4wLjGCCzE5Mi4xNjguOC4xgg0x
-OTIuMTY4LjguMTkyMA0GCSqGSIb3DQEBBQUAA4GBAE8ZpiQJf/chU50tzJ9ijw0V
-ZghvKob3BzXaJ6W5jpJWG9Z/P0BZe+a93tSxjhSUUslZfaTas0Vlivs/bnQH82G8
-nduEWVyMRUHXcYPAt0wsmtLCTPmiIl5sqGlzIm6svPG7Ko2111ELy4XjoKpiD43X
-KK60NuHYP80ZoVOwoDPB
------END CERTIFICATE-----

+ 0 - 27
TEAMModelOS/JwtRsaFile/private.pem

@@ -1,27 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIEowIBAAKCAQEAq8pNyi9hNGbjAU16coA/W6hBQb92YbLFKuePbpmRg7nc/8be
-iGI6ngl0IDmbAcyQEN5IHN8B1xma33RSXdlRO3+fiUlk81gV1uSYTaiRAWL0TryM
-Kf9avQsw+ezP5HVNQRj75lZZxeNg9YTbjVEbVAj/cF/0E8xBdplk1+AyrZTk/0Cl
-04Pr+dM5R+fisgIp3sEULORzhpow38l+S2YjoCagsckPKhSuqLEkB3KoiFJKCoHK
-UJ+dOfYoa6m3N5ylQCm79HzWeS7PSaXVq6Qh+nxNvA2FkSgcSPc1a1vNKXCwHW2H
-ShKsPGugaRCZPTHPDip05suatheVU4AhpVq9MwIDAQABAoIBAEN7ZLNXiUecYu/Q
-D5mK51iJ75h0LXyTTQBdlepMSO0FxdpztFa+v2f1Lri56Dn8sVru9kThFUf5tuyw
-NOrIwzAsIe879XvhzjJr+agH3248ANwtFKIqvOoly0dhzwhfS8mWlt0Ubo9dkmjf
-l58bjTClmDH8f1SHl++Osh5a441rmoTMfx6YyvTp5ekHLGsll24nOVE3w/6MWTvU
-wBoNFFMvkb062l3QSG/3iPgwEsk8VNX3+7MRp40gurEk51wGL91ysKQq6k8xe8JI
-fMN6x+D8ZuVSOzUMwK4JjoXR646bEEmQMTO/uypQqvXav2V2k5pLW40tlirR48il
-9OYCNAECgYEA4tjAqEbnhHuErcgtzQCHD24/vAXuDiKw58Caq+Bae6QgkqjWC2IQ
-FAkLuvZ2tQSx0EVDZ1+1qP9PLVx2Q1DYs+CwiOKaM04M3XAbppgonZ4+PWiSWUKa
-6jKXmHmQeuCWQRlCrinrrPsrRhNbc1UvhjRWFtlOeHEjMp8kkMvqKFMCgYEAwd4y
-TuaV8fAExYsNZtBTx1lyyp+2Yk3zjNG4AsxJZ7QRx5VQVXmh5Y9CMvkwB09KQonF
-IcHYWMuseLvVfweQwH3WS4D8G/zf92GISLtsIUes4bDxs3lFipoCutzJt3hcHYIs
-fcKW29VravnY5P1FBL7Kw1FV9fReC5G8Kr56+6ECgYAToDka1feVyLHz7wu3XsJQ
-nXM6KzErW+j+Q/WdxS1O4SZISf8qwPMvKJExPb2Lb7qKkFOCkA9BbcVF4WgB7u6w
-sVHUpfY9VhVa2yYpRaTN7jDoUzHGMzL/7Bydfnb3ipK1UyAnvUy8jIZz65zP36Da
-9ZA1LdvSI8ety4L4XAwILQKBgEG0D3LEHT9grA1TIhidNDeUrh3T4RkR+B/al7WD
-DMGzum7cwNwnG+JUGghygX+ItM82J/RX4P2/EVXduu6RXtKOE0mFjmvh2PnbOTgF
-JRFmXEYlFNVRnWrq5U/1MfwXM4jgrDl28G/StdQMlyCMYY7JJqjpcOuphRIAszf9
-VGrhAoGBAOEsLNr0BUZncJRgPEr+v1mI89d53WlM13J1YOaw7xVdvAPbOPlUix3f
-/ZGka2N14K4Dt1NjpwpGfMrfZFAlWKIiF9HFaXmTFjK68JK9HFJfW01k6qfiltH1
-0vhPZ/VIj6wrkHB61tuu0J8VFdap2KAtop+9HyIRiVsOjxtrASHP
------END RSA PRIVATE KEY-----

+ 0 - 9
TEAMModelOS/JwtRsaFile/public.pem

@@ -1,9 +0,0 @@
------BEGIN PUBLIC KEY-----
-MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq8pNyi9hNGbjAU16coA/
-W6hBQb92YbLFKuePbpmRg7nc/8beiGI6ngl0IDmbAcyQEN5IHN8B1xma33RSXdlR
-O3+fiUlk81gV1uSYTaiRAWL0TryMKf9avQsw+ezP5HVNQRj75lZZxeNg9YTbjVEb
-VAj/cF/0E8xBdplk1+AyrZTk/0Cl04Pr+dM5R+fisgIp3sEULORzhpow38l+S2Yj
-oCagsckPKhSuqLEkB3KoiFJKCoHKUJ+dOfYoa6m3N5ylQCm79HzWeS7PSaXVq6Qh
-+nxNvA2FkSgcSPc1a1vNKXCwHW2HShKsPGugaRCZPTHPDip05suatheVU4AhpVq9
-MwIDAQAB
------END PUBLIC KEY-----

+ 0 - 18
TEAMModelOS/Models/Dto/AzureBlobSASDto.cs

@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace TEAMModelOS.Models.Dto
-{
-    public class AzureBlobSASDto
-    {
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string ContainerName { get; set; }
-        public string BlobName { get; set; }
-        public string PolicyName { get; set; }
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string TEAMModelId { get; set; }
-    }
-}

+ 0 - 51
TEAMModelOS/Models/Dto/BlockPointDto.cs

@@ -1,51 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace TEAMModelOS.Models.Dto
-{
-    public class BlockPointDto
-    {
-        public string PartitionKey { get; set; }
-        public string RowKey { get; set; }
-        /// <summary>
-        /// 名称
-        /// </summary>
-        public string Name { get; set; }
-        /// <summary>
-        /// 描述
-        /// </summary>
-       // public string Description { get; set; }
-        /// <summary>
-        /// 上级ID
-        /// </summary>
-        public string Pid { get; set; } = "root";
-        /// <summary>
-        /// 学科
-        /// </summary>
-        public string SubjectCode { get; set; }
-        /// <summary>
-        /// 建议学段
-        /// </summary>
-        public string AdvicePeriodCode { get; set; }
-        /// <summary>
-        /// 类型0 知识块,1知识点
-        /// </summary>
-        public int Type { get; set; }
-        /// <summary>
-        /// 是否展开
-        /// </summary>
-        public bool Expand { get; set; }
-        public int Order { get; set; }
-        //public DateTimeOffset Timestamp { get; set; }
-        //[IgnoreMember]
-        // public List<PointDto> Points { get; set; }
-        public List<BlockPointDto> Children { get; set; }
-
-        public BlockPointDto()
-        {
-            Children = new List<BlockPointDto>();
-        }
-    }
-}

+ 0 - 18
TEAMModelOS/Models/Dto/CommentsDto.cs

@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace TEAMModelOS.Models.Dto
-{
-    public class CommentsDto
-    {
-
-        public string TEAMModelId { get; set; }
-
-        /// <summary>
-        /// 评语
-        /// </summary>
-        public string comment { get; set; }
-    }
-}

+ 0 - 14
TEAMModelOS/Models/Dto/CommonQuery.cs

@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace TEAMModelOS.Models.Dto
-{
-    public class CommonQuery
-    {
-        public string collectionName { get; set; }
-        public Dictionary<string ,object> queryDict { get; set; }
-      
-    }
-}

+ 0 - 29
TEAMModelOS/Models/Dto/CoursePlanDto.cs

@@ -1,29 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Threading.Tasks;
-using TEAMModelOS.SDK.Models;
-
-namespace TEAMModelOS.Models.Dto
-{
-    public class CoursePlanDto
-    {
-        [Required(ErrorMessage = "课程ID必须设置")]
-        public string courseId { get; set; }
-        [Required(ErrorMessage = "班级编码必须设置")]
-        public string classroomCode { get; set; }
-        [Required(ErrorMessage = "任课教师必须设置")]
-        public string code { get; set; }
-        /// <summary>
-        /// 课程时间安排
-        /// </summary>
-        public CourseTime courseTime { get; set; }
-        public bool isnew { get; set; } = true;
-    }
-
-    public class ClassPlan {
-        public string classroomCode { get; set; }
-        public List<CoursePlanDto> coursePlans { get; set; }
-    }
-}

+ 0 - 51
TEAMModelOS/Models/Dto/HomeWorkCommentDto.cs

@@ -1,51 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace TEAMModelOS.Models.Dto
-{
-    public class HomeworkCommentDto
-    {
-        /// <summary>
-        /// 
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string studentId { get; set; }
-
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string homeWorkId { get; set; }
-
-        /// <summary>
-        /// 评论id 不带是评论 带是评论的回复
-        /// </summary>
-        public string commentid { get; set; }
-
-        /// <summary>
-        /// 评论者id
-        /// </summary>
-        public string fromId { get; set; }
-        
-        /// <summary>
-        /// 被评论者id 醍摩豆或studenId
-        /// </summary>
-        public string toId { get; set; }
-
-        /// <summary>
-        /// 评论者身份 教师 学生
-        /// </summary>
-        public string identity { get; set; }
-
-        /// <summary>
-        /// 评语
-        /// </summary>
-        public string comment { get; set; }
-
-
-        /// <summary>
-        /// 学生分数
-        /// </summary>
-        public double? score { get; set; }
-    }
-}

+ 0 - 18
TEAMModelOS/Models/Dto/HomeWorkDto.cs

@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using TEAMModelOS.SDK.Models;
-
-namespace TEAMModelOS.Models.Dto
-{
-    public class HomeworkDto
-    {
-        public Homework homeWork { get; set; }
-
-        /// <summary>
-        /// 是否重置学生作业关联表数据
-        /// </summary>
-        public bool reset { get; set; }
-    }
-}

+ 0 - 22
TEAMModelOS/Models/Dto/HomeWorkFindDto.cs

@@ -1,22 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using TEAMModelOS.Models;
-using TEAMModelOS.SDK.Models;
-
-namespace TEAMModelOS.Models.Dto
-{
-    public class HomeworkFindDto : Homework
-    {
-        //public HomeWorkFindDto()
-        //{
-        //    other = new List<HomeWork>();
-        //    dict = new Dictionary<string, object>();
-        //}
-
-        //public HomeWork homeWork { get; set; }
-
-        public Dictionary<string,object> statistics { get; set; }
-    }
-}

+ 0 - 42
TEAMModelOS/Models/Dto/HomeWorkScoringDto.cs

@@ -1,42 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace TEAMModelOS.Models.Dto
-{
-    public class HomeworkScoringDto
-    {
-        /// <summary>
-        /// 学生id
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string studentId { get; set; }
-        
-        /// <summary>
-        /// 作业id
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string homeWorkId { get; set; }
-
-        /// <summary>
-        /// 教师打分
-        /// </summary>
-        public double? score { get; set; }
-
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string comments { get; set; }
-
-        /// <summary>
-        ///  醍摩豆id 或者学生id
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string TEAMModelId { get; set; }
-
-        /// <summary>
-        /// 学生打星星
-        /// </summary>
-        public double start { get; set; } = -1;
-    }
-}

+ 0 - 20
TEAMModelOS/Models/Dto/KnowledgeDto.cs

@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace TEAMModelOS.Models.Dto
-{
-    public class KnowledgeDto
-    {
-        public KnowledgeDto()
-        {
-            Periods = new List<string>();
-            PointParams = new Dictionary<string, object>();
-        }
-        public string BlockId { get; set; }
-        public List<string> Periods { get; set; }
-        public Dictionary<string, object> PointParams { get; set; }
-
-    }
-}

+ 0 - 31
TEAMModelOS/Models/Dto/PointDto.cs

@@ -1,31 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace TEAMModelOS.Models.Dto
-{
-    public class PointDto
-    {
-
-        public string PartitionKey { get; set; }
-
-        //public string Id { get; set; }
-        public string PointId { get; set; }
-        /// <summary>
-        /// 原始名称
-        /// </summary>
-        public string Name { get; set; }
-        /// <summary>
-        /// 建议学段
-        /// </summary>
-        public string AdvicePeriodCode { get; set; }
-        public int Order { get; set; }
-        /// <summary>
-        /// 学科
-        /// </summary>
-        public string SubjectCode { get; set; }
-        public string BlockId { get; set; }
-        //public DateTimeOffset Timestamp { get; set; }
-    }
-}

+ 3 - 348
TEAMModelOS/Services/Common/ActivityStudentService.cs

@@ -19,13 +19,7 @@ namespace TEAMModelOS.Services.Common
     public static class ActivityStudentService
     {
 
-        /// <summary>
-        /// 活动委托
-        /// </summary>
-        /// <param name="data"></param>
-        /// <returns></returns>
-        delegate dynamic DoActivityTips(ActivityData data, AzureCosmosFactory _azureCosmos,string id, AzureRedisFactory _azureRedis);
-
+       
         public static async Task<int> Decide(JsonElement request,AzureCosmosFactory _azureCosmos,AzureRedisFactory _azureRedis,string userid ) {
 
             DateTimeOffset now = DateTimeOffset.UtcNow;
@@ -387,235 +381,7 @@ namespace TEAMModelOS.Services.Common
             return (datas, continuationToken);
         }
 
-        /// <summary>
-        /// 学生端查询
-        /// </summary>
-        /// <param name="containerId">容器</param>
-        /// <param name="requert"></param>
-        /// <param name="id">登录者ID</param>
-        /// <param name="_azureCosmos"></param>
-        /// <returns></returns>
-        public static async Task<(List<ActivityData> datas, string continuationTokenSchool,string continuationTokenTeacher)> FindAsStu( JsonElement requert, string id,string school, AzureCosmosFactory _azureCosmos,AzureRedisFactory _azureRedis)
-        {
-            if (string.IsNullOrWhiteSpace(id)) {
-                id = requert.GetProperty("userid").GetString();
-            }
-            if (string.IsNullOrWhiteSpace(school))
-            {
-                school = requert.GetProperty("school").GetString();
-            }
-            //开始时间,默认最近三十天
-            var stimestamp = DateTimeOffset.UtcNow.AddDays(-30).ToUnixTimeMilliseconds();
-            if (requert.TryGetProperty("stime", out JsonElement stime))
-            {
-                if (!stime.ValueKind.Equals(JsonValueKind.Undefined) && !stime.ValueKind.Equals(JsonValueKind.Null) &&stime.TryGetInt64(out long data))
-                {
-                    stimestamp = data;
-                } 
-            }
-            string stimesql = $" c.startTime >= {stimestamp}  ";
-            //默认当前时间,  未开始的不能查询
-            var etimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
-            string etimesql = $" and c.startTime <= {etimestamp}   ";
-            var progresssql = "";
-            if (requert.TryGetProperty("progress", out JsonElement progress))
-            {
-
-                if (!progress.ValueKind.Equals(JsonValueKind.Undefined) && !progress.ValueKind.Equals(JsonValueKind.Null) && progress.ValueKind.Equals(JsonValueKind.String))
-                {
-                    progresssql = $" and c.progress='{progress}' ";
-                }
-            }
-            var typesql = "";
-            if (requert.TryGetProperty("type", out JsonElement type))
-            {
-
-                if (!type.ValueKind.Equals(JsonValueKind.Undefined) && !type.ValueKind.Equals(JsonValueKind.Null) && type.ValueKind.Equals(JsonValueKind.String))
-                {
-                    typesql = $" and c.type='{type}' ";
-                }
-            }
-            string continuationTokenSchool = null;
-            string continuationTokenTeacher = null;
-            //默认不指定返回大小
-            int? topcout = null;
-            if (requert.TryGetProperty("count", out JsonElement jcount))
-            {
-                if (!jcount.ValueKind.Equals(JsonValueKind.Undefined) && !jcount.ValueKind.Equals(JsonValueKind.Null) && jcount.TryGetInt32(out int data))
-                {
-                    topcout = data;
-                } 
-            } 
-            //是否需要进行分页查询,默认不分页
-            bool iscontinuation = false;
-            if (topcout != null && topcout.Value > 0) {
-                iscontinuation = true;
-            }
-            //如果指定了返回大小
-            if (requert.TryGetProperty("continuationTokenSchool", out JsonElement continuationSchool))
-            {
-                //指定了cancellationToken continuationSchool
-                if (!continuationSchool.ValueKind.Equals(JsonValueKind.Null) && continuationSchool.ValueKind.Equals(JsonValueKind.String))
-                {
-                    continuationTokenSchool = continuationSchool.GetString();
-                    
-                }
-            }
-            //如果指定了返回大小
-            if (requert.TryGetProperty("continuationTokenTeacher", out JsonElement continuationTeacher))
-            {
-                //指定了cancellationToken 表示需要进行分页
-                if (!continuationTeacher.ValueKind.Equals(JsonValueKind.Null) && continuationTeacher.ValueKind.Equals(JsonValueKind.String))
-                {
-                    continuationTokenTeacher = continuationTeacher.GetString();
-                    
-                }
-            }
-            //个人tmdid
-            string joinSqlTmdids = $"join A0 in c.tmdids";
-            string andSqlTmdids = $"   A0 in('{id}')";
-            //班级
-            string joinSqlClasses = "";
-            string andSqlClasses = "";
-            List<string> classes=null;
-            if ( requert.TryGetProperty("classes", out JsonElement jclasses))
-            {
-                if (jclasses.ValueKind is JsonValueKind.Array ) {
-                    classes = jclasses.ToObject<List<string>>();
-                    if (classes.IsNotEmpty()) {
-                        joinSqlClasses = " join A1 in c.classes ";
-                        List<string> sqlList = new List<string>();
-                        classes.ForEach(x => { sqlList.Add($" '{x}' "); });
-                        string sql = string.Join(" , ", sqlList);
-                        andSqlClasses = $"   A1 in ({sql}) ";
-                    }
-                }
-            }
-            string tgSql = "";
-            if (!string.IsNullOrWhiteSpace(joinSqlClasses))
-            {
-                tgSql = $" and ({andSqlTmdids} or  {andSqlClasses } )";
-            }
-            else {
-                tgSql = $" and {andSqlTmdids}";
-            }
-            //科目
-            string joinSqlSubjects = "";
-            string andSqlSubjects = "";
-            if ( requert.TryGetProperty("subjects", out JsonElement jsubjects))
-            {
-                if (jsubjects.ValueKind is JsonValueKind.Array)
-                {
-                    List<string> subjects  = jsubjects.ToObject<List<string>>();
-                    if (subjects.IsNotEmpty()) {
-                        joinSqlSubjects = " join A2 in c.subjects ";
-                        List<string> sqlList = new List<string>();
-                        subjects.ForEach(x => { sqlList.Add($" '{x}' "); });
-                        string sql = string.Join(" , ", sqlList);
-                        andSqlSubjects = $" and A2 in ({sql}) ";
-                    }
-                }
-            }
-            List<ActivityData> datas = new List<ActivityData>();
-            var client = _azureCosmos.GetCosmosClient();
-            if (!string.IsNullOrWhiteSpace(school)) {
-                string querySchool = $" SELECT distinct  value c   FROM c  {joinSqlTmdids} {joinSqlClasses} {joinSqlSubjects}  where {stimesql}  {etimesql} and c.pk='Activity' {progresssql}  {typesql}  {andSqlSubjects}  {tgSql}";
-               
-                //查询数据归属学校的
-                await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(querySchool, continuationToken: continuationTokenSchool, requestOptions: new QueryRequestOptions() { MaxItemCount = topcout, PartitionKey = new PartitionKey($"Activity-{school}") }))
-                {
-                    using var json = await JsonDocument.ParseAsync(item.ContentStream);
-                    if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
-                    {
-                        foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
-                        {
-                            datas.Add(obj.ToObject<ActivityData>());
-                        }
-                        //如果需要分页则跳出
-                        if (iscontinuation)
-                        {
-                            continuationTokenSchool = item.GetContinuationToken();
-                            break;
-                        }
-                    }
-                }
-            }
-            //TODO会处理掉科目相关的
-            //查询数据归属Common 私人教室的。
-            string queryTeacher = $" SELECT distinct  value c   FROM c  {joinSqlTmdids} {joinSqlClasses} where {stimesql}  {etimesql} and c.pk='Activity' {progresssql}  {typesql} {tgSql} ";
-            await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryStreamIterator(queryTeacher, continuationToken: continuationTokenTeacher, requestOptions: new QueryRequestOptions() { MaxItemCount = topcout, PartitionKey = new PartitionKey($"Activity-Common") }))
-            {
-                using var json = await JsonDocument.ParseAsync(item.ContentStream);
-                if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
-                {
-                    foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
-                    {
-                        datas.Add(obj.ToObject<ActivityData>());
-                    }
-                    //如果需要分页则跳出
-                    if (iscontinuation)
-                    {
-                        continuationTokenTeacher = item.GetContinuationToken();
-                        break;
-                    }
-                }
-            }
-            bool tips = false;
-            if (requert.TryGetProperty("tips", out JsonElement jtips))
-            {
-                if (!jtips.ValueKind.Equals(JsonValueKind.Undefined) && !jtips.ValueKind.Equals(JsonValueKind.Null) && (jtips.ValueKind.Equals(JsonValueKind.True)|| jtips.ValueKind.Equals(JsonValueKind.False)))
-                {
-                    tips = jtips.GetBoolean();
-                }
-            }
-            if (tips)
-            {
-                DoActivityTips activityTips;
-                //TODO 处理活动tips 的res
-                dynamic res = default;
-                foreach (var data in datas)
-                {
-                    switch (data.type)
-                    {
-                        //投票
-                        case "vote":
-                            activityTips = DoVoteTips;
-                            //msgid, //0不能投票,1可以投票,2不在时间范围内,3周期内的可投票数不足
-                            //voteCount 可用投票数
-                            res =await activityTips(data, _azureCosmos, id, _azureRedis);
-                            break;
-                        //问卷
-                        case "survey":
-                            //msgid 0 已作答, 1未作答,2,未完成
-                            activityTips = DoSurveyTips;
-                            res = await activityTips(data, _azureCosmos, id, _azureRedis);
-                            break;
-                        //评测
-                        case "exam":
-                            //msgid 0 已作答, 1未作答,2,未完成, 用时间控制 相关发布状态,并且展示相应的结果
-                            activityTips = DoExamTips;
-                            res = await activityTips(data, _azureCosmos, id, _azureRedis);
-                            break;
-                        //学习活动
-                        case "learn":
-                            //msgid 0 已完成, 1未开始,2,未完成
-                            activityTips = DoLearnTips;
-                            res = await activityTips(data, _azureCosmos, id, _azureRedis);
-                            break;
-                        //作业活动
-                        case "homework":
-                            //msgid 0 已作答, 1未作答,2,未完成,3已批改,且有错误,4已批改,已完成
-                            //index:0,1,5 错误题序
-                            activityTips = DoHomeworkTips;
-                            res = await activityTips(data, _azureCosmos, id, _azureRedis);
-                            break;
-                        default: break;
-                    }
-                }
-            }
-            return (datas, continuationTokenSchool,continuationTokenTeacher);
-        }
-
+        
         public static async Task<int> Answer(JsonElement request, AzureCosmosFactory _azureCosmos, AzureRedisFactory azureRedis, string userid, AzureStorageFactory _azureStorage)
         {
 
@@ -746,117 +512,6 @@ namespace TEAMModelOS.Services.Common
         public class RdsRecord {
             public Dictionary<string, int> srecord { get; set; } = new Dictionary<string, int>();
             public Dictionary<string, string[]> urecord { get; set; } = new Dictionary<string, string[]>();
-        }
-        private async static Task<dynamic> DoVoteTips(ActivityData commonData , AzureCosmosFactory _azureCosmos,string userid,AzureRedisFactory _azureRedis)
-        {
-            Vote vote=null;
-            var client = _azureCosmos.GetCosmosClient();
-            await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryIterator<Vote>($"select value c from c where c.id='{commonData.id}'", 
-                requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey(commonData.scode) }))
-            {
-                vote = item;
-                break;
-            }
-            byte msgid = 0;
-            int voteCount = 0;
-            if (vote != null) {
-                DateTimeOffset now = DateTimeOffset.UtcNow;
-                long curr = now.ToUnixTimeMilliseconds();
-                //判断投票时间是否在起止时间内
-                if (curr >= vote.startTime && curr <= vote.endTime)
-                {
-                    string Field = "";
-                    RedisValue value = default;
-                    switch (vote.times)
-                    {
-                        case "once":
-                            // //如果是只能投票一次的活动则直接获取Redis的第一条 只能投一次
-                            Field = $"{userid}-once";
-                            RedisValue[] values = _azureRedis.GetRedisClient(8).HashValues($"Vote:Record:{vote.id}");
-                            if (values != null && values.Length>0)
-                            {
-                                value = values[0];
-                            }
-                            break;
-                        case "day": //周期内每天
-                            Field = $"{userid}-day-{now.ToString("yyyyMMdd")}";
-                            value = _azureRedis.GetRedisClient(8).HashGet($"Vote:Record:{vote.id}", Field);
-                            break;
-                        case "week": //自然周
-                            Field = $"{userid}-week-{now.ToString("yyyy")}{GetWeek(now)}";
-                            value = _azureRedis.GetRedisClient(8).HashGet($"Vote:Record:{vote.id}", Field);
-                            
-                            break;
-                        case "month":  //月份
-                            Field = $"{userid}-month-{now.ToString("yyyyMM")}";
-                            value = _azureRedis.GetRedisClient(8).HashGet($"Vote:Record:{vote.id}", Field);
-                           
-                            break;
-                        case "year"://年份
-                            Field = $"{userid}-year-{now.ToString("yyyy")}";
-                            value = _azureRedis.GetRedisClient(8).HashGet($"Vote:Record:{vote.id}", Field);
-                           
-                            break;
-                    }
-                    if (value != default && !value.IsNullOrEmpty)
-                    {
-                        List<string> opt = null;
-                        JsonElement record = value.ToString().ToObject<JsonElement>();
-                        if (record.TryGetProperty("opt", out JsonElement jopt)) {
-                            opt = jopt.ToObject<List<string>>();
-                        }
-                        if (opt != null)
-                        {
-                            //处理记录投票是否小于等于周期内最大投票数
-                            if (opt.Count <= vote.voteNum)
-                            {
-                                voteCount = vote.voteNum - opt.Count;
-                                msgid = 1;
-                            }
-                            else
-                            {
-                                //3周期内的可投票数不足
-                                msgid = 3;
-                                voteCount = 0;
-                            }
-                        }
-                        else {
-                            msgid = 1;
-                            voteCount = vote.voteNum;
-                        }
-                    }
-                    else {
-                        //未投票,可以投票
-                        msgid = 1;
-                        voteCount = vote.voteNum;
-                    }
-                }
-                else
-                {
-                    msgid = 2; 
-                    voteCount = 0;
-
-                }
-            }
-            return new {msgid,voteCount };
-        }
-
-        private static dynamic DoHomeworkTips(ActivityData commonData, AzureCosmosFactory _azureCosmos, string id, AzureRedisFactory _azureRedis)
-        {
-            return null;
-        }
-        private static dynamic DoLearnTips(ActivityData commonData, AzureCosmosFactory _azureCosmos, string id, AzureRedisFactory _azureRedis)
-        {
-            return null;
-        }
-        private static dynamic DoExamTips(ActivityData commonData, AzureCosmosFactory _azureCosmos, string id, AzureRedisFactory _azureRedis)
-        {
-            return null;
-        }
-        private static dynamic DoSurveyTips(ActivityData commonData, AzureCosmosFactory _azureCosmos, string id, AzureRedisFactory _azureRedis)
-        {
-            return null;
-        }
-       
+        }  
     }
 }

+ 7 - 2
TEAMModelOS/TEAMModelOS.csproj

@@ -3,6 +3,13 @@
   <PropertyGroup>
     <TargetFramework>netcoreapp3.1</TargetFramework>
   </PropertyGroup>
+
+  <ItemGroup>
+    <Compile Remove="Services\Evaluation\**" />
+    <Content Remove="Services\Evaluation\**" />
+    <EmbeddedResource Remove="Services\Evaluation\**" />
+    <None Remove="Services\Evaluation\**" />
+  </ItemGroup>
   <ItemGroup>
     <PackageReference Include="Caching.CSRedis" Version="3.6.50" />
     <PackageReference Include="CSRedisCore" Version="3.6.5" />
@@ -13,9 +20,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Folder Include="JwtRsaFile\" />
     <Folder Include="logfile\" />
-    <Folder Include="Services\Evaluation\" />
     <Folder Include="wwwroot\" />
   </ItemGroup>
   <ItemGroup>

+ 0 - 27
TEAMModelOS/private.pem

@@ -1,27 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIEowIBAAKCAQEAq8pNyi9hNGbjAU16coA/W6hBQb92YbLFKuePbpmRg7nc/8be
-iGI6ngl0IDmbAcyQEN5IHN8B1xma33RSXdlRO3+fiUlk81gV1uSYTaiRAWL0TryM
-Kf9avQsw+ezP5HVNQRj75lZZxeNg9YTbjVEbVAj/cF/0E8xBdplk1+AyrZTk/0Cl
-04Pr+dM5R+fisgIp3sEULORzhpow38l+S2YjoCagsckPKhSuqLEkB3KoiFJKCoHK
-UJ+dOfYoa6m3N5ylQCm79HzWeS7PSaXVq6Qh+nxNvA2FkSgcSPc1a1vNKXCwHW2H
-ShKsPGugaRCZPTHPDip05suatheVU4AhpVq9MwIDAQABAoIBAEN7ZLNXiUecYu/Q
-D5mK51iJ75h0LXyTTQBdlepMSO0FxdpztFa+v2f1Lri56Dn8sVru9kThFUf5tuyw
-NOrIwzAsIe879XvhzjJr+agH3248ANwtFKIqvOoly0dhzwhfS8mWlt0Ubo9dkmjf
-l58bjTClmDH8f1SHl++Osh5a441rmoTMfx6YyvTp5ekHLGsll24nOVE3w/6MWTvU
-wBoNFFMvkb062l3QSG/3iPgwEsk8VNX3+7MRp40gurEk51wGL91ysKQq6k8xe8JI
-fMN6x+D8ZuVSOzUMwK4JjoXR646bEEmQMTO/uypQqvXav2V2k5pLW40tlirR48il
-9OYCNAECgYEA4tjAqEbnhHuErcgtzQCHD24/vAXuDiKw58Caq+Bae6QgkqjWC2IQ
-FAkLuvZ2tQSx0EVDZ1+1qP9PLVx2Q1DYs+CwiOKaM04M3XAbppgonZ4+PWiSWUKa
-6jKXmHmQeuCWQRlCrinrrPsrRhNbc1UvhjRWFtlOeHEjMp8kkMvqKFMCgYEAwd4y
-TuaV8fAExYsNZtBTx1lyyp+2Yk3zjNG4AsxJZ7QRx5VQVXmh5Y9CMvkwB09KQonF
-IcHYWMuseLvVfweQwH3WS4D8G/zf92GISLtsIUes4bDxs3lFipoCutzJt3hcHYIs
-fcKW29VravnY5P1FBL7Kw1FV9fReC5G8Kr56+6ECgYAToDka1feVyLHz7wu3XsJQ
-nXM6KzErW+j+Q/WdxS1O4SZISf8qwPMvKJExPb2Lb7qKkFOCkA9BbcVF4WgB7u6w
-sVHUpfY9VhVa2yYpRaTN7jDoUzHGMzL/7Bydfnb3ipK1UyAnvUy8jIZz65zP36Da
-9ZA1LdvSI8ety4L4XAwILQKBgEG0D3LEHT9grA1TIhidNDeUrh3T4RkR+B/al7WD
-DMGzum7cwNwnG+JUGghygX+ItM82J/RX4P2/EVXduu6RXtKOE0mFjmvh2PnbOTgF
-JRFmXEYlFNVRnWrq5U/1MfwXM4jgrDl28G/StdQMlyCMYY7JJqjpcOuphRIAszf9
-VGrhAoGBAOEsLNr0BUZncJRgPEr+v1mI89d53WlM13J1YOaw7xVdvAPbOPlUix3f
-/ZGka2N14K4Dt1NjpwpGfMrfZFAlWKIiF9HFaXmTFjK68JK9HFJfW01k6qfiltH1
-0vhPZ/VIj6wrkHB61tuu0J8VFdap2KAtop+9HyIRiVsOjxtrASHP
------END RSA PRIVATE KEY-----

+ 0 - 9
TEAMModelOS/public.pem

@@ -1,9 +0,0 @@
------BEGIN PUBLIC KEY-----
-MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq8pNyi9hNGbjAU16coA/
-W6hBQb92YbLFKuePbpmRg7nc/8beiGI6ngl0IDmbAcyQEN5IHN8B1xma33RSXdlR
-O3+fiUlk81gV1uSYTaiRAWL0TryMKf9avQsw+ezP5HVNQRj75lZZxeNg9YTbjVEb
-VAj/cF/0E8xBdplk1+AyrZTk/0Cl04Pr+dM5R+fisgIp3sEULORzhpow38l+S2Yj
-oCagsckPKhSuqLEkB3KoiFJKCoHKUJ+dOfYoa6m3N5ylQCm79HzWeS7PSaXVq6Qh
-+nxNvA2FkSgcSPc1a1vNKXCwHW2HShKsPGugaRCZPTHPDip05suatheVU4AhpVq9
-MwIDAQAB
------END PUBLIC KEY-----