Files
TelegramService/TelegramService.Bl/SendMessageBl.cs
2025-11-27 16:58:03 +08:00

56 lines
1.3 KiB
C#

using NetTaste;
using System;
using System.Collections.Generic;
using System.Net;
using System.Text;
using TelegramService.Help;
namespace TelegramService.Bl
{
public class SendMessageBl
{
public static async Task<bool> SendWx(string url,string msg)
{
HttpResult httpResult;
for (int i = 0; i < 2; i++)
{
httpResult = await HttpHelper.PostJsonAsync(url, msg);
if (httpResult.StatusCode != 200)
{
continue;
}
if (httpResult.Html.IndexOfStr("\"errmsg\":\"ok\""))
{
return true;
}
}
return false;
}
public static async Task<bool> SendTg(string url,string msg)
{
HttpResult httpResult = null;
for (int i = 0; i < 2; i++)
{
httpResult = await HttpHelper.PostJsonAsync(url, msg);
if (httpResult.StatusCode != 200)
{
continue;
}
if (httpResult.Html.IndexOfStr("\"ok\":true,"))
{
return true;
}
}
return false;
}
}
}