25 lines
710 B
C#
25 lines
710 B
C#
using System.Text;
|
|
|
|
namespace Core;
|
|
|
|
public static class WxNotify
|
|
{
|
|
public static async Task SendCommonAsync(string msg)
|
|
{
|
|
var wxRebotUrl = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=96f9fa23-a959-4492-ac3a-7415fae19680";
|
|
var client = new HttpClient();
|
|
var requestBody =
|
|
"""
|
|
{
|
|
"msgtype": "markdown",
|
|
"markdown": {
|
|
"content": "{Msg}"
|
|
}
|
|
}
|
|
""";
|
|
|
|
// 转义
|
|
requestBody = requestBody.Replace("{Msg}", msg.Replace("\r\n", "\n"));
|
|
await client.PostAsync(wxRebotUrl, new StringContent(requestBody, Encoding.UTF8, "application/json"));
|
|
}
|
|
} |