Files
juipnet/Infrastructure/Hncore.Infrastructure/WebApi/CommonController/PodHookController.cs
“wanyongkang” ed3b2c653e 接口文件
2024-04-10 13:55:27 +08:00

35 lines
1.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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();
}
}
}