|
@@ -0,0 +1,104 @@
|
|
|
+using Microsoft.AspNetCore.Mvc;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using TEAMModelOS.Models;
|
|
|
+using TEAMModelOS.SDK.DI;
|
|
|
+using System.Text.Json;
|
|
|
+using TEAMModelOS.SDK.Models;
|
|
|
+using Microsoft.AspNetCore.Http;
|
|
|
+using TEAMModelOS.SDK.Extension;
|
|
|
+using Azure.Cosmos;
|
|
|
+using System.Text;
|
|
|
+using TEAMModelOS.SDK.DI.AzureCosmos.Inner;
|
|
|
+using Microsoft.Extensions.Options;
|
|
|
+using Azure.Messaging.ServiceBus;
|
|
|
+using Microsoft.Extensions.Configuration;
|
|
|
+using HTEXLib.COMM.Helpers;
|
|
|
+using TEAMModelOS.SDK;
|
|
|
+using System.IdentityModel.Tokens.Jwt;
|
|
|
+using TEAMModelOS.Services;
|
|
|
+using TEAMModelOS.SDK.Models.Service;
|
|
|
+using System.IO;
|
|
|
+using System.Dynamic;
|
|
|
+using Microsoft.AspNetCore.Authorization;
|
|
|
+using Azure.Storage.Blobs.Models;
|
|
|
+using static TEAMModelOS.SDK.Models.Teacher;
|
|
|
+using System.Web;
|
|
|
+using static TEAMModelOS.Controllers.FixDataController;
|
|
|
+using static TEAMModelOS.SDK.SchoolService;
|
|
|
+using Microsoft.AspNetCore.Hosting;
|
|
|
+namespace TEAMModelOS.Controllers
|
|
|
+{
|
|
|
+ // <summary>
|
|
|
+ ///
|
|
|
+ /// </summary>
|
|
|
+ ///
|
|
|
+ [ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
+ [ProducesResponseType(StatusCodes.Status400BadRequest)]
|
|
|
+ //
|
|
|
+ //[Route("")]
|
|
|
+ //[Route("api/[controller]")]
|
|
|
+ [ApiController]
|
|
|
+ public class NxController : ControllerBase
|
|
|
+ {
|
|
|
+ private readonly SnowflakeId _snowflakeId;
|
|
|
+ private readonly AzureCosmosFactory _azureCosmos;
|
|
|
+ private readonly DingDing _dingDing;
|
|
|
+ private readonly Option _option;
|
|
|
+ private readonly AzureStorageFactory _azureStorage;
|
|
|
+ private readonly AzureServiceBusFactory _serviceBus;
|
|
|
+ private readonly AzureRedisFactory _azureRedis;
|
|
|
+ private readonly CoreAPIHttpService _coreAPIHttpService;
|
|
|
+ private readonly ThirdApisService _scsApisService;
|
|
|
+ public readonly string type = "nxedu";
|
|
|
+ private readonly HttpTrigger _httpTrigger;
|
|
|
+ private readonly IWebHostEnvironment _environment;
|
|
|
+ /// <summary>
|
|
|
+ /// 机构安全码
|
|
|
+ /// </summary>
|
|
|
+ public string _sc_passKey;
|
|
|
+ /// <summary>
|
|
|
+ /// 机构ID
|
|
|
+ /// </summary>
|
|
|
+ public string _sc_trainComID;
|
|
|
+ /// <summary>
|
|
|
+ /// 机构 AES 密钥
|
|
|
+ /// </summary>
|
|
|
+ public string _sc_privateKey;
|
|
|
+ /// <summary>
|
|
|
+ /// 访问地址
|
|
|
+ /// </summary>
|
|
|
+ public string _sc_url;
|
|
|
+ public IConfiguration _configuration { get; set; }
|
|
|
+ public NxController(IWebHostEnvironment environment, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
|
|
|
+ AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService, ThirdApisService scsApisService, HttpTrigger httpTrigger)
|
|
|
+ {
|
|
|
+ _azureCosmos = azureCosmos;
|
|
|
+ _snowflakeId = snowflakeId;
|
|
|
+ _dingDing = dingDing;
|
|
|
+ _option = option?.Value;
|
|
|
+ _azureStorage = azureStorage;
|
|
|
+ _serviceBus = serviceBus;
|
|
|
+ _configuration = configuration;
|
|
|
+ _azureRedis = azureRedis;
|
|
|
+ _coreAPIHttpService = coreAPIHttpService;
|
|
|
+ _scsApisService = scsApisService;
|
|
|
+ _httpTrigger = httpTrigger;
|
|
|
+ _environment = environment;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 动态地址路由。"config":"scsyxpt","path":"sc{pjx/jinniu}"
|
|
|
+ /// </summary>D:\VisualStudioProjects\TEAMModelOS\TEAMModelOS.SDK\Models\Service\Third\ScYxptModel.cs
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+
|
|
|
+ [HttpGet("{path}/oauth2")]
|
|
|
+ [AllowAnonymous]
|
|
|
+ public async Task<IActionResult> Oauth2([FromQuery] NxOauth oauth, string path) {
|
|
|
+ return Ok(new { oauth, path });
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|