其他平台买手拍单发送功能 店铺筛选功能逻辑优化
This commit is contained in:
1 parent
2dece676c1
commit
aa45b35145
46 files changed
+4038
-2223
No files matched your search
@@ -43,6 +43,7 @@ namespace TemuKJD.ToolForms
|
||||
int filterMonthSaleCount = 100;
|
||||
int filterTotalSaleCount = 500;
|
||||
int searchPageCount = 0;
|
||||
int noNextPageRetryTimes = 50;
|
||||
|
||||
public WXSaleAssistantForm()
|
||||
{
|
||||
@@ -425,6 +426,8 @@ namespace TemuKJD.ToolForms
|
||||
pbLoading.Visible = true;
|
||||
Task.Run(() =>
|
||||
{
|
||||
var rowLst = dgvProduct.Rows.Cast<DataGridViewRow>().ToList();
|
||||
rowLst.Reverse();
|
||||
foreach (DataGridViewRow row in dgvProduct.Rows)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
@@ -559,7 +562,7 @@ namespace TemuKJD.ToolForms
|
||||
var cookieShop = new ShopLoginInfo();
|
||||
cookieShop.Cookies = JsonHelper.SerializeObject(cookieList);
|
||||
getSpuItemsParams["pageContext"]["pageContext"] = pageContext;
|
||||
getSpuItemsParams["requestContext"]["requestId"] = requestId;
|
||||
getSpuItemsParams["requestContext"]["requestId"] = BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now).ToString(); // requestId;
|
||||
foreach (var item in spuItemsBase)
|
||||
{
|
||||
JObject jObjDisplaySpu = new JObject();
|
||||
@@ -569,8 +572,9 @@ namespace TemuKJD.ToolForms
|
||||
|
||||
//{"code":0,"pageContextResp":{"hasNext":false},"requestId":"1778688044492"}
|
||||
int errorCnt = 0;
|
||||
int nomoreCnt = 0;
|
||||
var spuItemsData = GetAssistant.wxGetAssistant(cookieShop, getSpuItemsParams);
|
||||
for (int i = 1; i <= 50; i++) // 重试50次
|
||||
for (int i = 1; i <= noNextPageRetryTimes; i++) // 重试50次
|
||||
{
|
||||
if (!spuItemsData.Contains("\"code\":0") || spuItemsData.Contains("\"hasNext\":false"))
|
||||
{
|
||||
@@ -579,6 +583,28 @@ namespace TemuKJD.ToolForms
|
||||
if (errorCnt > 5)
|
||||
break;
|
||||
|
||||
if (spuItemsData.Contains("\"hasNext\":false"))
|
||||
nomoreCnt++;
|
||||
|
||||
if (nomoreCnt > 7)
|
||||
{
|
||||
}
|
||||
else if (nomoreCnt > 6)
|
||||
{
|
||||
}
|
||||
else if (nomoreCnt > 5)
|
||||
{
|
||||
}
|
||||
else if (nomoreCnt > 4)
|
||||
{
|
||||
}
|
||||
else if (nomoreCnt > 3)
|
||||
{
|
||||
}
|
||||
else if (nomoreCnt > 2)
|
||||
{
|
||||
}
|
||||
|
||||
sleepTime = (int)(getDetailWaitSeconds * 1000) - 100 + Randomx.GetId(101, 501);
|
||||
Thread.Sleep(Math.Max(100, sleepTime));
|
||||
|
||||
@@ -586,8 +612,8 @@ namespace TemuKJD.ToolForms
|
||||
}
|
||||
if (i % 10 == 0 && spuItemsData.Contains("\"hasNext\":false"))
|
||||
{
|
||||
if (BaseMsgForm.ShowConfirm("已连续" + i + "次未查询到下一页商品,是否继续?").DialogResult != DialogResult.OK)
|
||||
break;
|
||||
//if (BaseMsgForm.ShowConfirm("已连续" + i + "次未查询到下一页商品,是否继续?").DialogResult != DialogResult.OK)
|
||||
// break;
|
||||
}
|
||||
}
|
||||
if (!spuItemsData.Contains("\"code\":0"))
|
||||
@@ -671,6 +697,17 @@ namespace TemuKJD.ToolForms
|
||||
}
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_sale_assistant_list_" + MainForm.ProcessCount, lstWxSaleAssistantSpuItemInfo);
|
||||
}
|
||||
|
||||
private void txtRetryTimes_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
noNextPageRetryTimes = Math.Max(20, txtRetryTimes.Text.ParseToInt());
|
||||
}
|
||||
|
||||
private void btnReload_Click(object sender, EventArgs e)
|
||||
{
|
||||
CEFBrowser.DeleteCookie(cefWebBrowser.GetCookieManager(null));
|
||||
cefWebBrowser.Load(InitUrl);
|
||||
}
|
||||
}
|
||||
|
||||
public class WXSaleAssistantSpuItemInfo
|
||||
|
||||
Reference in new issue
Block a user