1.代运营优化
This commit is contained in:
parent
8596133f25
commit
5d837aea82
|
@ -427,7 +427,7 @@ namespace FLSystem
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
EventClient.OnEvent("", $"商户状态查询异常:{ex.Message} - {ex.StackTrace} , {html}");
|
||||
EventClient.OnEvent("", $"商户状态查询异常.:{ex.Message} - {ex.StackTrace} , {html}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -522,81 +522,87 @@ namespace ProductClient
|
|||
return string.Empty;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 执行发送任务
|
||||
///// </summary>
|
||||
//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
|
||||
// {
|
||||
// //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);
|
||||
|
||||
// var json = item.SendCircle(objectDesc);//发送朋友圈的主内容
|
||||
// if (string.IsNullOrWhiteSpace(json))
|
||||
// EventClient.OnEvent(this, $"【代运营朋友圈】 => {item.WeixinHao},转发失败");
|
||||
// else
|
||||
// EventClient.OnEvent(this, $"【代运营朋友圈】 => {item.WeixinHao},转发成功");
|
||||
|
||||
// if (!Class1.Config.isPl)
|
||||
// {
|
||||
// var reg = Regex.Match(json.Replace("<![CDATA[", "").Replace("]]>", ""), @"<id>(?<id>\d{15,})</id>");//获取返回的朋友圈id
|
||||
// if (reg.Success && !string.IsNullOrWhiteSpace(comment))
|
||||
// {
|
||||
// var id = reg.Groups["id"].Value;
|
||||
// var commentStr = string.Empty;
|
||||
// if (string.IsNullOrWhiteSpace(Class1.Config.appendComment))
|
||||
// commentStr = string.Join("[分段]", comment);
|
||||
// else
|
||||
// commentStr = string.Join("[分段]", comment, Class1.Config.appendComment);
|
||||
// if (!string.IsNullOrWhiteSpace(commentStr))
|
||||
// item.SendCircleComment(item.User.Username, id, commentStr.Replace("[活动口令]", Class1.Config.actionLink));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// EventClient.OnEvent(this, $"【代运营朋友圈】 发送异常:{ex.Message} - {ex.StackTrace}");
|
||||
// }
|
||||
// //});
|
||||
// }
|
||||
|
||||
// if (Class1.Config.Monitor_Interval != 0)
|
||||
// {
|
||||
// Class1.Config.LastSendTime = DateTime.Now;
|
||||
// Util.Save(Class1.Config);
|
||||
// }
|
||||
// EventClient.OnEvent(this, $"【代运营朋友圈】 所有账号发送完毕");
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// EventClient.OnEvent(this, $"【代运营朋友圈】 发送失败:{ex.Message} - {ex.StackTrace}");
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 执行发送任务
|
||||
/// </summary>
|
||||
private void _ExecuteSend(string objectDesc, string comment)
|
||||
public static void _ExecuteSend(string objectDesc, List<string> comments, bool isGoods, string taskId)
|
||||
{
|
||||
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)
|
||||
if (string.IsNullOrWhiteSpace(objectDesc))
|
||||
{
|
||||
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);
|
||||
|
||||
var json = item.SendCircle(objectDesc);//发送朋友圈的主内容
|
||||
if (string.IsNullOrWhiteSpace(json))
|
||||
EventClient.OnEvent(this, $"【代运营朋友圈】 => {item.WeixinHao},转发失败");
|
||||
else
|
||||
EventClient.OnEvent(this, $"【代运营朋友圈】 => {item.WeixinHao},转发成功");
|
||||
|
||||
if (!Class1.Config.isPl)
|
||||
{
|
||||
var reg = Regex.Match(json.Replace("<![CDATA[", "").Replace("]]>", ""), @"<id>(?<id>\d{15,})</id>");//获取返回的朋友圈id
|
||||
if (reg.Success && !string.IsNullOrWhiteSpace(comment))
|
||||
{
|
||||
var id = reg.Groups["id"].Value;
|
||||
var commentStr = string.Empty;
|
||||
if (string.IsNullOrWhiteSpace(Class1.Config.appendComment))
|
||||
commentStr = string.Join("[分段]", comment);
|
||||
else
|
||||
commentStr = string.Join("[分段]", comment, Class1.Config.appendComment);
|
||||
if (!string.IsNullOrWhiteSpace(commentStr))
|
||||
item.SendCircleComment(item.User.Username, id, commentStr.Replace("[活动口令]", Class1.Config.actionLink));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
EventClient.OnEvent(this, $"【代运营朋友圈】 发送异常:{ex.Message} - {ex.StackTrace}");
|
||||
}
|
||||
//});
|
||||
}
|
||||
|
||||
if (Class1.Config.Monitor_Interval != 0)
|
||||
{
|
||||
Class1.Config.LastSendTime = DateTime.Now;
|
||||
Util.Save(Class1.Config);
|
||||
}
|
||||
EventClient.OnEvent(this, $"【代运营朋友圈】 所有账号发送完毕");
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
EventClient.OnEvent(this, $"【代运营朋友圈】 发送失败:{ex.Message} - {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
comments.Add(Class1.Config.appendComment);
|
||||
var commentStr = string.Join("[分段]", comments);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 执行发送任务
|
||||
/// </summary>
|
||||
public static void _ExecuteSend(string objectDesc, List<string> comments,bool isGoods,string taskId)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -621,12 +627,9 @@ namespace ProductClient
|
|||
//if (!Class1.Config.isPl)
|
||||
//{
|
||||
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;
|
||||
comments.Add(Class1.Config.appendComment);
|
||||
var commentStr = string.Join("[分段]", comments);
|
||||
|
||||
EventClient.OnEvent(null, $"【代运营朋友圈】 => {item.WeixinHao},评论内容:{commentStr}");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(commentStr))
|
||||
|
|
Loading…
Reference in New Issue