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, bool> PublicUserCache = new Dictionary<string, bool>();
private Dictionary<string, DateTime> SendCache = new Dictionary<string, DateTime>();
private void OnSendHandle() private void OnSendHandle()
{ {
while (true) 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(); StringBuilder sb = new StringBuilder();
try 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})执行发送"); sb.Append($"{robot.User.Nickname}({robot.User.Wxid})执行发送");
robot.SendMessage(userNameList[index], robot.SendMessage(userNameList[index], mess);
DateTime.Now
.AddSeconds( //robot.SendMessage(userNameList[index], DateTime.Now.AddSeconds(-new Random(Guid.NewGuid().GetHashCode()).Next(1000000, 9000000)).ToString("HHmmssffffdd"));
-new Random(Guid.NewGuid().GetHashCode()).Next(1000000, 9000000))
.ToString("HHmmssffffdd"));
} }
} }
} }

View File

@ -680,34 +680,46 @@ html = {html}");
var html = string.Empty; var html = string.Empty;
try try
{ {
var param = $"promotion_id={goodsId}"; for (int i = 0; i < 5; i++)
var sign = GetSign(param, Member.other);
if (!string.IsNullOrWhiteSpace(sign))
param = $"{param}&_signature={sign}";
var xb = GetXbogus(param, Member.other);
var searchUrl = $"https://buyin.jinritemai.com/pc/decision/detail?";
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{ {
URL = $"{searchUrl}{param}&X-Bogus={xb}", var param = $"promotion_id={goodsId}";
Method = "get", var sign = GetSign(param, Member.other);
IsToLower = false, if (!string.IsNullOrWhiteSpace(sign))
Cookie = Member.cookies, param = $"{param}&_signature={sign}";
Referer = "https://buyin.jinritemai.com/dashboard/shopwindow/goods-list",
Postdata = "", var xb = GetXbogus(param, Member.other);
Timeout = 100000,
ReadWriteTimeout = 30000, var searchUrl = $"https://buyin.jinritemai.com/pc/decision/detail?";
UserAgent = Member.other,
ContentType = "application/json", HttpHelper http = new HttpHelper();
Allowautoredirect = false, HttpItem item = new HttpItem()
ProxyIp = "", {
ResultType = ResultType.String URL = $"{searchUrl}{param}&X-Bogus={xb}",
}; Method = "get",
HttpResult result = http.GetHtml(item); IsToLower = false,
html = result.Html; Cookie = Member.cookies,
Referer = "https://buyin.jinritemai.com/dashboard/shopwindow/goods-list",
Postdata = "",
Timeout = 100000,
ReadWriteTimeout = 30000,
UserAgent = Member.other,
ContentType = "application/json",
Allowautoredirect = false,
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"} //{"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); var goodsInfo = JsonConvert.DeserializeObject<DouyinGoodsInfo>(html);