😎修改SolidWorksManage服务获取token逻辑,更改数据库连接字符串
This commit is contained in:
parent
ce21fa4543
commit
431b1a5710
@ -0,0 +1,13 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "8.0.10",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
],
|
||||
"rollForward": false
|
||||
}
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
{
|
||||
//"ConfigId": "1300000000001", // 默认库标识-禁止修改
|
||||
"DbType": "SqlServer", // MySql、SqlServer、Sqlite、Oracle、PostgreSQL、Dm、Kdbndp、Oscar、MySqlConnector、Access、OpenGauss、QuestDB、HG、ClickHouse、GBase、Odbc、Custom
|
||||
"ConnectionString": "Data Source=127.0.0.1;Initial Catalog=VistarStarDataManage;User ID=sa;Password=123456", // Sqlite 库连接字符串
|
||||
"ConnectionString": "Data Source=192.168.10.101;Initial Catalog=VistarStarDataManage;User ID=sa;Password=Vistar2024.", // Sqlite 库连接字符串123456
|
||||
//"ConnectionString": "PORT=5432;DATABASE=xxx;HOST=localhost;PASSWORD=xxx;USER ID=xxx", // PostgreSQL 库连接字符串
|
||||
//"ConnectionString": "Server=localhost;Database=xxx;Uid=xxx;Pwd=xxx;SslMode=None;", // MySql 库连接字符串",
|
||||
//"ConnectionString": "User Id=xxx; Password=xxx; Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)))", // Oracle 库连接字符串
|
||||
@ -62,7 +62,7 @@
|
||||
{
|
||||
"ConfigId": "启威星 1.94.4.74", // 库标识
|
||||
"DbType": "SqlServer", // 库类型
|
||||
"ConnectionString": "Data Source=1.94.4.74;Initial Catalog=SWManage_Vistar;User ID=sa;Password=ASDzxc123.", // 库连接字符串
|
||||
"ConnectionString": "Data Source=192.168.10.101;Initial Catalog=SWManage_Vistar;User ID=sa;Password=Vistar2024.", // 库连接字符串ASDzxc123.
|
||||
"DbSettings": {
|
||||
"EnableInitDb": false, // 启用库初始化
|
||||
"EnableDiffLog": false, // 启用库表差异日志
|
||||
|
@ -7,6 +7,7 @@
|
||||
using Admin.NET.Core;
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.DynamicApiController;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
@ -40,7 +41,7 @@ public class SapOpenInterfaceService : IDynamicApiController, ITransient
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize(AuthenticationSchemes = SignatureAuthenticationDefaults.AuthenticationScheme)]
|
||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
|
||||
[ApiDescriptionSettings(Name = "CreateClientRecord"), HttpPost]
|
||||
[DisplayName("SAP创建、修改客户档案")]
|
||||
public async Task<ManageResponse> CreateClientRecord(CreateClientRecordInput input)
|
||||
|
@ -2,6 +2,7 @@
|
||||
using Admin.NET.Core.Service;
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.DynamicApiController;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
@ -30,6 +31,7 @@ public class SolidWorksManageService : IDynamicApiController, ITransient
|
||||
/// 获取 token
|
||||
/// </summary>
|
||||
/// <returns>授权响应对象</returns>
|
||||
[AllowAnonymous]
|
||||
public async Task<AuthorizationResponse> Authenticate()
|
||||
{
|
||||
// 获取 SolidWorksManage 地址
|
||||
@ -58,6 +60,9 @@ public class SolidWorksManageService : IDynamicApiController, ITransient
|
||||
{
|
||||
// 读取响应内容并反序列化为授权响应对象
|
||||
string responseBody = await response.Content.ReadAsStringAsync();
|
||||
AuthorizationResponse jsondata = JsonConvert.DeserializeObject<AuthorizationResponse>(responseBody);
|
||||
string value = jsondata.access_token;
|
||||
await _sysConfigService.UpdateConfigValue(ConfigConst.SolidWorksManageAuthorization, value);
|
||||
return JsonConvert.DeserializeObject<AuthorizationResponse>(responseBody);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user