😎1、升级Furion v4.9.6.17 2、去掉.NET 6

This commit is contained in:
zuohuaijun 2024-12-22 00:36:12 +08:00
parent 943944aac1
commit 7f476010b5
24 changed files with 52 additions and 81 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<NoWarn>1701;1702;1591;8632</NoWarn>
<DocumentationFile></DocumentationFile>
<ImplicitUsings>enable</ImplicitUsings>

View File

@ -7,7 +7,7 @@
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore": "Information",
"AspNetCoreRateLimit": "None",
"System.Net.Http.HttpClient": "Error"
"System.Net.Http.HttpClient": "Warning"
},
"File": {
"Enabled": false, //

View File

@ -4,12 +4,6 @@
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Admin.NET.Application.Entity;
/// <summary>
@ -84,4 +78,4 @@ public class TestCodeGenDemo : EntityBase
/// </summary>
[SugarColumn(ColumnDescription = "上传控件")]
public string? UploadImage { get; set; }
}
}

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<NoWarn>1701;1702;1591;8632</NoWarn>
<DocumentationFile></DocumentationFile>
<ImplicitUsings>enable</ImplicitUsings>
@ -18,9 +18,9 @@
<PackageReference Include="AspectCore.Extensions.Reflection" Version="2.4.0" />
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.16.3" />
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.5.26" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.5.26" />
<PackageReference Include="Furion.Pure" Version="4.9.5.26" />
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.6.17" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.6.17" />
<PackageReference Include="Furion.Pure" Version="4.9.6.17" />
<PackageReference Include="Hardware.Info" Version="101.0.0" />
<PackageReference Include="Hashids.net" Version="1.7.0" />
<PackageReference Include="IPTools.China" Version="1.6.0" />
@ -50,17 +50,6 @@
<PackageReference Include="UAParser" Version="3.1.47" />
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<PackageReference Include="AspNet.Security.OAuth.Gitee" Version="6.0.15" />
<PackageReference Include="AspNet.Security.OAuth.Weixin" Version="6.0.15" />
<PackageReference Include="Lazy.Captcha.Core" Version="2.0.6" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.9" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="6.0.36" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="6.0.36" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.StackExchangeRedis" Version="6.0.36" />
<PackageReference Include="OnceMi.AspNetCore.OSS" Version="1.1.9" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="AspNet.Security.OAuth.Gitee" Version="8.3.0" />

View File

@ -17,7 +17,7 @@ global using Furion.EventBus;
global using Furion.FriendlyException;
global using Furion.JsonSerialization;
global using Furion.Logging;
global using Furion.RemoteRequest.Extensions;
global using Furion.HttpRemote;
global using Furion.Schedule;
global using Furion.UnifyResult;
global using Furion.ViewEngine;

View File

@ -138,8 +138,9 @@ public class SysFileService : IDynamicApiController, ITransient
var filePath = Path.Combine(file.FilePath ?? "", file.Id + file.Suffix);
if (_OSSProviderOptions.Enabled)
{
var stream = await (await _OSSService.PresignedGetObjectAsync(file.BucketName, filePath, 5)).GetAsStreamAsync();
return new FileStreamResult(stream.Stream, "application/octet-stream") { FileDownloadName = fileName + file.Suffix };
var httpRemoteService = App.GetRequiredService<IHttpRemoteService>();
var stream = await httpRemoteService.GetAsStreamAsync(await _OSSService.PresignedGetObjectAsync(file.BucketName, filePath, 5));
return new FileStreamResult(stream, "application/octet-stream") { FileDownloadName = fileName + file.Suffix };
}
if (App.Configuration["SSHProvider:Enabled"].ToBoolean())

View File

@ -161,7 +161,8 @@ public class SysRegionService : IDynamicApiController, ITransient
var syncLevel = await _sysConfigService.GetConfigValueByCode<int>(ConfigConst.SysRegionSyncLevel);
if (syncLevel is < 1 or > 5) syncLevel = 3; // 默认区县级
var html = await "http://xzqh.mca.gov.cn/map".GetAsStringAsync();
var httpRemoteService = App.GetRequiredService<IHttpRemoteService>();
var html = await httpRemoteService.GetAsStringAsync("http://xzqh.mca.gov.cn/map");
var municipalityList = new List<string> { "北京", "天津", "上海", "重庆" };
var provList = Regex.Match(html, @"(?<=var json = )(\[\{.*?\}\])(?=;)").Value.ToJsonEntity<List<Dictionary<string, string>>>();
foreach (var dict1 in provList)
@ -224,11 +225,11 @@ public class SysRegionService : IDynamicApiController, ITransient
// 获取选择数据
async Task<List<Dictionary<string, string>>> GetSelectList(string prov, string prefecture = null)
{
var json = await "http://xzqh.mca.gov.cn/selectJson".SetQueries(new
var json = await httpRemoteService.PostAsStringAsync("http://xzqh.mca.gov.cn/selectJson", builder => builder.SetJsonContent(new
{
shengji = prov,
diji = prefecture,
}).PostAsStringAsync();
}));
return json.ToJsonEntity<List<Dictionary<string, string>>>();
}
}
@ -247,7 +248,8 @@ public class SysRegionService : IDynamicApiController, ITransient
var syncLevel = await _sysConfigService.GetConfigValueByCode<int>(ConfigConst.SysRegionSyncLevel);
if (syncLevel is < 1 or > 5) syncLevel = 3; // 默认区县级
var res = await $"https://restapi.amap.com/v3/config/district?subdistrict={syncLevel}&key={key}".GetAsync();
var httpRemoteService = App.GetRequiredService<IHttpRemoteService>();
var res = await httpRemoteService.GetAsync($"https://restapi.amap.com/v3/config/district?subdistrict={syncLevel}&key={key}");
if (!res.IsSuccessStatusCode) return;
var gdResponse = JSON.Deserialize<GDResponse<List<GDRegionResponse>>>(res.Content.ReadAsStringAsync().Result);

View File

@ -16,24 +16,12 @@ namespace Admin.NET.Core;
/// </summary>
public sealed class SignatureAuthenticationHandler : AuthenticationHandler<SignatureAuthenticationOptions>
{
#if NET6_0
public SignatureAuthenticationHandler(IOptionsMonitor<SignatureAuthenticationOptions> options,
ILoggerFactory logger,
UrlEncoder encoder,
ISystemClock clock)
: base(options, logger, encoder, clock)
{
}
#else
public SignatureAuthenticationHandler(IOptionsMonitor<SignatureAuthenticationOptions> options,
ILoggerFactory logger,
UrlEncoder encoder)
: base(options, logger, encoder)
{
}
#endif
private new SignatureAuthenticationEvent Events
{
@ -68,12 +56,7 @@ public sealed class SignatureAuthenticationHandler : AuthenticationHandler<Signa
return await AuthenticateResultFailAsync("timestamp 值不合法");
var requestDate = DateTimeUtil.ConvertUnixTime(timestamp);
#if NET6_0
var utcNow = Clock.UtcNow;
#else
var utcNow = TimeProvider.GetUtcNow();
#endif
if (requestDate > utcNow.Add(Options.AllowedDateDrift).LocalDateTime || requestDate < utcNow.Subtract(Options.AllowedDateDrift).LocalDateTime)
return await AuthenticateResultFailAsync("timestamp 值已超过允许的偏差范围");

View File

@ -152,7 +152,8 @@ public static class ComputerUtil
try
{
var url = "https://www.ip.cn/api/index?ip&type=0";
var str = url.GetAsStringAsync().GetAwaiter().GetResult();
var httpRemoteService = App.GetRequiredService<IHttpRemoteService>();
var str = httpRemoteService.GetAsStringAsync(url).GetAwaiter().GetResult();
var resp = JSON.Deserialize<IpCnResp>(str);
return resp.Ip + " " + resp.Address;
}

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<NoWarn>1701;1702;1591</NoWarn>
<DocumentationFile></DocumentationFile>
<GenerateDocumentationFile>True</GenerateDocumentationFile>

View File

@ -70,7 +70,7 @@ public class Startup : AppStartup
// 允许跨域
services.AddCorsAccessor();
// 远程请求
services.AddRemoteRequest();
services.AddHttpRemote();
// 任务队列
services.AddTaskQueue();
// 作业调度

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
<PublishReadyToRunComposite>true</PublishReadyToRunComposite>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<NoWarn>1701;1702;1591;8632</NoWarn>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<NoWarn>1701;1702;1591;8632</NoWarn>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>

View File

@ -10,8 +10,7 @@ global using Furion.ConfigurableOptions;
global using Furion.DependencyInjection;
global using Furion.DynamicApiController;
global using Furion.FriendlyException;
global using Furion.RemoteRequest;
global using Microsoft.AspNetCore.Http;
global using Furion.HttpRemote;
global using Microsoft.AspNetCore.Mvc;
global using Microsoft.Extensions.Options;
global using Newtonsoft.Json;

View File

@ -6,7 +6,7 @@
namespace Admin.NET.Plugin.DingTalk;
public interface IDingTalkApi : IHttpDispatchProxy
public interface IDingTalkApi : IHttpDeclarative
{
/// <summary>
/// 获取企业内部应用的access_token
@ -15,7 +15,7 @@ public interface IDingTalkApi : IHttpDispatchProxy
/// <param name="appsecret"> 应用的密钥。AppKey和AppSecret可在钉钉开发者后台的应用详情页面获取。</param>
/// <returns></returns>
[Get("https://oapi.dingtalk.com/gettoken")]
Task<GetDingTalkTokenOutput> GetDingTalkToken([QueryString] string appkey, [QueryString] string appsecret);
Task<GetDingTalkTokenOutput> GetDingTalkToken([Query] string appkey, [Query] string appsecret);
/// <summary>
/// 获取在职员工列表
@ -24,7 +24,7 @@ public interface IDingTalkApi : IHttpDispatchProxy
/// <param name="input"></param>
/// <returns></returns>
[Post("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/queryonjob")]
Task<DingTalkBaseResponse<GetDingTalkCurrentEmployeesListOutput>> GetDingTalkCurrentEmployeesList([QueryString] string access_token,
Task<DingTalkBaseResponse<GetDingTalkCurrentEmployeesListOutput>> GetDingTalkCurrentEmployeesList([Query] string access_token,
[Body, Required] GetDingTalkCurrentEmployeesListInput input);
/// <summary>
@ -34,7 +34,7 @@ public interface IDingTalkApi : IHttpDispatchProxy
/// <param name="input"></param>
/// <returns></returns>
[Post("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/v2/list")]
Task<DingTalkBaseResponse<List<DingTalkEmpRosterFieldVo>>> GetDingTalkCurrentEmployeesRosterList([QueryString] string access_token,
Task<DingTalkBaseResponse<List<DingTalkEmpRosterFieldVo>>> GetDingTalkCurrentEmployeesRosterList([Query] string access_token,
[Body, Required] GetDingTalkCurrentEmployeesRosterListInput input);
/// <summary>
@ -45,7 +45,7 @@ public interface IDingTalkApi : IHttpDispatchProxy
/// <returns></returns>
[Post("https://api.dingtalk.com/v1.0/im/interactiveCards/send")]
Task<DingTalkSendInteractiveCardsOutput> DingTalkSendInteractiveCards(
[Headers("x-acs-dingtalk-access-token")] string token,
[Header("x-acs-dingtalk-access-token")] string token,
[Body] DingTalkSendInteractiveCardsInput input);
/// <summary>
@ -56,6 +56,6 @@ public interface IDingTalkApi : IHttpDispatchProxy
/// <returns></returns>
[Get("https://api.dingtalk.com/v1.0/robot/oToMessages/readStatus")]
Task<GetDingTalkCardMessageReadStatusOutput> GetDingTalkCardMessageReadStatus(
[Headers("x-acs-dingtalk-access-token")] string token,
[QueryString] GetDingTalkCardMessageReadStatusInput input);
[Header("x-acs-dingtalk-access-token")] string token,
[Query] GetDingTalkCardMessageReadStatusInput input);
}

View File

@ -16,6 +16,11 @@ public class Startup : AppStartup
public void ConfigureServices(IServiceCollection services)
{
services.AddConfigurableOptions<DingTalkOptions>();
services.AddHttpRemote(builder =>
{
builder.AddHttpDeclarative<IDingTalkApi>();
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<NoWarn>1701;1702;1591;8632</NoWarn>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<NoWarn>1701;1702;1591;8632</NoWarn>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>

View File

@ -5,4 +5,5 @@
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
global using Furion;
global using Furion.ConfigurableOptions;
global using Furion.ConfigurableOptions;
global using Furion.HttpRemote;

View File

@ -4,15 +4,13 @@
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Furion.RemoteRequest;
namespace Admin.NET.Plugin.K3Cloud.Service;
/// <summary>
/// 金蝶云星空ERP接口
/// </summary>
[Client("K3Cloud")]
public interface IK3CloudApi : IHttpDispatchProxy
[HttpClientName("K3Cloud")]
public interface IK3CloudApi : IHttpDeclarative
{
/// <summary>
/// 验证用户
@ -21,7 +19,7 @@ public interface IK3CloudApi : IHttpDispatchProxy
/// <param name="action"></param>
/// <returns></returns>
[Post("Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc")]
Task<K3CloudLoginOutput> ValidateUser([Body] K3CloudLoginInput input, [Interceptor(InterceptorTypes.Response)] Action<HttpClient, HttpResponseMessage> action = default);
Task<K3CloudLoginOutput> ValidateUser([Body] K3CloudLoginInput input, Action<HttpClient, HttpResponseMessage> action = default);
/// <summary>
/// 保存表单
@ -30,7 +28,7 @@ public interface IK3CloudApi : IHttpDispatchProxy
/// <param name="action"></param>
/// <returns></returns>
[Post("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc")]
Task<K3CloudPushResultOutput> Save<T>([Body] K3CloudBaeInput<T> input, [Interceptor(InterceptorTypes.Request)] Action<HttpClient, HttpRequestMessage> action = default);
Task<K3CloudPushResultOutput> Save<T>([Body] K3CloudBaeInput<T> input, Action<HttpClient, HttpRequestMessage> action = default);
/// <summary>
/// 提交表单
@ -39,7 +37,7 @@ public interface IK3CloudApi : IHttpDispatchProxy
/// <param name="action"></param>
/// <returns></returns>
[Post("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit.common.kdsvc")]
Task<K3CloudPushResultOutput> Submit<T>([Body] K3CloudBaeInput<T> input, [Interceptor(InterceptorTypes.Request)] Action<HttpClient, HttpRequestMessage> action = default);
Task<K3CloudPushResultOutput> Submit<T>([Body] K3CloudBaeInput<T> input, Action<HttpClient, HttpRequestMessage> action = default);
/// <summary>
/// 审核表单
@ -48,5 +46,5 @@ public interface IK3CloudApi : IHttpDispatchProxy
/// <param name="action"></param>
/// <returns></returns>
[Post("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit.common.kdsvc")]
Task<K3CloudPushResultOutput> Audit<T>([Body] K3CloudBaeInput<T> input, [Interceptor(InterceptorTypes.Request)] Action<HttpClient, HttpRequestMessage> action = default);
Task<K3CloudPushResultOutput> Audit<T>([Body] K3CloudBaeInput<T> input, Action<HttpClient, HttpRequestMessage> action = default);
}

View File

@ -16,12 +16,10 @@ public class Startup : AppStartup
public void ConfigureServices(IServiceCollection services)
{
services.AddConfigurableOptions<K3CloudOptions>();
services.AddRemoteRequest(options =>
services.AddHttpClient("K3Cloud", client =>
{
options.AddHttpClient("K3Cloud", u =>
{
u.BaseAddress = new Uri(App.GetConfig<K3CloudOptions>("K3Cloud", true).Url);
});
client.BaseAddress = new Uri(App.GetConfig<K3CloudOptions>("K3Cloud", true).Url);
});
}

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<NoWarn>1701;1702;1591;8632</NoWarn>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<NoWarn>1701;1702;1591;8632</NoWarn>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>