添加项目文件。
This commit is contained in:
55
TelegramService.Bl/SendMessageBl.cs
Normal file
55
TelegramService.Bl/SendMessageBl.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user