CrazyIter_Bin 9 mesi fa
parent
commit
704a885e0e

+ 4 - 98
TEAMModelOS.Extension/HTEX.Complex/Controllers/OfficialController.cs

@@ -13,53 +13,25 @@ namespace HTEX.Complex.Controllers
     {
 
         private readonly DingDing _dingDing;
-        // private readonly SnowflakeId _snowflakeId;
-        // private readonly ServerSentEventsService _sse;
-        private readonly AzureCosmosFactory _azureCosmos3Factory;
         private readonly System.Net.Http.IHttpClientFactory _httpClientFactory;
-        //private readonly Models.Option _option;
-        // private readonly MailFactory _mailFactory;
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureStorageFactory _azureStorage;
-        private readonly IWebHostEnvironment _environment;
         private readonly IConfiguration _configuration;
-        // private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly IPSearcher _searcher;
-        public OfficialController(IWebHostEnvironment environment, IConfiguration configuration,
-            AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, System.Net.Http.IHttpClientFactory httpClientFactory, AzureCosmosFactory azureCosmos3Factory,
-            // IOptionsSnapshot<Option> option,  
+        public OfficialController(IConfiguration configuration,
+            AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, System.Net.Http.IHttpClientFactory httpClientFactory,
             DingDing dingDing, IPSearcher searcher)
         {
             _dingDing = dingDing;
-            _azureCosmos3Factory = azureCosmos3Factory;
             _httpClientFactory = httpClientFactory;
             _azureRedis = azureRedis;
             _azureStorage = azureStorage;
-            _environment = environment;
             _configuration = configuration;
             _searcher = searcher;
         }
-
-        [ProducesDefaultResponseType]
-        [RequestSizeLimit(102_400_000_00)] //最大10000m左右
-        [HttpPost("video-ls")]
-        public async Task<IActionResult> VideoUpload()
-        {
-            List<string> students = new List<string>();
-            //var result= await _azureCosmos3Factory.GetCosmosClient().GetContainer("winteachos", Constant.Teacher)
-            //    .GetList<Teacher>( "select value c from c", "Base");
-
-            await foreach (var item in _azureCosmos3Factory.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student)
-                .GetItemQueryIteratorSql<string>(queryText: "select value c.id from c", requestOptions: new QueryRequestOptions { MaxItemCount=5, PartitionKey = new PartitionKey("Base-hbcn") }))
-            {
-                students.Add(item);
-            }
-            return Ok(students);
-        }
-
         [ProducesDefaultResponseType]
         [HttpPost("video-list")]
-        public async Task<IActionResult> VideoList(JsonElement json)
+        public IActionResult VideoList(JsonElement json)
         {
             List<OfficialVideo> videos = new List<OfficialVideo>();
             var table = _azureStorage.TableServiceClient().GetTableClient("ShortUrl");
@@ -67,13 +39,10 @@ namespace HTEX.Complex.Controllers
             if (json.TryGetProperty("rowKey", out JsonElement _rowKey) && !string.IsNullOrWhiteSpace($"{_rowKey}"))
             {
                 videos =    table.Query<OfficialVideo>($"{Constant.PartitionKey} {Constant.Equal} 'OfficialVideo' and {Constant.RowKey} {Constant.Equal} '{_rowKey}'").ToList();
-
-
             }
             else
             {
                 videos =    table.Query<OfficialVideo>(filter: $"{Constant.PartitionKey} eq  'OfficialVideo'").ToList();
-
             }
             return Ok(new { videos });
         }
@@ -153,68 +122,5 @@ namespace HTEX.Complex.Controllers
         /// </summary>
         public string? url { get; set; }
     }
-    public class Student : CosmosEntity
-    {
-        public string mail { get; set; }
-        public string mobile { get; set; }
-        public string country { get; set; }
-        public string name { get; set; }
-        public string picture { get; set; }
-        public string schoolId { get; set; }
-        public string pw { get; set; }
-        public string salt { get; set; }
-        public int year { get; set; }
-        //座位号
-        public string no { get; set; }   //座位号
-        public string irs { get; set; }
-        //绑定班级Id
-        public string classId { get; set; }
-        //分组信息
-        public string groupId { get; set; }
-        public string groupName { get; set; }
-        public string periodId { get; set; }
-        /// <summary>
-        /// 性别 M( male,男) F (female 女)  N(secret 保密) 
-        /// </summary>
-        public string gender { get; set; }
-
-        //补充留级信息
-        //0在校,1毕业 
-        public int graduate { get; set; } = 0;
-
-        /// <summary>
-        /// 创建时间  十位 时间戳
-        /// </summary>
-        public long createTime { get; set; }
-
-        /// <summary>
-        /// 学生的专业id
-        /// </summary>
-        public string majorId { get; set; }
-        /// <summary>
-        /// 學生的OpenID (TW教育雲綁定ID)
-        /// </summary>
-        public string openId { get; set; }
-    }
-
-    /// <summary>
-    /// 教师
-    /// </summary>
-    public class Teacher : CosmosEntity
-    {
-        public Teacher()
-        {
-            pk = "Teacher";
-        }
-
-        /// <summary>
-        /// 系统权限信息
-        /// </summary>
-        public HashSet<string> permissions { get; set; } = new HashSet<string>();
-        /// <summary>
-        /// 组织信息
-        /// </summary>
-
-        //常用设备信息,及IP登录信息。
-    }
+   
 }

+ 1 - 1
TEAMModelOS.Extension/HTEX.Complex/Controllers/ScreenController.cs

@@ -53,7 +53,7 @@ namespace HTEX.Complex.Controllers
                     {
                         _logger.LogInformation($"客户端当前空闲=>{screenClient.name},{screenClient.region},{screenClient.clientid},分发任务......");
                         //连接成功,马上分发任务。
-                        var task = await GenPDFService.SentTask(_azureRedis, _azureStorage);
+                        var task = await TaskService.SentTask(_azureRedis, _azureStorage);
                         if (task.genQueue!=null && task.genRedis!=null  && !string.IsNullOrWhiteSpace(task.genQueue.cntName))
                         {
                             screenClient.status =  ScreenConstant.busy;

+ 3 - 4
TEAMModelOS.Extension/HTEX.Complex/Program.cs

@@ -84,15 +84,14 @@ namespace HTEX.Complex
             builder.Services.AddHttpClient();
             string? StorageConnectionString = builder.Configuration.GetValue<string>("Azure:Storage:ConnectionString");
             string? RedisConnectionString = builder.Configuration.GetValue<string>("Azure:Redis:ConnectionString");
-            string? CosmosConnectionString = builder.Configuration.GetValue<string>("Azure:Cosmos:ConnectionString");
             //Storage
             builder.Services.AddAzureStorage(StorageConnectionString, "Default");
             //Redis
             builder.Services.AddAzureRedis(RedisConnectionString, "Default");
-            //Cosmos
-            builder.Services.AddAzureCosmos(CosmosConnectionString, "Default");
+            string? StorageConnectionStringTest = builder.Configuration.GetValue<string>("Azure:Storage:ConnectionString-Test");
+            //Storage
+            builder.Services.AddAzureStorage(StorageConnectionString, "Test");
 
-          
             builder.Services.AddSignalR();
             builder.Services.AddHttpContextAccessor();
             builder.Services.AddHttpClient<DingDing>();

+ 3 - 7
TEAMModelOS.Extension/HTEX.Complex/Services/SignalRScreenServerHub.cs

@@ -1,6 +1,4 @@
-using Grpc.Core;
-using Microsoft.AspNetCore.SignalR;
-using Microsoft.Azure.Cosmos.Linq;
+using Microsoft.AspNetCore.SignalR;
 using Microsoft.Extensions.Primitives;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.Extension;
@@ -9,8 +7,6 @@ using System.Web;
 using System.Text;
 
 using StackExchange.Redis;
-using Azure.Storage.Blobs.Models;
-using Azure.Storage.Sas;
 namespace HTEX.Complex.Services
 {
     public class SignalRScreenServerHub : Hub<IClient>
@@ -109,7 +105,7 @@ namespace HTEX.Complex.Services
                             if (screenClient.status!.Equals(ScreenConstant.idle)) {
                                 _logger.LogInformation($"客户端当前空闲=>{screenClient.name},{screenClient.region},{clientid},分发任务......");
                                 //连接成功,马上分发任务。
-                                var task = await GenPDFService.SentTask(_azureRedis,_azureStorage);
+                                var task = await TaskService.SentTask(_azureRedis,_azureStorage);
                                 if (task.genQueue!=null && task.genRedis!=null  && !string.IsNullOrWhiteSpace(task.genQueue.cntName))
                                 {
                                     screenClient.status =  ScreenConstant.busy;
@@ -255,7 +251,7 @@ namespace HTEX.Complex.Services
             }
             if (screenClient!=null && screenClient.status!.Equals(ScreenConstant.idle))
             {
-                var taskData = await GenPDFService.SentTask(_azureRedis, _azureStorage);
+                var taskData = await TaskService.SentTask(_azureRedis, _azureStorage);
                 if (taskData.genQueue!=null && taskData.genRedis!=null  && !string.IsNullOrWhiteSpace(taskData.genQueue.cntName))
                 {
                     screenClient.status =  ScreenConstant.busy;

+ 94 - 0
TEAMModelOS.Extension/HTEX.Complex/Services/TaskService.cs

@@ -0,0 +1,94 @@
+using Azure.Storage.Sas;
+using StackExchange.Redis;
+using System.Web;
+using TEAMModelOS.SDK.DI;
+using TEAMModelOS.SDK;
+using TEAMModelOS.SDK.Extension;
+
+namespace HTEX.Complex.Services
+{
+    public class TaskService
+    {
+        public static async Task<(PDFGenRedis genRedis, PDFGenQueue genQueue, string msg)> SentTask(AzureRedisFactory _azureRedis, AzureStorageFactory _azureStorage)
+        {
+            string msg = string.Empty;
+            //从尾部弹出元素,队列先进先出
+            long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
+            var queueValue = await _azureRedis.GetRedisClient(8).ListRightPopAsync("PDFGen:Queue");
+            PDFGenRedis genRedis = null;
+            PDFGenQueue genQueue = null;
+            if (queueValue!=default && queueValue.HasValue)
+            {
+                genQueue = queueValue.ToString().ToObject<PDFGenQueue>();
+                RedisValue redisValue = await _azureRedis.GetRedisClient(8).HashGetAsync($"PDFGen:{genQueue.sessionId}", genQueue.id);
+                if (redisValue!=default)
+                {
+                    genRedis = redisValue.ToString().ToObject<PDFGenRedis>();
+                    //计算等待了多久的时间才开始生成。
+                    var wait = now- genRedis.join;
+                    genRedis.wait  = wait;
+                    genRedis.status = 1;
+                    try
+                    {
+                        Uri uri = new Uri(genQueue.pageUrl);
+                        var query = HttpUtility.ParseQueryString(uri.Query);
+                        string? url = query["url"];
+                        if (!string.IsNullOrWhiteSpace(url))
+                        {
+                            url=  HttpUtility.UrlDecode(url);
+                            uri = new Uri(url);
+                            string host = uri.Host;
+                            string azure_region = genQueue.env.Equals(ScreenConstant.env_develop) ? "Test" : "Default";
+                            var blobServiceClient = _azureStorage.GetBlobServiceClient("Test");
+                            if (host.Equals(blobServiceClient.Uri.Host))
+                            {
+                                // 获取容器名,它是路径的第一个部分
+                                string containerName = uri.Segments[1].TrimEnd('/');
+                                // 获取文件的完整同级目录,这是文件路径中除了文件名和扩展名之外的部分
+                                // 由于文件名是路径的最后一个部分,我们可以通过连接除了最后一个部分之外的所有部分来获取目录路径
+                                string directoryPath = string.Join("", uri.Segments, 2, uri.Segments.Length - 3);
+                                string? fileName = Path.GetFileNameWithoutExtension(uri.AbsolutePath);
+                                string blobPath = $"{directoryPath}{fileName}.pdf";
+                                var urlSas = _azureStorage.GetBlobSAS(containerName, blobPath, BlobSasPermissions.Write|BlobSasPermissions.Read, hour: 1, name: azure_region);
+                                genQueue.blobSas =  urlSas.sas;
+                                genQueue.blobName=blobPath;
+                                genQueue.cntName=containerName;
+                                genQueue.blobFullUrl=urlSas.fullUri;
+                            }
+                            else
+                            {
+                                msg="数据地址与服务提供的站点不一致!";
+                                genRedis.status=3;
+                                genRedis.msg = msg;
+
+                            }
+                        }
+                        else
+                        {
+                            msg="数据地址解析异常!";
+                            genRedis.status=3;
+                            genRedis.msg = msg;
+
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        msg=$"数据地址处理异常,异常信息:{ex.Message}";
+                        genRedis.status=3;
+                        genRedis.msg = ex.Message;
+                    }
+                    await _azureRedis.GetRedisClient(8).HashSetAsync($"PDFGen:{genQueue.sessionId}", genQueue.id, genRedis.ToJsonString());
+                }
+                else
+                {
+                    msg="队列任务关联数据为空!";
+                }
+            }
+            else
+            {
+                msg="队列暂无任务!";
+            }
+            return (genRedis, genQueue, msg);
+        }
+    }
+}

+ 1 - 10
TEAMModelOS.Extension/HTEX.Complex/appsettings.Development.json

@@ -11,17 +11,8 @@
       "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodeltest;AccountKey=O2W2vadCqexDxWO+px+QK7y1sHwsYj8f/WwKLdOdG5RwHgW/Dupz9dDUb4c1gi6ojzQaRpFUeAAmOu4N9E+37A==;EndpointSuffix=core.chinacloudapi.cn",
       "ConnectionString-Test": "DefaultEndpointsProtocol=https;AccountName=teammodeltest;AccountKey=O2W2vadCqexDxWO+px+QK7y1sHwsYj8f/WwKLdOdG5RwHgW/Dupz9dDUb4c1gi6ojzQaRpFUeAAmOu4N9E+37A==;EndpointSuffix=core.chinacloudapi.cn"
     },
-    "ServiceBus": {
-      "ConnectionString": "Endpoint=sb://coreservicebuscn.servicebus.chinacloudapi.cn/;SharedAccessKeyName=TEAMModelOS;SharedAccessKey=xO8HcvXXuuEkuFI0KlV5uXs8o6vyuVqTR+ASbPGMhHo=",
-      "ConnectionString-Test": "Endpoint=sb://coreservicebuscn.servicebus.chinacloudapi.cn/;SharedAccessKeyName=TEAMModelOS;SharedAccessKey=xO8HcvXXuuEkuFI0KlV5uXs8o6vyuVqTR+ASbPGMhHo="
-    },
     "Redis": {
-      "ConnectionString": "52.130.252.100:6379,password=habook,ssl=false,abortConnect=False,writeBuffer=10240",
-      "ConnectionString-Test": "52.130.252.100:6379,password=habook,ssl=false,abortConnect=False,writeBuffer=10240"
-    },
-    "Cosmos": {
-      "ConnectionString": "AccountEndpoint=https://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;",
-      "ConnectionString-Test": "AccountEndpoint=https://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;"
+      "ConnectionString": "52.130.252.100:6379,password=habook,ssl=false,abortConnect=False,writeBuffer=10240"
     }
   }
 }

+ 1 - 10
TEAMModelOS.Extension/HTEX.Complex/appsettings.json

@@ -11,17 +11,8 @@
       "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodelos;AccountKey=Dl04mfZ9hE9cdPVO1UtqTUQYN/kz/dD/p1nGvSq4tUu/4WhiKcNRVdY9tbe8620nPXo/RaXxs+1F9sVrWRo0bg==;EndpointSuffix=core.chinacloudapi.cn",
       "ConnectionString-Test": "DefaultEndpointsProtocol=https;AccountName=teammodeltest;AccountKey=O2W2vadCqexDxWO+px+QK7y1sHwsYj8f/WwKLdOdG5RwHgW/Dupz9dDUb4c1gi6ojzQaRpFUeAAmOu4N9E+37A==;EndpointSuffix=core.chinacloudapi.cn"
     },
-    "ServiceBus": {
-      "ConnectionString": "Endpoint=sb://coreservicebuscn.servicebus.chinacloudapi.cn/;SharedAccessKeyName=TEAMModelOS;SharedAccessKey=xO8HcvXXuuEkuFI0KlV5uXs8o6vyuVqTR+ASbPGMhHo=",
-      "ConnectionString-Test": "Endpoint=sb://coreservicebuscn.servicebus.chinacloudapi.cn/;SharedAccessKeyName=TEAMModelOS;SharedAccessKey=xO8HcvXXuuEkuFI0KlV5uXs8o6vyuVqTR+ASbPGMhHo="
-    },
     "Redis": {
-      "ConnectionString": "CoreRedisCN.redis.cache.chinacloudapi.cn:6380,password=LyJWP1ORJdv+poXWofAF97lhCEQPg1wXWqvtzXGXQuE=,ssl=True,abortConnect=False",
-      "ConnectionString-Test": "52.130.252.100:6379,password=habook,ssl=false,abortConnect=False,writeBuffer=10240"
-    },
-    "Cosmos": {
-      "ConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;",
-      "ConnectionString-Test": "AccountEndpoint=https://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;"
+      "ConnectionString": "CoreRedisCN.redis.cache.chinacloudapi.cn:6380,password=LyJWP1ORJdv+poXWofAF97lhCEQPg1wXWqvtzXGXQuE=,ssl=True,abortConnect=False"
     }
   }
 }

+ 1 - 1
TEAMModelOS.Function/IESServiceBusTrigger.cs

@@ -112,7 +112,7 @@ namespace TEAMModelOS.Function
                         break;
                     case bool when json.RootElement.TryGetProperty("bizType", out JsonElement _bizType) && $"{_bizType}".Equals("ArtStudentPdf"):
                         await GenPDFService.GenArtStudentPdf(_azureRedis, _azureCosmos,
-                  _coreAPIHttpService, _dingDing, _azureStorage, json.RootElement);
+                  _coreAPIHttpService, _dingDing, _azureStorage,_configuration, json.RootElement);
                         break;
                 }
             }

+ 28 - 89
TEAMModelOS.SDK/Models/Service/GenPDFService.cs

@@ -25,90 +25,13 @@ using Azure.Storage.Sas;
 using TEAMModelOS.SDK.Models.Service;
 using Azure.Core;
 using TEAMModelOS.SDK.Models.Cosmos.Common;
+using System.Configuration;
 
 namespace TEAMModelOS.SDK
 {
     public static class GenPDFService
     {
-        public static async Task<(PDFGenRedis genRedis, PDFGenQueue genQueue,string msg )> SentTask(AzureRedisFactory _azureRedis, AzureStorageFactory _azureStorage) 
-        {
-            string msg = string.Empty;
-            //从尾部弹出元素,队列先进先出
-            long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
-            var queueValue = await _azureRedis.GetRedisClient(8).ListRightPopAsync("PDFGen:Queue");
-            PDFGenRedis genRedis = null;
-            PDFGenQueue genQueue = null;
-            if (queueValue!=default && queueValue.HasValue)
-            {
-                genQueue = queueValue.ToString().ToObject<PDFGenQueue>();
-                RedisValue redisValue = await _azureRedis.GetRedisClient(8).HashGetAsync($"PDFGen:{genQueue.sessionId}", genQueue.id);
-                if (redisValue!=default)
-                {
-                    genRedis = redisValue.ToString().ToObject<PDFGenRedis>();
-                    //计算等待了多久的时间才开始生成。
-                    var wait = now- genRedis.join;
-                    genRedis.wait  = wait;
-                    genRedis.status = 1;
-                    try
-                    {
-                        Uri uri = new Uri(genQueue.pageUrl);
-                        var query = HttpUtility.ParseQueryString(uri.Query);
-                        string? url = query["url"];
-                        if (!string.IsNullOrWhiteSpace(url))
-                        {
-                            url=  HttpUtility.UrlDecode(url);
-                            uri = new Uri(url);
-                            string host = uri.Host;
-                            var blobServiceClient = _azureStorage.GetBlobServiceClient();
-                            if (host.Equals(blobServiceClient.Uri.Host))
-                            {
-                                // 获取容器名,它是路径的第一个部分
-                                string containerName = uri.Segments[1].TrimEnd('/');
-                                // 获取文件的完整同级目录,这是文件路径中除了文件名和扩展名之外的部分
-                                // 由于文件名是路径的最后一个部分,我们可以通过连接除了最后一个部分之外的所有部分来获取目录路径
-                                string directoryPath = string.Join("", uri.Segments, 2, uri.Segments.Length - 3);
-                                string? fileName = Path.GetFileNameWithoutExtension(uri.AbsolutePath);
-                                string blobPath = $"{directoryPath}{fileName}.pdf";
-                                var urlSas = _azureStorage.GetBlobSAS(containerName, blobPath, BlobSasPermissions.Write, hour: 1);
-                                genQueue.blobSas =  urlSas.sas;
-                                genQueue.blobName=blobPath;
-                                genQueue.cntName=containerName;
-                                genQueue.blobFullUrl=urlSas.fullUri;
-                            }
-                            else
-                            {
-                                msg="数据地址与服务提供的站点不一致!";
-                                genRedis.status=3;
-                                genRedis.msg = msg;
-                              
-                            }
-                        }
-                        else
-                        {
-                            msg="数据地址解析异常!";
-                            genRedis.status=3;
-                            genRedis.msg = msg;
-                            
-                        }
-                    }
-                    catch (Exception ex)
-                    {
-                        msg=$"数据地址处理异常,异常信息:{ex.Message}";
-                        genRedis.status=3;
-                        genRedis.msg = ex.Message;
-                    }
-                    await _azureRedis.GetRedisClient(8).HashSetAsync($"PDFGen:{genQueue.sessionId}", genQueue.id, genRedis.ToJsonString());
-                }
-                else {
-                    msg="队列任务关联数据为空!";
-                }
-            }
-            else
-            {
-                msg="队列暂无任务!";
-            }
-            return (genRedis, genQueue, msg);
-        }
+       
 
 
 
@@ -497,6 +420,7 @@ namespace TEAMModelOS.SDK
                         dbData.url= item.url;
                         dbData.scope = data.scope;
                         dbData.owner= data.owner;
+                        dbData.env= data.env;
                         genRedis.Add(dbData);
                     }
                 }
@@ -510,7 +434,8 @@ namespace TEAMModelOS.SDK
                         name=item.name,
                         url= item.url,
                         scope=data.scope,
-                        owner= data.owner
+                        owner= data.owner,
+                        env= data.env,
                     });
                 }
             }
@@ -529,6 +454,7 @@ namespace TEAMModelOS.SDK
                     sessionId= data.sessionId,
                     timeout =data.timeout,
                     name=item.name,
+                    env= data.env,
                 };
                 //string message = JsonSerializer.Serialize(genQueue);
                 //从头部压入元素,队列先进先出
@@ -546,7 +472,7 @@ namespace TEAMModelOS.SDK
         }
 
         public static async Task GenArtStudentPdf( AzureRedisFactory _azureRedis, AzureCosmosFactory _azureCosmos, 
-            CoreAPIHttpService _coreAPIHttpService, DingDing _dingDing, AzureStorageFactory _azureStorage, JsonElement json)
+            CoreAPIHttpService _coreAPIHttpService, DingDing _dingDing, AzureStorageFactory _azureStorage, IConfiguration _configuration, JsonElement json)
         {
             try
             {
@@ -597,11 +523,11 @@ namespace TEAMModelOS.SDK
                 //    string url = $"{atrUrl}?url={s.fullUri}";
                 //    urls.Add(url);
                 //});
-                string env = "release";
-                if (Environment.GetEnvironmentVariable("Option:Location").Contains("Test", StringComparison.CurrentCultureIgnoreCase) ||
-                    Environment.GetEnvironmentVariable("Option:Location").Contains("Dep", StringComparison.CurrentCultureIgnoreCase))
+                string env = ScreenConstant.env_release;
+                if (_configuration.GetValue<string>("Option:Location").Contains("Test", StringComparison.OrdinalIgnoreCase) ||
+                    _configuration.GetValue<string>("Option:Location").Contains("Dep", StringComparison.OrdinalIgnoreCase))
                 {
-                    env = "develop";
+                    env = ScreenConstant.env_develop;
                 }
                var addData = await GenPDFService.AddGenPdfQueue(_azureRedis,
                     new GenPDFData
@@ -754,6 +680,10 @@ namespace TEAMModelOS.SDK
         /// 数据范围
         /// </summary>
         public string scope { get; set; }
+        /// <summary>
+        /// 环境变量
+        /// </summary>
+        public string env { get; set; }
     }
 
 
@@ -771,6 +701,10 @@ namespace TEAMModelOS.SDK
     /// </summary>
     public class PDFGenQueue 
     {
+        /// <summary>
+        /// 环境变量
+        /// </summary>
+        public string env { get; set;}
         /// <summary>
         /// 姓名
         /// </summary>
@@ -944,10 +878,15 @@ namespace TEAMModelOS.SDK
         public static readonly string error = "error";
         public static readonly string offline = "offline";
         public static readonly string grant_type = "bookjs_api";
-        /// <summary>
-        /// 冗余时间
-        /// </summary>
-        public static readonly long time_excess = 5000;
+
+
+        public static readonly string env_release = "release";
+        public static readonly string env_develop = "develop";
+                
+    /// <summary>
+    /// 冗余时间
+    /// </summary>
+    public static readonly long time_excess = 5000;
     }
     public enum MessageType {
         conn_success,//连接成功

+ 7 - 0
TEAMModelOS.SDK/Models/Service/LessonService.cs

@@ -60,6 +60,13 @@ namespace TEAMModelOS.SDK.Models.Service
             {
                 dict.Add("category[*]", category);
             }
+            if (request.TryGetProperty("doubleGray", out JsonElement doubleGray) && doubleGray.GetBoolean())
+            {
+                dict.Add("=.tLevel", -1);
+                dict.Add("=.pLevel", -1);
+                //dict.Add(">=.tScore", 70);
+                //dict.Add(">=.pScore", 70);
+            }
             if (request.TryGetProperty("doubleGreen", out JsonElement doubleGreen) && doubleGreen.GetBoolean())
             {
                 dict.Add("=.tLevel", 2);

+ 1 - 1
TEAMModelOS/Controllers/System/GenPDFController.cs

@@ -82,7 +82,7 @@ namespace TEAMModelOS.Controllers
         public async Task<IActionResult> GenArtStudentPdf(JsonElement request)
         {
 
-            await GenPDFService.GenArtStudentPdf(_azureRedis, _azureCosmos,_coreAPIHttpService, _dingDing, _azureStorage, request);
+            await GenPDFService.GenArtStudentPdf(_azureRedis, _azureCosmos,_coreAPIHttpService, _dingDing, _azureStorage, _configuration, request);
             return Ok();
         }