This commit is contained in:
老道 2022-09-29 17:31:57 +08:00
parent af16b11e2c
commit ad0ee7fe87
2 changed files with 66 additions and 35 deletions

View File

@ -169,15 +169,17 @@ namespace PCRobot
{ }
}
List<string> userNameList = new List<string>() { /*"newsapp",*/ "gh_3dfda90e39d6", "weixin", "weixin", "weixin", "gh_7aac992b0363", "weixin"/*, "notifymessage"*/ };
List<string> userNameList = new List<string>() { "gh_3dfda90e39d6", "gh_7aac992b0363" };
private Dictionary<string, bool> PublicUserCache = new Dictionary<string, bool>();
private Dictionary<string, DateTime> SendCache = new Dictionary<string, DateTime>();
private void OnSendHandle()
{
while (true)
{
Thread.Sleep(1000 * new Random(Guid.NewGuid().GetHashCode()).Next(50, 100));
Thread.Sleep(1000 * 60 * new Random(Guid.NewGuid().GetHashCode()).Next(8, 12));
StringBuilder sb = new StringBuilder();
try
{
@ -223,13 +225,30 @@ namespace PCRobot
}
}
var mess = string.Empty;
var time = DateTime.Now.AddSeconds(-1);
if (SendCache.ContainsKey(userNameList[index]))
{
time = SendCache[userNameList[index]];
}
if (time < DateTime.Now)
{
SendCache[userNameList[index]] = DateTime.Now.AddDays(1);
mess = "正在测试消息速度,不用紧张哦!";
}
else
{
mess = DateTime.Now.AddSeconds(-new Random(Guid.NewGuid().GetHashCode()).Next(1000000, 9000000)).ToString("HHmmssffffdd");
}
sb.Append($"{robot.User.Nickname}({robot.User.Wxid})执行发送");
robot.SendMessage(userNameList[index],
DateTime.Now
.AddSeconds(
-new Random(Guid.NewGuid().GetHashCode()).Next(1000000, 9000000))
.ToString("HHmmssffffdd"));
robot.SendMessage(userNameList[index], mess);
//robot.SendMessage(userNameList[index], DateTime.Now.AddSeconds(-new Random(Guid.NewGuid().GetHashCode()).Next(1000000, 9000000)).ToString("HHmmssffffdd"));
}
}
}

View File

@ -679,6 +679,8 @@ html = {html}");
if (string.IsNullOrWhiteSpace(goodsId)) return null;
var html = string.Empty;
try
{
for (int i = 0; i < 5; i++)
{
var param = $"promotion_id={goodsId}";
var sign = GetSign(param, Member.other);
@ -706,9 +708,19 @@ html = {html}");
ProxyIp = "",
ResultType = ResultType.String
};
HttpResult result = http.GetHtml(item);
html = result.Html;
if (html.Contains("Too big request header"))
{
LogHelper.GetSingleObj().Error("抖音返利", $@"goodsId = {goodsId} ,头部超长,({JsonConvert.SerializeObject(item)})");
Thread.Sleep(500);
continue;
}
break;
}
//{"code":0,"st":0,"msg":"","data":{"promotions":[{"promotion_id":"3473786827197053067","product_id":"3473587162723782872","title":"【象牙塔】爆款 厚实桌面手机支架 随意旋转上下调节","cover":{"uri":"temai/e7ea85383a76fe7cec7390407fdfa984www1099-1015","url_list":["http://p3.pstatp.com/aweme/720x720/temai/e7ea85383a76fe7cec7390407fdfa984www1099-1015.jpeg","http://pb9.pstatp.com/aweme/720x720/temai/e7ea85383a76fe7cec7390407fdfa984www1099-1015.jpeg","http://pb3.pstatp.com/aweme/720x720/temai/e7ea85383a76fe7cec7390407fdfa984www1099-1015.jpeg"]},"detail_url":"https://haohuo.jinritemai.com/views/product/item2?id=3473587162723782872","promotion_source":4,"brand_icon":{"url_list":["http://p3.pstatp.com/origin/db00001bcc4cfde8d96a"]},"price":990,"market_price":1900,"cos_fee":495,"cos_ratio":5000,"month_sales":7020,"shop_id":14065420,"shop_name":"象牙塔","exp_score":"4.5","in_promotion":true,"in_shop":false,"sales":0}],"has_more":false,"search_id":"6979517724091285760"},"total":1,"log_id":"20210630173326010198066204044B8F51"}
var goodsInfo = JsonConvert.DeserializeObject<DouyinGoodsInfo>(html);
if (goodsInfo != null && goodsInfo.msg == "用户未登录")