From d70b2eb6a709e7657b500d413b816161ebb2cbdd Mon Sep 17 00:00:00 2001 From: wule_5900x Date: Fri, 2 Jan 2026 18:36:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E4=BC=98=E5=8C=96=E6=8B=BC?= =?UTF-8?q?=E5=A4=9A=E5=A4=9A=E4=B8=8A=E8=B4=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PDDDBProdUserSelectForm.cs | 50 ++++++++++++------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs index 078fc67..2229f5e 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs @@ -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 signLst = new List() { 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);