CrazyIter_Bin há 1 ano atrás
pai
commit
68c1ba4ad4

+ 11 - 5
TEAMModelOS/Controllers/Common/ActivityController.cs

@@ -157,7 +157,9 @@ namespace TEAMModelOS.Controllers
         [ProducesDefaultResponseType]
         [AuthToken(Roles = "admin,area")]
         [HttpPost("invite-target")]
+#if !DEBUG
         [Authorize(Roles = "IES")]
+#endif
 
         public async Task<IActionResult> InviteTarget(JsonElement request)
         {
@@ -169,22 +171,24 @@ namespace TEAMModelOS.Controllers
                     {
 
                         if (!request.TryGetProperty("scope", out JsonElement _scope)) return BadRequest();
+                        if (!request.TryGetProperty("areaId", out JsonElement _areaId)) return BadRequest();
                         string sql = string.Empty;
-                        if (_scope.GetString().Equals("public", StringComparison.OrdinalIgnoreCase))
+                        if (_scope.GetString().Equals("public", StringComparison.OrdinalIgnoreCase)  && _areaId.GetString().Equals( "02944f32-f534-3397-ea56-e6f1fc6c3714"))
                         {
                             sql = "select c.id,c.name ,c.picture,c.region,c.province,c.city,c.areaId   from c where c.code='Base' ";
                         }
                         else {
-                            if (!request.TryGetProperty("areaId", out JsonElement _areaId)) return BadRequest();
+                           
                             sql = $"select c.id,c.name ,c.picture,c.region,c.province,c.city,c.areaId   from c where c.code='Base' and c.areaId='{_areaId}' ";
                         }
                         var result = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).GetList<School>(sql, "Base");
                         var sc = result.list.FindAll(z => !string.IsNullOrWhiteSpace(z.areaId));
+                        List<dynamic> schools = new List<dynamic>();
                         if (sc.IsNotEmpty()) {
                             string areaSql = $"select value c from c where c.id in ({string.Join(",", sc.Select(z => $"'{z.areaId}'").ToHashSet())})";
-                            var areaResult = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Normal).GetList<Area>(sql, "Base-Area");
+                            var areaResult = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Normal).GetList<Area>(areaSql, "Base-Area");
                             if (areaResult.list.IsNotEmpty()) {
-                                List<dynamic> schools = new List<dynamic>();
+                              
                                 foreach (var item in result.list) {
                                     if (!string.IsNullOrWhiteSpace(item.areaId))
                                     {
@@ -197,7 +201,7 @@ namespace TEAMModelOS.Controllers
                                 }
                             }
                         }
-                        return Ok(new { code = 200, schools = result.list.Select(z => new { z.id, z.name, z.picture, z.region, z.province, z.city, z.areaId, areaName = string.Empty }) });
+                        return Ok(new { code = 200, schools });
                     }
                 case bool when $"{grant_type}".Equals("teachers", StringComparison.OrdinalIgnoreCase):
                     {
@@ -221,7 +225,9 @@ namespace TEAMModelOS.Controllers
         [ProducesDefaultResponseType]
         [AuthToken(Roles = "teacher,admin,area")]
         [HttpPost("manage")]
+#if !DEBUG
         [Authorize(Roles = "IES")]
+#endif
 
         public async Task<IActionResult> Manage(JsonElement request)
         {

+ 32 - 32
TEAMModelOS/appsettings.Development.json

@@ -22,48 +22,48 @@
   },
   "Azure": {
     // 测试站数据库
-    //"Storage": {
-    //  "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodeltest;AccountKey=O2W2vadCqexDxWO+px+QK7y1sHwsYj8f/WwKLdOdG5RwHgW/Dupz9dDUb4c1gi6ojzQaRpFUeAAmOu4N9E+37A==;EndpointSuffix=core.chinacloudapi.cn"
-    //},
-    //"Cosmos": {
-    //  "ConnectionString": "AccountEndpoint=https://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;"
-    //},
-    //"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",
-    //  "GenPdfQueue": "dep-genpdf"
-    //},
-    //"SignalR": {
-    //  "ConnectionString": "Endpoint=https://channel.service.signalr.net;AccessKey=KrblW06tuA4a/GyqRPDU0ynFFmAWxbAvyJihHclSXbQ=;Version=1.0;"
-    //}
-    // 正式站数据库
     "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://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;"
     },
     "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",
-      "GenPdfQueue": "genpdf"
+      "ConnectionString": "Endpoint=sb://teammodelos.servicebus.chinacloudapi.cn/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=Sy4h4EQ8zP+7w/lOLi1X3tGord/7ShFHimHs1vC50Dc=",
+      "ActiveTask": "dep-active-task",
+      "ItemCondQueue": "dep-itemcond",
+      "GenPdfQueue": "dep-genpdf"
     },
     "SignalR": {
-      "ConnectionString": "Endpoint=https://channel.signalr.azure.cn;AccessKey=AtcB7JYFNUbUXb1rGxa3PVksQ2X5YSv3JOHZR9J88tw=;Version=1.0;"
-    },
-    "Speech": {
-      "SubscriptionKey": "a4f5f4e2e2e54c6e8b0a4a0b4a0a4a0b",
-      "Region": "chinanorth3",
-      "Endpoint": "https://chinanorth3.api.cognitive.azure.cn/sts/v1.0/issuetoken"
+      "ConnectionString": "Endpoint=https://channel.service.signalr.net;AccessKey=KrblW06tuA4a/GyqRPDU0ynFFmAWxbAvyJihHclSXbQ=;Version=1.0;"
     }
+    // 正式站数据库
+    //"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",
+    //  "GenPdfQueue": "genpdf"
+    //},
+    //"SignalR": {
+    //  "ConnectionString": "Endpoint=https://channel.signalr.azure.cn;AccessKey=AtcB7JYFNUbUXb1rGxa3PVksQ2X5YSv3JOHZR9J88tw=;Version=1.0;"
+    //},
+    //"Speech": {
+    //  "SubscriptionKey": "a4f5f4e2e2e54c6e8b0a4a0b4a0a4a0b",
+    //  "Region": "chinanorth3",
+    //  "Endpoint": "https://chinanorth3.api.cognitive.azure.cn/sts/v1.0/issuetoken"
+    //}
   },
   "HaBookAuth": {
     "CoreId": {