忽略dll文件git

This commit is contained in:
“wanyongkang”
2023-07-29 10:19:42 +08:00
parent 7f97317bcc
commit b562aba2b1
3868 changed files with 63608 additions and 385427 deletions

View File

@@ -1,16 +0,0 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Hncore.Infrastructure.WebApi
{
[Route("/check")]
public class CheckController: ControllerBase
{
[HttpGet]
[AllowAnonymous]
public IActionResult Get()
{
return Ok("ok");
}
}
}

View File

@@ -1,124 +0,0 @@
using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Hncore.Infrastructure.EF;
using Hncore.Infrastructure.Extension;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Routing;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.Extensions.DependencyInjection;
namespace Hncore.Infrastructure.WebApi
{
[ApiController]
public class HncoreControllerBase : ControllerBase
{
protected ApiResult Success()
{
return new ApiResult(ResultCode.C_SUCCESS, "");
}
protected ApiResult Success<T>(T data, string message = "")
{
return new ApiResult(ResultCode.C_SUCCESS, message) {Data = data};
}
protected ApiResult Error(string message = "")
{
return new ApiResult(ResultCode.C_UNKNOWN_ERROR, message);
}
protected ApiResult Error(ResultCode code, string message = "")
{
return new ApiResult(code, message);
}
protected ApiResult UofCommit(string message = "")
{
RepositoryDbContext.SaveChanges();
return Success(message);
}
protected ApiResult UofCommit<T>(Func<T> func, string message = "")
{
RepositoryDbContext.SaveChanges();
return Success(func(), message);
}
protected async Task<ApiResult> UofCommitAsync(string message = "")
{
await RepositoryDbContext.SaveChangesAsync();
return Success(message);
}
protected async Task<ApiResult> UofCommitAsync(IDbContextTransaction trans, string message = "")
{
await RepositoryDbContext.SaveChangesAsync();
trans.Commit();
return Success(message);
}
protected async Task<ApiResult> UofCommitAsync<T>(Func<T> func, string message = "")
{
await RepositoryDbContext.SaveChangesAsync();
return Success(func(), message);
}
protected DbContext RepositoryDbContext =>
Request.HttpContext
.RequestServices
.GetService<IRepositoryDbContext>()
.DbContext;
protected async Task<string> RenderViewToStringAsync(string viewName, object model = null)
{
using (var sw = new StringWriter())
{
var actionContext = new ActionContext(HttpContext, new RouteData(), new ActionDescriptor());
var viewResult = HttpContext.RequestServices.GetService<IRazorViewEngine>()
.FindView(actionContext, viewName, false);
if (viewResult.View == null)
{
throw new ArgumentNullException($"未找到视图{viewName}");
}
var viewDictionary =
new ViewDataDictionary(new EmptyModelMetadataProvider(), new ModelStateDictionary())
{
Model = model
};
var viewContext = new ViewContext(
actionContext,
viewResult.View,
viewDictionary,
new TempDataDictionary(actionContext.HttpContext,
HttpContext.RequestServices.GetService<ITempDataProvider>()),
sw,
new HtmlHelperOptions()
);
await viewResult.View.RenderAsync(viewContext);
return sw.ToString().HtmlDecode();
}
}
}
}

View File

@@ -1,35 +0,0 @@
using System;
using System.Threading.Tasks;
using Hncore.Infrastructure.Common;
using Hncore.Infrastructure.Common.DingTalk;
using Hncore.Infrastructure.Extension;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Hncore.Infrastructure.WebApi
{
[Route("/pod/[action]")]
public class PodHookController : ControllerBase
{
[HttpGet, AllowAnonymous]
public async Task<IActionResult> PreStop()
{
LogHelper.Warn("应用即将退出");
if (EnvironmentVariableHelper.IsAspNetCoreProduction)
{
await DingTalkHelper.SendMessage(new MarkDownModel()
{
markdown = new markdown()
{
title = "应用即将退出",
text = "### 应用即将退出\n\nhostname" + EnvironmentVariableHelper.HostName + "\n\n" +
DateTime.Now.Format("yyyy-MM-dd HH:mm:ss")
}
});
}
return Ok();
}
}
}