feat:完成furion改造
This commit is contained in:
14
Yi.BBS.Vue3/package-lock.json
generated
14
Yi.BBS.Vue3/package-lock.json
generated
@@ -13,6 +13,7 @@
|
||||
"echarts": "^5.4.2",
|
||||
"element-plus": "^2.2.32",
|
||||
"highlight": "^0.2.4",
|
||||
"i": "^0.3.7",
|
||||
"marked": "^4.2.12",
|
||||
"mavon-editor": "^3.0.0",
|
||||
"nprogress": "^0.2.0",
|
||||
@@ -2345,6 +2346,14 @@
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/i": {
|
||||
"version": "0.3.7",
|
||||
"resolved": "https://registry.npmmirror.com/i/-/i-0.3.7.tgz",
|
||||
"integrity": "sha512-FYz4wlXgkQwIPqhzC5TdNMLSE5+GS1IIDJZY/1ZiEPCT2S3COUVZeT5OW4BmW4r5LHLQuOosSwsvnroG9GR59Q==",
|
||||
"engines": {
|
||||
"node": ">=0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/ignore": {
|
||||
"version": "5.2.4",
|
||||
"resolved": "https://registry.npmmirror.com/ignore/-/ignore-5.2.4.tgz",
|
||||
@@ -5641,6 +5650,11 @@
|
||||
"debug": "4"
|
||||
}
|
||||
},
|
||||
"i": {
|
||||
"version": "0.3.7",
|
||||
"resolved": "https://registry.npmmirror.com/i/-/i-0.3.7.tgz",
|
||||
"integrity": "sha512-FYz4wlXgkQwIPqhzC5TdNMLSE5+GS1IIDJZY/1ZiEPCT2S3COUVZeT5OW4BmW4r5LHLQuOosSwsvnroG9GR59Q=="
|
||||
},
|
||||
"ignore": {
|
||||
"version": "5.2.4",
|
||||
"resolved": "https://registry.npmmirror.com/ignore/-/ignore-5.2.4.tgz",
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"echarts": "^5.4.2",
|
||||
"element-plus": "^2.2.32",
|
||||
"highlight": "^0.2.4",
|
||||
"i": "^0.3.7",
|
||||
"marked": "^4.2.12",
|
||||
"mavon-editor": "^3.0.0",
|
||||
"nprogress": "^0.2.0",
|
||||
|
||||
@@ -124,7 +124,7 @@ fileDialogVisible.value=false;
|
||||
}
|
||||
//文件上传成功后
|
||||
const onSuccess=(response)=>{
|
||||
fileUrlList.value.push(response[0].id)
|
||||
fileUrlList.value.push(response.data[0].id)
|
||||
|
||||
}
|
||||
//图片上传
|
||||
|
||||
@@ -36,8 +36,12 @@ myaxios.interceptors.request.use(function (config) {
|
||||
|
||||
// 响应拦截器
|
||||
myaxios.interceptors.response.use(function (response) {
|
||||
|
||||
return response;
|
||||
//业务错误
|
||||
if(response.data.statusCode==403)
|
||||
{
|
||||
ElMessage.error(response.data.errors)
|
||||
}
|
||||
return response.data;
|
||||
}, function (error) {
|
||||
const response=error.response.data;
|
||||
//业务异常+应用异常,统一处理
|
||||
|
||||
@@ -93,7 +93,7 @@ const dialogImageUrl = ref('')
|
||||
|
||||
//文件上传成功后
|
||||
const onSuccess=(response)=>{
|
||||
dialogImageUrl.value=response[0].id
|
||||
dialogImageUrl.value=response.data[0].id
|
||||
}
|
||||
//封面url
|
||||
const getUrl= (str)=>{
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Yi.Framework.Infrastructure.Data.Entities;
|
||||
using Yi.Framework.Infrastructure.Data.Filters;
|
||||
|
||||
namespace Yi.Framework.Infrastructure.Data
|
||||
{
|
||||
public static class DataFilterExtensions
|
||||
{
|
||||
public static IApplicationBuilder UseDataFiterServer(this IApplicationBuilder builder)
|
||||
{
|
||||
return builder.UseMiddleware<DataFilterMiddleware>();
|
||||
}
|
||||
}
|
||||
|
||||
public class DataFilterMiddleware
|
||||
{
|
||||
private readonly RequestDelegate _next;
|
||||
private readonly ILogger<DataFilterMiddleware> _logger;
|
||||
public DataFilterMiddleware(RequestDelegate next, ILoggerFactory loggerFactory)
|
||||
{
|
||||
_next = next;
|
||||
_logger = loggerFactory.CreateLogger<DataFilterMiddleware>();
|
||||
}
|
||||
public async Task InvokeAsync(HttpContext context, IDataFilter dataFilter)
|
||||
{
|
||||
//添加默认的过滤器
|
||||
dataFilter.AddFilter<ISoftDelete>(u => u.IsDeleted == false);
|
||||
//dataFilter.AddFilter<IMultiTenant>(u => u.TenantId == Guid.Empty);
|
||||
await _next(context);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Infrastructure.Data.Json
|
||||
{
|
||||
public class DateTimeJsonConverter : JsonConverter<DateTime>
|
||||
{
|
||||
private readonly string Format;
|
||||
public DateTimeJsonConverter(string format)
|
||||
{
|
||||
Format = format;
|
||||
}
|
||||
public override void Write(Utf8JsonWriter writer, DateTime date, JsonSerializerOptions options)
|
||||
{
|
||||
writer.WriteStringValue(date.ToString(Format));
|
||||
}
|
||||
public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
return DateTime.ParseExact(reader.GetString(), Format, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.Buffers.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Yi.Framework.Infrastructure.Data.Json
|
||||
{
|
||||
/// <summary>
|
||||
/// 长整形转字符串
|
||||
/// </summary>
|
||||
public class LongToStringConverter : JsonConverter<long>
|
||||
{
|
||||
public override long Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
if (reader.TokenType == JsonTokenType.String)
|
||||
{
|
||||
ReadOnlySpan<byte> span = reader.HasValueSequence ? reader.ValueSequence.ToArray() : reader.ValueSpan;
|
||||
if (Utf8Parser.TryParse(span, out long number, out int bytesConsumed) && span.Length == bytesConsumed)
|
||||
{
|
||||
return number;
|
||||
}
|
||||
|
||||
if (long.TryParse(reader.GetString(), out number))
|
||||
{
|
||||
return number;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return reader.GetInt64();
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, long value, JsonSerializerOptions options)
|
||||
{
|
||||
writer.WriteStringValue(value.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using StackExchange.Profiling.SqlFormatters;
|
||||
using Yi.Framework.Infrastructure.AspNetCore;
|
||||
using Yi.Framework.Infrastructure.Data;
|
||||
using Yi.Framework.Infrastructure.Data.Filters;
|
||||
using Yi.Framework.Infrastructure.Sqlsugar;
|
||||
using Yi.Framework.Infrastructure.Sqlsugar.Filters;
|
||||
@@ -29,6 +30,6 @@ public class Startup : AppStartup
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
|
||||
app.UseDataFiterServer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using Microsoft.Extensions.Hosting;
|
||||
using Yi.Framework.Infrastructure.AspNetCore;
|
||||
using Yi.Framework.Infrastructure.Sqlsugar;
|
||||
using Yi.Framework.Module.ImageSharp.HeiCaptcha;
|
||||
using Yi.Framework.Module.Sms.Aliyun;
|
||||
|
||||
namespace Yi.Framework.Module;
|
||||
|
||||
@@ -20,6 +21,8 @@ public class Startup : AppStartup
|
||||
services.AddDbSqlsugarContextServer();
|
||||
|
||||
services.AddHeiCaptcha();
|
||||
|
||||
services.Configure<SmsAliyunOptions>(App.Configuration.GetSection("SmsAliyunOptions"));
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
|
||||
@@ -55,10 +55,9 @@ namespace Yi.Furion.Application.Bbs.Services.Impl
|
||||
User = new UserGetListOutputDto() { UserName = user.UserName, Nick = user.Nick, Icon = user.Icon }
|
||||
}, true).SingleAsync(discuss => discuss.Id == id);
|
||||
|
||||
await VerifyDiscussPermissionAsync(item.Id);
|
||||
|
||||
if (item is not null)
|
||||
{
|
||||
await VerifyDiscussPermissionAsync(item.Id);
|
||||
_eventPublisher.PublishAsync(new SeeDiscussEventSource(new SeeDiscussEventArgs { DiscussId = item.Id, OldSeeNum = item.SeeNum }));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Yi.Framework.Infrastructure.Data.Json;
|
||||
using Yi.Furion.Web.Core.Handlers;
|
||||
|
||||
namespace Yi.Furion.Web.Core;
|
||||
@@ -16,7 +17,10 @@ public class Startup : AppStartup
|
||||
|
||||
services.AddCorsAccessor();
|
||||
|
||||
services.AddControllers().AddInjectWithUnifyResult();
|
||||
services.AddControllers().AddInjectWithUnifyResult().AddJsonOptions(x => {
|
||||
//x.JsonSerializerOptions.Converters.Add(new DateTimeJsonConverter("yyyy-MM-dd HH:mm:ss"));
|
||||
x.JsonSerializerOptions.Converters.Add(new LongToStringConverter());
|
||||
});
|
||||
|
||||
services.AddEventBus();
|
||||
|
||||
|
||||
12
Yi.Furion.Net6/Yi.Furion.Web.Entry/.config/dotnet-tools.json
Normal file
12
Yi.Furion.Net6/Yi.Furion.Web.Entry/.config/dotnet-tools.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "7.0.5",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,14 @@
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\File\" />
|
||||
<Folder Include="wwwroot\Image\" />
|
||||
<Folder Include="wwwroot\Thumbnail\" />
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties properties_4launchsettings_1json__JsonSchema="" />
|
||||
|
||||
@@ -37,5 +37,13 @@
|
||||
"ExpiredTime": 20, // 过期时间,long 类型,单位分钟,默认20分钟
|
||||
"ClockSkew": 5, // 过期时间容错值,long 类型,单位秒,默认 5秒
|
||||
"Algorithm": "HS256" // 加密算法,string 类型,默认 HS256
|
||||
},
|
||||
//阿里云短信
|
||||
"SmsAliyunOptions": {
|
||||
"AccessKeyId": "",
|
||||
"AccessKeySecret": "",
|
||||
"SignName": "",
|
||||
"TemplateCode": "",
|
||||
"EnableFeature": false
|
||||
}
|
||||
}
|
||||
@@ -81,6 +81,16 @@ service.interceptors.request.use(config => {
|
||||
|
||||
// 响应拦截器
|
||||
service.interceptors.response.use(res => {
|
||||
|
||||
//业务错误
|
||||
if(res.data.statusCode==403)
|
||||
{
|
||||
ElMessage({
|
||||
message: res.data.errors,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
|
||||
// 未设置状态码则默认成功状态
|
||||
const code = res.status || 200;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user