1.代运营优化
This commit is contained in:
parent
8596133f25
commit
5d837aea82
|
@ -427,7 +427,7 @@ namespace FLSystem
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
EventClient.OnEvent("", $"商户状态查询异常:{ex.Message} - {ex.StackTrace} , {html}");
|
EventClient.OnEvent("", $"商户状态查询异常.:{ex.Message} - {ex.StackTrace} , {html}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
@ -522,71 +522,71 @@ namespace ProductClient
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// 执行发送任务
|
///// 执行发送任务
|
||||||
/// </summary>
|
///// </summary>
|
||||||
private void _ExecuteSend(string objectDesc, string comment)
|
//private void _ExecuteSend(string objectDesc, string comment)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(objectDesc)) return;
|
|
||||||
var clients = Chat.Framework.ChatClient.WXClient.Values.ToList().Where(f => (f.WeixinType == WeixinType.Grpc微信 || f.WeixinType == WeixinType.Hook微信) && f.Status == WxStatus.在线).ToList();
|
|
||||||
if (clients.Count != 0)
|
|
||||||
{
|
|
||||||
foreach (var _item in clients)
|
|
||||||
{
|
|
||||||
var item = _item;
|
|
||||||
//Task.Run(() =>
|
|
||||||
//{
|
//{
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
//objectDesc = Regex.Replace(objectDesc, @"videomd5=""(.{32})""", @"videomd5=""" + Util.GetMD5Hash(Guid.NewGuid().ToByteArray()) + @"""");
|
// if (string.IsNullOrWhiteSpace(objectDesc)) return;
|
||||||
//objectDesc = Regex.Replace(objectDesc, @"md5=""(.{32})""", @"md5=""" + Util.GetMD5Hash(Guid.NewGuid().ToByteArray()) + @"""");
|
// var clients = Chat.Framework.ChatClient.WXClient.Values.ToList().Where(f => (f.WeixinType == WeixinType.Grpc微信 || f.WeixinType == WeixinType.Hook微信) && f.Status == WxStatus.在线).ToList();
|
||||||
|
// if (clients.Count != 0)
|
||||||
|
// {
|
||||||
|
// foreach (var _item in clients)
|
||||||
|
// {
|
||||||
|
// var item = _item;
|
||||||
|
// //Task.Run(() =>
|
||||||
|
// //{
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// //objectDesc = Regex.Replace(objectDesc, @"videomd5=""(.{32})""", @"videomd5=""" + Util.GetMD5Hash(Guid.NewGuid().ToByteArray()) + @"""");
|
||||||
|
// //objectDesc = Regex.Replace(objectDesc, @"md5=""(.{32})""", @"md5=""" + Util.GetMD5Hash(Guid.NewGuid().ToByteArray()) + @"""");
|
||||||
|
|
||||||
objectDesc = objectDesc.Replace("[活动口令]", Class1.Config.actionLink);
|
// objectDesc = objectDesc.Replace("[活动口令]", Class1.Config.actionLink);
|
||||||
|
|
||||||
var json = item.SendCircle(objectDesc);//发送朋友圈的主内容
|
// var json = item.SendCircle(objectDesc);//发送朋友圈的主内容
|
||||||
if (string.IsNullOrWhiteSpace(json))
|
// if (string.IsNullOrWhiteSpace(json))
|
||||||
EventClient.OnEvent(this, $"【代运营朋友圈】 => {item.WeixinHao},转发失败");
|
// EventClient.OnEvent(this, $"【代运营朋友圈】 => {item.WeixinHao},转发失败");
|
||||||
else
|
// else
|
||||||
EventClient.OnEvent(this, $"【代运营朋友圈】 => {item.WeixinHao},转发成功");
|
// EventClient.OnEvent(this, $"【代运营朋友圈】 => {item.WeixinHao},转发成功");
|
||||||
|
|
||||||
if (!Class1.Config.isPl)
|
// if (!Class1.Config.isPl)
|
||||||
{
|
// {
|
||||||
var reg = Regex.Match(json.Replace("<![CDATA[", "").Replace("]]>", ""), @"<id>(?<id>\d{15,})</id>");//获取返回的朋友圈id
|
// var reg = Regex.Match(json.Replace("<![CDATA[", "").Replace("]]>", ""), @"<id>(?<id>\d{15,})</id>");//获取返回的朋友圈id
|
||||||
if (reg.Success && !string.IsNullOrWhiteSpace(comment))
|
// if (reg.Success && !string.IsNullOrWhiteSpace(comment))
|
||||||
{
|
// {
|
||||||
var id = reg.Groups["id"].Value;
|
// var id = reg.Groups["id"].Value;
|
||||||
var commentStr = string.Empty;
|
// var commentStr = string.Empty;
|
||||||
if (string.IsNullOrWhiteSpace(Class1.Config.appendComment))
|
// if (string.IsNullOrWhiteSpace(Class1.Config.appendComment))
|
||||||
commentStr = string.Join("[分段]", comment);
|
// commentStr = string.Join("[分段]", comment);
|
||||||
else
|
// else
|
||||||
commentStr = string.Join("[分段]", comment, Class1.Config.appendComment);
|
// commentStr = string.Join("[分段]", comment, Class1.Config.appendComment);
|
||||||
if (!string.IsNullOrWhiteSpace(commentStr))
|
// if (!string.IsNullOrWhiteSpace(commentStr))
|
||||||
item.SendCircleComment(item.User.Username, id, commentStr.Replace("[活动口令]", Class1.Config.actionLink));
|
// item.SendCircleComment(item.User.Username, id, commentStr.Replace("[活动口令]", Class1.Config.actionLink));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
catch (Exception ex)
|
// catch (Exception ex)
|
||||||
{
|
// {
|
||||||
EventClient.OnEvent(this, $"【代运营朋友圈】 发送异常:{ex.Message} - {ex.StackTrace}");
|
// EventClient.OnEvent(this, $"【代运营朋友圈】 发送异常:{ex.Message} - {ex.StackTrace}");
|
||||||
}
|
// }
|
||||||
//});
|
// //});
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (Class1.Config.Monitor_Interval != 0)
|
// if (Class1.Config.Monitor_Interval != 0)
|
||||||
{
|
// {
|
||||||
Class1.Config.LastSendTime = DateTime.Now;
|
// Class1.Config.LastSendTime = DateTime.Now;
|
||||||
Util.Save(Class1.Config);
|
// Util.Save(Class1.Config);
|
||||||
}
|
// }
|
||||||
EventClient.OnEvent(this, $"【代运营朋友圈】 所有账号发送完毕");
|
// EventClient.OnEvent(this, $"【代运营朋友圈】 所有账号发送完毕");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
catch (Exception ex)
|
// catch (Exception ex)
|
||||||
{
|
// {
|
||||||
EventClient.OnEvent(this, $"【代运营朋友圈】 发送失败:{ex.Message} - {ex.StackTrace}");
|
// EventClient.OnEvent(this, $"【代运营朋友圈】 发送失败:{ex.Message} - {ex.StackTrace}");
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -596,7 +596,13 @@ namespace ProductClient
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(objectDesc)) return;
|
if (string.IsNullOrWhiteSpace(objectDesc))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
comments.Add(Class1.Config.appendComment);
|
||||||
|
var commentStr = string.Join("[分段]", comments);
|
||||||
|
|
||||||
var clients = Chat.Framework.ChatClient.WXClient.Values.ToList().Where(f => (f.WeixinType == WeixinType.Grpc微信 || f.WeixinType == WeixinType.Hook微信) && f.Status == WxStatus.在线).ToList();
|
var clients = Chat.Framework.ChatClient.WXClient.Values.ToList().Where(f => (f.WeixinType == WeixinType.Grpc微信 || f.WeixinType == WeixinType.Hook微信) && f.Status == WxStatus.在线).ToList();
|
||||||
if (clients.Count != 0)
|
if (clients.Count != 0)
|
||||||
{
|
{
|
||||||
|
@ -621,12 +627,9 @@ namespace ProductClient
|
||||||
//if (!Class1.Config.isPl)
|
//if (!Class1.Config.isPl)
|
||||||
//{
|
//{
|
||||||
var reg = Regex.Match(json.Replace("<![CDATA[", "").Replace("]]>", ""), @"<id>(?<id>\d{15,})</id>");//获取返回的朋友圈id
|
var reg = Regex.Match(json.Replace("<![CDATA[", "").Replace("]]>", ""), @"<id>(?<id>\d{15,})</id>");//获取返回的朋友圈id
|
||||||
if (reg.Success && comments != null && comments.Count > 0)
|
if (reg.Success && !string.IsNullOrWhiteSpace(commentStr))
|
||||||
{
|
{
|
||||||
var id = reg.Groups["id"].Value;
|
var id = reg.Groups["id"].Value;
|
||||||
comments.Add(Class1.Config.appendComment);
|
|
||||||
var commentStr = string.Join("[分段]", comments);
|
|
||||||
|
|
||||||
EventClient.OnEvent(null, $"【代运营朋友圈】 => {item.WeixinHao},评论内容:{commentStr}");
|
EventClient.OnEvent(null, $"【代运营朋友圈】 => {item.WeixinHao},评论内容:{commentStr}");
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(commentStr))
|
if (!string.IsNullOrWhiteSpace(commentStr))
|
||||||
|
|
Loading…
Reference in New Issue