diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs
index c515f7b..44d07a6 100644
--- a/AllBase/BaseClass.cs
+++ b/AllBase/BaseClass.cs
@@ -27,7 +27,7 @@ namespace AllBase
///
/// 版本ID
///
- public static int VersionCount = 999;
+ public static int VersionCount = 1002;
//public static int VersionCount = 613;
///
diff --git a/AllBase/Model/Result/PDDResult/PDDProductInfo.cs b/AllBase/Model/Result/PDDResult/PDDProductInfo.cs
index 29cccd8..9400596 100644
--- a/AllBase/Model/Result/PDDResult/PDDProductInfo.cs
+++ b/AllBase/Model/Result/PDDResult/PDDProductInfo.cs
@@ -29,5 +29,11 @@ namespace AllBase.Model.Result.PDDResult
public string chance_id { get; set; }
public string chance_refere { get; set; } // 记录机会商品提交的refere
public string chance_tab { get; set; } // 记录机会商品提交的tab
+
+
+
+
+ // 报名活动批量记录运费
+ public int ship_price { get; set; } = 0;
}
}
diff --git a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs
index ee0ea67..486f7bb 100644
--- a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs
+++ b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs
@@ -1107,7 +1107,8 @@ namespace KJD_Web.BLL.BXX
}
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
- int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
+ int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(200);
+ var product_get_type = RegexUtils.GetStringQuery(ref inputData, "product_get_type")?.Replace("'", "\\'");
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
@@ -1115,6 +1116,8 @@ namespace KJD_Web.BLL.BXX
string sql = "SELECT DISTINCT p.group FROM `bxx`.`product` p where p.is_del=0";
string where = "";
+ if (!string.IsNullOrEmpty(product_get_type))
+ where += " and p.product_get_type ='" + product_get_type + "'";
sql += where;
var dt = mySql.ExecuteDataTable(sql);
diff --git a/TEMUKJD/KJD.csproj.user b/TEMUKJD/KJD.csproj.user
index 7a74901..10da63c 100644
--- a/TEMUKJD/KJD.csproj.user
+++ b/TEMUKJD/KJD.csproj.user
@@ -11,4 +11,7 @@
zh-CN
false
+
+ false
+
\ No newline at end of file
diff --git a/TEMUKJD/PDDForms/ProductForms/ActivityForms/PDDAddActivityForm.Designer.cs b/TEMUKJD/PDDForms/ProductForms/ActivityForms/PDDAddActivityForm.Designer.cs
index 60bb4c0..be669ca 100644
--- a/TEMUKJD/PDDForms/ProductForms/ActivityForms/PDDAddActivityForm.Designer.cs
+++ b/TEMUKJD/PDDForms/ProductForms/ActivityForms/PDDAddActivityForm.Designer.cs
@@ -32,16 +32,17 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
+ this.chkLowPrice = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.label6 = new System.Windows.Forms.Label();
this.txtMultiCnt = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
@@ -136,7 +137,6 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
this.btnClear = new DevComponents.DotNetBar.PanelEx();
this.panelEx1 = new DevComponents.DotNetBar.PanelEx();
this.panel1 = new System.Windows.Forms.Panel();
- this.chkLowPrice = new TemuKJD.UserComponent.UcCheckBox(this.components);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -233,6 +233,18 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
this.ucGroupBoxEx2.TabStop = false;
this.ucGroupBoxEx2.Text = "活动价格配置";
//
+ // chkLowPrice
+ //
+ this.chkLowPrice.AutoSize = true;
+ this.chkLowPrice.Checked = true;
+ this.chkLowPrice.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.chkLowPrice.Location = new System.Drawing.Point(662, 90);
+ this.chkLowPrice.Name = "chkLowPrice";
+ this.chkLowPrice.Size = new System.Drawing.Size(71, 21);
+ this.chkLowPrice.TabIndex = 914;
+ this.chkLowPrice.Text = "低价sku";
+ this.chkLowPrice.UseVisualStyleBackColor = true;
+ //
// label6
//
this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@@ -283,7 +295,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
this.txtSleepTime.Name = "txtSleepTime";
this.txtSleepTime.Size = new System.Drawing.Size(38, 23);
this.txtSleepTime.TabIndex = 891;
- this.txtSleepTime.Text = "5";
+ this.txtSleepTime.Text = "1";
this.txtSleepTime.TextChanged += new System.EventHandler(this.txtSleepTime_TextChanged);
//
// chk23456
@@ -1041,19 +1053,19 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
this.dgvShop.AllowUserToAddRows = false;
this.dgvShop.AllowUserToDeleteRows = false;
- dataGridViewCellStyle9.BackColor = System.Drawing.Color.WhiteSmoke;
- this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9;
+ dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
+ this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgvShop.AutoRowNumber = true;
this.dgvShop.BackgroundColor = System.Drawing.Color.White;
this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
- dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control;
- dataGridViewCellStyle10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText;
- dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
- this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10;
+ dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+ dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
+ dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
+ dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+ dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+ dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
+ this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colSelect,
@@ -1258,19 +1270,19 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
this.dgvActProduct.AllowUserToAddRows = false;
this.dgvActProduct.AllowUserToDeleteRows = false;
- dataGridViewCellStyle11.BackColor = System.Drawing.Color.WhiteSmoke;
- this.dgvActProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11;
+ dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke;
+ this.dgvActProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
this.dgvActProduct.AutoRowNumber = true;
this.dgvActProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvActProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
- dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control;
- dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText;
- dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
- this.dgvActProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12;
+ dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+ dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
+ dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
+ dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+ dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+ dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
+ this.dgvActProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.dgvActProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvActProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
@@ -1319,8 +1331,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
// colSupplierName
//
- dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle13;
+ dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle5;
this.colSupplierName.Frozen = true;
this.colSupplierName.HeaderText = "店铺名称";
this.colSupplierName.Name = "colSupplierName";
@@ -1375,8 +1387,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
// colProductName
//
- dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.colProductName.DefaultCellStyle = dataGridViewCellStyle14;
+ dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.colProductName.DefaultCellStyle = dataGridViewCellStyle6;
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
@@ -1403,8 +1415,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
// colUpdateTime
//
- dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.colUpdateTime.DefaultCellStyle = dataGridViewCellStyle15;
+ dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.colUpdateTime.DefaultCellStyle = dataGridViewCellStyle7;
this.colUpdateTime.FillWeight = 80F;
this.colUpdateTime.HeaderText = "上架时间";
this.colUpdateTime.Name = "colUpdateTime";
@@ -1420,8 +1432,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
// colOpResult
//
- dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.colOpResult.DefaultCellStyle = dataGridViewCellStyle16;
+ dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.colOpResult.DefaultCellStyle = dataGridViewCellStyle8;
this.colOpResult.HeaderText = "操作结果";
this.colOpResult.Name = "colOpResult";
this.colOpResult.ReadOnly = true;
@@ -1518,18 +1530,6 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
this.panel1.TabIndex = 189;
this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
//
- // chkLowPrice
- //
- this.chkLowPrice.AutoSize = true;
- this.chkLowPrice.Checked = true;
- this.chkLowPrice.CheckState = System.Windows.Forms.CheckState.Checked;
- this.chkLowPrice.Location = new System.Drawing.Point(662, 90);
- this.chkLowPrice.Name = "chkLowPrice";
- this.chkLowPrice.Size = new System.Drawing.Size(71, 21);
- this.chkLowPrice.TabIndex = 914;
- this.chkLowPrice.Text = "低价sku";
- this.chkLowPrice.UseVisualStyleBackColor = true;
- //
// PDDAddActivityForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
diff --git a/TEMUKJD/PDDForms/ProductForms/ActivityForms/PDDAddActivityForm.cs b/TEMUKJD/PDDForms/ProductForms/ActivityForms/PDDAddActivityForm.cs
index 894fedb..d64f72a 100644
--- a/TEMUKJD/PDDForms/ProductForms/ActivityForms/PDDAddActivityForm.cs
+++ b/TEMUKJD/PDDForms/ProductForms/ActivityForms/PDDAddActivityForm.cs
@@ -2973,6 +2973,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
}));
continue;
}
+ prodInfo.ship_price = shipPrice;
}
#endregion
@@ -3257,25 +3258,33 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
}));
var lowPrice = prodParam.skus.Where(s => s.sku69_code != "yes" && s.quantity_delta != 0).ToList().Min(s => s.multi_price);
- var skuTmp = prodParam.skus.Where(s => s.sku69_code != "yes" && s.quantity_delta != 0).ToList().FirstOrDefault(s => s.multi_price == lowPrice);
- var skuTmpLst = prodParam.skus.Where(s => s.spec[0].spec_id == skuTmp.spec[0].spec_id && s.multi_price == lowPrice).ToList();
+ //var skuTmp = prodParam.skus.Where(s => s.sku69_code != "yes" && s.quantity_delta != 0).ToList().FirstOrDefault(s => s.multi_price == lowPrice);
+ //var skuTmpLst = prodParam.skus.Where(s => s.spec[0].spec_id == skuTmp.spec[0].spec_id && s.multi_price == lowPrice).ToList();
+ var skuTmpLst = prodParam.skus.Where(s => s.multi_price == lowPrice).ToList();
+ var prodInfo = lstActListProdInfo.FirstOrDefault(a => a.goods_id == prodParam.goods_id).productInfo;
+ var skuInfos = prodInfo.detail.sku.Where(s => skuTmpLst.Any(st => st.out_sku_sn == s.out_sku_sn)).ToList();
+ //var newMultiPrice = skuInfos.Max(s => s.multi_price) + (prodInfo.ship_price * defaultAddPriceRule.AddShippingFeeTimes).ParseToInt();
+ var newMultiPrice = skuInfos.Max(s => s.multi_price) + prodInfo.ship_price;
PddEditProdStockQuantity prodQuantity = new PddEditProdStockQuantity();
prodQuantity.data = new List();
+ int index = 1;
foreach (var sku in skuTmpLst)
{
+ // 相同低价商品,只有一个设置1个库存,其他0库存
prodQuantity.data.Add(new quantityData()
{
beforeQuantity = sku.quantity_delta,
goodsId = prodParam.goods_id,
- quantity = -sku.quantity_delta + 1,
+ quantity = -sku.quantity_delta + (index == 1 ? 1 : 0),
skuId = sku.sku_id,
});
+ index++;
- var prodInfo = lstActListProdInfo.FirstOrDefault(a => a.goods_id == prodParam.goods_id).productInfo;
- var skuInfo = prodInfo.detail.sku.FirstOrDefault(s => s.out_sku_sn == sku.out_sku_sn);
- if (skuInfo != null)
- sku.multi_price = skuInfo.multi_price;
+ //var skuInfo = prodInfo.detail.sku.FirstOrDefault(s => s.out_sku_sn == sku.out_sku_sn);
+ //if (skuInfo != null)
+ // sku.multi_price = skuInfo.multi_price;
+ sku.multi_price = newMultiPrice;
}
var mdyQuantityRst = increase_prod_stock_quantity(shop, prodQuantity);
@@ -3283,8 +3292,10 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
{
Thread.Sleep(Randomx.GetId(500, 1500));
mdyQuantityRst = increase_prod_stock_quantity(shop, prodQuantity);
+ if (mdyQuantityRst.Contains("\"errorMsg\":\"库存未修改\""))
+ break;
}
- if (!mdyQuantityRst.Contains("\"success\":true"))
+ if (!mdyQuantityRst.Contains("\"success\":true") && !mdyQuantityRst.Contains("\"errorMsg\":\"库存未修改\""))
{
goodsIds.Add(prodParam.goods_id);
var error = BaseRegex.GetStringJson(ref mdyQuantityRst, "error_msg");
@@ -3299,6 +3310,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
continue;
}
}
+ // 移除修改库存失败的商品
+ prodParamLst.RemoveAll(p => goodsIds.Contains(p.goods_id));
}
string activityRsts = SignActivity(shop, prodParamLst, sign22347, sign20981, sign21365, sign15996, sign23513, sign23730, sign23456);
@@ -3429,7 +3442,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
}
}
- public decimal moreSleepTime = 5;
+ public decimal moreSleepTime = 1;
private void txtSleepTime_TextChanged(object sender, EventArgs e)
{
moreSleepTime = txtSleepTime.Text.Trim().ParseToDecimal();
diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs
index a4f18d9..c18382e 100644
--- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs
+++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs
@@ -777,15 +777,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
GetPDDProductGroup(new List { cmbGroup, cmbGroupFilter, });
}
- public static void GetPDDProductGroup(ComboBox box)
+ public static void GetPDDProductGroup(ComboBox box, string get_type = "")
{
- GetPDDProductGroup(new List { box });
+ GetPDDProductGroup(new List { box }, get_type);
}
- public static void GetPDDProductGroup(List boxs)
+ public static void GetPDDProductGroup(List boxs, string get_type = "")
{
var url = BaseClass.BuildPDDObjString("product/get_product_groups");
var data = UserLogin.GetSignaturex();
+ if (!string.IsNullOrWhiteSpace(get_type))
+ data += "&product_get_type=" + get_type;
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs
index 6be7d43..ab38fd0 100644
--- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs
+++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs
@@ -6812,7 +6812,7 @@ Content-Type: image/jpeg
//pddApi.Data["ignore_edit_warn"] = false;
pddApi.Data["image_url"] = prodRstObj["image_url"];
pddApi.Data["invoice_status"] = prodRstObj["invoice_status"];
- pddApi.Data["is_customs"] = prodRstObj["is_customs"].ParseToInt() == 1;
+ pddApi.Data["is_customs"] = prodRstObj["is_customs"].ParseToBool(); // prodRstObj["is_customs"].ParseToInt() == 1;
pddApi.Data["is_folt"] = prodRstObj["is_folt"].ParseToInt() == 1; //是否支持假一赔十,false-不支持,true-支持
pddApi.Data["is_group_pre_sale"] = prodRstObj["is_group_pre_sale"];
pddApi.Data["is_pre_sale"] = prodRstObj["is_pre_sale"].ParseToInt() == 1;
@@ -7682,7 +7682,7 @@ Content-Type: image/jpeg
List addPriceFakeSkuInfoLst = new List();
Dictionary skuFakeSpecNameDic1 = new Dictionary();
Dictionary skuFakeSpecNameDic2 = new Dictionary();
- int marketPriceFake = prodInfo.detail.market_price.ParseToInt();
+ int marketPriceFake = 0; // prodInfo.detail.market_price.ParseToInt();
{
var maxPrice1 = 0;
foreach (var sku in prodInfo.detail.sku)
@@ -7708,9 +7708,9 @@ Content-Type: image/jpeg
skuInfo.multi_price = ((new_multi_price + this.txtAddMorePrice.Text.Trim().ParseToDecimal() * 100) * this.txtAddTimesFake.Text.Trim().ParseToDecimal()).ParseToInt();
skuInfo.price = skuInfo.multi_price + Math.Max(100, this.txtSinglePriceAdd.Text.Trim().ParseToDecimal() * 100).ParseToInt();
- if (marketPriceFake < skuInfo.price + 1000)
+ if (marketPriceFake < skuInfo.price.ParseToInt() * 2)
{
- marketPriceFake = skuInfo.price.ParseToInt() + 1000;
+ marketPriceFake = skuInfo.price.ParseToInt() * 2;
//pddApi.Data["market_price"] = marketPriceFake;
}
@@ -7778,7 +7778,7 @@ Content-Type: image/jpeg
#region 生成一组正常加价后的sku
List addPriceSkuInfoLst = new List();
- int marketPrice = prodInfo.detail.market_price.ParseToInt();
+ int marketPrice = 0; // prodInfo.detail.market_price.ParseToInt();
{
foreach (var sku in prodInfo.detail.sku)
{
@@ -7919,27 +7919,31 @@ Content-Type: image/jpeg
#endregion
- spec_item multiPcsSkuSpec = null; // multiPcsSkuSpec
+ //spec_item multiPcsSkuSpec = null; // multiPcsSkuSpec
if (chkMultiPcsSku.Checked)
{
#region // 添加一个多件sku
- //申请skuSpec
+ // 申请skuSpec
var multiPcsSku = JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(addPriceSkuInfoLst.OrderByDescending(s => s.multi_price).FirstOrDefault()));
+ // 双规格有多个sku
+ var multiPcsSkus = JsonHelper.DeserializeJsonToList(JsonHelper.SerializeObject(addPriceSkuInfoLst.Where(s => s.spec[0].spec_name == multiPcsSku.spec[0].spec_name).ToList()));
+
int min = txtMultiPcsSku1.Text.Trim().ParseToInt();
int max = txtMultiPcsSku2.Text.Trim().ParseToInt() + 1;
if (max <= min)
max = min + 1;
- var oldSpec = multiPcsSku.spec[0];
- if (skuFakeSpecNameDic1.Values.Contains(oldSpec.spec_name))
- oldSpec.spec_name = skuFakeSpecNameDic1.FirstOrDefault(s => s.Value == oldSpec.spec_name).Key;
- multiPcsSku.spec[0].spec_name = oldSpec.spec_name + Randomx.GetId(min, max) + txtMultiPcsSku3.Text.Trim();
- multiPcsSkuSpec = multiPcsSku.spec[0];
+ var multiPcsSpec1 = JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(multiPcsSku.spec[0]));
+ var oldSpecName1 = multiPcsSpec1.spec_name;
+ if (skuFakeSpecNameDic1.Values.Contains(oldSpecName1))
+ oldSpecName1 = skuFakeSpecNameDic1.FirstOrDefault(s => s.Value == oldSpecName1).Key;
+ var newSpecName1 = oldSpecName1 + Randomx.GetId(min, max) + txtMultiPcsSku3.Text.Trim();
+ multiPcsSku.spec[0].spec_name = newSpecName1;
if (1 == 1)
{
PddApi PddGoodsSpecIdGetApi = new PddApi(shop);
- PddGoodsSpecIdGetApi.Data["parent_spec_id"] = multiPcsSkuSpec.parent_id;
- PddGoodsSpecIdGetApi.Data["spec_name"] = multiPcsSkuSpec.spec_name;
+ PddGoodsSpecIdGetApi.Data["parent_spec_id"] = multiPcsSku.spec[0].parent_id;
+ PddGoodsSpecIdGetApi.Data["spec_name"] = multiPcsSku.spec[0].spec_name;
var PddGoodsSpecIdGetApiRst = PddGoodsSpecIdGetApi.PddGoodsSpecIdGet();
if (!PddGoodsSpecIdGetApiRst.Contains("\"goods_spec_id_get_response\""))
{
@@ -7948,57 +7952,58 @@ Content-Type: image/jpeg
errMsg = PddGoodsSpecIdGetApiRst;
return "设置多件Sku失败 " + errMsg;
}
- multiPcsSkuSpec.spec_id = BaseRegex.GetLongJson(ref PddGoodsSpecIdGetApiRst, "spec_id");
+ multiPcsSku.spec[0].spec_id = BaseRegex.GetLongJson(ref PddGoodsSpecIdGetApiRst, "spec_id");
- List first_spec_lst = new List();
- List second_spec_lst = new List();
- List new_sku_lst = new List();
- foreach (var sku in addPriceSkuInfoLst)
+ //List first_spec_lst = new List();
+ //List second_spec_lst = new List();
+ //List new_sku_lst = new List();
+ //foreach (var sku in addPriceSkuInfoLst)
+ //{
+ // if (sku.spec.Count > 0)
+ // {
+ // if (sku.spec[0].parent_id != multiPcsSkuSpec.parent_id && !first_spec_lst.Any(s => s.spec_id == sku.spec[0].spec_id))
+ // {
+ // first_spec_lst.Add(sku.spec[0]);
+ // new_sku_lst.Add(JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(sku)));
+ // }
+ // }
+ // if (sku.spec.Count > 1)
+ // {
+ // if (sku.spec[1].parent_id != multiPcsSkuSpec.parent_id && !second_spec_lst.Any(s => s.spec_id == sku.spec[1].spec_id))
+ // {
+ // second_spec_lst.Add(sku.spec[1]);
+ // new_sku_lst.Add(JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(sku)));
+ // }
+ // }
+ //}
+ //if (new_sku_lst.Count == 0)
+ //{
+ // new_sku_lst.Add(JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(addPriceSkuInfoLst.LastOrDefault())));
+ //}
+ //var maxMultiPcsSkuBasePrice = addPriceSkuInfoLst.Max(s => s.multi_price);
+ foreach (var sku in multiPcsSkus)
{
- if (sku.spec.Count > 0)
- {
- if (sku.spec[0].parent_id != multiPcsSkuSpec.parent_id && !first_spec_lst.Any(s => s.spec_id == sku.spec[0].spec_id))
- {
- first_spec_lst.Add(sku.spec[0]);
- new_sku_lst.Add(JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(sku)));
- }
- }
- if (sku.spec.Count > 1)
- {
- if (sku.spec[1].parent_id != multiPcsSkuSpec.parent_id && !second_spec_lst.Any(s => s.spec_id == sku.spec[1].spec_id))
- {
- second_spec_lst.Add(sku.spec[1]);
- new_sku_lst.Add(JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(sku)));
- }
- }
- }
- if (new_sku_lst.Count == 0)
- {
- new_sku_lst.Add(JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(addPriceSkuInfoLst.LastOrDefault())));
- }
- var maxMultiPcsSkuBasePrice = addPriceSkuInfoLst.Max(s => s.multi_price);
- foreach (var sku in new_sku_lst)
- {
- if (sku.spec.Count > 0 && sku.spec[0].parent_id == multiPcsSkuSpec.parent_id)
- {
- sku.spec[0] = JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(multiPcsSkuSpec));
- }
- else if (sku.spec.Count > 1 && sku.spec[1].parent_id == multiPcsSkuSpec.parent_id)
- {
- sku.spec[1] = JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(multiPcsSkuSpec));
- }
- sku.thumb_url = multiPcsSku.thumb_url;
- sku.thumb_url_file_id = null;
- sku.multi_price = (maxMultiPcsSkuBasePrice * txtMultiPcsSku4.Text.ParseToDecimal()).ParseToInt();
+ //if (sku.spec.Count > 0 && sku.spec[0].parent_id == multiPcsSkuSpec.parent_id)
+ //{
+ // sku.spec[0] = JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(multiPcsSkuSpec));
+ //}
+ //else if (sku.spec.Count > 1 && sku.spec[1].parent_id == multiPcsSkuSpec.parent_id)
+ //{
+ // sku.spec[1] = JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(multiPcsSkuSpec));
+ //}
+ //sku.thumb_url = multiPcsSku.thumb_url; // 反序列化时已获得
+ //sku.thumb_url_file_id = null;
+ sku.spec[0].spec_id = multiPcsSku.spec[0].spec_id;
+ sku.spec[0].spec_name = multiPcsSku.spec[0].spec_name;
+ sku.multi_price = (sku.multi_price * txtMultiPcsSku4.Text.ParseToDecimal()).ParseToInt();
sku.price = sku.multi_price + Math.Max(100, this.txtSinglePriceAdd.Text.Trim().ParseToDecimal() * 100).ParseToInt();
- sku.quantity_delta = 0;
+ sku.quantity_delta = 0; // 库存设置为0防止出单
sku.quantity = 0;
addPriceSkuInfoLst.Add(sku);
if (marketPrice < sku.price * 2)
{
marketPrice = sku.price.ParseToInt() * 2;
- //pddApi.Data["market_price"] = marketPrice;
}
}
}
@@ -8980,26 +8985,6 @@ Content-Type: image/jpeg
if (cancellationTokenSource != null)
cancellationTokenSource.Cancel();
cancellationTokenSource = new CancellationTokenSource();
- //Task.Run(() =>
- //{
- // try
- // {
- // GetShopAndUpProduct(cancellationTokenSource.Token);
- // }
- // catch (Exception ex)
- // {
- // BaseMsgForm.ShowError("店铺商品上传分配错误:" + ex.Message);
- // }
- // Invoke(new Action(() =>
- // {
- // if (!cancellationTokenSource.IsCancellationRequested)
- // BaseMsgForm.ShowConfirm("上传完成");
- // else
- // BaseMsgForm.ShowConfirm("上传停止");
- // this.btnUpload.Enabled = true;
- // }));
- //}, cancellationTokenSource.Token);
-
Task.Run(() =>
{
AddProductByChanceImg(shopIdLst);
@@ -9217,10 +9202,10 @@ Content-Type: image/jpeg
continue;
}
- // 获取token
+ // 获取token 纯cef操作不需要
//GetToken(shop);
- // 上传商品
+ // 上传商品 每次关闭上次的cef初始化一个新的cef
InitShopCef(shop);
bool finish = false;
var t = Task.Run(() =>
@@ -9236,8 +9221,9 @@ Content-Type: image/jpeg
{
this.panel2.SendToBack();
}));
- Thread.Sleep(Randomx.GetId(60000, 90000));
+ Thread.Sleep(Randomx.GetId(6000, 9000));
+ // 显示sku替换图
Invoke(new Action(() =>
{
//if (chkActivity.Checked)
@@ -9401,9 +9387,12 @@ Content-Type: image/jpeg
}
//Dictionary dicShopCef = new Dictionary();
+ public static bool isCopyImage = false;
string CefUploadProduct(ShopLoginInfo shop, KJDDBProduct dbProd, TemuDBProductSelect selectProd, DataGridViewCell cell, DateTime startTime)
{
+ // 将当前商品id初始化为空
shop.CurrentProdId = "";
+
#region 将聚水潭产品数据格式进行转换成pdd格式统一上传,匹配加密的spuCode和skuCoke
if (dbProd.product_get_type_text == "厂商直采" && dbProd.sku_secret_json != null && dbProd.sku_secret_json.Contains("goodsId"))
{
@@ -9464,8 +9453,8 @@ Content-Type: image/jpeg
Invoke(new Action(() =>
{
- panel2.BringToFront();
- cefWebBrowser.BringToFront();
+ //panel2.BringToFront();
+ //cefWebBrowser.BringToFront();
}));
Thread.Sleep(Randomx.GetId(1000, 1500));
@@ -9481,6 +9470,11 @@ Content-Type: image/jpeg
//t.Wait(5000);
}
+ Invoke(new Action(() =>
+ {
+ if (cell != null)
+ cell.Value = "正在查询以图搜款商品";
+ }));
// 加载机会商品页面
cefWebBrowser.Load("https://mms.pinduoduo.com/goods/goods_list/chance?sourcePage=goodsListTopButton");
while (cefWebBrowser.IsLoading || !cefWebBrowser.GetMainFrame().IsValid)
@@ -9491,7 +9485,7 @@ Content-Type: image/jpeg
var client = cefWebBrowser.GetDevToolsClient();
if (host == null || client == null)
{
- return "设置图片失败 以图搜款网页打开失败";
+ return "商品发布失败 设置图片页面打开失败";
}
// 点击图片搜索图标
@@ -9509,20 +9503,31 @@ Content-Type: image/jpeg
Thread.Sleep(Randomx.GetId(1500, 3000));
// ctrl + v 复制图片
- string getImgError;
- var image = GetHtml.GetUrlImg(dbProd.main_img.Replace("https://", "http://"), out getImgError);
- if (!string.IsNullOrEmpty(getImgError) || image == null)
+ while (isCopyImage)
{
- return "设置图片失败 图片上传失败";
+ Thread.Sleep(500);
}
- var bitMap = new Bitmap(image.Width, image.Height);
- using (Graphics g = Graphics.FromImage(bitMap))
+ isCopyImage = true;
+ try
{
- g.DrawImage(image, new Rectangle(0, 0, bitMap.Width, bitMap.Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
- }
- Invoke(new Action(() => { Clipboard.SetImage(bitMap); }));
+ string getImgError;
+ var image = GetHtml.GetUrlImg(dbProd.main_img.Replace("https://", "http://"), out getImgError);
+ if (!string.IsNullOrEmpty(getImgError) || image == null)
+ {
+ isCopyImage = false;
+ return "商品发布失败 上传图片获取失败";
+ }
+ var bitMap = new Bitmap(image.Width, image.Height);
+ using (Graphics g = Graphics.FromImage(bitMap))
+ {
+ g.DrawImage(image, new Rectangle(0, 0, bitMap.Width, bitMap.Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
+ }
+ Invoke(new Action(() => { Clipboard.SetImage(bitMap); }));
- host.SendKeyEvent(new CefSharp.KeyEvent() { WindowsKeyCode = 86, Type = KeyEventType.RawKeyDown, Modifiers = CefEventFlags.ControlDown });
+ host.SendKeyEvent(new CefSharp.KeyEvent() { WindowsKeyCode = 86, Type = KeyEventType.RawKeyDown, Modifiers = CefEventFlags.ControlDown });
+ }
+ catch { }
+ isCopyImage = false;
Thread.Sleep(Randomx.GetId(4000, 6000));
// 点击搜索按钮
@@ -9543,10 +9548,15 @@ Content-Type: image/jpeg
ts2.Wait(5000);
if ((ts2.Result?.Result?.Value).ParseToString().IsNullOrEmpty())
{
- return "设置图片失败 图片脚本搜索失败";
+ return "商品发布失败 图片查询失败";
}
Thread.Sleep(Randomx.GetId(7000, 10000));
+ Invoke(new Action(() =>
+ {
+ if (cell != null)
+ cell.Value = "正在初始化以图搜款商品信息";
+ }));
// 点击发布同款
var jsStr3 = @"(function() {
var spanElements = document.getElementsByTagName('span');
@@ -9565,14 +9575,21 @@ Content-Type: image/jpeg
ts3.Wait(5000);
if ((ts3.Result?.Result?.Value).ParseToString().IsNullOrEmpty())
{
- return "设置图片失败 商品发布失败";
+ return "商品发布失败 同款发布失败";
}
Thread.Sleep(Randomx.GetId(7000, 10000));
-
- host.SendMouseClickEvent(50, 50, MouseButtonType.Left, false, 1, CefEventFlags.None);
+ Invoke(new Action(() =>
+ {
+ if (cell != null)
+ cell.Value = "正在设置以图搜款商品详情";
+ }));
+ // 点一下获取焦点
+ int randomX = Randomx.GetId(50, 500);
+ int randomY = Randomx.GetId(20, 300);
+ host.SendMouseClickEvent(randomX, randomY, MouseButtonType.Left, false, 1, CefEventFlags.None);
Thread.Sleep(Randomx.GetId(100, 300));
- host.SendMouseClickEvent(50, 50, MouseButtonType.Left, true, 1, CefEventFlags.None);
+ host.SendMouseClickEvent(randomX, randomY, MouseButtonType.Left, true, 1, CefEventFlags.None);
Thread.Sleep(Randomx.GetId(1000, 2000));
// 点击知道了
var jsStr4 = @"(function() {
@@ -9589,9 +9606,143 @@ Content-Type: image/jpeg
})();";
var ts4 = client.Runtime.EvaluateAsync(jsStr4, null, true, null, null, true, null, true);
- Thread.Sleep(Randomx.GetId(7000, 10000));
+ Thread.Sleep(Randomx.GetId(4000, 7000));
- for (int i = 0; i < 100; i++)
+ var jsStr5 = @"(function() {
+ var inputItems = document.getElementsByTagName('input');
+ for (i = 0; i < inputItems.length; i++){
+ var inputItem = inputItems[i];
+ if (inputItem.outerHTML.indexOf('拼单价') >= 0) {
+ inputItem.scrollIntoView({
+ behavior: 'smooth',
+ block: 'center'
+ })
+ return 'success'
+ }
+ }
+ return 'no_item';
+ })();";
+ var ts5 = client.Runtime.EvaluateAsync(jsStr5, null, true, null, null, true, null, true);
+ jsStr5 = @"(function() {
+ var inputItems = document.getElementsByTagName('input');
+ var price = 0;
+ for (i = 0; i < inputItems.length; i++){
+ var inputItem = inputItems[i];
+ if (inputItem.outerHTML.indexOf('beast-core-inputNumber-htmlInput') >= 0) {
+ //price += ',' + inputItem.value;
+ if (parseFloat(inputItem.value) > price)
+ price = parseFloat(inputItem.value);
+ }
+ }
+ return price;
+ })();";
+ ts5 = client.Runtime.EvaluateAsync(jsStr5, null, true, null, null, true, null, true);
+ ts5.Wait(3000);
+ var newMultiPrice = (prodInfo.detail.sku.Max(s => s.multi_price) + 10) * 0.03m; // 最高价加10的三倍
+ if (ts5.IsCompleted && ts5.Result != null && ts5.Result.Result.Value.ParseToDecimal() * 2m > newMultiPrice)
+ {
+ newMultiPrice = ts5.Result.Result.Value.ParseToDecimal() * 2m;
+ }
+ Thread.Sleep(Randomx.GetId(2000, 4000));
+ jsStr5 = PDDShopLoginForm.sInputValueChange2 + @"(function() {
+ var inputItems = document.getElementsByTagName('input');
+ for (i = 0; i < inputItems.length; i++){
+ var inputItem = inputItems[i];
+ if (inputItem.outerHTML.indexOf('拼单价') >= 0) {
+ changeReactInputValue(inputItem, '" + newMultiPrice + @"');
+ return 'success';
+ }
+ }
+ return 'no_item';
+ })();";
+ ts5 = client.Runtime.EvaluateAsync(jsStr5, null, true, null, null, true, null, true);
+ Thread.Sleep(Randomx.GetId(1000, 2500));
+ jsStr5 = PDDShopLoginForm.sInputValueChange2 + @"(function() {
+ var inputItems = document.getElementsByTagName('input');
+ for (i = 0; i < inputItems.length; i++){
+ var inputItem = inputItems[i];
+ if (inputItem.outerHTML.indexOf('单买价') >= 0) {
+ changeReactInputValue(inputItem, '" + (newMultiPrice + 1m) + @"');
+ return 'success';
+ }
+ }
+ return 'no_item';
+ })();";
+ ts5 = client.Runtime.EvaluateAsync(jsStr5, null, true, null, null, true, null, true);
+ Thread.Sleep(Randomx.GetId(1500, 3000));
+ jsStr5 = PDDShopLoginForm.sInputValueChange2 + @"(function() {
+ var spanElements = document.getElementsByTagName('span');
+ for (i = 0; i < spanElements.length; i++) {
+ var spanElement = spanElements[i];
+ if (spanElement.innerHTML.indexOf('批量设置') >= 0) {
+ spanElement.click();
+ return 'success';
+ }
+ }
+ return 'no_item';
+ })();";
+ ts5 = client.Runtime.EvaluateAsync(jsStr5, null, true, null, null, true, null, true);
+ Thread.Sleep(Randomx.GetId(1000, 2000));
+
+ // 停用尺码表
+ var jsStr6 = @"(function() {
+ var spanElements = document.getElementsByTagName('span');
+ for (i = 0; i < spanElements.length; i++) {
+ var spanElement = spanElements[i];
+ if (spanElement.innerHTML.indexOf('停用尺码表') >= 0) {
+ //var rect = spanElement.getBoundingClientRect();
+ //return rect.left + ',' + rect.top;
+ spanElement.click();
+ return 'success';
+ }
+ }
+ return 'no_item';
+ })();";
+ var ts6 = client.Runtime.EvaluateAsync(jsStr6, null, true, null, null, true, null, true);
+ ts6.Wait(3000);
+ if (ts6.IsCompleted && ts6.Result != null && ts6.Result.Result.Value.ParseToString() == "success")
+ {
+ Thread.Sleep(Randomx.GetId(1000, 2000));
+ jsStr6 = @"(function() {
+ var spanElements = document.getElementsByTagName('span');
+ for (i = 0; i < spanElements.length; i++) {
+ var spanElement = spanElements[i];
+ if (spanElement.innerHTML.indexOf('确认停用') >= 0) {
+ //var rect = spanElement.getBoundingClientRect();
+ //return rect.left + ',' + rect.top;
+ spanElement.click();
+ return 'success';
+ }
+ }
+ return 'no_item';
+ })();";
+ ts6 = client.Runtime.EvaluateAsync(jsStr6, null, true, null, null, true, null, true);
+ }
+ Thread.Sleep(Randomx.GetId(2000, 3000));
+
+ Invoke(new Action(() =>
+ {
+ if (cell != null)
+ cell.Value = "正在提交以图搜款商品";
+ }));
+ // 提交并上架
+ var jsStr7 = @"(function() {
+ var spanElements = document.getElementsByTagName('span');
+ for (i = 0; i < spanElements.length; i++) {
+ var spanElement = spanElements[i];
+ if (spanElement.innerHTML.indexOf('提交并上架') >= 0) {
+ var rect = spanElement.getBoundingClientRect();
+ spanElement.click();
+ return rect.left + ',' + rect.top;
+ }
+ }
+ return '0,0';
+ })();";
+ var ts7 = client.Runtime.EvaluateAsync(jsStr7, null, true, null, null, true, null, true);
+ Thread.Sleep(Randomx.GetId(4000, 7000));
+
+ // 等待获取到商品id
+ for (int i = 0; i < 50; i++)
{
Thread.Sleep(1000);
if (!shop.CurrentProdId.IsNullOrEmpty())
@@ -9599,10 +9750,14 @@ Content-Type: image/jpeg
break;
}
}
+ Invoke(new Action(() =>
+ {
+ this.panel2.SendToBack();
+ }));
if (shop.CurrentProdId.IsNullOrEmpty())
{
- return "机会商品提交失败";
+ return "商品发布失败 商品提交失败";
}
Thread.Sleep(Randomx.GetId(10000, 15000));
@@ -9610,20 +9765,32 @@ Content-Type: image/jpeg
var pddApi = new PddApi(shop);
pddApi.Data["goods_id"] = shop.CurrentProdId;
var rst = pddApi.PddGoodsDetailGet();
- if (rst.Contains("商品不存在"))
+ for (int i = 0; i < 2 && rst.Contains("商品不存在"); i++)
{
- Thread.Sleep(15000);
+ Thread.Sleep(10000);
pddApi = new PddApi(shop);
pddApi.Data["goods_id"] = shop.CurrentProdId;
rst = pddApi.PddGoodsDetailGet();
}
- if (rst.Contains("商品不存在"))
+ if (!rst.Contains("\"goods_detail_get_response\""))
{
- Thread.Sleep(15000);
- return "商品提交失败";
+ if (rst.Contains("商品不存在"))
+ return "商品发布失败 商品不存在,可能是审核未通过";
+ else
+ {
+ var error = (BaseRegex.GetStringJson(ref rst, "error_msg") + " " + BaseRegex.GetStringJson(ref rst, "sub_msg")).Trim();
+ if (string.IsNullOrWhiteSpace(error))
+ error = rst;
+ return "商品发布失败 " + error;
+ }
}
var prodRstObj = JsonHelper.JObjectParse(rst)["goods_detail_get_response"] as JObject;
+ Invoke(new Action(() =>
+ {
+ if (cell != null)
+ cell.Value = "正在再次编辑商品";
+ }));
var editRst = ChangeAndUpdateChanceProd(shop, prodRstObj, dbProd, prodInfo, relationLst, cell);
return editRst;
@@ -9667,6 +9834,7 @@ Content-Type: image/jpeg
{
}
+ // cef机会商品模拟提交后修改商品sku为原商品sku
string ChangeAndUpdateChanceProd(ShopLoginInfo shop, JObject prodRstObj, KJDDBProduct dbProd, PDDProductInfo prodInfo, List relationLst, DataGridViewCell cell)
{
try
@@ -9679,13 +9847,16 @@ Content-Type: image/jpeg
pddApi.Data["carousel_gallery"] = JsonHelper.SerializeObject(prodRstObj["carousel_gallery_list"]);
pddApi.Data["cat_id"] = prodRstObj["cat_id"];
pddApi.Data["cost_template_id"] = prodRstObj["cost_template_id"].ToString();
- pddApi.Data["country_id"] = prodRstObj["country_id"];
+ pddApi.Data["country_id"] = "0"; // prodRstObj["country_id"];
pddApi.Data["customer_num"] = prodRstObj["customer_num"];
- pddApi.Data["customs"] = prodRstObj["customs"];
+ if (!prodRstObj["customs"].IsJTokenNullOrEmpty())
+ pddApi.Data["customs"] = prodRstObj["customs"];
pddApi.Data["delivery_one_day"] = prodRstObj["delivery_one_day"];
- pddApi.Data["delivery_type"] = prodRstObj["delivery_type"];
+ if (!prodRstObj["delivery_type"].IsJTokenNullOrEmpty())
+ pddApi.Data["delivery_type"] = prodRstObj["delivery_type"];
pddApi.Data["detail_gallery"] = JsonHelper.SerializeObject(prodRstObj["detail_gallery_list"]);
- pddApi.Data["elec_goods_attributes"] = prodRstObj["elec_goods_attributes"];
+ if (!prodRstObj["elec_goods_attributes"].IsJTokenNullOrEmpty())
+ pddApi.Data["elec_goods_attributes"] = prodRstObj["elec_goods_attributes"];
pddApi.Data["goods_desc"] = prodRstObj["goods_desc"].ParseToString();
pddApi.Data["goods_id"] = prodRstObj["goods_id"];
pddApi.Data["goods_name"] = prodRstObj["goods_name"].ParseToString();
@@ -9702,13 +9873,15 @@ Content-Type: image/jpeg
}
pddApi.Data["goods_properties"] = "[" + goods_properties.Trim(',') + "]";
- pddApi.Data["goods_trade_attr"] = prodRstObj["goods_trade_attr"];
- pddApi.Data["goods_travel_attr"] = prodRstObj["goods_travel_attr"];
+ if (!prodRstObj["goods_trade_attr"].IsJTokenNullOrEmpty())
+ pddApi.Data["goods_trade_attr"] = prodRstObj["goods_trade_attr"];
+ if (!prodRstObj["goods_travel_attr"].IsJTokenNullOrEmpty())
+ pddApi.Data["goods_travel_attr"] = prodRstObj["goods_travel_attr"];
pddApi.Data["goods_type"] = prodRstObj["goods_type"];
//pddApi.Data["ignore_edit_warn"] = false;
pddApi.Data["image_url"] = prodRstObj["image_url"];
pddApi.Data["invoice_status"] = prodRstObj["invoice_status"];
- pddApi.Data["is_customs"] = prodRstObj["is_customs"].ParseToInt() == 1;
+ pddApi.Data["is_customs"] = prodRstObj["is_customs"].ParseToBool();
pddApi.Data["is_folt"] = prodRstObj["is_folt"].ParseToInt() == 1; //是否支持假一赔十,false-不支持,true-支持
pddApi.Data["is_group_pre_sale"] = prodRstObj["is_group_pre_sale"];
pddApi.Data["is_pre_sale"] = prodRstObj["is_pre_sale"].ParseToInt() == 1;
@@ -9722,10 +9895,13 @@ Content-Type: image/jpeg
//pddApi.Data["operate_type"] = 0; // 是否提交草稿,默认提交 0:提交,1:保存
pddApi.Data["order_limit"] = prodRstObj["order_limit"];
pddApi.Data["origin_country_id"] = prodRstObj["origin_country_id"];
- pddApi.Data["out_goods_id"] = prodRstObj["out_goods_id"];
- pddApi.Data["out_source_goods_id"] = prodRstObj["out_source_goods_id"];
- pddApi.Data["out_source_type"] = prodRstObj["out_source_type"];
- pddApi.Data["oversea_goods"] = prodRstObj["oversea_goods"];
+ pddApi.Data["out_goods_id"] = prodInfo.detail.out_goods_sn; //prodRstObj["out_goods_id"];
+ if (!prodRstObj["out_source_goods_id"].IsJTokenNullOrEmpty())
+ pddApi.Data["out_source_goods_id"] = prodRstObj["out_source_goods_id"];
+ if (!prodRstObj["out_source_type"].IsJTokenNullOrEmpty())
+ pddApi.Data["out_source_type"] = prodRstObj["out_source_type"];
+ if (!prodRstObj["oversea_goods"].IsJTokenNullOrEmpty())
+ pddApi.Data["oversea_goods"] = prodRstObj["oversea_goods"];
pddApi.Data["oversea_type"] = prodRstObj["oversea_type"];
pddApi.Data["pre_sale_time"] = prodRstObj["pre_sale_time"];
pddApi.Data["privacy_delivery"] = prodRstObj["privacy_delivery"];
@@ -9733,13 +9909,14 @@ Content-Type: image/jpeg
pddApi.Data["second_hand"] = prodRstObj["second_hand"].ParseToInt() == 1;
//if (!prodRstObj["shang_men_an_zhuang"].IsJTokenNullOrEmpty())
// pddApi.Data["shang_men_an_zhuang"] = prodRstObj["shang_men_an_zhuang"];
- pddApi.Data["shipment_limit_second"] = prodRstObj["shipment_limit_second"];
- pddApi.Data["shop_group_id"] = prodRstObj["shop_group_id"];
+ pddApi.Data["shipment_limit_second"] = 172800; //prodRstObj["shipment_limit_second"];
+ if (!prodRstObj["shop_group_id"].IsJTokenNullOrEmpty())
+ pddApi.Data["shop_group_id"] = prodRstObj["shop_group_id"];
if (!prodRstObj["size_spec_id"].IsJTokenNullOrEmpty())
pddApi.Data["size_spec_id"] = prodRstObj["size_spec_id"];
-
- pddApi.Data["sku_type"] = prodRstObj["sku_type"];
+ if (!prodRstObj["sku_type"].IsJTokenNullOrEmpty())
+ pddApi.Data["sku_type"] = prodRstObj["sku_type"];
//if (!prodRstObj["song_huo_an_zhuang"].IsJTokenNullOrEmpty())
// pddApi.Data["song_huo_an_zhuang"] = prodRstObj["song_huo_an_zhuang"];
//if (!prodRstObj["song_huo_ru_hu"].IsJTokenNullOrEmpty())
@@ -9902,11 +10079,26 @@ Content-Type: image/jpeg
List addPriceFakeSkuInfoLst = new List();
Dictionary skuFakeSpecNameDic1 = new Dictionary();
Dictionary skuFakeSpecNameDic2 = new Dictionary();
- int marketPriceFake = prodInfo.detail.market_price.ParseToInt();
+ int marketPriceFake = 0; // prodInfo.detail.market_price.ParseToInt();
{
var maxPrice1 = 0;
+ var spec0ParentName = "颜色";
+ if (prodInfo.detail?.sku?.Count > 0 && prodInfo.detail.sku[0].spec?.Count > 0)
+ {
+ spec0ParentName = prodInfo.detail.sku[0].spec[0]?.parent_name;
+ }
+ var spec1ParentName = "规格";
+ if (prodInfo.detail?.sku?.Count > 0 && prodInfo.detail.sku[0].spec?.Count > 1)
+ {
+ spec1ParentName = prodInfo.detail.sku[0].spec[1]?.parent_name;
+ }
foreach (var sku in prodInfo.detail.sku)
{
+ if (sku.spec?.Count > 0)
+ sku.spec[0].parent_name = spec0ParentName;
+ if (sku.spec?.Count > 1)
+ sku.spec[1].parent_name = spec1ParentName;
+
var skuInfo = JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(sku));
skuInfo.is_onsale = skuInfo.is_onsale != null ? skuInfo.is_onsale : 1;
skuInfo.limit_quantity = 999; // 只入参999
@@ -9928,9 +10120,9 @@ Content-Type: image/jpeg
skuInfo.multi_price = ((new_multi_price + this.txtAddMorePrice.Text.Trim().ParseToDecimal() * 100) * this.txtAddTimesFake.Text.Trim().ParseToDecimal()).ParseToInt();
skuInfo.price = skuInfo.multi_price + Math.Max(100, this.txtSinglePriceAdd.Text.Trim().ParseToDecimal() * 100).ParseToInt();
- if (marketPriceFake < skuInfo.price + 1000)
+ if (marketPriceFake < skuInfo.price.ParseToInt() * 2)
{
- marketPriceFake = skuInfo.price.ParseToInt() + 1000;
+ marketPriceFake = skuInfo.price.ParseToInt() * 2;
//pddApi.Data["market_price"] = marketPriceFake;
}
@@ -9998,7 +10190,7 @@ Content-Type: image/jpeg
#region 生成一组正常加价后的sku
List addPriceSkuInfoLst = new List();
- int marketPrice = prodInfo.detail.market_price.ParseToInt();
+ int marketPrice = 0; // prodInfo.detail.market_price.ParseToInt();
{
foreach (var sku in prodInfo.detail.sku)
{
@@ -10043,9 +10235,9 @@ Content-Type: image/jpeg
//skuInfo.multi_price += (shipPrice * defaultAddPriceRule.AddShippingFeeTimes).ParseToInt();
//skuInfo.price += (shipPrice * defaultAddPriceRule.AddShippingFeeTimes).ParseToInt();
- if (marketPrice < skuInfo.price + 1000)
+ if (marketPrice < skuInfo.price * 2)
{
- marketPrice = skuInfo.price.ParseToInt() + 1000;
+ marketPrice = skuInfo.price.ParseToInt() * 2;
//pddApi.Data["market_price"] = marketPrice;
}
@@ -10112,8 +10304,8 @@ Content-Type: image/jpeg
}
if (parent_id == 0)
{
- parent_id = specNameDic.ToList()[j].Key;
- specInfo.parent_name = specNameDic.ToList()[j].Value;
+ parent_id = specNameDic.ToList().FirstOrDefault(s => !addPriceSkuInfoLst[i].spec.Any(s1 => s1.parent_name == s.Value)).Key; // specNameDic.ToList()[j].Key;
+ specInfo.parent_name = specNameDic.ToList().FirstOrDefault(s => !addPriceSkuInfoLst[i].spec.Any(s1 => s1.parent_name == s.Value)).Value; // specNameDic.ToList()[j].Value;
}
specInfo.parent_id = parent_id;
@@ -10218,12 +10410,9 @@ Content-Type: image/jpeg
}
pddApi.Data["sku_list"] = "[" + skuApiString.Trim(',') + "]";
- if (marketPrice > maxPrice * 5)
- marketPrice = (maxPrice * 5).ParseToInt() - 1;
- pddApi.Data["market_price"] = marketPrice;
#endregion
- // 计算转换列表内是否有符合条件的转换商品
+ #region 计算转换列表内是否有符合条件的转换商品
var addPriceSkuInfoMinPrice = addPriceSkuInfoLst.Min(s => s.price);
var addPriceSkuInfoMaxPrice = addPriceSkuInfoLst.Max(s => s.price);
var relationData = relationLst?
@@ -10231,37 +10420,9 @@ Content-Type: image/jpeg
.FirstOrDefault(r => r.price_min.ParseToInt() * 1.08m > addPriceSkuInfoMinPrice && r.price_max.ParseToInt() * 1.08m > addPriceSkuInfoMaxPrice);
if (relationData == null)
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"转换数据获取价格失败\"}";
+ #endregion
- string skuStr = "";
- if (1 == 1)
- {
- for (int i = 0; i < prodRstObj["sku_list"].Count(); i++)
- {
- var skuObj = JObject.Parse(JsonHelper.SerializeObject(prodRstObj["sku_list"][i]));
- skuObj["sku_properties"] = skuObj["sku_property_list"];
- skuObj["quantity"] = 0;
- string spec = "";
- foreach (var specObj in skuObj["spec"])
- {
- spec += "," + specObj["spec_id"].ParseToString();
- }
- spec = spec.Trim(',');
- skuObj["spec_id_list"] = "[" + spec + "]";
- skuObj.Remove("sku_property_list");
- //skuObj.Remove("sku_properties");
- skuObj.Remove("spec");
- skuStr += JsonHelper.SerializeObject(skuObj) + ",";
- }
- skuStr = skuStr.Trim(',');
- }
- else
- {
-
- }
- pddApi.Data["sku_list"] = "[" + skuStr + "]";
-
-
-
+ // 移除为空的字段,防止误填
foreach (var key in pddApi.Data.Select(d => d.Key).ToList())
{
if (pddApi.Data[key].IsNullOrEmpty())
@@ -10270,6 +10431,13 @@ Content-Type: image/jpeg
}
};
+
+ Invoke(new Action(() =>
+ {
+ if (cell != null)
+ cell.Value = "正在提交更新过商品";
+ }));
+
var rst = pddApi.PddGoodsInformationUpdate();
if (!rst.Contains("\"is_success\":true"))
diff --git a/TEMUKJD/PDDForms/ShopForms/PDDShopLoginForm.cs b/TEMUKJD/PDDForms/ShopForms/PDDShopLoginForm.cs
index a6a4ad3..cc55b38 100644
--- a/TEMUKJD/PDDForms/ShopForms/PDDShopLoginForm.cs
+++ b/TEMUKJD/PDDForms/ShopForms/PDDShopLoginForm.cs
@@ -1290,7 +1290,7 @@ event.eventType = 'message';
usernameId.dispatchEvent(event);
";
- string sInputValueChange2 = @"
+ public static string sInputValueChange2 = @"
function changeReactInputValue(inputDom,newText){
let lastValue = inputDom.value;
inputDom.value = newText;
diff --git a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs
index 6d6ab5b..c76b4ef 100644
--- a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs
+++ b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs
@@ -293,6 +293,11 @@ namespace TemuKJD.WXForms.ProductForms
if (BaseClass.UserAuthority.ParseToString().Contains("货源选择"))
{
cmbSourceType.Visible = true;
+ if (!string.IsNullOrWhiteSpace(cmbSourceType.Text))
+ {
+ lblGroupFilter.Visible = true;
+ cmbGroupFilter.Visible = true;
+ }
}
if (BaseClass.UserAuthority.ParseToString().Contains("微信回采"))
{
@@ -460,9 +465,10 @@ namespace TemuKJD.WXForms.ProductForms
private void RefreshDbProdGroupAndCate()
{
+ string sourceType = cmbSourceType.Text.Trim();
Task.Run(() =>
{
- PDDDBProdListForm.GetPDDProductGroup(cmbGroupFilter); // 同时刷新下商品分组
+ PDDDBProdListForm.GetPDDProductGroup(cmbGroupFilter, sourceType); // 同时刷新下商品分组
GetPddProductCate();
Invoke(new Action(() =>
{
@@ -4793,6 +4799,26 @@ namespace TemuKJD.WXForms.ProductForms
{
cmbJstInitSet.Text = "已设置";
}
+
+ string sourceType = cmbSourceType.Text.Trim();
+ Task.Run(() =>
+ {
+ PDDDBProdListForm.GetPDDProductGroup(cmbGroupFilter, sourceType); // 同时刷新下商品分组
+ });
+ if (!string.IsNullOrWhiteSpace(cmbSourceType.Text))
+ {
+ lblGroupFilter.Visible = true;
+ cmbGroupFilter.Visible = true;
+ }
+ else
+ {
+ if (BaseClass.SaLevel != 1)
+ {
+ lblGroupFilter.Visible = false;
+ cmbGroupFilter.Visible = false;
+ cmbGroupFilter.Text = "";
+ }
+ }
}
private void cmbSourceType_TextChanged(object sender, EventArgs e)