继续优化拼多多上货
This commit is contained in:
1 parent
f451ba769f
commit
d70b2eb6a7
1 file changed
+31
-19
@@ -877,13 +877,13 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
sleepTime = Randomx.GetId(4000, 8000);
|
||||
sleepTimeTotal += sleepTime;
|
||||
Thread.Sleep(sleepTime);
|
||||
//if (Randomx.GetId(2) > 0) // 后面重试的地方较多,一次获取的token不够了,随机再登录一次
|
||||
//{
|
||||
// loginForm.cefWebBrowser.Load("https://mms.pinduoduo.com/home/");
|
||||
// sleepTime = Randomx.GetId(4000, 8000);
|
||||
// sleepTimeTotal += sleepTime;
|
||||
// Thread.Sleep(sleepTime);
|
||||
//}
|
||||
if (Randomx.GetId(3) > 0) // 后面重试的地方较多,一次获取的token不够了,随机再登录一次
|
||||
{
|
||||
loginForm.cefWebBrowser.Load("https://mms.pinduoduo.com/goods/goods_list?msfrom=mms_sidenav");
|
||||
sleepTime = Randomx.GetId(4000, 8000);
|
||||
sleepTimeTotal += sleepTime;
|
||||
Thread.Sleep(sleepTime);
|
||||
}
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
@@ -914,19 +914,13 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
//将商品上传
|
||||
result = UploadProduct(shop, kjdDbProd, prod, row.Cells["colOpResult"], startTime);
|
||||
|
||||
//额外等待时间(无论失败与否)
|
||||
var waitTime = 0;
|
||||
Invoke(new Action(() => { waitTime = txtWaitSeconds.Text.Trim().ParseToInt(); }));
|
||||
if (waitTime > 0)
|
||||
Thread.Sleep(Randomx.GetId(waitTime * 1000, (waitTime + 10) * 1000));
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row.Cells["colSkuFakeImgUrl"].Value = kjdDbProd.sku_img_replace_url;
|
||||
if (row.Displayed)
|
||||
{
|
||||
string getImgError = "";
|
||||
Image img = GetHtml.GetUrlImg(kjdDbProd.sku_img_replace_url.Replace("https://", "http://"), out getImgError);
|
||||
Image img = GetHtml.GetUrlImg(kjdDbProd.sku_img_replace_url.Replace("https://", "http://"), out getImgError);
|
||||
if (string.IsNullOrEmpty(getImgError))
|
||||
row.Cells["colSkuFakeImg"].Value = img;
|
||||
}
|
||||
@@ -974,7 +968,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
row.Cells["colOpResult"].Value = error + " " + duration.ParseToInt() + "秒";
|
||||
}
|
||||
}));
|
||||
continue;
|
||||
//continue;
|
||||
goto UploadEnd;
|
||||
}
|
||||
prod.status = BaseRegex.GetStringJson(ref result, "status");
|
||||
if (string.IsNullOrWhiteSpace(prod.status))
|
||||
@@ -991,6 +986,15 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
row.Cells["colMsg"].Value = prod.status;
|
||||
}
|
||||
}));
|
||||
|
||||
UploadEnd:;
|
||||
|
||||
//额外等待时间(无论失败与否)
|
||||
var waitTime = 0;
|
||||
Invoke(new Action(() => { waitTime = txtWaitSeconds.Text.Trim().ParseToInt(); }));
|
||||
if (waitTime > 0)
|
||||
Thread.Sleep(Randomx.GetId(waitTime * 1000, (waitTime + 10) * 1000));
|
||||
|
||||
}
|
||||
currentShopList.Remove(randomShop);
|
||||
});
|
||||
@@ -3137,6 +3141,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
|
||||
foreach (var specName in spec0NameLst)
|
||||
{
|
||||
endTime = DateTime.Now;
|
||||
timeSpan = endTime - startTime;
|
||||
duration = timeSpan.TotalSeconds;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
cell.Value = "商品已上传,进行后续操作中" + " " + (spec0NameLst.IndexOf(specName) + 1) + "/" + spec0NameLst.Count + " " + duration.ParseToInt() + "秒";
|
||||
}));
|
||||
|
||||
List<int> signLst = new List<int>() { 20981, 15996, 21365, 22347 };
|
||||
while (signLst.Count > 0)
|
||||
{
|
||||
@@ -3146,7 +3158,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
if (signId == 20981 && sign20981)
|
||||
{
|
||||
var activityRst = activity_goods_info(shop, prodParam.goods_id.ParseToString(), "20981");
|
||||
for (int i = 0; i < 5 && !activityRst.Contains("\"success\":true"); i++)
|
||||
for (int i = 0; i < 2 && !activityRst.Contains("\"success\":true"); i++)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(11200, 11800));
|
||||
activityRst = activity_goods_info(shop, prodParam.goods_id.ParseToString(), "20981");
|
||||
@@ -3156,7 +3168,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
if (signId == 15996 && sign15996)
|
||||
{
|
||||
var activityRst = activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 15996, 18);
|
||||
for (int i = 0; i < 5 && !activityRst.Contains("\"success\":true"); i++)
|
||||
for (int i = 0; i < 2 && !activityRst.Contains("\"success\":true"); i++)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(11200, 11800));
|
||||
activityRst = activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 15996, 18);
|
||||
@@ -3166,7 +3178,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
if (signId == 21365 && sign21365)
|
||||
{
|
||||
var activityRst = activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 21365, 27);
|
||||
for (int i = 0; i < 5 && !activityRst.Contains("\"success\":true"); i++)
|
||||
for (int i = 0; i < 2 && !activityRst.Contains("\"success\":true"); i++)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(11200, 11800));
|
||||
activityRst = activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 21365, 27);
|
||||
@@ -3176,7 +3188,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
if (signId == 22347 && sign22347)
|
||||
{
|
||||
var activityRst = activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 22347, 27);
|
||||
for (int i = 0; i < 5 && !activityRst.Contains("\"success\":true"); i++)
|
||||
for (int i = 0; i < 2 && !activityRst.Contains("\"success\":true"); i++)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(1200, 1800));
|
||||
activityRst = activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 22347, 27);
|
||||
|
||||
Reference in new issue
Block a user