Sfoglia il codice sorgente

Merge branch 'develop6.0-tmd' of http://52.130.252.100:10000/TEAMMODEL/TEAMModelOS into develop6.0-tmd

XW 3 anni fa
parent
commit
699f15242c

+ 4 - 2
TEAMModelBI/Controllers/BISchool/SchoolController.cs

@@ -503,6 +503,10 @@ namespace TEAMModelBI.Controllers.BISchool
                 {
                     dic.Add("userId", $"{userId}");
                 }
+                if (string.IsNullOrEmpty($"{userId}") && string.IsNullOrEmpty($"{tmdId}")) 
+                {
+                    return Ok(new { state = 400, msg = "钉钉账户或醍摩豆账户需要至少要传一个!" });
+                }
 
                 Dictionary<string, List<string>> noSchools = new();
                 List<DingDingUserInfo> ddUserInfoList = await table.FindListByDict<DingDingUserInfo>(dic);
@@ -569,7 +573,6 @@ namespace TEAMModelBI.Controllers.BISchool
             }
         }
 
-
         /// <summary>
         /// 依据学校ID查学校管理员信息
         /// </summary>
@@ -868,7 +871,6 @@ namespace TEAMModelBI.Controllers.BISchool
             return Ok(new { state = 200, allSize, useSize, teacherSpace, useSpaceInfo });
         }
 
-
         /// <summary>
         /// 未加入区域的学校
         /// </summary>

+ 23 - 13
TEAMModelBI/Controllers/Census/SchoolController.cs

@@ -42,26 +42,36 @@ namespace TEAMModelBI.Controllers.Census
         public async Task<IActionResult> GetAll() 
         {
             var cosmosClient = _azureCosmos.GetCosmosClient();
-            
-            List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, "select c.id from c", "Base");
-            int tecCount = await CommonFind.FindTotals(cosmosClient, "select count(c.id) totals from c", "Teacher", "Base");
-            int stuCount = await CommonFind.FindTotals(cosmosClient, "select count(c.id) totals from c", "Student", "Base");
-            long roomCount = await CommonFind.FindTotals(cosmosClient, "select count(c.id) totals from c where c.pk = 'Room' and c.serial != null", new List<string>() { "School" });
+
+            long allLessCount = 0; //所有课例          
+            long lastYearLessCount = 0; //去年课例
+            long yearLessCount = 0;//今年课例
+            long allActivityCount = 0; //所有活动
+            long lastActivityCount = 0; //去年活动
+            long activityCount = 0;   //今年活动
+            int tecCount = 0;  //教师数量
+            int stuCount = 0;  //学生数量
+            long roomCount = 0;  //教师数量
+
+
 
             var (lastYearStart, lastYearEnd) = TimeHelper.GetStartOrEnd(DateTimeOffset.Parse($"{DateTimeOffset.UtcNow.Year - 1}-1-1"), "year");
             var (yearStart, yearEnd) = TimeHelper.GetStartOrEnd(DateTimeOffset.UtcNow, "year");
 
+            List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, "select c.id from c", "Base");
+            tecCount = await CommonFind.FindTotals(cosmosClient, "select count(c.id) totals from c", "Teacher", "Base");
+            stuCount = await CommonFind.FindTotals(cosmosClient, "select count(c.id) totals from c", "Student", "Base");
+            roomCount = await CommonFind.FindTotals(cosmosClient, "select count(c.id) totals from c where c.pk = 'Room' and c.serial != null", new List<string>() { "School" });
+
+
             //所有课例
-            long allLessCount = await CommonFind.FindTotals(cosmosClient, $"select count(c.id) as totals from c where c.pk='LessonRecord'", new List<string>() { "School", "Teacher" });
+            allLessCount = await CommonFind.FindTotals(cosmosClient, $"select count(c.id) as totals from c where c.pk='LessonRecord'", new List<string>() { "School", "Teacher" });
             //去年课例
-            long lastYearLessCount = await CommonFind.FindTotals(cosmosClient, $"select count(c.id) as totals from c where c.pk='LessonRecord' and c.startTime>={lastYearStart} and c.startTime<={lastYearEnd}", new List<string>() { "School", "Teacher" });
+            lastYearLessCount = await CommonFind.FindTotals(cosmosClient, $"select count(c.id) as totals from c where c.pk='LessonRecord' and c.startTime>={lastYearStart} and c.startTime<={lastYearEnd}", new List<string>() { "School", "Teacher" });
             //今年课例
-            long yearLessCount = await CommonFind.FindTotals(cosmosClient, $"select count(c.id) as totals from c where c.pk='LessonRecord' and c.startTime>={yearStart} and c.startTime<={yearEnd}", new List<string>() { "School", "Teacher" });
-
-            long allActivityCount = 0;
-            long lastActivityCount = 0;
-            long activityCount = 0;
+            yearLessCount = await CommonFind.FindTotals(cosmosClient, $"select count(c.id) as totals from c where c.pk='LessonRecord' and c.startTime>={yearStart} and c.startTime<={yearEnd}", new List<string>() { "School", "Teacher" });
 
+            //活动
             foreach (var type in StaticValue.activityTypes)
             {
                 allActivityCount += await CommonFind.FindTotals(cosmosClient, $"select count(c.id) as totals from c where c.pk='{type}' ", new List<string>() { "Common" });
@@ -69,7 +79,7 @@ namespace TEAMModelBI.Controllers.Census
                 activityCount += await CommonFind.FindTotals(cosmosClient, $"select count(c.id) as totals from c where c.pk='{type}' and c.createTime >={yearStart} and c.createTime<= {yearEnd}", new List<string>() { "Common" });
             }
 
-            return Ok(new { state = 200, scCount = schoolIds.Count, tecCount, stuCount, roomCount, lastYearLessCount, yearLessCount, allActivityCount, lastActivityCount, activityCount });
+            return Ok(new { state = 200, scCount = schoolIds.Count, tecCount, stuCount, roomCount, allLessCount, lastYearLessCount, yearLessCount, allActivityCount, lastActivityCount, activityCount });
         }
 
         /// <summary>

+ 188 - 3
TEAMModelBI/Controllers/DingDingStruc/SystemConfigController.cs

@@ -15,6 +15,9 @@ using Microsoft.Extensions.Options;
 using TEAMModelBI.Tool.Extension;
 using TEAMModelOS.SDK.DI;
 using TEAMModelBI.Filter;
+using TEAMModelOS.SDK.Extension;
+using System.Linq;
+using TEAMModelBI.Models;
 
 namespace TEAMModelBI.Controllers.DingDingStruc
 {
@@ -22,7 +25,6 @@ namespace TEAMModelBI.Controllers.DingDingStruc
     [ApiController]
     public class SystemConfigController : ControllerBase
     {
-
         private readonly IConfiguration _configuration;
         private readonly IWebHostEnvironment _hostingEnvironment; //读取文件
         private readonly Option _option;
@@ -38,7 +40,7 @@ namespace TEAMModelBI.Controllers.DingDingStruc
         }
 
         /// <summary>
-        /// 
+        /// 获取应用配置文件
         /// </summary>
         /// <returns></returns>
         [HttpPost("get-config")]
@@ -61,7 +63,7 @@ namespace TEAMModelBI.Controllers.DingDingStruc
         }
 
         /// <summary>
-        /// 配置文件修改
+        /// 应用配置文件修改
         /// </summary>
         /// <param name="jsonElement"></param>
         /// <returns></returns>
@@ -247,9 +249,192 @@ namespace TEAMModelBI.Controllers.DingDingStruc
             }
         }
 
+        /// <summary>
+        /// 获取当前应用的
+        /// </summary>
+        /// <param name="jsonElement"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [AuthToken(Roles = "admin")]
+        [HttpPost("get-allconfig")]
+        public async Task<IActionResult> GetAllConfig() 
+        {
+            var builder = $"{_hostingEnvironment.ContentRootPath}/JsonFile/SystemConfig.json";
+            StreamReader streamReader = new(new FileStream(builder, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Encoding.UTF8);
+            StringBuilder stringBuilder = new();
+            string text;
+            while ((text = streamReader.ReadLine()) != null)
+            {
+                stringBuilder.Append(text.ToString());
+            }
+            string input = stringBuilder.ToString();
+            List<SysConfig> allConfigs = input.ToObject<List<SysConfig>>();
+            var currentSite = _option.Location;
+            SysConfig currentSysConfig = allConfigs.Where(x => x.site.Equals(currentSite)).FirstOrDefault();
+            if (currentSysConfig != null)
+            {
+                return Ok(new { state = 200, allConfigs, currentSysConfig });
+            }
+            else {
+                currentSysConfig.site = currentSite;
+                currentSysConfig.nickName = currentSite;
+                currentSysConfig.proDeptId = long.Parse(_configuration["CustomParam:proDeptId"]);
+
+                currentSysConfig.clientKey.clientID = _configuration["HaBookAuth:CoreService:clientID"];
+                currentSysConfig.clientKey.clientSecret = _configuration["HaBookAuth:CoreService:clientSecret"];
+
+                currentSysConfig.dDAuth.agentId = _configuration["DingDingAuth:Agentld"];
+                currentSysConfig.dDAuth.appKey = _configuration["DingDingAuth:appKey"];
+                currentSysConfig.dDAuth.appSecret = _configuration["DingDingAuth:appSecret"];
+
+                currentSysConfig.azureClient.storage = _configuration["Azure:Storage:ConnectionString"];
+                currentSysConfig.azureClient.cosmos = _configuration["Azure:Cosmos:ConnectionString"];
+                currentSysConfig.azureClient.redis = _configuration["Azure:Redis:ConnectionString"];
+                currentSysConfig.azureClient.servicBus = _configuration["Azure:ServiceBus:ConnectionString"];
+
+                return Ok(new { state = 201, allConfigs, currentSysConfig }); 
+            }
+        }
+
+        /// <summary>
+        /// 修改或者添加配置文件,到多个配置文件中
+        /// </summary>
+        /// <param name="sysConfig"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [AuthToken(Roles = "admin")]
+        [HttpPost("set-singleconfig")]
+        public async Task<IActionResult> SetSingleConfig(SysConfig sysConfig) 
+        {
+            var builder = $"{_hostingEnvironment.ContentRootPath}/JsonFile/SystemConfig.json";
+            StreamReader streamReader = new(new FileStream(builder, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Encoding.UTF8);
+            StringBuilder stringBuilder = new();
+            string text;
+            while ((text = streamReader.ReadLine()) != null)
+            {
+                stringBuilder.Append(text.ToString());
+            }
+            string input = stringBuilder.ToString();
+
+            List<SysConfig> allConfigs = new();
+            if (!string.IsNullOrEmpty(input)) 
+            {
+                try
+                {
+                    allConfigs = input.ToObject<List<SysConfig>>();
+                }
+                catch
+                {
+                    allConfigs.Add(sysConfig);
+                }
+                var tempSysConfig = allConfigs.Where(x => x.site.Equals(sysConfig.site)).FirstOrDefault();
+                if (tempSysConfig != null)
+                {
+                    tempSysConfig.site = sysConfig.site;
+                    tempSysConfig.nickName = sysConfig.nickName;
+                    tempSysConfig.proDeptId = sysConfig.proDeptId;
+                    tempSysConfig.clientKey = sysConfig.clientKey;
+                    tempSysConfig.dDAuth = sysConfig.dDAuth;
+                    tempSysConfig.azureClient = sysConfig.azureClient;
+                }
+                else
+                {
+                    allConfigs.Add(sysConfig);
+                }
+            }
+            else
+            {
+                allConfigs.Add(sysConfig);
+            }
+
+            string ListJson = JsonConvert.SerializeObject(allConfigs, Formatting.Indented);
+            System.IO.File.WriteAllText(builder, ListJson);
+
+            return Ok(new { state = 200, allConfigs });
+        }
+
+        /// <summary>
+        /// 切换站点
+        /// </summary>
+        /// <param name="jsonElement"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [AuthToken(Roles = "admin")]
+        [HttpPost("cut-site")]
+        public async Task<IActionResult> CutSite(JsonElement jsonElement) 
+        {
+            if (!jsonElement.TryGetProperty("site", out JsonElement site)) return BadRequest();
+            var builder = $"{_hostingEnvironment.ContentRootPath}/JsonFile/SystemConfig.json";
+            var formalDeploy = $"{_hostingEnvironment.ContentRootPath}/appsettings.json";
+            var extendDeploy = $"{_hostingEnvironment.ContentRootPath}/appsettings.Development.json";
+
+            StreamReader streamReader = new(new FileStream(builder, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Encoding.UTF8);
+            StringBuilder stringBuilder = new();
+            string text;
+            while ((text = streamReader.ReadLine()) != null)
+            {
+                stringBuilder.Append(text.ToString());
+            }
+            string input = stringBuilder.ToString();
+
+            List<SysConfig> allConfigs = input.ToObject<List<SysConfig>>();
+
+            var tempSysConfig = allConfigs.Where(x => x.site.Equals($"{site}")).FirstOrDefault();
+
+            // 有排版  注释全无
+            StreamReader reader = System.IO.File.OpenText(formalDeploy);
+            JsonTextReader jsonTextReader = new(reader);
+            JObject jsonObject = (JObject)JToken.ReadFrom(jsonTextReader);
+
+            StreamReader readerDeve = System.IO.File.OpenText(extendDeploy);
+            JsonTextReader jsonTextReaderDeve = new(readerDeve);
+            JObject jsonObjectDeve = (JObject)JToken.ReadFrom(jsonTextReaderDeve);
+
+            if (tempSysConfig != null)
+            {
+                jsonObject["Option"]["Location"] = $"{site}";
+                jsonObject["CustomParam"]["proDeptId"] = $"{tempSysConfig.proDeptId}";
+
+                jsonObjectDeve["Option"]["Location"] = $"{site}";
+                jsonObjectDeve["CustomParam"]["proDeptId"] = $"{tempSysConfig.proDeptId}";
+
+                jsonObject["HaBookAuth"]["CoreService"]["clientID"] = tempSysConfig.clientKey.clientID;
+                jsonObject["HaBookAuth"]["CoreService"]["clientSecret"] = tempSysConfig.clientKey.clientSecret;
+                jsonObjectDeve["HaBookAuth"]["CoreService"]["clientID"] = tempSysConfig.clientKey.clientID;
+                jsonObjectDeve["HaBookAuth"]["CoreService"]["clientSecret"] = tempSysConfig.clientKey.clientSecret;
 
+                jsonObject["DingDingAuth"]["Agentld"] = $"{tempSysConfig.dDAuth.agentId}";
+                jsonObject["DingDingAuth"]["appKey"] = $"{tempSysConfig.dDAuth.appKey}";
+                jsonObject["DingDingAuth"]["appSecret"] = $"{tempSysConfig.dDAuth.appSecret}";
 
+                jsonObjectDeve["DingDingAuth"]["Agentld"] = $"{tempSysConfig.dDAuth.agentId}";
+                jsonObjectDeve["DingDingAuth"]["appKey"] = $"{tempSysConfig.dDAuth.appKey}";
+                jsonObjectDeve["DingDingAuth"]["appSecret"] = $"{tempSysConfig.dDAuth.appSecret}";
 
 
+                jsonObject["Azure"]["Storage"]["ConnectionString"] = $"{ tempSysConfig.azureClient.storage}";
+                jsonObject["Azure"]["Cosmos"]["ConnectionString"] = $"{tempSysConfig.azureClient.cosmos}";
+                jsonObject["Azure"]["Redis"]["ConnectionString"] = $"{tempSysConfig.azureClient.redis}";
+                jsonObject["Azure"]["ServiceBus"]["ConnectionString"] = $"{tempSysConfig.azureClient.servicBus}";
+
+                jsonObjectDeve["Azure"]["Storage"]["ConnectionString"] = $"{ tempSysConfig.azureClient.storage}";
+                jsonObjectDeve["Azure"]["Cosmos"]["ConnectionString"] = $"{tempSysConfig.azureClient.cosmos}";
+                jsonObjectDeve["Azure"]["Redis"]["ConnectionString"] = $"{tempSysConfig.azureClient.redis}";
+                jsonObjectDeve["Azure"]["ServiceBus"]["ConnectionString"] = $"{tempSysConfig.azureClient.servicBus}";
+
+            }
+            else return Ok(new { state = 404,msg = "未找到你需要的参数" });
+
+            reader.Close();
+            string output = JsonConvert.SerializeObject(jsonObject, Formatting.Indented); //是否json文件有缩进
+            System.IO.File.WriteAllText(formalDeploy, output);
+
+            readerDeve.Close();
+            string outputDeve = JsonConvert.SerializeObject(jsonObjectDeve, Formatting.Indented); //是否json文件有缩进
+            System.IO.File.WriteAllText(extendDeploy, outputDeve);
+
+            return Ok(new { state = 200, SysConfig = tempSysConfig });
+        }
+
     }
 }

+ 62 - 0
TEAMModelBI/JsonFile/SystemConfig.json

@@ -0,0 +1,62 @@
+[
+  {
+    "site": "Chins",
+    "nickName": "正式站",
+    "proDeptId": 13456,
+    "clientKey": {
+      "clientID": "021251",
+      "clientSecret": "200005463678"
+    },
+    "dDAuth": {
+      "agentId": "12300456",
+      "appKey": "32001",
+      "appSecret": "12300456"
+    },
+    "azureClient": {
+      "storage": "0000",
+      "cosmos": "1234005",
+      "redis": "224005",
+      "servicBus": "12300455"
+    }
+  },
+  {
+    "site": "Chins-214",
+    "nickName": "正式站-214",
+    "proDeptId": 13456,
+    "clientKey": {
+      "clientID": "021251",
+      "clientSecret": "200005463678"
+    },
+    "dDAuth": {
+      "agentId": "12300456",
+      "appKey": "32001",
+      "appSecret": "12300456"
+    },
+    "azureClient": {
+      "storage": "0000",
+      "cosmos": "1234005",
+      "redis": "224005",
+      "servicBus": "12300455"
+    }
+  },
+  {
+    "site": "China-Dep",
+    "nickName": "测试站",
+    "proDeptId": 67690917,
+    "clientKey": {
+      "clientID": "c7317f88-7cea-4e48-ac57-a16071f7b884",
+      "clientSecret": "kguxh:V.PLmxBdaI@jnrTrDSth]A3346"
+    },
+    "dDAuth": {
+      "agentId": null,
+      "appKey": "dingrucgsnt8p13rfbgd",
+      "appSecret": "Gyx_N57yZslhQOAhAPlvmCwOp_qTm1DScKbd5OoOE0URAW4eViYA2Sk_ZxKb-8WG"
+    },
+    "azureClient": {
+      "storage": "DefaultEndpointsProtocol=https;AccountName=teammodelstorage;AccountKey=Yq7D4dE6cFuer2d2UZIccTA/i0c3sJ/6ITc8tNOyW+K5f+/lWw9GCos3Mxhj47PyWQgDL8YbVD63B9XcGtrMxQ==;EndpointSuffix=core.chinacloudapi.cn",
+      "cosmos": "AccountEndpoint=https://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;",
+      "redis": "52.130.252.100:6379,password=habook,ssl=false,abortConnect=False,writeBuffer=10240",
+      "servicBus": "Endpoint=sb://teammodelos.servicebus.chinacloudapi.cn/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=Sy4h4EQ8zP+7w/lOLi1X3tGord/7ShFHimHs1vC50Dc="
+    }
+  }
+]

+ 55 - 0
TEAMModelBI/Models/SysConfig.cs

@@ -0,0 +1,55 @@
+namespace TEAMModelBI.Models
+{
+    /// <summary>
+    /// 配置文件
+    /// </summary>
+    public class SysConfig
+    {
+        //public string id { get; set; }
+        /// <summary>
+        /// 站点
+        /// </summary>
+        public string site { get; set; }
+        /// <summary>
+        /// 站点昵称
+        /// </summary>
+        public string nickName { get; set; }
+        /// <summary>
+        /// 部门Id
+        /// </summary>
+        public long proDeptId { get; set; }
+        /// <summary>
+        /// 连接秘钥
+        /// </summary>
+        public ClientKey clientKey { get; set; }
+        /// <summary>
+        /// 钉钉秘钥
+        /// </summary>
+        public DDAuth dDAuth { get; set; }
+        /// <summary>
+        /// 数据库连接字串
+        /// </summary>
+        public AzureClient azureClient { get; set; }
+    }
+
+    public class ClientKey
+    {
+        public string clientID { get; set; }
+        public string clientSecret { get; set; }
+    }
+
+    public class DDAuth
+    {
+        public string agentId { get; set; }
+        public string appKey { get; set; }
+        public string appSecret { get; set; }
+    }
+
+    public class AzureClient
+    {
+        public string storage { get; set; }
+        public string cosmos { get; set; }
+        public string redis { get; set; }
+        public string servicBus { get; set; }
+    }
+}

+ 2 - 0
TEAMModelBI/Startup.cs

@@ -15,6 +15,7 @@ using System.Collections.Generic;
 using System.IdentityModel.Tokens.Jwt;
 using System.Linq;
 using System.Threading.Tasks;
+using TEAMModelBI.Models;
 using TEAMModelOS.Models;
 using TEAMModelOS.SDK;
 using TEAMModelOS.SDK.DI;
@@ -98,6 +99,7 @@ namespace TEAMModelBI
             services.AddHttpClient<CoreAPIHttpService>();
             services.AddMemoryCache();
             services.AddControllers().AddJsonOptions(options => { options.JsonSerializerOptions.IgnoreNullValues = false; });
+            services.Configure<SysConfig>(Configuration.GetSection("sysConfig"));  //注册连接
             //HttpContextAccessor,并用来访问HttpContext。(提供組件或非控制器服務存取HttpContext)
             services.AddHttpContextAccessor();
             services.Configure<Option>(options => Configuration.GetSection("Option").Bind(options));

+ 8 - 1
TEAMModelBI/Tool/TimeHelper.cs

@@ -226,7 +226,14 @@ namespace TEAMModelBI.Tool
                     DateTimeOffset weekEnd  = dateTime.AddDays(7-(int)(dateTime.DayOfWeek));
                     tempStrart = new DateTime(weekStrart.Year, weekStrart.Month, weekStrart.Day);
                     tempEnt = new DateTime(weekEnd.Year, weekEnd.Month, weekEnd.Day, 23, 59, 59); 
-
+                    break;
+                case "lastweek":
+                    var m = (dateTime.DayOfWeek == DayOfWeek.Sunday ? (DayOfWeek)7 : dateTime.DayOfWeek) - DayOfWeek.Monday;
+                    var s = (dateTime.DayOfWeek == DayOfWeek.Sunday ? (DayOfWeek)7 : dateTime.DayOfWeek) - (DayOfWeek)7;
+                    var Mon = dateTime.AddDays((-7 - m));//星期一
+                    var Sun = dateTime.AddDays((-7 - s));  //星期日
+                    tempStrart = new DateTime(Mon.Year, Mon.Month, Mon.Day);
+                    tempEnt = new DateTime(Sun.Year, Sun.Month, Sun.Day, 23, 59, 59);
 
                     break;
                 default:

+ 1 - 1
TEAMModelOS.SDK/Models/Service/GroupListService.cs

@@ -1010,7 +1010,7 @@ namespace TEAMModelOS.SDK
 
                 if (tmdids.IsNotEmpty()) {
                     ///获取真实的名称 
-                    var content = new StringContent(tmdids.Select(x => x.id).ToJsonString(), Encoding.UTF8, "application/json");
+                    var content = new StringContent(tmdids.Select(x => x.id).ToHashSet().ToJsonString(), Encoding.UTF8, "application/json");
                     string json = null;
                     try
                     {

+ 19 - 14
TEAMModelOS/Controllers/Common/HomeworkController.cs

@@ -98,14 +98,16 @@ namespace TEAMModelOS.Controllers.Learn
                 if (string.IsNullOrEmpty(homework.id))
                 {
                     homework.id = Guid.NewGuid().ToString();
-                    if (homework.startTime > now)
-                    {
-                        homework.progress = "pending";
-                    }
-                    else
-                    {
-                        homework.progress = "going";
-                    }
+                    if (string.IsNullOrEmpty(homework.progress)) {
+                        if (homework.startTime > now)
+                        {
+                            homework.progress = "pending";
+                        }
+                        else
+                        {
+                            homework.progress = "going";
+                        }
+                    }                   
                    // homework.progress = "going";
                     var messageBlob = new ServiceBusMessage();
                     string blobcntr = null;
@@ -171,13 +173,16 @@ namespace TEAMModelOS.Controllers.Learn
                     }
                     else
                     {
-                        if (homework.startTime > now)
-                        {
-                            homework.progress = "pending";
-                        }
-                        else
+                        if (string.IsNullOrEmpty(homework.progress))
                         {
-                            homework.progress = "going";
+                            if (homework.startTime > now)
+                            {
+                                homework.progress = "pending";
+                            }
+                            else
+                            {
+                                homework.progress = "going";
+                            }
                         }
                         //homework.progress = "going";
                         homework.recordUrl = $"/homework/{homework.id}/record.json";

+ 19 - 13
TEAMModelOS/Controllers/Common/SurveyController.cs

@@ -89,14 +89,17 @@ namespace TEAMModelOS.Controllers
                 if (string.IsNullOrEmpty(request.id))
                 {
                     request.id = Guid.NewGuid().ToString();
-                   
-                    if (request.startTime > now)
-                    {
-                        request.progress = "pending";
-                    }
-                    else
+
+                    if (string.IsNullOrEmpty(request.progress))
                     {
-                        request.progress = "going";
+                        if (request.startTime > now)
+                        {
+                            request.progress = "pending";
+                        }
+                        else
+                        {
+                            request.progress = "going";
+                        }
                     }
                     var messageBlob = new ServiceBusMessage();
                     string blobcntr = null;
@@ -161,13 +164,16 @@ namespace TEAMModelOS.Controllers
                         request = await client.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync(request, info.id, new PartitionKey($"{info.code}"));
                     }
                     else {
-                        if (request.startTime > now)
+                        if (string.IsNullOrEmpty(request.progress))
                         {
-                            request.progress = "pending";
-                        }
-                        else
-                        {
-                            request.progress = "going";
+                            if (request.startTime > now)
+                            {
+                                request.progress = "pending";
+                            }
+                            else
+                            {
+                                request.progress = "going";
+                            }
                         }
                         request.recordUrl = $"/survey/{request.id}/record.json";
                         var cods = new { records = new List<string>(), userids = new List<string>(), question = new List<QuestionRecord>() };

+ 19 - 11
TEAMModelOS/Controllers/Common/VoteController.cs

@@ -78,13 +78,18 @@ namespace TEAMModelOS.Controllers
                 {
                    
                     request.id = Guid.NewGuid().ToString();
-                    if (request.startTime > now)
+                    if(string.IsNullOrEmpty(request.progress))
                     {
-                        request.progress = "pending";
-                    }
-                    else { 
-                        request.progress = "going";
+                        if (request.startTime > now)
+                        {
+                            request.progress = "pending";
+                        }
+                        else
+                        {
+                            request.progress = "going";
+                        }
                     }
+                    
                     string blobcntr = null;
                     var messageBlob = new ServiceBusMessage();
                     if (request.scope.Equals("school"))
@@ -150,13 +155,16 @@ namespace TEAMModelOS.Controllers
                     }
                     else
                     {
-                        if (request.startTime > now)
-                        {
-                            request.progress = "pending";
-                        }
-                        else
+                        if (string.IsNullOrEmpty(request.progress))
                         {
-                            request.progress = "going";
+                            if (request.startTime > now)
+                            {
+                                request.progress = "pending";
+                            }
+                            else
+                            {
+                                request.progress = "going";
+                            }
                         }
                         string url = $"/vote/{request.id}/record.json";
                         request.recordUrl = url;

+ 184 - 82
TEAMModelOS/Controllers/XTest/TestController.cs

@@ -758,6 +758,109 @@ namespace TEAMModelOS.Controllers
             await table.SaveOrUpdateAll(teachersUp);
             return Ok();
         }
+        [HttpPost("get-teacher-ability-files")]
+        public async Task<IActionResult> GetScteacher(JsonElement json) {
+
+            List<string> teachers = new List<string>();
+            string schoolSql = "SELECT value  c.id FROM c join a in c.schools where a.areaId='870a5a6b-1ab3-461a-bdeb-baec19780ddb' and c.code='Base' ";
+            await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher)
+                .GetItemQueryIterator<string>(schoolSql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey("Base") }))
+            {
+                teachers.Add(item);
+            }
+            string tr =$"SELECT value(c) FROM c  where c.id in ({string.Join(",", teachers.Select(x=>$"'{x}'"))}) and c.onlineTime!=0  and c.onlineTime<20 and  c.pk='TeacherTrain' ";
+            List<TeacherTrain> teacherTrains = new List<TeacherTrain>();
+            await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher)
+                .GetItemQueryIterator<TeacherTrain>(tr, requestOptions: new QueryRequestOptions {  }))
+            {
+                if (!item.tmdid.Equals("1528783259")) {
+                    teacherTrains.Add(item);
+                }
+            }
+            foreach (var item in teacherTrains)
+            {
+                if (item.onlineTime > 15)
+                {
+                    TeacherFile teacherFile = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<TeacherFile>(item.id, new PartitionKey($"TeacherFile-{item.code.Replace("TeacherTrain-", "")}"));
+                    foreach (var x in item.currency.teacherAilities)
+                    {
+                        if (x.onlineTime < 320)
+                        {
+                            string sql = $" select value(c) from c  where c.abilityId='{x.id}' and c.code='AbilityTask-standard10'";
+                            List<AbilityTask> abilityTasks = new List<AbilityTask>();
+                            Dictionary<string, RecordFileAbility> valuePairs = new Dictionary<string, RecordFileAbility>();
+                            await foreach (var y in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Normal).GetItemQueryIterator<AbilityTask>
+                                  (sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"AbilityTask-standard10") }))
+                            {
+                                abilityTasks.Add(y);
+                            }
+                            double limit = 0;
+                            abilityTasks.ForEach(x =>
+                            {
+                                x.children.ForEach(y =>
+                                {
+                                    y.rnodes.ForEach(r =>
+                                    {
+                                         
+                                        if (valuePairs.ContainsKey(r.hash))
+                                        {
+                                            valuePairs.TryGetValue(r.hash, out var value);
+                                            value.fileAbilities.Add(new FileAbility { url = r.link, abilityId = x.abilityId, taskId = x.id, nodeId = y.id });
+                                            limit = limit + r.duration;
+                                        }
+                                        else
+                                        {
+                                            valuePairs.Add(r.hash, new RecordFileAbility
+                                            {
+                                                fileRecord =
+                                                new FileRecord { hash = r.hash, size = r.size.Value, duration = r.duration, view = (int)r.duration, type = r.type, done = true },
+                                                fileAbilities = new List<FileAbility> { new FileAbility { url = r.link, abilityId = x.abilityId, taskId = x.id, nodeId = y.id } }
+                                            });
+                                            limit = limit + r.duration;
+                                        }
+                                    });
+                                });
+                            });
+
+                            foreach (var ps in valuePairs)
+                            {
+                                var fils = teacherFile.fileRecords.Find(x => x.hash.Equals(ps.Key));
+                                if (fils != null)
+                                {
+                                    ps.Value.fileAbilities.ForEach(x =>
+                                    {
+                                        var a = fils.files.Find(z => z.nodeId.Equals(x.nodeId) && z.abilityId.Equals(x.abilityId));
+                                        if (a == null)
+                                        {
+                                            fils.files.Add(new FileAbility { url = x.url, abilityId = x.abilityId, taskId = x.taskId, nodeId = x.nodeId });
+                                        }
+                                    });
+                                }
+                                else
+                                {
+                                    teacherFile.fileRecords.Add(new FileRecord
+                                    {
+                                        hash = ps.Value.fileRecord.hash,
+                                        size = ps.Value.fileRecord.size,
+                                        duration = ps.Value.fileRecord.duration,
+                                        view = (int)ps.Value.fileRecord.view,
+                                        type = ps.Value.fileRecord.type,
+                                        done = true,
+                                        files = ps.Value.fileAbilities
+                                    });
+                                }
+                            }
+
+                        }
+                    }
+                    teacherFile = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReplaceItemAsync<TeacherFile>(teacherFile, teacherFile.id, new PartitionKey(teacherFile.code));
+                    item.update.Add(StatisticsService.TeacherAbility);
+                    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReplaceItemAsync<TeacherTrain>(item, item.id, new PartitionKey(item.code));
+                }
+            }
+            return Ok(teacherTrains);
+        }
+
         [HttpPost("fix-teacher-ability-files")]
         public async Task<IActionResult> TestScteacher(JsonElement json) {
             if (!json.TryGetProperty("ids", out JsonElement _ids)) return BadRequest();
@@ -782,92 +885,91 @@ namespace TEAMModelOS.Controllers
                 if (schools.Contains(item.code)) {
                     ids.Add(item);
                 }
-             
             }
             var grp = ids.GroupBy(g => g.code).Select(x => new { key = x.Key, list = x.ToList() });
           
-            foreach (var gp in grp) {
-                foreach (var tch in gp.list) {
-                    if (!string.IsNullOrWhiteSpace(tch.id)) {
-                       var id  =  ids.Find(x => x.id.Equals(tch.id))?.id;
-                        if (id != null) {
-                            TeacherFile teacherFile = new TeacherFile { id = id,pk= "TeacherFile",code= $"TeacherFile-{gp.key}",ttl=-1 };
-                            try {
-                                TeacherTrain teacherTrain = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<TeacherTrain>(id, new PartitionKey($"TeacherTrain-{gp.key}"));
-                                teacherTrain.update.Add("TeacherAbility");
-                                await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReplaceItemAsync<TeacherTrain>(teacherTrain,id, new PartitionKey($"TeacherTrain-{gp.key}"));
-                            } catch (Exception) { 
-                            }
-                            List<AbilitySub> abilitySubs = new List<AbilitySub>();
-                            string sql = "select value(c) from c ";
-                            try {
-                                await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).GetItemQueryIterator<AbilitySub>
-                             (sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"AbilitySub-{gp.key}-{id}") }))
-                                {
-                                    abilitySubs.Add(item);
-                                }
+            //foreach (var gp in grp) {
+            //    foreach (var tch in gp.list) {
+            //        if (!string.IsNullOrWhiteSpace(tch.id)) {
+            //           var id  =  ids.Find(x => x.id.Equals(tch.id))?.id;
+            //            if (id != null) {
+            //                TeacherFile teacherFile = new TeacherFile { id = id,pk= "TeacherFile",code= $"TeacherFile-{gp.key}",ttl=-1 };
+            //                try {
+            //                    TeacherTrain teacherTrain = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<TeacherTrain>(id, new PartitionKey($"TeacherTrain-{gp.key}"));
+            //                    teacherTrain.update.Add("TeacherAbility");
+            //                    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReplaceItemAsync<TeacherTrain>(teacherTrain,id, new PartitionKey($"TeacherTrain-{gp.key}"));
+            //                } catch (Exception) { 
+            //                }
+            //                List<AbilitySub> abilitySubs = new List<AbilitySub>();
+            //                string sql = "select value(c) from c ";
+            //                try 
+            //                {
+            //                    await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).GetItemQueryIterator<AbilitySub>
+            //                        (sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"AbilitySub-{gp.key}-{id}") }))
+            //                    {
+            //                        abilitySubs.Add(item);
+            //                    }
                            
-                            Dictionary<string, RecordFileAbility> valuePairs = new Dictionary<string, RecordFileAbility>();
-                            var taskids=  abilitySubs.SelectMany(x => x.taskRcds).Select(x => x.id).ToHashSet();
-                            if (taskids.Any()) {
-
-                                List<AbilityTask> abilityTasks = new List<AbilityTask>();
-                                string taskSql = $"select distinct value(c) from c  join b in c.children where c.code='AbilityTask-standard10' and b.id in ({string.Join(",", taskids.Select(m=>$"'{m}'"))})";
-                                await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Normal).GetItemQueryIterator<AbilityTask>
-                                   (taskSql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"AbilityTask-standard10") }))
-                                {
-                                    abilityTasks.Add(item);
-                                }
-                                abilityTasks.ForEach(x => {
-                                    x.children.ForEach(y => {
-                                       var di= taskids.ToList().Find(z => z.Equals(y.id));
-                                        if (!string.IsNullOrWhiteSpace(id)) {
-                                            y.rnodes.ForEach(r => {
-                                                if (valuePairs.ContainsKey(r.hash))
-                                                {
-                                                    valuePairs.TryGetValue(r.hash, out var value);
-                                                    value.fileAbilities.Add(new FileAbility { url = r.link, abilityId = x.abilityId, taskId = x.id, nodeId = r.id });
-                                                }
-                                                else {
-                                                    valuePairs.Add(r.hash, new RecordFileAbility
-                                                    {
-                                                        fileRecord =
-                                                        new FileRecord { hash = r.hash, size = r.size.Value, duration = r.duration, view = (int)r.duration, type = r.type, done = true },
-                                                        fileAbilities = new List<FileAbility> { new FileAbility { url=r.link,abilityId=x.abilityId,taskId=x.id,nodeId=r.id } }
-                                                    });
-                                                }
-                                            });
-                                        }
-                                    });
-                                });
-                                }
-                                foreach (var item in valuePairs)
-                                {
-                                    teacherFile.fileRecords.Add(new FileRecord
-                                    {
-                                        hash = item.Value.fileRecord.hash,
-                                        size = item.Value.fileRecord.size,
-                                        duration = item.Value.fileRecord.duration,
-                                        view = (int)item.Value.fileRecord.view,
-                                        type = item.Value.fileRecord.type,
-                                        done = true,
-                                        files = item.Value.fileAbilities
-                                    });
-                                    
-                                 
-                                }
-                            }
-                            catch (Exception ex)
-                            {
-                                return BadRequest(new { ex = ex.Message, ms = ex.StackTrace });
-
-                            }
-                            teacherFiles.Add(teacherFile);
-                             await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).UpsertItemAsync(teacherFile, new PartitionKey(teacherFile.code));
-                        }
-                    }
-                }
-            }
+            //                    Dictionary<string, RecordFileAbility> valuePairs = new Dictionary<string, RecordFileAbility>();
+            //                    var taskids=  abilitySubs.SelectMany(x => x.taskRcds).Select(x => x.id).ToHashSet();
+            //                    if (taskids.Any()) 
+            //                    {
+
+            //                        List<AbilityTask> abilityTasks = new List<AbilityTask>();
+            //                        string taskSql = $"select distinct value(c) from c  join b in c.children where c.code='AbilityTask-standard10' and b.id in ({string.Join(",", taskids.Select(m=>$"'{m}'"))})";
+            //                        await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Normal).GetItemQueryIterator<AbilityTask>
+            //                            (taskSql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"AbilityTask-standard10") }))
+            //                        {
+            //                            abilityTasks.Add(item);
+            //                        }
+            //                        abilityTasks.ForEach(x => {
+            //                            x.children.ForEach(y => {
+            //                                var di= taskids.ToList().Find(z => z.Equals(y.id));
+            //                                if (!string.IsNullOrWhiteSpace(di)) {
+            //                                    y.rnodes.ForEach(r => {
+            //                                        if (valuePairs.ContainsKey(r.hash))
+            //                                        {
+            //                                            valuePairs.TryGetValue(r.hash, out var value);
+            //                                            value.fileAbilities.Add(new FileAbility { url = r.link, abilityId = x.abilityId, taskId = x.id, nodeId = di });
+            //                                        }
+            //                                        else {
+            //                                            valuePairs.Add(r.hash, new RecordFileAbility
+            //                                            {
+            //                                                fileRecord =
+            //                                                new FileRecord { hash = r.hash, size = r.size.Value, duration = r.duration, view = (int)r.duration, type = r.type, done = true },
+            //                                                fileAbilities = new List<FileAbility> { new FileAbility { url=r.link,abilityId=x.abilityId,taskId=x.id,nodeId=di } }
+            //                                            });
+            //                                        }
+            //                                    });
+            //                                }
+            //                            });
+            //                        });
+            //                    }
+            //                    foreach (var item in valuePairs)
+            //                    {
+            //                        teacherFile.fileRecords.Add(new FileRecord
+            //                        {
+            //                            hash = item.Value.fileRecord.hash,
+            //                            size = item.Value.fileRecord.size,
+            //                            duration = item.Value.fileRecord.duration,
+            //                            view = (int)item.Value.fileRecord.view,
+            //                            type = item.Value.fileRecord.type,
+            //                            done = true,
+            //                            files = item.Value.fileAbilities
+            //                        });
+            //                    }
+            //                }
+            //                catch (Exception ex)
+            //                {
+            //                    return BadRequest(new { ex = ex.Message, ms = ex.StackTrace });
+
+            //                }
+            //                teacherFiles.Add(teacherFile);
+            //                await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).UpsertItemAsync(teacherFile, new PartitionKey(teacherFile.code));
+            //            }
+            //        }
+            //    }
+            //}
             
             return Ok(teacherFiles);
         }

+ 23 - 23
TEAMModelOS/appsettings.Development.json

@@ -20,37 +20,37 @@
     //"HttpTrigger": "http://localhost:7071/api/"
   },
   "Azure": {
-    "Storage": {
-      "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodeltest;AccountKey=O2W2vadCqexDxWO+px+QK7y1sHwsYj8f/WwKLdOdG5RwHgW/Dupz9dDUb4c1gi6ojzQaRpFUeAAmOu4N9E+37A==;EndpointSuffix=core.chinacloudapi.cn"
-    },
-    "Cosmos": {
-      //"ConnectionString": "AccountEndpoint=https://teammodel.documents.azure.com:443/;AccountKey=opemBAZi0yATewIlhxDYoIEUqncT5qJh3pUBZsBkTqEkuLYTuu3VS7oaDGJlPp8ASwm5SVSrK2caJsjgmqRw9g==;"
-      "ConnectionString": "AccountEndpoint=https://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;"
-      //"ConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;"
-    },
-    "Redis": {
-      "ConnectionString": "52.130.252.100:6379,password=habook,ssl=false,abortConnect=False,writeBuffer=10240"
-    },
-    "ServiceBus": {
-      "ConnectionString": "Endpoint=sb://teammodelos.servicebus.chinacloudapi.cn/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=Sy4h4EQ8zP+7w/lOLi1X3tGord/7ShFHimHs1vC50Dc=",
-      "ActiveTask": "dep-active-task",
-      "ItemCondQueue": "dep-itemcond"
-    }
-
     //"Storage": {
-    //  "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodelos;AccountKey=Dl04mfZ9hE9cdPVO1UtqTUQYN/kz/dD/p1nGvSq4tUu/4WhiKcNRVdY9tbe8620nPXo/RaXxs+1F9sVrWRo0bg==;EndpointSuffix=core.chinacloudapi.cn"
+    //  "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodeltest;AccountKey=O2W2vadCqexDxWO+px+QK7y1sHwsYj8f/WwKLdOdG5RwHgW/Dupz9dDUb4c1gi6ojzQaRpFUeAAmOu4N9E+37A==;EndpointSuffix=core.chinacloudapi.cn"
     //},
     //"Cosmos": {
-    //  "ConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;"
+    //  //"ConnectionString": "AccountEndpoint=https://teammodel.documents.azure.com:443/;AccountKey=opemBAZi0yATewIlhxDYoIEUqncT5qJh3pUBZsBkTqEkuLYTuu3VS7oaDGJlPp8ASwm5SVSrK2caJsjgmqRw9g==;"
+    //  "ConnectionString": "AccountEndpoint=https://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;"
+    //  //"ConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;"
     //},
     //"Redis": {
-    //  "ConnectionString": "CoreRedisCN.redis.cache.chinacloudapi.cn:6380,password=LyJWP1ORJdv+poXWofAF97lhCEQPg1wXWqvtzXGXQuE=,ssl=True,abortConnect=False"
+    //  "ConnectionString": "52.130.252.100:6379,password=habook,ssl=false,abortConnect=False,writeBuffer=10240"
     //},
     //"ServiceBus": {
-    //  "ConnectionString": "Endpoint=sb://coreiotservicebuscnpro.servicebus.chinacloudapi.cn/;SharedAccessKeyName=TEAMModelOS;SharedAccessKey=llRPBMDJG9w1Nnifj+pGhV0g4H2REcq0PjvX2qqpcOg=",
-    //  "ActiveTask": "active-task",
-    //  "ItemCondQueue": "itemcond"
+    //  "ConnectionString": "Endpoint=sb://teammodelos.servicebus.chinacloudapi.cn/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=Sy4h4EQ8zP+7w/lOLi1X3tGord/7ShFHimHs1vC50Dc=",
+    //  "ActiveTask": "dep-active-task",
+    //  "ItemCondQueue": "dep-itemcond"
     //}
+
+    "Storage": {
+      "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodelos;AccountKey=Dl04mfZ9hE9cdPVO1UtqTUQYN/kz/dD/p1nGvSq4tUu/4WhiKcNRVdY9tbe8620nPXo/RaXxs+1F9sVrWRo0bg==;EndpointSuffix=core.chinacloudapi.cn"
+    },
+    "Cosmos": {
+      "ConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;"
+    },
+    "Redis": {
+      "ConnectionString": "CoreRedisCN.redis.cache.chinacloudapi.cn:6380,password=LyJWP1ORJdv+poXWofAF97lhCEQPg1wXWqvtzXGXQuE=,ssl=True,abortConnect=False"
+    },
+    "ServiceBus": {
+      "ConnectionString": "Endpoint=sb://coreiotservicebuscnpro.servicebus.chinacloudapi.cn/;SharedAccessKeyName=TEAMModelOS;SharedAccessKey=llRPBMDJG9w1Nnifj+pGhV0g4H2REcq0PjvX2qqpcOg=",
+      "ActiveTask": "active-task",
+      "ItemCondQueue": "itemcond"
+    }
   },
   "HaBookAuth": {
     "CoreId": {