1.优化代运营 补偿机制

This commit is contained in:
老道 2023-02-02 15:37:56 +08:00
parent fb296bb61c
commit 26303e1ffb
2 changed files with 379 additions and 331 deletions

View File

@ -51,15 +51,22 @@ namespace ProductClient
//创建配置文件 //创建配置文件
Config = this.ReadConfig<Config>(); Config = this.ReadConfig<Config>();
//var thread = TimerTask.NewTimer<MonitorThread>(60) as MonitorThread;
EventClient.DyyNoticeEvent += EventClient_DyyNoticeEvent; EventClient.DyyNoticeEvent += EventClient_DyyNoticeEvent;
var thread = TimerTask.NewTimer<MonitorThread>(60) as MonitorThread;
//EventClient_DyyNoticeEvent(null, new DyyNoticeEvent() //EventClient_DyyNoticeEvent(null, new DyyNoticeEvent()
//{ //{
// //Data = "{\"Id\":\"122522636742819840\",\"TaskId\":\"122522636742819840\",\"IsGoods\":true}" // //Data = "{\"Id\":\"122522636742819840\",\"TaskId\":\"122522636742819840\",\"IsGoods\":true}"
// Data = "{\"TaskId\":\"142515582485397504\",\"CollectionSourceId\":\"129505086429724672\",\"IsGoods\":true}" // Data = "{\"TaskId\":\"142515582485397504\",\"CollectionSourceId\":\"129505086429724672\",\"IsGoods\":true}"
//}); //});
Task.Run(() =>
{
thread.Sleep(1000 * 30);
MonitorThread.GetDyyCircleGoodsLastTask();
});
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -17,6 +17,7 @@ using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using Api.Framework.Data.TB; using Api.Framework.Data.TB;
using Api.Framework.Events;
using static Api.Framework.Tools.TBHelper.TbAnalysis; using static Api.Framework.Tools.TBHelper.TbAnalysis;
namespace ProductClient namespace ProductClient
@ -31,6 +32,17 @@ namespace ProductClient
try try
{ {
count++; count++;
var node = 5;
var hour = DateTime.Now.Hour;
if (2 <= hour && hour <= 6)
{
node = 30;
}
if (count % node == 0)
{
GetDyyCircleGoodsLastTask();
}
#region web接口检测 #region web接口检测
//if (count % 5 == 0) //if (count % 5 == 0)
@ -229,6 +241,35 @@ namespace ProductClient
//private static string ZJYUrl = string.Empty; //private static string ZJYUrl = string.Empty;
public static void GetDyyCircleGoodsLastTask()
{
try
{
var taskId = Class1.Config.SignId;
var sourceId = Class1.Config.sourceId;
if (sourceId == null)
{
sourceId = "129505086429724672";
}
// $"{taskId}[分段]{collectionSourceId}"
HttpHelper http = new HttpHelper();
var html = http.GetHtml($"http://goods.api.52cmg.cn/api/WechatMomentsGoods-WechatMoments/GetLastTaskV2", postData: $"SourceId={sourceId}&LastTaskId={taskId}").Html;
//"{\"TaskId\":\"130145086167056384\",\"CollectionSourceId\":\"129505086429724672\",\"IsGoods\":true}"
if (string.IsNullOrWhiteSpace(html))
{
return;
}
EventClient.OnDyyNoticeEvent(null, new DyyNoticeEvent() { Data = html });
}
catch (Exception ex)
{
EventClient.OnEvent("", $"代运营朋友圈 - 补偿:{ex.Message}");
}
}
/// <summary> /// <summary>
/// 阿里妈妈转连接 /// 阿里妈妈转连接
/// </summary> /// </summary>