1 temu标题长度突破限制 2 pdd提取机会商品支持删除sku
This commit is contained in:
1 parent
5519a53430
commit
9a4ad6cb0e
5 files changed
+96
-28
No files matched your search
@@ -27,7 +27,7 @@ namespace AllBase
|
||||
/// <summary>
|
||||
/// 版本ID
|
||||
/// </summary>
|
||||
public static int VersionCount = 631;
|
||||
public static int VersionCount = 633;
|
||||
//public static int VersionCount = 613;
|
||||
|
||||
/// <summary>
|
||||
|
||||
+18
-3
@@ -145,6 +145,7 @@
|
||||
this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
|
||||
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
|
||||
this.chkLongTitle = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
@@ -184,6 +185,7 @@
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.chkLongTitle);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.chkSameExtcodeRandomMainImg);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.lblSkuRandomLetterNotes);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.btnAdd);
|
||||
@@ -818,7 +820,7 @@
|
||||
"核价成功",
|
||||
"核价成功(重复)",
|
||||
"重复"});
|
||||
this.cmbNotes.Location = new System.Drawing.Point(917, 8);
|
||||
this.cmbNotes.Location = new System.Drawing.Point(917, 5);
|
||||
this.cmbNotes.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.cmbNotes.Name = "cmbNotes";
|
||||
this.cmbNotes.Size = new System.Drawing.Size(65, 25);
|
||||
@@ -843,7 +845,7 @@
|
||||
"已上传",
|
||||
"草稿箱",
|
||||
"全部"});
|
||||
this.cmbStatus.Location = new System.Drawing.Point(814, 8);
|
||||
this.cmbStatus.Location = new System.Drawing.Point(814, 5);
|
||||
this.cmbStatus.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.cmbStatus.Name = "cmbStatus";
|
||||
this.cmbStatus.Size = new System.Drawing.Size(65, 25);
|
||||
@@ -1210,7 +1212,7 @@
|
||||
"全部",
|
||||
"重上",
|
||||
"已买"});
|
||||
this.cmbUserNotes.Location = new System.Drawing.Point(1044, 8);
|
||||
this.cmbUserNotes.Location = new System.Drawing.Point(1044, 5);
|
||||
this.cmbUserNotes.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.cmbUserNotes.Name = "cmbUserNotes";
|
||||
this.cmbUserNotes.Size = new System.Drawing.Size(65, 25);
|
||||
@@ -1683,6 +1685,18 @@
|
||||
this.statusBar.Size = new System.Drawing.Size(1558, 25);
|
||||
this.statusBar.TabIndex = 5;
|
||||
//
|
||||
// chkLongTitle
|
||||
//
|
||||
this.chkLongTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.chkLongTitle.AutoSize = true;
|
||||
this.chkLongTitle.Location = new System.Drawing.Point(1276, 71);
|
||||
this.chkLongTitle.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
|
||||
this.chkLongTitle.Name = "chkLongTitle";
|
||||
this.chkLongTitle.Size = new System.Drawing.Size(96, 21);
|
||||
this.chkLongTitle.TabIndex = 660;
|
||||
this.chkLongTitle.Text = "500字长标题";
|
||||
this.chkLongTitle.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// DbProductSelectListManageForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
@@ -1839,5 +1853,6 @@
|
||||
private UserComponent.UcCheckBox chkSkuRandomLetter;
|
||||
private System.Windows.Forms.Label lblSkuRandomLetterNotes;
|
||||
private UserComponent.UcCheckBox chkSameExtcodeRandomMainImg;
|
||||
private UserComponent.UcCheckBox chkLongTitle;
|
||||
}
|
||||
}
|
||||
@@ -1139,9 +1139,20 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
var allTxt = headWords + dbProd.product_name + centerWords + fissionTxt + "," + endWords;
|
||||
//var allTxt = dbProd.product_name + centerWords + fissionTxt + ",";
|
||||
byte[] bytes = Encoding.GetEncoding("gb2312").GetBytes(allTxt);
|
||||
if (bytes.Length > 250)
|
||||
int titleLength = allTxt.Length;
|
||||
if (chkLongTitle.Checked)
|
||||
{
|
||||
break;
|
||||
if (titleLength > 500)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bytes.Length > 250)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
centerWords += fissionTxt + ",";
|
||||
}
|
||||
|
||||
@@ -190,6 +190,8 @@ namespace TemuKJD
|
||||
//settings.CachePath = null; //禁止缓存
|
||||
//settings.CefCommandLineArgs.Add("enable-javascript", "1");
|
||||
//settings.CefCommandLineArgs.Add("disable-features", "NetworkService,NetworkServiceInProcess");
|
||||
settings.CefCommandLineArgs.Add("--disable-web-security", "1");
|
||||
//settings.CefCommandLineArgs.Add("--disable-request-handling-for-testing", "1");
|
||||
Cef.Initialize(settings);
|
||||
}
|
||||
|
||||
|
||||
@@ -1371,7 +1371,7 @@ function getElementWithText(sText)
|
||||
|
||||
}
|
||||
|
||||
private void btnSendToUpload_Click(object sender, EventArgs e)
|
||||
private async void btnSendToUpload_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (prodUserSelectForm == null)
|
||||
{
|
||||
@@ -1387,26 +1387,55 @@ function getElementWithText(sText)
|
||||
var prodInfoStr = JsonHelper.SerializeObject(jObj["result"]);
|
||||
PDDProductDetailInfo detailInfo = JsonHelper.DeserializeJsonToObject<PDDProductDetailInfo>(prodInfoStr);
|
||||
|
||||
//string jsStr = "function getSkuChange() {" +
|
||||
// " var spec1 = document.getElementsByClassName('property-container-v2 package');" +
|
||||
// " var spec2 = document.getElementsByClassName('goods-spec-row');" +
|
||||
// " if (spec1) return 'success';" +
|
||||
// " if (spec1) return spec1;" +
|
||||
// " else if (spec2) return spec2;" +
|
||||
// " else return document.body;" +
|
||||
// "}" +
|
||||
// "getSkuChange();";
|
||||
string jsStr = "function getSkuChange() {\r\n" +
|
||||
//" var spec1 = window.parent.document.getElementsByClassName('property-container-v2 package');\r\n" +
|
||||
" var spec1 = window.parent.document.getElementsByClassName('property-values-container');\r\n" +
|
||||
" var spec2 = window.parent.document.getElementsByClassName('goods-spec-row');\r\n" +
|
||||
" var rst = '';\r\n" +
|
||||
" if (spec1.length > 0) {\r\n" +
|
||||
" rst += spec1[0].innerHTML + '&&&&SPLIT1&&&&';\r\n" +
|
||||
" for (i = 1; i < spec1.length; i++) {\r\n" +
|
||||
" var chkCheckedLst = spec1[i].getElementsByClassName('CBX_active_5-161-0');\r\n" +
|
||||
" if (chkCheckedLst.length > 0) {\r\n" +
|
||||
" for (j = 0; j < chkCheckedLst.length; j++){\r\n" +
|
||||
" rst += chkCheckedLst[j].innerHTML;\r\n" +
|
||||
" }\r\n" +
|
||||
" rst += '&&&&SPLIT1&&&&';\r\n" +
|
||||
" }\r\n" +
|
||||
" else\r\n" +
|
||||
" rst += spec1[i].innerHTML + '&&&&SPLIT1&&&&';" +
|
||||
" }\r\n" +
|
||||
" return rst;\r\n" +
|
||||
" }\r\n" +
|
||||
" else if (spec2.length > 0) {\r\n" +
|
||||
" for (i = 0; i < spec2.length; i++) {\r\n" +
|
||||
" rst += spec2[i].innerHTML + '&&&&SPLIT2&&&&';" +
|
||||
" }\r\n" +
|
||||
" return rst;\r\n" +
|
||||
" }\r\n" +
|
||||
" else return document.body.innerHTML;\r\n" +
|
||||
"}\r\n" +
|
||||
"getSkuChange();";
|
||||
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
// var t1 = cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
||||
// t1.Wait();
|
||||
|
||||
|
||||
// var t2 = cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync("alert('" + 333 + "');");
|
||||
// t2.Wait(2000);
|
||||
//});
|
||||
//return;
|
||||
string skuHtml = "";
|
||||
// 此处不使用工作台无法正常执行js // cef Request BrowserId : 1 not found it's likely the browser is already closed
|
||||
// 获取页面内sku信息(支持删除sku后抓取商品也删除对应sku)
|
||||
var client = cefWebBrowser.GetDevToolsClient();
|
||||
if (client != null)
|
||||
{
|
||||
var result = await client.Runtime.EvaluateAsync(jsStr, null, true, null, null, true, null, true);
|
||||
if (result != null && result.ExceptionDetails == null)
|
||||
{
|
||||
skuHtml = (result.Result?.Value).ParseToString();
|
||||
}
|
||||
}
|
||||
var skuHtmlLst = skuHtml.Split(new string[] { "&&&&SPLIT1&&&&", "&&&&SPLIT2&&&&" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (skuHtml.Contains("&&&&SPLIT1&&&&"))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
var skuPrice = (this.txtSendPrice.Text.ParseToDecimal() * 100).ParseToInt();
|
||||
foreach (var sku in detailInfo.sku)
|
||||
@@ -1421,12 +1450,23 @@ function getElementWithText(sText)
|
||||
List<sku_item> skuTmpLst = new List<sku_item>();
|
||||
foreach (var sku in detailInfo.sku)
|
||||
{
|
||||
if (1==1)
|
||||
string spec1Name = sku.spec.FirstOrDefault().spec_name;
|
||||
string spec2Name = sku.spec.LastOrDefault().spec_name;
|
||||
if (string.IsNullOrEmpty(skuHtml))
|
||||
{
|
||||
skuTmpLst.Add(sku);
|
||||
}
|
||||
else if ((skuHtmlLst.FirstOrDefault().Contains("value=\"" + spec1Name + "\"") || skuHtmlLst.FirstOrDefault().Contains(">" + spec1Name + "<")) &&
|
||||
(skuHtmlLst.LastOrDefault().Contains("value=\"" + spec2Name + "\"") || skuHtmlLst.LastOrDefault().Contains(">" + spec2Name + "<")))
|
||||
{
|
||||
skuTmpLst.Add(sku);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
detailInfo.sku = skuTmpLst;
|
||||
if (skuTmpLst.Count > 0)
|
||||
detailInfo.sku = skuTmpLst;
|
||||
|
||||
jObj = JObject.Parse(pddSourceGoodsDecorationTemp);
|
||||
var prodDecorationTStr = JsonHelper.SerializeObject(jObj["result"]);
|
||||
|
||||
Reference in new issue
Block a user