.net10 orderby mulpite
examplenet10/ExampleApeart.Application.Contracts/ExampleApeart.Application.Contracts.csproj
diff --git a/examplenet10/ExampleApeart.Application.Contracts/ExampleApeart.Application.Contracts.csproj b/examplenet10/ExampleApeart.Application.Contracts/ExampleApeart.Application.Contracts.csproj
index e776c42..51197ab 100644
--- a/examplenet10/ExampleApeart.Application.Contracts/ExampleApeart.Application.Contracts.csproj
+++ b/examplenet10/ExampleApeart.Application.Contracts/ExampleApeart.Application.Contracts.csproj
@@ -12,7 +12,7 @@
<DocumentationFile>..\ExampleApeart.HttpApi.Host\ExampleApeart.Application.Contracts.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="PasteApeart.Application.Contracts" Version="26.8.2" />
+ <PackageReference Include="PasteApeart.Application.Contracts" Version="26.10.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ExampleApeart.Domain\ExampleApeart.Domain.csproj" />
examplenet10/ExampleApeart.Application.Contracts/usermodels/GradeRoleDto.cs
diff --git a/examplenet10/ExampleApeart.Application.Contracts/usermodels/GradeRoleDto.cs b/examplenet10/ExampleApeart.Application.Contracts/usermodels/GradeRoleDto.cs
index 4229a71..8ffedc9 100644
--- a/examplenet10/ExampleApeart.Application.Contracts/usermodels/GradeRoleDto.cs
+++ b/examplenet10/ExampleApeart.Application.Contracts/usermodels/GradeRoleDto.cs
@@ -1,4 +1,5 @@
using PasteApeart;
+using PasteApeart.Applciation.Contracts.EntityDto;
using PasteApeart.Application.Contracts;
using PasteApeart.Helper;
using System.ComponentModel;
examplenet10/ExampleApeart.Application.Contracts/usermodels/RoleInfoDto.cs
diff --git a/examplenet10/ExampleApeart.Application.Contracts/usermodels/RoleInfoDto.cs b/examplenet10/ExampleApeart.Application.Contracts/usermodels/RoleInfoDto.cs
index 2ffca7c..307ae0e 100644
--- a/examplenet10/ExampleApeart.Application.Contracts/usermodels/RoleInfoDto.cs
+++ b/examplenet10/ExampleApeart.Application.Contracts/usermodels/RoleInfoDto.cs
@@ -1,4 +1,5 @@
using PasteApeart;
+using PasteApeart.Applciation.Contracts.EntityDto;
using PasteApeart.Application.Contracts;
using PasteApeart.Helper;
using System.ComponentModel;
examplenet10/ExampleApeart.Application.Contracts/usermodels/TestDto.cs
diff --git a/examplenet10/ExampleApeart.Application.Contracts/usermodels/TestDto.cs b/examplenet10/ExampleApeart.Application.Contracts/usermodels/TestDto.cs
index 5b99b34..654b7c7 100644
--- a/examplenet10/ExampleApeart.Application.Contracts/usermodels/TestDto.cs
+++ b/examplenet10/ExampleApeart.Application.Contracts/usermodels/TestDto.cs
@@ -1,4 +1,5 @@
using PasteApeart;
+using PasteApeart.Applciation.Contracts.EntityDto;
namespace ExampleApeart.Application.Contracts.usermodels
{
examplenet10/ExampleApeart.Application.Contracts/usermodels/UserGradeDto.cs
diff --git a/examplenet10/ExampleApeart.Application.Contracts/usermodels/UserGradeDto.cs b/examplenet10/ExampleApeart.Application.Contracts/usermodels/UserGradeDto.cs
index c2eac95..4855e2a 100644
--- a/examplenet10/ExampleApeart.Application.Contracts/usermodels/UserGradeDto.cs
+++ b/examplenet10/ExampleApeart.Application.Contracts/usermodels/UserGradeDto.cs
@@ -1,4 +1,5 @@
using PasteApeart;
+using PasteApeart.Applciation.Contracts.EntityDto;
using PasteApeart.Application.Contracts;
using PasteApeart.Helper;
using System.ComponentModel;
examplenet10/ExampleApeart.Application.Contracts/usermodels/UserInfoDto.cs
diff --git a/examplenet10/ExampleApeart.Application.Contracts/usermodels/UserInfoDto.cs b/examplenet10/ExampleApeart.Application.Contracts/usermodels/UserInfoDto.cs
index 7001537..60295fd 100644
--- a/examplenet10/ExampleApeart.Application.Contracts/usermodels/UserInfoDto.cs
+++ b/examplenet10/ExampleApeart.Application.Contracts/usermodels/UserInfoDto.cs
@@ -1,4 +1,5 @@
using PasteApeart;
+using PasteApeart.Applciation.Contracts.EntityDto;
using PasteApeart.Application.Contracts;
using PasteApeart.Helper;
using System.ComponentModel;
examplenet10/ExampleApeart.Application/DefaultApiAppService.cs
diff --git a/examplenet10/ExampleApeart.Application/DefaultApiAppService.cs b/examplenet10/ExampleApeart.Application/DefaultApiAppService.cs
index 9426290..0cbd286 100644
--- a/examplenet10/ExampleApeart.Application/DefaultApiAppService.cs
+++ b/examplenet10/ExampleApeart.Application/DefaultApiAppService.cs
@@ -1,4 +1,3 @@
-using ExampleApeart;
using Microsoft.AspNetCore.Mvc;
using PasteApeart.Application;
using PasteApeart.Application.Contracts;
examplenet10/ExampleApeart.Application/ExampleApeart.Application.csproj
diff --git a/examplenet10/ExampleApeart.Application/ExampleApeart.Application.csproj b/examplenet10/ExampleApeart.Application/ExampleApeart.Application.csproj
index 087186c..0498897 100644
--- a/examplenet10/ExampleApeart.Application/ExampleApeart.Application.csproj
+++ b/examplenet10/ExampleApeart.Application/ExampleApeart.Application.csproj
@@ -16,7 +16,7 @@
<ItemGroup>
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.7" />
<FrameworkReference Include="Microsoft.AspNetCore.App" />
- <PackageReference Include="PasteApeart.Application" Version="26.8.5" />
+ <PackageReference Include="PasteApeart.Application" Version="26.10.5" />
</ItemGroup>
<ItemGroup>
examplenet10/ExampleApeart.Application/ExampleApeartAppService.cs
diff --git a/examplenet10/ExampleApeart.Application/ExampleApeartAppService.cs b/examplenet10/ExampleApeart.Application/ExampleApeartAppService.cs
index cb35f4e..90081af 100644
--- a/examplenet10/ExampleApeart.Application/ExampleApeartAppService.cs
+++ b/examplenet10/ExampleApeart.Application/ExampleApeartAppService.cs
@@ -1,9 +1,9 @@
+using ExampleApeart.EntityFrameworkCore;
using Microsoft.AspNetCore.Http;
using PasteApeart;
using PasteApeart.Application.Contracts;
+using PasteApeart.Handler.lazy;
using PasteApeart.Helper;
-using ExampleApeart.Application.Contracts;
-using ExampleApeart.EntityFrameworkCore;
using System.Reflection;
namespace ExampleApeart
@@ -30,6 +30,11 @@ namespace ExampleApeart
protected CacheHandler _userHelper => LazyServiceProvider.LazyGetRequiredService<CacheHandler>();
/// <summary>
+ /// 当前登录用户
+ /// </summary>
+ protected CurrentUser _currentUser => LazyServiceProvider.LazyGetRequiredService<CurrentUser>();
+
+ /// <summary>
///
/// </summary>
protected ExampleApeartAppService()
@@ -96,28 +101,29 @@ namespace ExampleApeart
/// <returns></returns>
protected string ReadCurrentUserToken()
{
- if (_httpContext.Request.Headers.TryGetValue(PublicString.TokenHeadName, out var heads))
- {
- var token = heads.FirstOrDefault();
- if (!String.IsNullOrEmpty(token))
- {
- if (token.TokenCheck())
- {
- return token;
- }
- }
- }
- if (_httpContext.Request.Cookies.TryGetValue(PublicString.TokenHeadName, out var cookie))
- {
- if (!String.IsNullOrEmpty(cookie))
- {
- if (cookie.TokenCheck())
- {
- return cookie.ToString();
- }
- }
- }
- return "";
+ return _currentUser.Token;
+ //if (_httpContext.Request.Headers.TryGetValue(PublicString.TokenHeadName, out var heads))
+ //{
+ // var token = heads.FirstOrDefault();
+ // if (!String.IsNullOrEmpty(token))
+ // {
+ // if (token.TokenCheck())
+ // {
+ // return token;
+ // }
+ // }
+ //}
+ //if (_httpContext.Request.Cookies.TryGetValue(PublicString.TokenHeadName, out var cookie))
+ //{
+ // if (!String.IsNullOrEmpty(cookie))
+ // {
+ // if (cookie.TokenCheck())
+ // {
+ // return cookie.ToString();
+ // }
+ // }
+ //}
+ //return "";
}
/// <summary>
examplenet10/ExampleApeart.Application/ExampleApeartApplicationAutoMapperProfile.cs
diff --git a/examplenet10/ExampleApeart.Application/ExampleApeartApplicationAutoMapperProfile.cs b/examplenet10/ExampleApeart.Application/ExampleApeartApplicationAutoMapperProfile.cs
deleted file mode 100644
index 59b7a15..0000000
--- a/examplenet10/ExampleApeart.Application/ExampleApeartApplicationAutoMapperProfile.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-//using AutoMapper;
-
-//namespace ExampleApeart
-//{
-// /// <summary>
-// ///
-// /// </summary>
-// public class ExampleApeartApplicationAutoMapperProfile : Profile
-// {
-
-// /// <summary>
-// ///
-// /// </summary>
-// public ExampleApeartApplicationAutoMapperProfile()
-// {
-// /* You can configure your AutoMapper mapping configuration here.
-// * Alternatively, you can split your mapping configurations
-// * into multiple profile classes for a better organization. */
-// // DefaultModel:
-
-
-
-// }
-// }
-//}
\ No newline at end of file
examplenet10/ExampleApeart.Application/ExampleApeartApplicationModule.cs
diff --git a/examplenet10/ExampleApeart.Application/ExampleApeartApplicationModule.cs b/examplenet10/ExampleApeart.Application/ExampleApeartApplicationModule.cs
index 050d140..74275de 100644
--- a/examplenet10/ExampleApeart.Application/ExampleApeartApplicationModule.cs
+++ b/examplenet10/ExampleApeart.Application/ExampleApeartApplicationModule.cs
@@ -9,6 +9,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.WebEncoders.Testing;
using PasteApeart;
using PasteApeart.Application;
+using PasteApeart.Dependency;
using PasteApeart.Handler;
using System.Text.Json;
using System.Text.Json.Serialization;
examplenet10/ExampleApeart.Application/ExampleApeartDefaultService.cs
diff --git a/examplenet10/ExampleApeart.Application/ExampleApeartDefaultService.cs b/examplenet10/ExampleApeart.Application/ExampleApeartDefaultService.cs
index 817213d..ae5a7f8 100644
--- a/examplenet10/ExampleApeart.Application/ExampleApeartDefaultService.cs
+++ b/examplenet10/ExampleApeart.Application/ExampleApeartDefaultService.cs
@@ -2,9 +2,9 @@ using ExampleApeart.Application.Contracts.eventmodels;
using ExampleApeart.EntityFrameworkCore;
using ExampleApeart.usermodels;
using Microsoft.EntityFrameworkCore;
-using PasteApeart;
using PasteApeart.Application;
using PasteApeart.Application.Contracts;
+using PasteApeart.Handler;
namespace ExampleApeart.Application
{
examplenet10/ExampleApeart.Application/PasteRoleAttribute.cs
diff --git a/examplenet10/ExampleApeart.Application/PasteRoleAttribute.cs b/examplenet10/ExampleApeart.Application/PasteRoleAttribute.cs
index 504a9cb..2f12328 100644
--- a/examplenet10/ExampleApeart.Application/PasteRoleAttribute.cs
+++ b/examplenet10/ExampleApeart.Application/PasteRoleAttribute.cs
@@ -5,6 +5,7 @@ using PasteApeart.Handler;
using ExampleApeart.Handler;
using System.Security.Claims;
using System.Text.Json;
+using PasteApeart.Application.Contracts;
namespace ExampleApeart
{
examplenet10/ExampleApeart.Application/usermodels/GradeRoleAppService.cs
diff --git a/examplenet10/ExampleApeart.Application/usermodels/GradeRoleAppService.cs b/examplenet10/ExampleApeart.Application/usermodels/GradeRoleAppService.cs
index 5f13bce..6f88975 100644
--- a/examplenet10/ExampleApeart.Application/usermodels/GradeRoleAppService.cs
+++ b/examplenet10/ExampleApeart.Application/usermodels/GradeRoleAppService.cs
@@ -4,6 +4,7 @@ using PasteApeart;
using ExampleApeart.Handler;
using System.Collections;
using System.Linq.Dynamic.Core;
+using PasteApeart.Handler.Extensions;
namespace ExampleApeart.usermodels
{
examplenet10/ExampleApeart.Application/usermodels/RoleInfoAppService.cs
diff --git a/examplenet10/ExampleApeart.Application/usermodels/RoleInfoAppService.cs b/examplenet10/ExampleApeart.Application/usermodels/RoleInfoAppService.cs
index 263983b..4d21169 100644
--- a/examplenet10/ExampleApeart.Application/usermodels/RoleInfoAppService.cs
+++ b/examplenet10/ExampleApeart.Application/usermodels/RoleInfoAppService.cs
@@ -6,6 +6,8 @@ using PasteApeart.Helper;
using ExampleApeart.Application;
using ExampleApeart.Handler;
using System.Linq.Dynamic.Core;
+using PasteApeart.Handler.Extensions;
+using PasteApeart.Helper.Extensions;
namespace ExampleApeart.usermodels
{
examplenet10/ExampleApeart.Domain/CurrentUser.cs
diff --git a/examplenet10/ExampleApeart.Domain/CurrentUser.cs b/examplenet10/ExampleApeart.Domain/CurrentUser.cs
new file mode 100644
index 0000000..8dc75ab
--- /dev/null
+++ b/examplenet10/ExampleApeart.Domain/CurrentUser.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ExampleApeart
+{
+ /// <summary>
+ ///
+ /// </summary>
+ public class CurrentUser
+ {
+ /// <summary>
+ ///
+ /// </summary>
+ public int Id { get; set; }
+
+ /// <summary>
+ ///
+ /// </summary>
+ public string Token { get; set; }
+ }
+}
examplenet10/ExampleApeart.Domain/ExampleApeart.Domain.csproj
diff --git a/examplenet10/ExampleApeart.Domain/ExampleApeart.Domain.csproj b/examplenet10/ExampleApeart.Domain/ExampleApeart.Domain.csproj
index f4379fa..bd358b9 100644
--- a/examplenet10/ExampleApeart.Domain/ExampleApeart.Domain.csproj
+++ b/examplenet10/ExampleApeart.Domain/ExampleApeart.Domain.csproj
@@ -15,8 +15,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="10.0.9" />
<!--<PackageReference Include="Volo.Abp.Ddd.Domain" Version="8.3.4" />-->
- <PackageReference Include="PasteApeart.Helper" Version="26.8.1" />
- <PackageReference Include="PasteApeart.Domain" Version="26.8.1" />
+ <PackageReference Include="PasteApeart.Helper" Version="26.10.5" />
+ <PackageReference Include="PasteApeart.Domain" Version="26.10.5" />
</ItemGroup>
</Project>
examplenet10/ExampleApeart.Domain/usermodels/GradeInfo.cs
diff --git a/examplenet10/ExampleApeart.Domain/usermodels/GradeInfo.cs b/examplenet10/ExampleApeart.Domain/usermodels/GradeInfo.cs
index 87e1107..bab3585 100644
--- a/examplenet10/ExampleApeart.Domain/usermodels/GradeInfo.cs
+++ b/examplenet10/ExampleApeart.Domain/usermodels/GradeInfo.cs
@@ -1,5 +1,5 @@
using Microsoft.EntityFrameworkCore;
-using PasteApeart;
+using PasteApeart.Domain.Entity;
using PasteApeart.Helper;
using System.ComponentModel.DataAnnotations;
examplenet10/ExampleApeart.Domain/usermodels/GradeRole.cs
diff --git a/examplenet10/ExampleApeart.Domain/usermodels/GradeRole.cs b/examplenet10/ExampleApeart.Domain/usermodels/GradeRole.cs
index c0a2d64..ebd1e4c 100644
--- a/examplenet10/ExampleApeart.Domain/usermodels/GradeRole.cs
+++ b/examplenet10/ExampleApeart.Domain/usermodels/GradeRole.cs
@@ -1,5 +1,6 @@
using Microsoft.EntityFrameworkCore;
using PasteApeart;
+using PasteApeart.Domain.Entity;
using PasteApeart.Helper;
namespace ExampleApeart.usermodels
examplenet10/ExampleApeart.Domain/usermodels/RoleInfo.cs
diff --git a/examplenet10/ExampleApeart.Domain/usermodels/RoleInfo.cs b/examplenet10/ExampleApeart.Domain/usermodels/RoleInfo.cs
index dfb97d5..84b6489 100644
--- a/examplenet10/ExampleApeart.Domain/usermodels/RoleInfo.cs
+++ b/examplenet10/ExampleApeart.Domain/usermodels/RoleInfo.cs
@@ -1,4 +1,5 @@
using PasteApeart;
+using PasteApeart.Domain.Entity;
using PasteApeart.Helper;
using System.ComponentModel.DataAnnotations;
examplenet10/ExampleApeart.Domain/usermodels/UserGrade.cs
diff --git a/examplenet10/ExampleApeart.Domain/usermodels/UserGrade.cs b/examplenet10/ExampleApeart.Domain/usermodels/UserGrade.cs
index 87476fa..f4fc650 100644
--- a/examplenet10/ExampleApeart.Domain/usermodels/UserGrade.cs
+++ b/examplenet10/ExampleApeart.Domain/usermodels/UserGrade.cs
@@ -1,5 +1,6 @@
using PasteApeart.Helper;
using PasteApeart;
+using PasteApeart.Domain.Entity;
namespace ExampleApeart.usermodels
{
examplenet10/ExampleApeart.Domain/usermodels/UserInfo.cs
diff --git a/examplenet10/ExampleApeart.Domain/usermodels/UserInfo.cs b/examplenet10/ExampleApeart.Domain/usermodels/UserInfo.cs
index dce7050..679fa6c 100644
--- a/examplenet10/ExampleApeart.Domain/usermodels/UserInfo.cs
+++ b/examplenet10/ExampleApeart.Domain/usermodels/UserInfo.cs
@@ -1,5 +1,6 @@
using Microsoft.EntityFrameworkCore;
using PasteApeart;
+using PasteApeart.Domain.Entity;
using PasteApeart.Helper;
using System.ComponentModel.DataAnnotations;
examplenet10/ExampleApeart.EntityFrameworkCore/EntityFrameworkCore/AbsFilterDbContext.cs
diff --git a/examplenet10/ExampleApeart.EntityFrameworkCore/EntityFrameworkCore/AbsFilterDbContext.cs b/examplenet10/ExampleApeart.EntityFrameworkCore/EntityFrameworkCore/AbsFilterDbContext.cs
index ee2d722..a8ad3c0 100644
--- a/examplenet10/ExampleApeart.EntityFrameworkCore/EntityFrameworkCore/AbsFilterDbContext.cs
+++ b/examplenet10/ExampleApeart.EntityFrameworkCore/EntityFrameworkCore/AbsFilterDbContext.cs
@@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using System.Linq.Expressions;
using PasteApeart;
using PasteApeart.EntityFrameworkCore;
+using PasteApeart.Domain.Entity;
namespace ExampleApeart.EntityFrameworkCore
{
examplenet10/ExampleApeart.EntityFrameworkCore/ExampleApeart.EntityFrameworkCore.csproj
diff --git a/examplenet10/ExampleApeart.EntityFrameworkCore/ExampleApeart.EntityFrameworkCore.csproj b/examplenet10/ExampleApeart.EntityFrameworkCore/ExampleApeart.EntityFrameworkCore.csproj
index af4764d..47e0129 100644
--- a/examplenet10/ExampleApeart.EntityFrameworkCore/ExampleApeart.EntityFrameworkCore.csproj
+++ b/examplenet10/ExampleApeart.EntityFrameworkCore/ExampleApeart.EntityFrameworkCore.csproj
@@ -17,7 +17,7 @@
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<!-- <PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql" Version="8.3.4" />-->
<!--<PackageReference Include="Volo.Abp.EntityFrameworkCore.Sqlite" Version="8.3.4" />-->
- <PackageReference Include="PasteApeart.EntityFrameworkCore" Version="26.8.1" />
+ <PackageReference Include="PasteApeart.EntityFrameworkCore" Version="26.10.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.4" />
examplenet10/ExampleApeart.Handler/ExampleApeart.Handler.csproj
diff --git a/examplenet10/ExampleApeart.Handler/ExampleApeart.Handler.csproj b/examplenet10/ExampleApeart.Handler/ExampleApeart.Handler.csproj
index 243d8b3..1dd7633 100644
--- a/examplenet10/ExampleApeart.Handler/ExampleApeart.Handler.csproj
+++ b/examplenet10/ExampleApeart.Handler/ExampleApeart.Handler.csproj
@@ -11,10 +11,12 @@
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
+ <PackageReference Include="PasteApeart.Dependency" Version="26.10.5" />
<PackageReference Include="Serilog.AspNetCore" Version="10.0.0" />
+ <PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.7" />
<!--
<PackageReference Include="Volo.Abp.AutoMapper" Version="8.3.4" />
- <PackageReference Include="Volo.Abp.ObjectMapping" Version="8.3.4" />-->
+ <PackageReference Include="Volo.Abp.ObjectMapping" Version="8.3.4" />
<PackageReference Include="Mapster" Version="10.0.8" />
<PackageReference Include="Mapster.DependencyInjection" Version="1.0.0" />
@@ -22,11 +24,12 @@
<PackageReference Include="Autofac" Version="9.2.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="11.0.0" />
- <PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.7" />
+
<PackageReference Include="StackExchange.Redis" Version="3.0.0" />
<PackageReference Include="RabbitMQ.Client" Version="7.1.2" />
- <PackageReference Include="PasteApeart.Handler" Version="26.8.3" />
+ -->
+ <PackageReference Include="PasteApeart.Handler" Version="26.10.5" />
<!--<PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="8.103.9.3" />-->
</ItemGroup>
examplenet10/ExampleApeart.Handler/ExampleApeartHandlerModule.cs
diff --git a/examplenet10/ExampleApeart.Handler/ExampleApeartHandlerModule.cs b/examplenet10/ExampleApeart.Handler/ExampleApeartHandlerModule.cs
index b363026..cd746cd 100644
--- a/examplenet10/ExampleApeart.Handler/ExampleApeartHandlerModule.cs
+++ b/examplenet10/ExampleApeart.Handler/ExampleApeartHandlerModule.cs
@@ -1,12 +1,9 @@
-using Autofac;
-using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
-using PasteApeart;
+using PasteApeart.Dependency;
using PasteApeart.Handler;
-using PasteApeart.Handler.eventmodels;
-using PasteApeart.Handler.rabbitmodel;
-using System.Collections.Concurrent;
+using PasteApeart.Handler.lazy;
+using PasteApeart.Handler.rabbit;
namespace ExampleApeart
{
@@ -26,13 +23,13 @@ namespace ExampleApeart
services.AddTransient<ILazyServiceProvider, LazyServiceProvider>();
services.AddScoped<CurrentUser>();
- services.AddSingleton<IChannelHelper,ChannelHelper>();
+ services.AddSingleton<IChannelHelper, ChannelHelper>();
services.AddSingleton<IRabbitMQProducer, RabbitMQProducer>();
services.AddSingleton<IEventActionHandler, EventActionHandler>();
- services.AddSingleton<RabbitMultiConsumerHandler>();
- services.AddSingleton<RabbitMQProducer>();
+ services.AddSingleton<IRabbitMultiConsumerHandler,RabbitMultiConsumerHandler>();
- services.AddSingleton<ChannelHelper>();
+
+ services.AddScoped<CurrentUser>();
//services.AddAutoDependencyInjection(typeof(PasteApeartHandlerModule).Assembly);
examplenet10/ExampleApeart.Handler/SerilogCustomHandler.cs
diff --git a/examplenet10/ExampleApeart.Handler/SerilogCustomHandler.cs b/examplenet10/ExampleApeart.Handler/SerilogCustomHandler.cs
index 4a52d49..41e681f 100644
--- a/examplenet10/ExampleApeart.Handler/SerilogCustomHandler.cs
+++ b/examplenet10/ExampleApeart.Handler/SerilogCustomHandler.cs
@@ -1,10 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
-using PasteApeart;
+using PasteApeart.Handler;
using Serilog.Core;
using Serilog.Events;
@@ -36,7 +31,7 @@ namespace ExampleApeart.Handler
{
if (ServiceProvider != null)
{
- var _channel = ServiceProvider.GetRequiredService<ChannelHelper>();
+ var _channel = ServiceProvider.GetRequiredService<IChannelHelper>();
//Console.WriteLine($"channel is null:{(_channel == null)}!");
//这里进行比如异常推送等
}
examplenet10/ExampleApeart.Handler/common/CacheHandler.cs
diff --git a/examplenet10/ExampleApeart.Handler/common/CacheHandler.cs b/examplenet10/ExampleApeart.Handler/common/CacheHandler.cs
index 98bd095..c9ad6f9 100644
--- a/examplenet10/ExampleApeart.Handler/common/CacheHandler.cs
+++ b/examplenet10/ExampleApeart.Handler/common/CacheHandler.cs
@@ -5,6 +5,9 @@ using ExampleApeart.Application.Contracts;
using ExampleApeart.EntityFrameworkCore;
using ExampleApeart.Handler;
using ExampleApeart.usermodels;
+using PasteApeart.Domain.Entity;
+using PasteApeart.Handler.redis;
+using PasteApeart.Dependency;
namespace ExampleApeart
{
examplenet10/ExampleApeart.Handler/eventmodels/EventDemoModelHandler.cs
diff --git a/examplenet10/ExampleApeart.Handler/eventmodels/EventDemoModelHandler.cs b/examplenet10/ExampleApeart.Handler/eventmodels/EventDemoModelHandler.cs
index 7e608ab..8aab925 100644
--- a/examplenet10/ExampleApeart.Handler/eventmodels/EventDemoModelHandler.cs
+++ b/examplenet10/ExampleApeart.Handler/eventmodels/EventDemoModelHandler.cs
@@ -1,8 +1,9 @@
+using ExampleApeart.Application.Contracts.eventmodels;
using Microsoft.Extensions.Logging;
-using PasteApeart;
+using PasteApeart.Dependency;
using PasteApeart.Handler;
-using PasteApeart.Handler.eventmodels;
-using ExampleApeart.Application.Contracts.eventmodels;
+using PasteApeart.Handler.Extensions;
+using PasteApeart.Handler.redis;
namespace ExampleApeart.Handler.eventmodels
{
@@ -15,7 +16,7 @@ namespace ExampleApeart.Handler.eventmodels
private readonly ILogger<EventDemoModelHandler> _logger;
- private readonly ChannelHelper _channelHelper;
+ private readonly IChannelHelper _channelHelper;
/// <summary>
///
@@ -23,7 +24,7 @@ namespace ExampleApeart.Handler.eventmodels
/// <param name="appCache"></param>
/// <param name="logger"></param>
/// <param name="channelHelper"></param>
- public EventDemoModelHandler(IAppCache appCache, ILogger<EventDemoModelHandler> logger, ChannelHelper channelHelper)
+ public EventDemoModelHandler(IAppCache appCache, ILogger<EventDemoModelHandler> logger, IChannelHelper channelHelper)
{
_appCache = appCache;
_logger = logger;
examplenet10/ExampleApeart.HttpApi.Host/Controllers/IBaseController.cs
diff --git a/examplenet10/ExampleApeart.HttpApi.Host/Controllers/IBaseController.cs b/examplenet10/ExampleApeart.HttpApi.Host/Controllers/IBaseController.cs
index 390e6b5..e61ab9a 100644
--- a/examplenet10/ExampleApeart.HttpApi.Host/Controllers/IBaseController.cs
+++ b/examplenet10/ExampleApeart.HttpApi.Host/Controllers/IBaseController.cs
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging.Abstractions;
using PasteApeart;
using ExampleApeart.EntityFrameworkCore;
+using PasteApeart.Handler.lazy;
namespace ExampleApeart.Controllers
{
examplenet10/ExampleApeart.HttpApi.Host/Controllers/TestController.cs
diff --git a/examplenet10/ExampleApeart.HttpApi.Host/Controllers/TestController.cs b/examplenet10/ExampleApeart.HttpApi.Host/Controllers/TestController.cs
index bd7a7be..c2ea7ba 100644
--- a/examplenet10/ExampleApeart.HttpApi.Host/Controllers/TestController.cs
+++ b/examplenet10/ExampleApeart.HttpApi.Host/Controllers/TestController.cs
@@ -4,6 +4,7 @@ using Mapster;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using PasteApeart;
+using PasteApeart.Handler.Extensions;
using PasteApeart.Helper;
using System.Reflection;
using System.Text;
examplenet10/ExampleApeart.HttpApi.Host/Controllers/UserController.cs
diff --git a/examplenet10/ExampleApeart.HttpApi.Host/Controllers/UserController.cs b/examplenet10/ExampleApeart.HttpApi.Host/Controllers/UserController.cs
index 66dd708..35ff649 100644
--- a/examplenet10/ExampleApeart.HttpApi.Host/Controllers/UserController.cs
+++ b/examplenet10/ExampleApeart.HttpApi.Host/Controllers/UserController.cs
@@ -7,6 +7,8 @@ using PasteApeart.Handler;
using ExampleApeart.Controllers;
using ExampleApeart.usermodels;
using System.ComponentModel.DataAnnotations;
+using PasteApeart.Handler.redis;
+using PasteApeart.Handler.Extensions;
namespace ExampleApeart.HttpApi.Host.Controllers
{
examplenet10/ExampleApeart.HttpApi.Host/ExampleApeart.Application.xml
diff --git a/examplenet10/ExampleApeart.HttpApi.Host/ExampleApeart.Application.xml b/examplenet10/ExampleApeart.HttpApi.Host/ExampleApeart.Application.xml
index 9628dea..66ee21c 100644
--- a/examplenet10/ExampleApeart.HttpApi.Host/ExampleApeart.Application.xml
+++ b/examplenet10/ExampleApeart.HttpApi.Host/ExampleApeart.Application.xml
@@ -90,7 +90,7 @@
</summary>
</member>
- <member name="M:ExampleApeart.Application.ExampleApeartDefaultService.#ctor(PasteApeart.Application.IPasteDefaultHelper,PasteApeart.IChannelHelper,ExampleApeart.EntityFrameworkCore.IExampleApeartDbContext)">
+ <member name="M:ExampleApeart.Application.ExampleApeartDefaultService.#ctor(PasteApeart.Application.IPasteDefaultHelper,PasteApeart.Handler.IChannelHelper,ExampleApeart.EntityFrameworkCore.IExampleApeartDbContext)">
<summary>
</summary>
@@ -220,6 +220,11 @@
</summary>
</member>
+ <member name="P:ExampleApeart.ExampleApeartAppService._currentUser">
+ <summary>
+ 当前登录用户
+ </summary>
+ </member>
<member name="M:ExampleApeart.ExampleApeartAppService.#ctor">
<summary>
examplenet10/ExampleApeart.HttpApi.Host/ExampleApeart.Domain.xml
diff --git a/examplenet10/ExampleApeart.HttpApi.Host/ExampleApeart.Domain.xml b/examplenet10/ExampleApeart.HttpApi.Host/ExampleApeart.Domain.xml
index 0cc5c7b..c1eb9ea 100644
--- a/examplenet10/ExampleApeart.HttpApi.Host/ExampleApeart.Domain.xml
+++ b/examplenet10/ExampleApeart.HttpApi.Host/ExampleApeart.Domain.xml
@@ -49,6 +49,21 @@
使用读写分离
</summary>
</member>
+ <member name="T:ExampleApeart.CurrentUser">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="P:ExampleApeart.CurrentUser.Id">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="P:ExampleApeart.CurrentUser.Token">
+ <summary>
+
+ </summary>
+ </member>
<member name="T:ExampleApeart.EnumIsEnableState">
<summary>
状态枚举
examplenet10/ExampleApeart.HttpApi.Host/ExampleApeart.HttpApi.Host.xml
diff --git a/examplenet10/ExampleApeart.HttpApi.Host/ExampleApeart.HttpApi.Host.xml b/examplenet10/ExampleApeart.HttpApi.Host/ExampleApeart.HttpApi.Host.xml
index d40ec81..915eb6a 100644
--- a/examplenet10/ExampleApeart.HttpApi.Host/ExampleApeart.HttpApi.Host.xml
+++ b/examplenet10/ExampleApeart.HttpApi.Host/ExampleApeart.HttpApi.Host.xml
@@ -341,6 +341,12 @@
</summary>
</member>
+ <member name="M:ExampleApeart.HttpApi.Host.Services.AuthMiddleware.#ctor(ExampleApeart.CurrentUser)">
+ <summary>
+
+ </summary>
+ <param name="current"></param>
+ </member>
<member name="M:ExampleApeart.HttpApi.Host.Services.AuthMiddleware.InvokeAsync(Microsoft.AspNetCore.Http.HttpContext,Microsoft.AspNetCore.Http.RequestDelegate)">
<summary>
@@ -403,7 +409,7 @@
系统初始化
</summary>
</member>
- <member name="M:ExampleApeart.StartHostedService.#ctor(System.IServiceProvider,Microsoft.Extensions.Options.IOptions{PasteApeart.RabbitConfig},PasteApeart.Handler.rabbitmodel.RabbitMultiConsumerHandler,Microsoft.Extensions.Logging.ILogger{ExampleApeart.StartHostedService},PasteApeart.IChannelHelper,PasteApeart.Handler.IEventActionHandler,Microsoft.Extensions.Options.IOptions{ExampleApeart.AppConfig})">
+ <member name="M:ExampleApeart.StartHostedService.#ctor(System.IServiceProvider,Microsoft.Extensions.Options.IOptions{PasteApeart.Application.Contracts.RabbitConfig},PasteApeart.Handler.rabbit.IRabbitMultiConsumerHandler,Microsoft.Extensions.Logging.ILogger{ExampleApeart.StartHostedService},PasteApeart.Handler.IChannelHelper,PasteApeart.Handler.IEventActionHandler,Microsoft.Extensions.Options.IOptions{ExampleApeart.AppConfig})">
<summary>
</summary>
examplenet10/ExampleApeart.HttpApi.Host/ExampleApeartHttpApiHostModule.cs
diff --git a/examplenet10/ExampleApeart.HttpApi.Host/ExampleApeartHttpApiHostModule.cs b/examplenet10/ExampleApeart.HttpApi.Host/ExampleApeartHttpApiHostModule.cs
index 20601f1..142d3d9 100644
--- a/examplenet10/ExampleApeart.HttpApi.Host/ExampleApeartHttpApiHostModule.cs
+++ b/examplenet10/ExampleApeart.HttpApi.Host/ExampleApeartHttpApiHostModule.cs
@@ -1,7 +1,10 @@
using ExampleApeart.HttpApi.Host.auditmodels;
using Microsoft.AspNetCore.Mvc;
using PasteApeart;
+using PasteApeart.Dependency;
using PasteApeart.Handler;
+using PasteApeart.Handler.Extensions;
+using PasteApeart.Handler.redis;
namespace ExampleApeart.HttpApi.Host
{
examplenet10/ExampleApeart.HttpApi.Host/Program.cs
diff --git a/examplenet10/ExampleApeart.HttpApi.Host/Program.cs b/examplenet10/ExampleApeart.HttpApi.Host/Program.cs
index 3a35916..e3fdb28 100644
--- a/examplenet10/ExampleApeart.HttpApi.Host/Program.cs
+++ b/examplenet10/ExampleApeart.HttpApi.Host/Program.cs
@@ -2,6 +2,7 @@ using Autofac;
using Autofac.Extensions.DependencyInjection;
using ExampleApeart.Handler;
using PasteApeart;
+using PasteApeart.Handler.lazy;
using Serilog;
//using Serilog.Sinks.RabbitMQ;
examplenet10/ExampleApeart.HttpApi.Host/Services/AuthMiddleware.cs
diff --git a/examplenet10/ExampleApeart.HttpApi.Host/Services/AuthMiddleware.cs b/examplenet10/ExampleApeart.HttpApi.Host/Services/AuthMiddleware.cs
index b29009e..2f023a4 100644
--- a/examplenet10/ExampleApeart.HttpApi.Host/Services/AuthMiddleware.cs
+++ b/examplenet10/ExampleApeart.HttpApi.Host/Services/AuthMiddleware.cs
@@ -1,4 +1,4 @@
-using PasteApeart;
+using PasteApeart.Dependency;
using PasteApeart.EntityFrameworkCore;
using System.Security.Claims;
@@ -9,6 +9,16 @@ namespace ExampleApeart.HttpApi.Host.Services
/// </summary>
public class AuthMiddleware : IMiddleware, IScopedDependency
{
+ private readonly CurrentUser _currentUser;
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="current"></param>
+ public AuthMiddleware(CurrentUser current)
+ {
+ _currentUser = current;
+ }
/// <summary>
///
@@ -42,7 +52,7 @@ namespace ExampleApeart.HttpApi.Host.Services
}
if (!String.IsNullOrEmpty(token))
{
- Console.WriteLine($"解析到密钥:{token}");
+ //Console.WriteLine($"解析到密钥:{token}");
var userId = token.CurrentUserId();
//context.Items["CurrentUser"] = new CurrentUser { Id = userId, Token = token };
@@ -56,8 +66,10 @@ namespace ExampleApeart.HttpApi.Host.Services
var identity = new ClaimsIdentity(claims, "Custom");//Simple
context.User = new ClaimsPrincipal(identity);
//context.User.FindFirstValue
+ _currentUser.Id = userId;
+ _currentUser.Token = token;
//Console.WriteLine($"配置了用户信息{token} {userId}");
- context.Items["CurrentUser"] = new CurrentUser { Id = userId, Token = token };
+ context.Items["CurrentUser"] = _currentUser;
}
var endpoint = context.GetEndpoint();
examplenet10/ExampleApeart.HttpApi.Host/Services/StartHostedService.cs
diff --git a/examplenet10/ExampleApeart.HttpApi.Host/Services/StartHostedService.cs b/examplenet10/ExampleApeart.HttpApi.Host/Services/StartHostedService.cs
index d63fc43..79a3ed1 100644
--- a/examplenet10/ExampleApeart.HttpApi.Host/Services/StartHostedService.cs
+++ b/examplenet10/ExampleApeart.HttpApi.Host/Services/StartHostedService.cs
@@ -1,11 +1,12 @@
-using Microsoft.EntityFrameworkCore;
-using Microsoft.Extensions.Options;
-using PasteApeart;
-using PasteApeart.Handler;
-using PasteApeart.Handler.rabbitmodel;
using ExampleApeart.EntityFrameworkCore;
using ExampleApeart.Handler;
using ExampleApeart.usermodels;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Options;
+using PasteApeart.Application.Contracts;
+using PasteApeart.Handler;
+using PasteApeart.Handler.Extensions;
+using PasteApeart.Handler.rabbit;
namespace ExampleApeart
{
@@ -20,7 +21,7 @@ namespace ExampleApeart
private readonly IChannelHelper _channelHelper;
private readonly IEventActionHandler _eventHandler;
private readonly AppConfig _config;
- private readonly RabbitMultiConsumerHandler _rabbitReviceHandler;
+ private readonly IRabbitMultiConsumerHandler _rabbitReviceHandler;
private readonly RabbitConfig _rabbitConfig;
/// <summary>
@@ -33,7 +34,7 @@ namespace ExampleApeart
/// <param name="channelHelper"></param>
/// <param name="eventHandler"></param>
/// <param name="config"></param>
- public StartHostedService(IServiceProvider serviceProvider, IOptions<RabbitConfig> rabbitConfig, RabbitMultiConsumerHandler rabbitMultiConsumerHandler, ILogger<StartHostedService> logger, IChannelHelper channelHelper, IEventActionHandler eventHandler, IOptions<AppConfig> config)
+ public StartHostedService(IServiceProvider serviceProvider, IOptions<RabbitConfig> rabbitConfig, IRabbitMultiConsumerHandler rabbitMultiConsumerHandler, ILogger<StartHostedService> logger, IChannelHelper channelHelper, IEventActionHandler eventHandler, IOptions<AppConfig> config)
{
_serviceProvider = serviceProvider;
_logger = logger;
@@ -205,7 +206,7 @@ namespace ExampleApeart
var read = await _channelHelper.ChannelEventModel.Reader.ReadAsync(token);
if (read != null)
{
- await _eventHandler.HanlderEventMessage(read);
+ await _eventHandler.ActionMessageAsync(read);
}
else
{
examplenet10/ExampleApeart.Test/ExampleApeart.Test.csproj
diff --git a/examplenet10/ExampleApeart.Test/ExampleApeart.Test.csproj b/examplenet10/ExampleApeart.Test/ExampleApeart.Test.csproj
new file mode 100644
index 0000000..f2ad0cd
--- /dev/null
+++ b/examplenet10/ExampleApeart.Test/ExampleApeart.Test.csproj
@@ -0,0 +1,25 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <TargetFramework>net10.0</TargetFramework>
+ <ImplicitUsings>enable</ImplicitUsings>
+ <Nullable>enable</Nullable>
+ </PropertyGroup>
+ <ItemGroup>
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
+ <PackageReference Include="Sdcb.SimdPaddleOCR" Version="2.0.0" />
+ <PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" />
+ <PackageReference Include="xunit.v3" Version="4.0.2" />
+
+ <!-- 图形识别测试
+ <PackageReference Include="Sdcb.SimdPaddleOCR.Models.ChineseV6Tiny" Version="1.0.0" />
+ <PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />-->
+
+
+ </ItemGroup>
+ <ItemGroup>
+ <None Update="sample.jpg">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ </ItemGroup>
+</Project>
examplenet10/ExampleApeart.Test/ScanImageTest.cs
diff --git a/examplenet10/ExampleApeart.Test/ScanImageTest.cs b/examplenet10/ExampleApeart.Test/ScanImageTest.cs
new file mode 100644
index 0000000..23cd1c6
--- /dev/null
+++ b/examplenet10/ExampleApeart.Test/ScanImageTest.cs
@@ -0,0 +1,56 @@
+//using Sdcb.SimdPaddleOCR;
+//using Sdcb.SimdPaddleOCR.Models.ChineseV6Tiny;
+//using SixLabors.ImageSharp;
+//using SixLabors.ImageSharp.Formats;
+//using SixLabors.ImageSharp.PixelFormats;
+//using System.Runtime.InteropServices;
+//using Xunit;
+
+//namespace ExampleApeart.Test
+//{
+// public class ScanImageTest
+// {
+
+// private readonly ITestOutputHelper _output;
+
+// public ScanImageTest(ITestOutputHelper output)
+// {
+// _output = output;
+// }
+
+// [Fact]
+// public async Task Scan()
+// {
+// if (System.IO.File.Exists("sample.jpg"))
+// {
+// _output.WriteLine("文件存在");
+// }
+// using PaddleOcrAll ocr = await PaddleOcrAll.LoadAsync(ChineseV6TinyModels.Default);
+// using Image<Rgba32> image = await Image.LoadAsync<Rgba32>(CreateDecoderOptions(), "sample.jpg");
+// Rgba32[]? packedCopy = null;
+// if (!image.DangerousTryGetSinglePixelMemory(out Memory<Rgba32> memory))
+// {
+// packedCopy = new Rgba32[checked(image.Width * image.Height)];
+// image.CopyPixelDataTo(packedCopy);
+// memory = packedCopy;
+// }
+
+// PaddleOcrResult result = ocr.Run(MemoryMarshal.AsBytes(memory.Span), image.Width, image.Height,
+// format: ImagePixelFormat.Rgba32);
+// _output.WriteLine(result.Text);
+// Assert.Equal(1, 1);
+// }
+
+
+
+// // 必须 Clone Default:直接改 Configuration.Default 会丢掉 PNG/JPEG 解码器。
+// // 默认分配器按 4MB 分块,大图会让 DangerousTryGetSinglePixelMemory 失败。
+// static DecoderOptions CreateDecoderOptions()
+// {
+// Configuration configuration = Configuration.Default.Clone();
+// configuration.PreferContiguousImageBuffers = true;
+// return new DecoderOptions { Configuration = configuration };
+// }
+
+// }
+//}
examplenet10/ExampleApeart.Test/sample.jpg
diff --git a/examplenet10/ExampleApeart.Test/sample.jpg b/examplenet10/ExampleApeart.Test/sample.jpg
new file mode 100644
index 0000000..1deded0
Binary files /dev/null and b/examplenet10/ExampleApeart.Test/sample.jpg differ
examplenet10/ExampleApeartNet10.sln
diff --git a/examplenet10/ExampleApeartNet10.sln b/examplenet10/ExampleApeartNet10.sln
index 05b83e8..51be808 100644
--- a/examplenet10/ExampleApeartNet10.sln
+++ b/examplenet10/ExampleApeartNet10.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18
-VisualStudioVersion = 18.8.11925.187 insiders
+VisualStudioVersion = 18.8.11925.187
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B6C22D26-6881-46F4-A60B-991431883F11}"
EndProject
@@ -17,6 +17,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExampleApeart.EntityFramewo
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExampleApeart.Handler", "ExampleApeart.Handler\ExampleApeart.Handler.csproj", "{5DB8C732-32E3-449B-9721-3995687DB7EF}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExampleApeart.Test", "ExampleApeart.Test\ExampleApeart.Test.csproj", "{463E5E20-653B-4304-8406-CAB87D1E2E58}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -125,6 +127,22 @@ Global
{5DB8C732-32E3-449B-9721-3995687DB7EF}.Release|x64.Build.0 = Release|x64
{5DB8C732-32E3-449B-9721-3995687DB7EF}.Release|x86.ActiveCfg = Release|Any CPU
{5DB8C732-32E3-449B-9721-3995687DB7EF}.Release|x86.Build.0 = Release|Any CPU
+ {463E5E20-653B-4304-8406-CAB87D1E2E58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {463E5E20-653B-4304-8406-CAB87D1E2E58}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {463E5E20-653B-4304-8406-CAB87D1E2E58}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {463E5E20-653B-4304-8406-CAB87D1E2E58}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {463E5E20-653B-4304-8406-CAB87D1E2E58}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {463E5E20-653B-4304-8406-CAB87D1E2E58}.Debug|x64.Build.0 = Debug|Any CPU
+ {463E5E20-653B-4304-8406-CAB87D1E2E58}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {463E5E20-653B-4304-8406-CAB87D1E2E58}.Debug|x86.Build.0 = Debug|Any CPU
+ {463E5E20-653B-4304-8406-CAB87D1E2E58}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {463E5E20-653B-4304-8406-CAB87D1E2E58}.Release|Any CPU.Build.0 = Release|Any CPU
+ {463E5E20-653B-4304-8406-CAB87D1E2E58}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {463E5E20-653B-4304-8406-CAB87D1E2E58}.Release|ARM64.Build.0 = Release|Any CPU
+ {463E5E20-653B-4304-8406-CAB87D1E2E58}.Release|x64.ActiveCfg = Release|Any CPU
+ {463E5E20-653B-4304-8406-CAB87D1E2E58}.Release|x64.Build.0 = Release|Any CPU
+ {463E5E20-653B-4304-8406-CAB87D1E2E58}.Release|x86.ActiveCfg = Release|Any CPU
+ {463E5E20-653B-4304-8406-CAB87D1E2E58}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -136,6 +154,7 @@ Global
{35C70EDC-18D0-49B5-B122-080177F0B27F} = {B6C22D26-6881-46F4-A60B-991431883F11}
{A1F2FF89-D4CE-40AC-A86F-FA72A88FA293} = {B6C22D26-6881-46F4-A60B-991431883F11}
{5DB8C732-32E3-449B-9721-3995687DB7EF} = {B6C22D26-6881-46F4-A60B-991431883F11}
+ {463E5E20-653B-4304-8406-CAB87D1E2E58} = {B6C22D26-6881-46F4-A60B-991431883F11}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D5B6327E-927F-4D35-9FFE-1EBDA1F97354}
framework/PasteApeart.Helper/BuilderHelper.cs
diff --git a/framework/PasteApeart.Helper/BuilderHelper.cs b/framework/PasteApeart.Helper/BuilderHelper.cs
index 377c7b5..003b274 100644
--- a/framework/PasteApeart.Helper/BuilderHelper.cs
+++ b/framework/PasteApeart.Helper/BuilderHelper.cs
@@ -5,6 +5,7 @@ using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Reflection;
+using System.Text.Json;
using System.Text.Json.Serialization;
using System.Xml.Linq;
@@ -337,7 +338,7 @@ namespace PasteApeart.Helper
{
var _declarType = _property.DeclaringType;
}
- _cpro.Name = _property.Name.FirstLetterToLower();
+ _cpro.Name = _property.Name.ToCamelCase();
_cpro.DataType = _property.PropertyType.Name;
//_cpro.Value = _property.GetValue(_new)?.ToString();
var attributes = _property.GetCustomAttributes<Attribute>();
@@ -955,7 +956,7 @@ namespace PasteApeart.Helper
}
else
{
- proInfo.Name = $"{head}{_property.Name.FirstLetterToLower()}";
+ proInfo.Name = $"{head}{_property.Name.ToCamelCase()}";
}
proInfo.DataType = _property.PropertyType.Name;
var attributes = _property.GetCustomAttributes<Attribute>();
@@ -1249,7 +1250,7 @@ namespace PasteApeart.Helper
}
else
{
- proInfo.Name = $"{head}{_property.Name.FirstLetterToLower()}";
+ proInfo.Name = $"{head}{_property.Name.ToCamelCase()}";
}
proInfo.DataType = _property.PropertyType.Name;
@@ -2321,11 +2322,11 @@ namespace PasteApeart.Helper
{
if (String.IsNullOrEmpty(_attri.Args1))
{
- _attri.Args1 = property.Name;
+ _attri.Args1 = property.Name.ToCamelCase();
}
if (String.IsNullOrEmpty(_attri.Args2))
{
- _attri.Args2 = $"{property.Name} Desc";
+ _attri.Args2 = $"{property.Name} desc".ToCamelCase();
}
}
}
@@ -2383,31 +2384,36 @@ namespace PasteApeart.Helper
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
- private static string FirstLetterToLower(this string input)
+ private static string ToCamelCase(this string input)
{
- if (!String.IsNullOrEmpty(input))
+ if (!string.IsNullOrEmpty(input))
{
- var _index = 0;
- for (var k = 0; k < input.Length; k++)
- {
- var _char = input[k];
- if ((int)_char >= 97)
- {
- _index = k - 1;
- break;
- }
- }
- if (_index > 0)
- {
- return (input.Substring(0, _index).ToLower() + input.Substring(_index));
- }
- else
- {
- return (input.Substring(0, 1).ToLower() + input.Substring(1));
- }
+ return JsonNamingPolicy.CamelCase.ConvertName(input);
}
return input;
}
+ //if (!String.IsNullOrEmpty(input))
+ //{
+ // var _index = 0;
+ // for (var k = 0; k < input.Length; k++)
+ // {
+ // var _char = input[k];
+ // if ((int)_char >= 97)
+ // {
+ // _index = k - 1;
+ // break;
+ // }
+ // }
+ // if (_index > 0)
+ // {
+ // return (input.Substring(0, _index).ToLower() + input.Substring(_index));
+ // }
+ // else
+ // {
+ // return (input.Substring(0, 1).ToLower() + input.Substring(1));
+ // }
+ //}
+ //return input;
private static readonly IMemoryCache _memoryCache = new MemoryCache(new MemoryCacheOptions());
/// <summary>
manage/page/pasteform/index.js
diff --git a/manage/page/pasteform/index.js b/manage/page/pasteform/index.js
index ec90d06..3220651 100644
--- a/manage/page/pasteform/index.js
+++ b/manage/page/pasteform/index.js
@@ -79,8 +79,8 @@ var _config = {
search_after_selected: true,//搜索区域outer选择后,是否直接查询
trclass: null,//表格中trclass的字段名称,实际中这个值中去获取
batch: false,//是否启用批量操作
- show_excel:false,//是否启用导出excel功能
- orderby:"id",//排序
+ show_excel: false,//是否启用导出excel功能
+ orderby: "id",//排序
update_row_min_match_rate: 0.6,//更新行数据的时候,最小匹配率,低于这个值则不进行更新
bind_with_edit: false,//绑定模式下,是否启用编辑模式
};
@@ -153,12 +153,8 @@ $(window).ready(function () {
//localStorage.setItem(`${location.pathname}?path=${_classPath}`,pageSize);
//切换排序 查询基于哪个排序基于哪个
- $(".table").on('click', '.ordersell', function () {
- _config.orderby = $(this).attr('dataval');
- $(".table").find(".ordersell").removeClass('ordered');
- $(this).addClass('ordered');
- readPageData(1);//直接基于这个查询第一页
- })
+ addListenBindOrderby();
+
if (_config.expend_search_box) {
$(".searcharea").show();//不要动画
} else {
@@ -188,14 +184,83 @@ $(window).ready(function () {
QueryModel();
//显示导出功能
- if(_config.show_excel){
+ if (_config.show_excel) {
$(".command_excel_out").show();
//载入资源组件 导出到excel
- loadResource("./lib/xlsx.js",false);
+ loadResource("./lib/xlsx.js", false);
}
});
/**
+ * 绑定并处理点击排序
+ */
+function addListenBindOrderby() {
+ $(".table").on('click', '.ordersell', function (e) {
+ var val = $(this).attr('dataval');
+ var field = val.split(/\s+/)[0];
+
+ var $table = $(".table");
+
+ if (e.ctrlKey || e.metaKey) {
+ // ============ 多列排序模式 ============
+ var parts = (_config.orderby || '')
+ .split(',')
+ .map(function (s) { return s.trim(); })
+ .filter(Boolean);
+
+ // 1. 精确匹配当前 dataval
+ var exactIndex = parts.indexOf(val);
+
+ if (exactIndex > -1) {
+ // 完全相同 => 取消
+ parts.splice(exactIndex, 1);
+ } else {
+ // 2. 找同字段(开头一样)的那一项
+ var sameFieldIndex = -1;
+ for (var i = 0; i < parts.length; i++) {
+ if (parts[i].split(/\s+/)[0] === field) {
+ sameFieldIndex = i;
+ break;
+ }
+ }
+
+ if (sameFieldIndex > -1) {
+ // 同字段不同方向 => 替换
+ parts[sameFieldIndex] = val;
+ } else {
+ // 3. 追加
+ parts.push(val);
+ }
+ }
+
+ _config.orderby = parts.join(',');
+ } else {
+ // ============ 单列排序模式:直接顶替 ============
+ if (_config.orderby === val) {
+ _config.orderby = '';
+ } else {
+ _config.orderby = val;
+ }
+ }
+
+ // ============ 更新 UI 高亮(精确匹配 dataval)============
+ var currentParts = (_config.orderby || '')
+ .split(',')
+ .map(function (s) { return s.trim(); })
+ .filter(Boolean);
+
+ $table.find(".ordersell").removeClass('ordered');
+ $table.find(".ordersell").each(function () {
+ if (currentParts.indexOf($(this).attr('dataval')) > -1) {
+ $(this).addClass('ordered');
+ }
+ });
+
+ readPageData(1);
+ });
+}
+
+/**
* 绑定,预览图片
*/
function addImgTapListenter() {
@@ -993,12 +1058,12 @@ function handlerReadRowData(elc) {
rowData[dataName] = value;
});
- if(!rowData.hasOwnProperty('id')) {
+ if (!rowData.hasOwnProperty('id')) {
rowData.id = $(row).attr('dataid'); // 从tr的dataid属性获取id
//关键在于如何获得类型???
const idProperty = findPropertyByName(_global_list_properties, 'id');
- if(idProperty) {
- if(IsNumberDataType(idProperty.dataType)) {
+ if (idProperty) {
+ if (IsNumberDataType(idProperty.dataType)) {
rowData.id = Number(rowData.id);
}
}
@@ -1585,7 +1650,7 @@ function handlerModelFieldcolumnProperty(properties) {
{
item.dataType = "menuhtml";
item.hidden = true;
- if(_attribute.args4) {
+ if (_attribute.args4) {
if (_attribute.args4 == 'box') {
item.dataType = 'menuhtmlbox';
_config.menubox = true;
@@ -1864,7 +1929,7 @@ function handlerModelFieldcolumnProperty(properties) {
asc: _attribute.args1,
desc: _attribute.args2
};
-
+
}
}
break;
@@ -2374,8 +2439,8 @@ function InitUiData() {
if ($(".ulitems").length > 0) {
- //合并改版 新版本
- register_ulitems_click_event();
+ //合并改版 新版本
+ register_ulitems_click_event();
// //合并改版 旧版本
// $(".ulitems").on('click', 'li', function () {
@@ -2521,7 +2586,7 @@ function handlerInputValue(_info) {
_array.push($(_elcs[k]).attr('value'));
}
if (item.dataFrom.indexOf("[]") >= 0) {
- if ( IsNumberArrayDataType(item.dataFrom)) {
+ if (IsNumberArrayDataType(item.dataFrom)) {
var _newarray = new Array();
_array.forEach(_ary => {
_newarray.push(Number(_ary));
@@ -2533,7 +2598,7 @@ function handlerInputValue(_info) {
} else {
//string
- if ( IsNumberDataType(item.dataFrom)) {
+ if (IsNumberDataType(item.dataFrom)) {
_info[item.name] = Number(_array[0]);
} else {
var _splitchar = ',';
@@ -2770,7 +2835,7 @@ function handlerSwitchUpload(elc) {
if (c != 200) {
$(elc).prop('checked', !_value);
} else {
- layer.tips(typeof(o)=='string'?o: '操作成功', elc, { tipsMore: true,time:2000, tips: [4, '#3a3a3a'] });
+ layer.tips(typeof (o) == 'string' ? o : '操作成功', elc, { tipsMore: true, time: 2000, tips: [4, '#3a3a3a'] });
// 是否更新本行数据,如果是bind模式,则更新父级... .. .
if (_dataname == 'extendBind') {
//提示成功