1temu用户选择商品三个表及数据库id映射draftid分表操作 2拼多多读取商品显示总数 3temu可以修改单店备注

This commit is contained in:
wule committed 2025-12-19 19:47:53 +08:00
1 parent a61b8786d1
commit 4fd2a4d579
47 files changed
+2146 -1042

No files matched your search

@@ -74,6 +74,12 @@ namespace TemuKJD.KJDForms.AdminForms
//dgvShop.Columns["colSubSa"].Visible = false;
//btnSetSubSa.Visible = false;
}
if (BaseClass.SaLevel == 1 && ClientMode == EnumClientMode.Admin)
{
//chkForceRestoreTitle.Visible = true;
}
if (ClientMode != EnumClientMode.Admin)
{
ucSplitPage1.Visible = false;
@@ -1162,6 +1168,22 @@ namespace TemuKJD.KJDForms.AdminForms
return HttpResponseBLL.PostResponse2(shop, url, body, referer);
}
private string editPriceProductNameAndEnNameBatchAdd(ShopLoginInfo shop, string productId)
{
string url = "https://agentseller.temu.com/lich-mms/audit/edit/task/product/batchAdd";
string body = @"{""bizIdType"":1,""bizIds"":[" + productId + @"],""productEditItems"":[{""editItem"":1,""editAdvice"":""优化""},{""editItem"":2,""editAdvice"":""优化""}]}";
string referer = "https://agentseller.temu.com/goods/list?productId=" + productId;
return HttpResponseBLL.PostResponse2(shop, url, body, referer);
}
private string editPriceProductEnNameBatchAdd(ShopLoginInfo shop, string productId)
{
string url = "https://agentseller.temu.com/lich-mms/audit/edit/task/product/batchAdd";
string body = @"{""bizIdType"":1,""bizIds"":[" + productId + @"],""productEditItems"":[{""editItem"":2,""editAdvice"":""优化""}]}";
string referer = "https://agentseller.temu.com/goods/list?productId=" + productId;
return HttpResponseBLL.PostResponse2(shop, url, body, referer);
}
private string editPriceProductName(ShopLoginInfo shop, string taskUid, string productId, string productNewName)
{
string url = "https://agentseller.temu.com/visage-agent-seller/product/edit/task/reply";
@@ -1170,6 +1192,27 @@ namespace TemuKJD.KJDForms.AdminForms
string referer = "https://agentseller.temu.com/goods/edit?from=platform&productId=" + productId + "&taskUid=" + taskUid;
return HttpResponseBLL.PostResponse2(shop, url, body, referer);
}
private string editPriceProductNameAndEnName(ShopLoginInfo shop, string taskUid, string productId, string productNewName)
{
string url = "https://agentseller.temu.com/visage-agent-seller/product/edit/task/reply";
string body = "";
body = @"{""productId"":" + productId + @",""taskUid"":""" + taskUid + @""",""taskVersion"":0,""refuseEdit"":false," +
@"""productName"":""" + productNewName + @""",""productI18nReqs"":[{""productName"":""" + productNewName + @""",""language"":""en""}]}";
string referer = "https://agentseller.temu.com/goods/edit?from=platform&productId=" + productId + "&taskUid=" + taskUid;
return HttpResponseBLL.PostResponse2(shop, url, body, referer);
}
private string editPriceProductEnName(ShopLoginInfo shop, string taskUid, string productId, string productNewName)
{
string url = "https://agentseller.temu.com/visage-agent-seller/product/edit/task/reply";
string body = "";
body = @"{""productId"":" + productId + @",""taskUid"":""" + taskUid + @""",""taskVersion"":0,""refuseEdit"":false," +
@"""productI18nReqs"":[{""productName"":""" + productNewName + @""",""language"":""en""}]}";
string referer = "https://agentseller.temu.com/goods/edit?from=platform&productId=" + productId + "&taskUid=" + taskUid;
return HttpResponseBLL.PostResponse2(shop, url, body, referer);
}
//申请修改 SKU分类和包装清单 体积与重量 商品名称
//{"bizIdType":1,"bizIds":[8942170367],"productEditItems":[{"editItem":4,"editAdvice":"12345"},{"editItem":8,"editAdvice":"54321"},{"editItem":1,"editAdvice":"33333"}]}
@@ -1270,7 +1313,7 @@ namespace TemuKJD.KJDForms.AdminForms
}
var pName = price.productName;
if (CheckRestoreTitleWords(pName))
if (CheckRestoreTitleWords(pName) || chkForceRestoreTitle.Checked)
{
}
else
@@ -1283,16 +1326,44 @@ namespace TemuKJD.KJDForms.AdminForms
continue;
}
var html = editPriceProductNameBatchAdd(shop, price.productId.ParseToString());
var html = "";
var isRestoreEnName = false;
//// 中文标题不为空大概率加了英文标题了,一并还原英文标题
//if (ProductSelectForms.DbProductSelectListManageForm.CountChineseCharacters(pName) <= 0 )
//{
// isRestoreEnName = true;
// //if (chkForceRestoreTitle.Checked) // 强制还原英文标题功能已移除
// // html = editPriceProductEnNameBatchAdd(shop, price.productId.ParseToString());
// //else
// html = editPriceProductNameAndEnNameBatchAdd(shop, price.productId.ParseToString());
//}
if (!isRestoreEnName) // 商品上传时已禁止英文标题头尾词,此处默认只还原商品主标题
{
html = editPriceProductNameBatchAdd(shop, price.productId.ParseToString());
}
//{"success":true,"errorCode":1000000,"errorMsg":null,"result":{"handleFailedList":[{"failedBizId":4432690492,"failedReason":"This product has pending or in-progress modification tasks, cannot initiate again"}],"addFailedList":[{"failedBizId":4432690492,"failedReason":"This product has pending or in-progress modification tasks, cannot initiate again","failedReasonType":8}],"successBizId2TaskUidMap":{}}}
string taskUid = "";
if (html.Contains("This product has pending or in-progress modification tasks"))
{
Invoke(new Action(() =>
var taskHtml = editPriceProductSizeAndNumberTaskQuery(shop, price.productId.ParseToString());
taskUid = BaseRegex.GetStringJson(ref taskHtml, "taskUid");
//if (string.IsNullOrEmpty(taskUid) || !taskHtml.Contains("\"productEditTaskItems\":[{\"editItem\":1,\"editAdvice\":\"优化\"}]"))
if (string.IsNullOrEmpty(taskUid) || !taskHtml.Contains("\"productEditTaskItems\":[{\"editItem\":1,"))
{
foreach (var row in rows)
row.Cells["colMsg"].Value = "已提交过修改任务";
}));
continue;
Invoke(new Action(() =>
{
foreach (var row in rows)
row.Cells["colMsg"].Value = "已提交过修改任务或商品有其他修改任务,请在后店铺台终止任务并稍候重试";
}));
return; //continue;
}
//Invoke(new Action(() =>
//{
// foreach (var row in rows)
// row.Cells["colMsg"].Value = "已提交过修改任务";
//}));
//continue;
}
if (!html.Contains("\"success\":true"))
{
@@ -1319,11 +1390,14 @@ namespace TemuKJD.KJDForms.AdminForms
try
{
JObject jObj = JObject.Parse(html);
var item = jObj["result"]["successBizId2TaskUidMap"].LastOrDefault().LastOrDefault();
if (string.IsNullOrEmpty(taskUid))
{
JObject jObj = JObject.Parse(html);
taskUid = jObj["result"]["successBizId2TaskUidMap"].LastOrDefault().LastOrDefault().ParseToString();
}
// 还原原始标题
var newPName = RestoreProductName(pName);
var newProdName = RestoreProductName(pName, txtReplaceText.Text.Trim());
// 测试修改标题最多字符数量
//while (newPName.Length < 500)
@@ -1331,7 +1405,15 @@ namespace TemuKJD.KJDForms.AdminForms
// newPName += "长";
//}
html = editPriceProductName(shop, item.ParseToString(), price.productId.ParseToString(), newPName);
if (isRestoreEnName)
{
//if (chkForceRestoreTitle.Checked) // 强制还原英文标题功能已移除
// html = editPriceProductEnName(shop, item.ParseToString(), price.productId.ParseToString(), newProdName);
//else
html = editPriceProductNameAndEnName(shop, taskUid, price.productId.ParseToString(), newProdName);
}
else
html = editPriceProductName(shop, taskUid, price.productId.ParseToString(), newProdName);
Thread.Sleep(Randomx.GetId(25, 75));
commonSleep();
if (html.Contains("\"success\":true"))
@@ -1707,10 +1789,10 @@ namespace TemuKJD.KJDForms.AdminForms
bool CheckRestoreTitleWords(string filterProdName)
{
return filterProdName != RestoreProductName(filterProdName);
return filterProdName != RestoreProductName(filterProdName, txtReplaceText.Text.Trim());
}
public static string RestoreProductName(string pName)
public static string RestoreProductName(string pName, string replaceTxt = "")
{
string checkChineseName = pName.Replace("适合不同的搭配风格", "").Replace("个", "").Replace("适合不同的搭配场景", "");
bool containsChinese = Regex.IsMatch(checkChineseName, @"[\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF]");
@@ -1738,6 +1820,9 @@ namespace TemuKJD.KJDForms.AdminForms
newPName = newPName.Replace("适合不同的搭配风格", "Suitable for " + headword + " different matching styles").Trim()
.Replace("适合不同的搭配场景", "Suitable for " + headword + " different matching scenarios").Trim();
}
if (!string.IsNullOrWhiteSpace(replaceTxt))
newPName = newPName.Replace(replaceTxt, "");
return newPName;
}
@@ -1805,7 +1890,7 @@ namespace TemuKJD.KJDForms.AdminForms
Invoke(new Action(() =>
{
foreach (var row in rows)
row.Cells["colMsg"].Value = "已提交过修改任务或商品有其他修改任务";
row.Cells["colMsg"].Value = "已提交过修改任务或商品有其他修改任务,请在后店铺台终止任务并稍候重试";
}));
return; //continue;
}
@@ -1856,7 +1941,7 @@ namespace TemuKJD.KJDForms.AdminForms
Invoke(new Action(() =>
{
foreach (var row in rows)
row.Cells["colMsg"].Value = "已提交过修改任务";
row.Cells["colMsg"].Value = "已提交过修改任务,请在后店铺台终止任务并稍候重试";
}));
return; // continue;
}