项目引用更新

This commit is contained in:
陈淳
2022-07-13 10:32:43 +08:00
parent 300d8224ec
commit 7fe9a6c900
17 changed files with 977 additions and 21 deletions

View File

@@ -9,6 +9,7 @@ using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Model.Models;
using System.IdentityModel.Tokens.Jwt;
using System.IO;
namespace Yi.Framework.WebCore
{
@@ -51,5 +52,42 @@ namespace Yi.Framework.WebCore
//Name = claimlist.FirstOrDefault(u => u.Type == JwtRegisteredClaimNames.Name).Value
};
}
public static void FileInlineHandle(this HttpContext httpContext, string fileName)
{
string encodeFilename = System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.GetEncoding("UTF-8"));
httpContext.Response.Headers.Add("Content-Disposition", "inline;filename=" + encodeFilename);
}
public static void FileAttachmentHandle(this HttpContext httpContext, string fileName)
{
string encodeFilename = System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.GetEncoding("UTF-8"));
httpContext.Response.Headers.Add("Content-Disposition", "attachment;filename=" + encodeFilename);
}
public static string GetLanguage(this HttpContext httpContext)
{
string res = "zh-CN";
var str = httpContext.Request.Headers["Accept-Language"].FirstOrDefault();
if (str.IsNotNull())
{
res = str.Split(",")[0];
}
return res;
}
public static string GetBody(this HttpContext httpContext)
{
if (httpContext.Request.Body != null)
{
httpContext.Request.EnableBuffering();
httpContext.Request.Body.Position = 0;
StreamReader stream = new StreamReader(httpContext.Request.Body);
return stream.ReadToEndAsync().GetAwaiter().GetResult();
}
return "";
}
}
}

View File

@@ -10,7 +10,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
{
public static class SqlsugarExtension
{
public static void AddSqlsugarServer(this IServiceCollection services)
public static void AddSqlsugarServer(this IServiceCollection services, Action<SqlSugarClient> action = null)
{
@@ -61,6 +61,10 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
},
db =>
{
if (action.IsNotNull())
{
action(db);
}
db.Aop.DataExecuting = (oldValue, entityInfo) =>
{

View File

@@ -34,10 +34,6 @@
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Core\Yi.Framework.Core.csproj" />
<ProjectReference Include="..\Yi.Framework.DTOModel\Yi.Framework.DTOModel.csproj" />
<ProjectReference Include="..\Yi.Framework.Interface\Yi.Framework.Interface.csproj" />
<ProjectReference Include="..\Yi.Framework.Model\Yi.Framework.Model.csproj" />
<ProjectReference Include="..\Yi.Framework.Repository\Yi.Framework.Repository.csproj" />
<ProjectReference Include="..\Yi.Framework.Service\Yi.Framework.Service.csproj" />
</ItemGroup>