feat: publish dbussmsforward refactor

This commit is contained in:
2026-05-08 23:54:03 +08:00
commit 9f1ee9ffe6
77 changed files with 15585 additions and 0 deletions
+68
View File
@@ -0,0 +1,68 @@
using DbusSmsForward.Helper;
using DbusSmsForward.ProcessSmsContent;
using DbusSmsForward.SettingModel;
using DbusSmsForward.SMSModel;
using System.Text.Json;
namespace DbusSmsForward.SendMethod
{
public static class SendByBark
{
public static void SetupBarkInfo()
{
appsettingsModel result = new appsettingsModel();
ConfigHelper.GetSettings(ref result);
string BarkUrl = result.appSettings.BarkConfig.BarkUrl;
string BrakKey = result.appSettings.BarkConfig.BarkKey;
if (string.IsNullOrEmpty(BarkUrl) && string.IsNullOrEmpty(BrakKey))
{
Console.WriteLine("首次运行请输入Bark服务器地址:");
BarkUrl = Console.ReadLine().Trim();
result.appSettings.BarkConfig.BarkUrl = BarkUrl;
Console.WriteLine("首次运行请输入Bark推送key");
BrakKey = Console.ReadLine().Trim();
result.appSettings.BarkConfig.BarkKey = BrakKey;
ConfigHelper.UpdateSettings(ref result);
}
result = null;
}
public static void SendSms(SmsContentModel smsmodel, string body, string devicename)
{
try
{
appsettingsModel result = new appsettingsModel();
ConfigHelper.GetSettings(ref result);
string BarkUrl = result.appSettings.BarkConfig.BarkUrl;
string BrakKey = result.appSettings.BarkConfig.BarkKey;
result = null;
//string SmsCodeStr = GetSmsContentCode.GetSmsCodeStr(smsmodel.SmsContent);
SmsCodeModel codeResult = GetSmsContentCode.GetSmsCodeModel(smsmodel.SmsContent);
string url = BarkUrl + "/" + BrakKey + "/";
url += System.Web.HttpUtility.UrlEncode(body);
url += "?group=" + smsmodel.TelNumber + "&title="+ (string.IsNullOrEmpty(codeResult.CodeValue) ? "" : codeResult.CodeValue + " ") + "短信转发" + smsmodel.TelNumber+(string.IsNullOrEmpty(codeResult.CodeValue) ?"":"&autoCopy=1&copy="+ codeResult.CodeValue);
string msgresult = HttpHelper.HttpGet(url);
//JsonObject jsonObjresult = JObject.Parse(msgresult);
var jsonObjresult = JsonSerializer.Deserialize(msgresult, SourceGenerationContext.Default.JsonObject);
string status = jsonObjresult["code"].ToString();
if (status == "200")
{
Console.WriteLine("Bark转发成功");
}
else
{
Console.WriteLine(jsonObjresult["code"].ToString());
Console.WriteLine(jsonObjresult["message"].ToString());
}
}
catch(Exception ex)
{
Console.WriteLine("SendByBarkError:\n"+ex);
}
}
}
}
+105
View File
@@ -0,0 +1,105 @@
using DbusSmsForward.Helper;
using System.Security.Cryptography;
using System.Text;
using System.Web;
using DbusSmsForward.SMSModel;
using DbusSmsForward.ProcessSmsContent;
using System.Text.Json;
using System.Text.Json.Nodes;
using DbusSmsForward.SettingModel;
namespace DbusSmsForward.SendMethod
{
public class SendByDingTalkBot
{
private const string DING_TALK_BOT_URL = "https://oapi.dingtalk.com/robot/send?access_token=";
public static void SetupDingtalkBotMsg()
{
appsettingsModel result = new appsettingsModel();
ConfigHelper.GetSettings(ref result);
string DingTalkAccessToken = result.appSettings.DingTalkConfig.DingTalkAccessToken;
string DingTalkSecret = result.appSettings.DingTalkConfig.DingTalkSecret;
if (string.IsNullOrEmpty(DingTalkAccessToken) && string.IsNullOrEmpty(DingTalkSecret))
{
Console.WriteLine("首次运行请输入钉钉机器人AccessToken");
DingTalkAccessToken = Console.ReadLine().Trim();
result.appSettings.DingTalkConfig.DingTalkAccessToken = DingTalkAccessToken;
Console.WriteLine("请输入钉钉机器人加签secret");
DingTalkSecret = Console.ReadLine().Trim();
result.appSettings.DingTalkConfig.DingTalkSecret = DingTalkSecret;
ConfigHelper.UpdateSettings(ref result);
}
result = null;
}
public static void SendSms(SmsContentModel smsmodel, string body, string devicename)
{
try
{
appsettingsModel result = new appsettingsModel();
ConfigHelper.GetSettings(ref result);
string dingTalkAccessToken = result.appSettings.DingTalkConfig.DingTalkAccessToken;
string dingTalkSecret = result.appSettings.DingTalkConfig.DingTalkSecret;
result = null;
string url = DING_TALK_BOT_URL + dingTalkAccessToken;
//string SmsCodeStr = GetSmsContentCode.GetSmsCodeStr(smsmodel.SmsContent);
SmsCodeModel codeResult = GetSmsContentCode.GetSmsCodeModel(smsmodel.SmsContent);
long timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds();
string sign = addSign(timestamp, dingTalkSecret);
url += $"&timestamp={timestamp}&sign={sign}";
JsonObject msgContent = new()
{
{ "content", (string.IsNullOrEmpty(codeResult.CodeValue) ? "" : codeResult.CodeValue + "\n") + "短信转发\n" + body }
};
JsonObject msgObj = new()
{
{ "msgtype", "text" },
{ "text", msgContent }
};
string resultResp = HttpHelper.Post(url, msgObj);
//JObject jsonObjresult = JObject.Parse(resultResp);
JsonObject jsonObjresult = JsonSerializer.Deserialize(resultResp, SourceGenerationContext.Default.JsonObject);
string errcode1 = jsonObjresult["errcode"].ToString();
string errmsg1 = jsonObjresult["errmsg"].ToString();
if (errcode1 == "0" && errmsg1 == "ok")
{
Console.WriteLine("钉钉转发成功");
}
else
{
Console.WriteLine(errmsg1);
}
}
catch (Exception ex)
{
Console.WriteLine("SendByDingTalkBotError:\n" + ex);
}
}
public static string addSign(long timestamp ,string secret)
{
string secret1 = secret;
string stringToSign = timestamp + "\n" + secret1;
var encoding = new ASCIIEncoding();
byte[] keyByte = encoding.GetBytes(secret1);
byte[] messageBytes = encoding.GetBytes(stringToSign);
using (var hmacsha256 = new HMACSHA256(keyByte))
{
byte[] hashmessage = hmacsha256.ComputeHash(messageBytes);
return HttpUtility.UrlEncode(Convert.ToBase64String(hashmessage), Encoding.UTF8);
}
}
public static string Base64Encrypt(string input, Encoding encode)
{
return Convert.ToBase64String(encode.GetBytes(input));
}
}
}
+99
View File
@@ -0,0 +1,99 @@
using DbusSmsForward.SMSModel;
using DbusSmsForward.ProcessSmsContent;
using DbusSmsForward.Helper;
using DbusSmsForward.SettingModel;
using MimeKit;
using MailKit.Net.Smtp;
namespace DbusSmsForward.SendMethod
{
public static class SendByEmail
{
public static void SetupEmailInfo()
{
appsettingsModel result = new appsettingsModel();
ConfigHelper.GetSettings(ref result);
string smtpHost = result.appSettings.EmailConfig.smtpHost;
string smtpPort = result.appSettings.EmailConfig.smtpPort;
string emailKey = result.appSettings.EmailConfig.emailKey;
string sendEmail = result.appSettings.EmailConfig.sendEmail;
string reciveEmail = result.appSettings.EmailConfig.reciveEmail;
if (string.IsNullOrEmpty(smtpHost) && string.IsNullOrEmpty(smtpPort) && string.IsNullOrEmpty(emailKey) && string.IsNullOrEmpty(sendEmail) && string.IsNullOrEmpty(reciveEmail))
{
Console.WriteLine("首次运行请输入邮箱转发相关配置信息\n请输入smtp地址:");
smtpHost = Console.ReadLine().Trim();
result.appSettings.EmailConfig.smtpHost = smtpHost;
Console.WriteLine("请输入smtp端口:");
smtpPort = Console.ReadLine().Trim();
result.appSettings.EmailConfig.smtpPort = smtpPort;
string sslEnableInput = string.Empty;
do
{
Console.WriteLine("是否需要启用ssl(1.启用 2.不启用)");
sslEnableInput = Console.ReadLine().Trim();
} while (!(sslEnableInput == "1" || sslEnableInput == "2"));
if (sslEnableInput == "1")
{
result.appSettings.EmailConfig.enableSSL = "true";
}
else
{
result.appSettings.EmailConfig.enableSSL = "false";
}
Console.WriteLine("请输入邮箱密钥:");
emailKey = Console.ReadLine().Trim();
result.appSettings.EmailConfig.emailKey = emailKey;
Console.WriteLine("请输入发件邮箱:");
sendEmail = Console.ReadLine().Trim();
result.appSettings.EmailConfig.sendEmail = sendEmail;
Console.WriteLine("请输入收件邮箱:");
reciveEmail = Console.ReadLine().Trim();
result.appSettings.EmailConfig.reciveEmail = reciveEmail;
ConfigHelper.UpdateSettings(ref result);
}
result = null;
}
public static void SendSms(SmsContentModel smsmodel, string body, string devicename)
{
try
{
appsettingsModel result = new appsettingsModel();
ConfigHelper.GetSettings(ref result);
string smtpHost = result.appSettings.EmailConfig.smtpHost;
string smtpPort = result.appSettings.EmailConfig.smtpPort;
bool enableSSL = Convert.ToBoolean(result.appSettings.EmailConfig.enableSSL);
string emailKey = result.appSettings.EmailConfig.emailKey;
string sendEmail = result.appSettings.EmailConfig.sendEmail;
string reciveEmail = result.appSettings.EmailConfig.reciveEmail;
result = null;
var message = new MimeMessage();
message.From.Add(new MailboxAddress("SMSForwad", sendEmail));
message.To.Add(new MailboxAddress("", reciveEmail));
//string SmsCodeStr = GetSmsContentCode.GetSmsCodeStr(smsmodel.SmsContent);
SmsCodeModel codeResult = GetSmsContentCode.GetSmsCodeModel(smsmodel.SmsContent);
message.Subject = (string.IsNullOrEmpty(codeResult.CodeValue) ? "" : codeResult.CodeValue + " ") + "短信转发" + smsmodel.TelNumber;
message.Body = new TextPart("plain")
{
Text = body
};
using (var client = new SmtpClient())
{
client.Connect(smtpHost, Convert.ToInt32(smtpPort), enableSSL);
client.Authenticate(sendEmail, emailKey);
client.Send(message);
client.Disconnect(true);
}
}
catch (Exception ex)
{
Console.WriteLine("SendByEmailError:\n" + ex);
}
}
}
}
+66
View File
@@ -0,0 +1,66 @@
using DbusSmsForward.Helper;
using DbusSmsForward.ProcessSmsContent;
using DbusSmsForward.SettingModel;
using DbusSmsForward.SMSModel;
using System.Text.Json;
using System.Text.Json.Nodes;
namespace DbusSmsForward.SendMethod
{
public static class SendByPushPlus
{
public static void SetupPushPlusInfo()
{
appsettingsModel result = new appsettingsModel();
ConfigHelper.GetSettings(ref result);
string pushPlusToken = result.appSettings.PushPlusConfig.pushPlusToken;
if (string.IsNullOrEmpty(pushPlusToken))
{
Console.WriteLine("首次运行请输入PushPlusToken");
pushPlusToken = Console.ReadLine().Trim();
result.appSettings.PushPlusConfig.pushPlusToken = pushPlusToken;
ConfigHelper.UpdateSettings(ref result);
}
result = null;
}
public static void SendSms(SmsContentModel smsmodel, string body, string devicename)
{
try
{
appsettingsModel result = new appsettingsModel();
ConfigHelper.GetSettings(ref result);
string pushPlusToken = result.appSettings.PushPlusConfig.pushPlusToken;
result = null;
string pushPlusUrl = "http://www.pushplus.plus/send/";
//string SmsCodeStr = GetSmsContentCode.GetSmsCodeStr(smsmodel.SmsContent);
SmsCodeModel codeResult = GetSmsContentCode.GetSmsCodeModel(smsmodel.SmsContent);
JsonObject obj = new JsonObject();
obj.Add("token", pushPlusToken);
obj.Add("title", (string.IsNullOrEmpty(codeResult.CodeValue) ? "" : codeResult.CodeValue + " ") + "短信转发" + smsmodel.TelNumber);
obj.Add("content", body);
obj.Add("topic", "");
string msgresult = HttpHelper.Post(pushPlusUrl, obj);
//JObject jsonObjresult = JObject.Parse(msgresult);
JsonObject jsonObjresult = JsonSerializer.Deserialize(msgresult, SourceGenerationContext.Default.JsonObject);
string code = jsonObjresult["code"].ToString();
string errmsg = jsonObjresult["msg"].ToString();
if (code == "200")
{
Console.WriteLine("pushplus转发成功");
}
else
{
Console.WriteLine(errmsg);
}
}
catch (Exception ex)
{
Console.WriteLine("SetupPushPlusInfoError:\n" + ex);
}
}
}
}
+125
View File
@@ -0,0 +1,125 @@
using DbusSmsForward.Helper;
using DbusSmsForward.ProcessSmsContent;
using DbusSmsForward.SettingModel;
using DbusSmsForward.SMSModel;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Xml;
namespace DbusSmsForward.SendMethod
{
public static class SendByShell
{
public static void SetupCustomShellInfo()
{
appsettingsModel result = new appsettingsModel();
ConfigHelper.GetSettings(ref result);
string shellPath = result.appSettings.ShellConfig.ShellPath;
if (string.IsNullOrEmpty(shellPath))
{
Console.WriteLine("首次运行请输入自定义shell脚本路径:");
shellPath = Console.ReadLine().Trim();
result.appSettings.ShellConfig.ShellPath = shellPath;
ConfigHelper.UpdateSettings(ref result);
}
result = null;
}
public static void SendSms(SmsContentModel smsmodel, string body, string devicename)
{
try
{
appsettingsModel result = new appsettingsModel();
ConfigHelper.GetSettings(ref result);
string shellPath = result.appSettings.ShellConfig.ShellPath;
result = null;
SmsCodeModel codeResult = GetSmsContentCode.GetSmsCodeModel(smsmodel.SmsContent);
string[] arguments =
{
string.IsNullOrEmpty(smsmodel.TelNumber)?"":smsmodel.TelNumber,
string.IsNullOrEmpty(smsmodel.SmsDate)?"":smsmodel.SmsDate,
string.IsNullOrEmpty(smsmodel.SmsContent)?"":smsmodel.SmsContent,
string.IsNullOrEmpty(codeResult.CodeValue)?"":codeResult.CodeValue,
string.IsNullOrEmpty(codeResult.CodeFrom)?"":codeResult.CodeFrom,
string.IsNullOrEmpty(devicename)?"":devicename,
};
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = shellPath,
UseShellExecute = false, // 不直接使用操作系统shell启动
CreateNoWindow = true, // 不创建新窗口
RedirectStandardOutput = true, // 可以重定向输出
RedirectStandardError = true // 可以重定向错误
};
foreach (var arg in arguments)
{
startInfo.ArgumentList.Add(arg);
}
// 启动进程
using (Process process = new Process())
{
process.StartInfo = startInfo;
// 可以捕获输出(如果需要)
process.OutputDataReceived += (sender, e) =>
{
if (!string.IsNullOrEmpty(e.Data))
Console.WriteLine($"输出: {e.Data}");
};
process.ErrorDataReceived += (sender, e) =>
{
if (!string.IsNullOrEmpty(e.Data))
Console.WriteLine($"错误: {e.Data}");
};
bool started = process.Start();
if (started)
{
// 开始异步读取输出
process.BeginOutputReadLine();
process.BeginErrorReadLine();
// 等待进程完成(可以设置超时时间)
bool exited = process.WaitForExit(30000); // 30秒超时
if (exited)
{
int exitCode = process.ExitCode;
if (exitCode == 0)
{
Console.WriteLine("\nShell调用成功");
}
else
{
Console.WriteLine($"\nShell调用失败,退出代码: {exitCode}");
}
}
else
{
Console.WriteLine("\nShell调用超时");
process.Kill(); // 强制终止进程
}
}
else
{
Console.WriteLine("\n无法启动Shell进程");
}
}
}
catch (Exception ex)
{
Console.WriteLine("SendByShellError:\n" + ex);
}
}
}
}
+100
View File
@@ -0,0 +1,100 @@
using DbusSmsForward.Helper;
using DbusSmsForward.ProcessSmsContent;
using DbusSmsForward.SettingModel;
using DbusSmsForward.SMSModel;
using System.Text.Json;
using System.Text.Json.Nodes;
namespace DbusSmsForward.SendMethod
{
public static class SendByTelegramBot
{
public static void SetupTGBotInfo()
{
appsettingsModel result = new appsettingsModel();
ConfigHelper.GetSettings(ref result);
string TGBotToken = result.appSettings.TGBotConfig.TGBotToken;
string TGBotChatID = result.appSettings.TGBotConfig.TGBotChatID;
string IsEnableCustomTGBotApi = result.appSettings.TGBotConfig.IsEnableCustomTGBotApi;
string CustomTGBotApi = result.appSettings.TGBotConfig.CustomTGBotApi;
if (string.IsNullOrEmpty(TGBotToken) || string.IsNullOrEmpty(TGBotChatID) || string.IsNullOrEmpty(IsEnableCustomTGBotApi))
{
Console.WriteLine("首次运行请输入TG机器人Token");
TGBotToken = Console.ReadLine().Trim();
result.appSettings.TGBotConfig.TGBotToken = TGBotToken;
Console.WriteLine("请输入机器人要转发到的ChatId");
TGBotChatID = Console.ReadLine().Trim();
result.appSettings.TGBotConfig.TGBotChatID = TGBotChatID;
string customApiEnableInput=string.Empty;
do
{
Console.WriteLine("是否需要使用自定义api(1.使用 2.不使用)");
customApiEnableInput= Console.ReadLine().Trim();
} while (!(customApiEnableInput=="1"|| customApiEnableInput == "2"));
if(customApiEnableInput=="1")
{
IsEnableCustomTGBotApi = "true";
result.appSettings.TGBotConfig.IsEnableCustomTGBotApi = IsEnableCustomTGBotApi;
Console.WriteLine("请输入机器人自定义api(格式https://xxx.abc.com)");
CustomTGBotApi= Console.ReadLine().Trim();
result.appSettings.TGBotConfig.CustomTGBotApi = CustomTGBotApi;
}
else
{
IsEnableCustomTGBotApi = "false";
result.appSettings.TGBotConfig.IsEnableCustomTGBotApi = IsEnableCustomTGBotApi;
}
ConfigHelper.UpdateSettings(ref result);
}
result = null;
}
public static void SendSms(SmsContentModel smsmodel, string body, string devicename)
{
try
{
appsettingsModel result = new appsettingsModel();
ConfigHelper.GetSettings(ref result);
string TGBotToken = result.appSettings.TGBotConfig.TGBotToken;
string TGBotChatID = result.appSettings.TGBotConfig.TGBotChatID;
string IsEnableCustomTGBotApi = result.appSettings.TGBotConfig.IsEnableCustomTGBotApi;
string CustomTGBotApi = result.appSettings.TGBotConfig.CustomTGBotApi;
result = null;
//string SmsCodeStr = GetSmsContentCode.GetSmsCodeStr(smsmodel.SmsContent);
SmsCodeModel codeResult = GetSmsContentCode.GetSmsCodeModel(smsmodel.SmsContent);
string url = "";
if (IsEnableCustomTGBotApi == "true")
{
url = CustomTGBotApi;
}
else
{
url = "https://api.telegram.org";
}
url += "/bot" + TGBotToken + "/sendMessage?chat_id=" + TGBotChatID + "&text=";
url += System.Web.HttpUtility.UrlEncode((string.IsNullOrEmpty(codeResult.CodeValue) ? "" : codeResult.CodeValue + "\n") + "短信转发\n" + body);
string msgresult = HttpHelper.HttpGet(url);
JsonObject jsonObjresult = JsonSerializer.Deserialize(msgresult, SourceGenerationContext.Default.JsonObject);
string status = jsonObjresult["ok"].ToString();
if (status.ToLower() == "true")
{
Console.WriteLine("TGBot转发成功");
}
else
{
Console.WriteLine(jsonObjresult["error_code"].ToString());
Console.WriteLine(jsonObjresult["description"].ToString());
}
}
catch (Exception ex)
{
Console.WriteLine("SendByTelegramBotError:\n" + ex);
}
}
}
}
@@ -0,0 +1,103 @@
using DbusSmsForward.Helper;
using DbusSmsForward.ProcessSmsContent;
using DbusSmsForward.SettingModel;
using DbusSmsForward.SMSModel;
using System.Text.Json;
using System.Text.Json.Nodes;
namespace DbusSmsForward.SendMethod
{
public class SendByWeComApplication
{
public static void SetupWeComInfo()
{
appsettingsModel result = new appsettingsModel();
ConfigHelper.GetSettings(ref result);
string corpid = result.appSettings.WeComApplicationConfig.WeChatQYID;
string appsecret = result.appSettings.WeComApplicationConfig.WeChatQYApplicationSecret;
string appid = result.appSettings.WeComApplicationConfig.WeChatQYApplicationID;
if (string.IsNullOrEmpty(corpid) && string.IsNullOrEmpty(appsecret) && string.IsNullOrEmpty(appid))
{
Console.WriteLine("首次运行请输入企业ID");
corpid = Console.ReadLine().Trim();
result.appSettings.WeComApplicationConfig.WeChatQYID = corpid;
Console.WriteLine("请输入自建应用ID");
appid = Console.ReadLine().Trim();
result.appSettings.WeComApplicationConfig.WeChatQYApplicationID = appid;
Console.WriteLine("请输入自建应用密钥:");
appsecret = Console.ReadLine().Trim();
result.appSettings.WeComApplicationConfig.WeChatQYApplicationSecret = appsecret;
ConfigHelper.UpdateSettings(ref result);
}
result = null;
}
public static void SendSms(SmsContentModel smsmodel, string body, string devicename)
{
try
{
appsettingsModel configResult = new appsettingsModel();
ConfigHelper.GetSettings(ref configResult);
string corpid = configResult.appSettings.WeComApplicationConfig.WeChatQYID;
string corpsecret = configResult.appSettings.WeComApplicationConfig.WeChatQYApplicationSecret;
string agentid = configResult.appSettings.WeComApplicationConfig.WeChatQYApplicationID;
configResult = null;
string url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=" + corpid + "&corpsecret=" + corpsecret;
string result = HttpHelper.HttpGet(url);
//JsonObject jsonObj = JsonObject.Parse(result);
JsonObject jsonObj = JsonSerializer.Deserialize(result, SourceGenerationContext.Default.JsonObject);
string errcode = jsonObj["errcode"].ToString();
string errmsg = jsonObj["errmsg"].ToString();
//string SmsCodeStr = GetSmsContentCode.GetSmsCodeStr(smsmodel.SmsContent);
SmsCodeModel codeResult = GetSmsContentCode.GetSmsCodeModel(smsmodel.SmsContent);
if (errcode == "0" && errmsg == "ok")
{
string access_token = jsonObj["access_token"].ToString();
JsonObject obj = new JsonObject();
JsonObject obj1 = new JsonObject();
obj.Add("touser", "@all");
obj.Add("toparty", "");
obj.Add("totag", "");
obj.Add("msgtype", "text");
obj.Add("agentid", agentid);
obj1.Add("content", (string.IsNullOrEmpty(codeResult.CodeValue) ? "" : codeResult.CodeValue + "\n") + "短信转发\n" + body);
obj.Add("text", obj1);
obj.Add("safe", 0);
obj.Add("enable_id_trans", 0);
obj.Add("enable_duplicate_check", 0);
obj.Add("duplicate_check_interval", 1800);
string msgurl = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=" + access_token;
string msgresult = HttpHelper.Post(msgurl, obj);
//JsonObject jsonObjresult = JsonObject.Parse(msgresult);
//JsonObject jsonObjresult = JsonSerializer.Deserialize<JsonObject>(msgresult);
JsonObject jsonObjresult = JsonSerializer.Deserialize(msgresult, SourceGenerationContext.Default.JsonObject);
string errcode1 = jsonObjresult["errcode"].ToString();
string errmsg1 = jsonObjresult["errmsg"].ToString();
if (errcode1 == "0" && errmsg1 == "ok")
{
Console.WriteLine("企业微信转发成功");
}
else
{
Console.WriteLine(errmsg1);
}
}
else
{
Console.WriteLine(errmsg);
}
}
catch (Exception ex)
{
Console.WriteLine("SendByWeComApplicationError:\n" + ex);
}
}
}
}