1添加随机上传商品 2优化pdd api授权逻辑

This commit is contained in:
wule committed 2026-04-02 19:48:38 +08:00
1 parent 07b912e9eb
commit c0b7c2d986
34 files changed
+1651 -603

No files matched your search

@@ -29,6 +29,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private void PDDDBProdUserSelectCacheForm_Load(object sender, EventArgs e)
{
if (BaseClass.MainPath == "binxixi")
{
dgvSelectProduct.Columns["colBound"].Visible = false;
}
dgvSelectProduct.AddSelectorColumn("colCheck");
dgvSelectProduct.AddImgColumn("colProductSkcPic", "colImgUrl");
@@ -30,15 +30,16 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = 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();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.chkRandomCompanyProd = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.txtAddShippingFeeTimes = new System.Windows.Forms.TextBox();
this.label12 = new System.Windows.Forms.Label();
this.btnApiUpload = new DevComponents.DotNetBar.PanelEx();
@@ -207,7 +208,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer3);
this.splitContainer1.Size = new System.Drawing.Size(1523, 546);
this.splitContainer1.Size = new System.Drawing.Size(1571, 546);
this.splitContainer1.SplitterDistance = 140;
this.splitContainer1.TabIndex = 11;
//
@@ -218,6 +219,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
| System.Windows.Forms.AnchorStyles.Right)));
this.ucGroupBoxEx2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.ucGroupBoxEx2.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND;
this.ucGroupBoxEx2.Controls.Add(this.chkRandomCompanyProd);
this.ucGroupBoxEx2.Controls.Add(this.txtAddShippingFeeTimes);
this.ucGroupBoxEx2.Controls.Add(this.label12);
this.ucGroupBoxEx2.Controls.Add(this.btnApiUpload);
@@ -268,11 +270,23 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.ucGroupBoxEx2.Controls.Add(this.label11);
this.ucGroupBoxEx2.Location = new System.Drawing.Point(459, 2);
this.ucGroupBoxEx2.Name = "ucGroupBoxEx2";
this.ucGroupBoxEx2.Size = new System.Drawing.Size(1062, 140);
this.ucGroupBoxEx2.Size = new System.Drawing.Size(1110, 140);
this.ucGroupBoxEx2.TabIndex = 667;
this.ucGroupBoxEx2.TabStop = false;
this.ucGroupBoxEx2.Text = "商品上传";
//
// chkRandomCompanyProd
//
this.chkRandomCompanyProd.Checked = true;
this.chkRandomCompanyProd.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkRandomCompanyProd.Location = new System.Drawing.Point(846, 111);
this.chkRandomCompanyProd.Name = "chkRandomCompanyProd";
this.chkRandomCompanyProd.Size = new System.Drawing.Size(87, 21);
this.chkRandomCompanyProd.TabIndex = 808;
this.chkRandomCompanyProd.Text = "随机工厂商品";
this.chkRandomCompanyProd.UseVisualStyleBackColor = true;
this.chkRandomCompanyProd.Visible = false;
//
// txtAddShippingFeeTimes
//
this.txtAddShippingFeeTimes.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@@ -302,9 +316,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnApiUpload.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnApiUpload.DisabledBackColor = System.Drawing.Color.Empty;
this.btnApiUpload.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnApiUpload.Location = new System.Drawing.Point(965, 40);
this.btnApiUpload.Location = new System.Drawing.Point(1031, 40);
this.btnApiUpload.Name = "btnApiUpload";
this.btnApiUpload.Size = new System.Drawing.Size(84, 23);
this.btnApiUpload.Size = new System.Drawing.Size(66, 23);
this.btnApiUpload.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnApiUpload.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnApiUpload.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
@@ -327,9 +341,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnUpload.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnUpload.DisabledBackColor = System.Drawing.Color.Empty;
this.btnUpload.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUpload.Location = new System.Drawing.Point(965, 81);
this.btnUpload.Location = new System.Drawing.Point(1031, 81);
this.btnUpload.Name = "btnUpload";
this.btnUpload.Size = new System.Drawing.Size(84, 23);
this.btnUpload.Size = new System.Drawing.Size(66, 23);
this.btnUpload.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnUpload.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnUpload.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
@@ -349,7 +363,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(944, 43);
this.label7.Location = new System.Drawing.Point(992, 43);
this.label7.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(20, 17);
@@ -359,7 +373,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// txtWaitSeconds
//
this.txtWaitSeconds.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.txtWaitSeconds.Location = new System.Drawing.Point(912, 40);
this.txtWaitSeconds.Location = new System.Drawing.Point(960, 40);
this.txtWaitSeconds.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.txtWaitSeconds.Name = "txtWaitSeconds";
this.txtWaitSeconds.Size = new System.Drawing.Size(32, 23);
@@ -371,7 +385,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(858, 43);
this.label6.Location = new System.Drawing.Point(906, 43);
this.label6.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(56, 17);
@@ -476,10 +490,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnStop.CanvasColor = System.Drawing.SystemColors.Control;
this.btnStop.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnStop.DisabledBackColor = System.Drawing.Color.Empty;
this.btnStop.Location = new System.Drawing.Point(965, 110);
this.btnStop.Location = new System.Drawing.Point(1031, 110);
this.btnStop.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(84, 23);
this.btnStop.Size = new System.Drawing.Size(66, 23);
this.btnStop.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnStop.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnStop.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
@@ -671,7 +685,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnClearDgv.CanvasColor = System.Drawing.SystemColors.Control;
this.btnClearDgv.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnClearDgv.DisabledBackColor = System.Drawing.Color.Empty;
this.btnClearDgv.Location = new System.Drawing.Point(879, 110);
this.btnClearDgv.Location = new System.Drawing.Point(944, 110);
this.btnClearDgv.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2);
this.btnClearDgv.Name = "btnClearDgv";
this.btnClearDgv.Size = new System.Drawing.Size(84, 23);
@@ -918,7 +932,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.chkChance.AutoSize = true;
this.chkChance.Checked = true;
this.chkChance.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkChance.Location = new System.Drawing.Point(968, 17);
this.chkChance.Location = new System.Drawing.Point(1020, 17);
this.chkChance.Name = "chkChance";
this.chkChance.Size = new System.Drawing.Size(87, 21);
this.chkChance.TabIndex = 556;
@@ -1066,6 +1080,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.cmbSourceType.Name = "cmbSourceType";
this.cmbSourceType.Size = new System.Drawing.Size(92, 25);
this.cmbSourceType.TabIndex = 671;
this.cmbSourceType.Text = "厂商直采";
//
// label8
//
@@ -1339,7 +1354,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// splitContainer3.Panel2
//
this.splitContainer3.Panel2.Controls.Add(this.splitContainer4);
this.splitContainer3.Size = new System.Drawing.Size(1523, 402);
this.splitContainer3.Size = new System.Drawing.Size(1571, 402);
this.splitContainer3.SplitterDistance = 372;
this.splitContainer3.TabIndex = 1;
//
@@ -1363,7 +1378,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.splitContainer2.Panel2.Controls.Add(this.pbLoading);
this.splitContainer2.Panel2.Controls.Add(this.dgvSelectProduct);
this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0);
this.splitContainer2.Size = new System.Drawing.Size(1523, 372);
this.splitContainer2.Size = new System.Drawing.Size(1571, 372);
this.splitContainer2.SplitterDistance = 326;
this.splitContainer2.TabIndex = 0;
//
@@ -1383,19 +1398,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.dgvShop.AllowUserToAddRows = false;
this.dgvShop.AllowUserToDeleteRows = false;
dataGridViewCellStyle22.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle22;
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)))));
dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle23.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle23.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle23.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle23.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle23.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle23.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle23;
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,
@@ -1512,7 +1527,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// txtTest20981
//
this.txtTest20981.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.txtTest20981.Location = new System.Drawing.Point(970, 30);
this.txtTest20981.Location = new System.Drawing.Point(1018, 30);
this.txtTest20981.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.txtTest20981.Name = "txtTest20981";
this.txtTest20981.Size = new System.Drawing.Size(127, 23);
@@ -1525,7 +1540,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnTest20981.CanvasColor = System.Drawing.SystemColors.Control;
this.btnTest20981.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnTest20981.DisabledBackColor = System.Drawing.Color.Empty;
this.btnTest20981.Location = new System.Drawing.Point(1101, 30);
this.btnTest20981.Location = new System.Drawing.Point(1149, 30);
this.btnTest20981.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2);
this.btnTest20981.Name = "btnTest20981";
this.btnTest20981.Size = new System.Drawing.Size(84, 23);
@@ -1550,7 +1565,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue;
this.pbLoading.Location = new System.Drawing.Point(571, 161);
this.pbLoading.Location = new System.Drawing.Point(595, 161);
this.pbLoading.Name = "pbLoading";
this.pbLoading.Size = new System.Drawing.Size(50, 50);
this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -1562,19 +1577,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.dgvSelectProduct.AllowUserToAddRows = false;
this.dgvSelectProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle24.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle24;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
this.dgvSelectProduct.AutoRowNumber = true;
this.dgvSelectProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvSelectProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle25.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle25.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle25.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle25.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle25.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle25.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle25.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle25;
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.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.dgvSelectProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvSelectProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
@@ -1605,7 +1620,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.dgvSelectProduct.Name = "dgvSelectProduct";
this.dgvSelectProduct.ReadOnly = true;
this.dgvSelectProduct.RowTemplate.Height = 23;
this.dgvSelectProduct.Size = new System.Drawing.Size(1189, 372);
this.dgvSelectProduct.Size = new System.Drawing.Size(1237, 372);
this.dgvSelectProduct.TabIndex = 187;
this.dgvSelectProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSelectProduct_CellContentClick);
this.dgvSelectProduct.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dgvSelectProduct_Scroll);
@@ -1636,8 +1651,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colSupplierName
//
dataGridViewCellStyle26.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle26;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle5;
this.colSupplierName.Frozen = true;
this.colSupplierName.HeaderText = "店铺名称";
this.colSupplierName.Name = "colSupplierName";
@@ -1715,8 +1730,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colProductName
//
dataGridViewCellStyle27.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle27;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle6;
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
@@ -1776,8 +1791,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colAddTime
//
dataGridViewCellStyle28.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colAddTime.DefaultCellStyle = dataGridViewCellStyle28;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colAddTime.DefaultCellStyle = dataGridViewCellStyle7;
this.colAddTime.FillWeight = 80F;
this.colAddTime.HeaderText = "上传时间";
this.colAddTime.Name = "colAddTime";
@@ -1805,8 +1820,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.splitContainer4.Panel2.Controls.Add(this.btnClear);
this.splitContainer4.Panel2.Controls.Add(this.panelEx1);
this.splitContainer4.Size = new System.Drawing.Size(1523, 26);
this.splitContainer4.SplitterDistance = 832;
this.splitContainer4.Size = new System.Drawing.Size(1571, 26);
this.splitContainer4.SplitterDistance = 880;
this.splitContainer4.TabIndex = 3;
//
// statusBar
@@ -1817,7 +1832,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.statusBar.Location = new System.Drawing.Point(0, 0);
this.statusBar.Margin = new System.Windows.Forms.Padding(0);
this.statusBar.Name = "statusBar";
this.statusBar.Size = new System.Drawing.Size(832, 26);
this.statusBar.Size = new System.Drawing.Size(880, 26);
this.statusBar.TabIndex = 2;
//
// btnClear
@@ -2057,5 +2072,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private System.Windows.Forms.Label label12;
private System.Windows.Forms.PictureBox pbShopLoading;
private DevComponents.DotNetBar.PanelEx btnProdDb;
private UserComponent.UcCheckBox chkRandomCompanyProd;
}
}
@@ -187,7 +187,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
IsLoadComplate = true;
}
// 测试全局access_token
// 测试全局access_token 测试用,目前作废
void InitPddToken()
{
return;
@@ -5988,8 +5988,8 @@ Content-Type: image/jpeg
var selectProd = JsonHelper.DeserializeJsonToObject<TemuDBProductSelect>(JsonHelper.SerializeObject(prod));
selectProd.out_product_Id = prod.id.ToString();
selectProd.id = 1;
if(lstTemuDBProductSelect.Count > 0)
selectProd.id = lstTemuDBProductSelect.Max(p => p.id) + 1;
if (lstTemuDBProductSelect.Count > 0)
selectProd.id = lstTemuDBProductSelect.Max(p => p.id).ParseToInt() + 1;
this.lstTemuDBProductSelect.Add(selectProd);
Invoke(new Action(() =>
@@ -6067,7 +6067,7 @@ Content-Type: image/jpeg
try
{
list = JsonHelper.DeserializeJsonToList<KJDDBProduct>(sProd);
list = JsonHelper.DeserializeJsonToList<KJDDBProduct>(sProd).OrderBy(x => Randomx.GetId(999999)).ToList();
return list;
}
catch (Exception ex)
@@ -6076,6 +6076,67 @@ Content-Type: image/jpeg
}
}
/// <summary>
/// 随机添加黄总厂商商品(或其他指定分组产品,由服务端控制)
/// </summary>
/// <param name="totalCount"></param>
/// <param name="page"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
public List<KJDDBProduct> GetRandomCompanyProductList(out int totalCount, string groupName = "黄总数据包", int page = 1, int pageSize = 200)
{
var lstShopId = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
List<KJDDBProduct> list = new List<KJDDBProduct>();
int pageCount = 1;
totalCount = 0;
var url = BaseClass.BuildObjString("product/get_product_list_random");
var data = "";
Invoke(new Action(() =>
{
data = UserLogin.GetSignaturex() +
"&page=" + 1 +
"&page_size=" + pageSize;
data += "&in_groups=" + groupName;
}));
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
Invoke(new Action(() =>
{
BaseMsgForm.ShowError("获取商品失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg"));
}));
return new List<KJDDBProduct>();
}
int count = BaseRegex.GetIntJson(ref html, "count");
totalCount = count;
pageCount = Math.Ceiling(1.0 * count / pageSize).ParseToInt();
pageCount = Math.Max(pageCount, 1);
var jArr = JObject.Parse(html)["data"];
if (jArr.Count() == 0)
return list;
var sProd = JsonHelper.SerializeObject(jArr);
try
{
list = JsonHelper.DeserializeJsonToList<KJDDBProduct>(sProd).OrderBy(x=> Randomx.GetId(999999)).ToList();
return list;
}
catch (Exception ex)
{
return new List<KJDDBProduct>();
}
}
private void btnClearUpload_Click(object sender, EventArgs e)
{
if (BaseMsgForm.ShowConfirm("确定清空待上传商品吗?清空后不可恢复!").DialogResult == DialogResult.Cancel)
@@ -6083,7 +6144,7 @@ Content-Type: image/jpeg
this.lstTemuDBProductSelect.Clear();
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_db_prod_upload_list", this.lstTemuDBProductSelect);
lblWaitToUp.Text = "待上传 " + lstTemuDBProductSelect.Count + " 件";
lblWaitToUp.Text = "待上传 " + lstTemuDBProductSelect.Count + " 件";
}
private void lblNewAddPrice_Click(object sender, EventArgs e)
@@ -6675,13 +6736,27 @@ Content-Type: image/jpeg
}
this.btnUpload.Enabled = false;
this.btnApiUpload.Enabled = false;
Task.Run(() =>
{
Thread.Sleep(10000);
Invoke(new Action(() => {
this.btnUpload.Enabled = true;
this.btnApiUpload.Enabled = true;
}));
});
if (cancellationTokenSource != null)
cancellationTokenSource.Cancel();
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
// 随机店铺并分配商品
try
{
GetShopAndUpProduct();
GetShopAndUpProduct(cancellationTokenSource.Token);
}
catch (Exception ex)
{
@@ -6689,16 +6764,34 @@ Content-Type: image/jpeg
}
Invoke(new Action(() =>
{
if (!cancellationTokenSource.Token.IsCancellationRequested)
BaseMsgForm.ShowConfirm("上传完成");
this.btnUpload.Enabled = true;
}));
}, cancellationTokenSource.Token);
}
void GetShopAndUpProduct()
void GetShopAndUpProduct(CancellationToken token)
{
NaiBa.Util.ConcurrentList<ShopLoginInfo> currentUpShopLst = new NaiBa.Util.ConcurrentList<ShopLoginInfo>();
// 随机厂商商品
var url = BaseClass.BuildObjString("product/get_random_company_product_config");
var data = UserLogin.GetSignaturex();
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
chkRandomCompanyProd.Checked = BaseRegex.GetStringJson(ref html, "is_on") == "1";
int randomComProdInterval = Math.Max(1, BaseRegex.GetIntJson(ref html, "product_interval"));
string randomComProdGroup = BaseRegex.GetStringJson(ref html, "product_group");
int waitCompanyProdCnt = 0;
List<TemuDBProductSelect> CompanyProdLst = new List<TemuDBProductSelect>();
while (lstTemuDBProductSelect.Count > 0)
{
if (token.IsCancellationRequested)
break;
var shopIdLst = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
if (shopIdLst.Count <= 0)
@@ -6727,10 +6820,39 @@ Content-Type: image/jpeg
currentUpShopLst.Add(canUpShop);
// 每次挑选列表第一件商品
var selectProd = lstTemuDBProductSelect.FirstOrDefault();
var selectProd = lstTemuDBProductSelect.FirstOrDefault();
selectProd.shop_id = canUpShop.ShopId;
selectProd.shop_account = canUpShop.ShopAccount;
lstTemuDBProductSelect.Remove(selectProd);
// 每若干个个商品插一件黄总商品包或其他组商品
waitCompanyProdCnt++;
if (chkRandomCompanyProd.Checked && waitCompanyProdCnt > randomComProdInterval)
{
waitCompanyProdCnt = 0;
if (CompanyProdLst.Count == 0)
{
int dbCompanyProdCount;
var dbComProdLst = GetRandomCompanyProductList(out dbCompanyProdCount, randomComProdGroup);
foreach (var comProd in dbComProdLst)
{
var comSelectProd = JsonHelper.DeserializeJsonToObject<TemuDBProductSelect>(JsonHelper.SerializeObject(comProd));
comSelectProd.out_product_Id = comProd.id.ToString();
comSelectProd.id = 1;
if (CompanyProdLst.Count > 0)
comSelectProd.id = CompanyProdLst.Max(p => p.id).ParseToInt() + 1;
CompanyProdLst.Add(comSelectProd);
}
}
selectProd = CompanyProdLst.FirstOrDefault();
selectProd.shop_id = canUpShop.ShopId;
selectProd.shop_account = canUpShop.ShopAccount;
CompanyProdLst.Remove(selectProd);
}
else
{
lstTemuDBProductSelect.Remove(selectProd);
}
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_db_prod_upload_list", this.lstTemuDBProductSelect);
Invoke(new Action(() =>
{
@@ -6787,7 +6909,7 @@ Content-Type: image/jpeg
// 接口上传
try
{
result = ApiUploadProduct(canUpShop, selectProd, row);
result = ApiUploadProduct(canUpShop, selectProd, row, token);
}
catch (Exception ex)
{
@@ -6816,7 +6938,7 @@ Content-Type: image/jpeg
selectProd.status = BaseRegex.GetStringJson(ref result, "status");
if (string.IsNullOrWhiteSpace(selectProd.status))
selectProd.status = "待上传";
var goodsId = BaseRegex.GetStringJson(ref result, "goodsId");
var goodsId = BaseRegex.GetStringJson(ref result, "goods_id");
Invoke(new Action(() =>
{
@@ -6842,9 +6964,17 @@ Content-Type: image/jpeg
}, cancellationTokenSource.Token);
}
if (token.IsCancellationRequested)
BaseMsgForm.ShowConfirm("上传终止,正在上传的商品将继续上传");
while (currentUpShopLst.Count > 0)
{
Thread.Sleep(1000);
}
}
string ApiUploadProduct(ShopLoginInfo shop, TemuDBProductSelect selectProd, DataGridViewRow row)
string ApiUploadProduct(ShopLoginInfo shop, TemuDBProductSelect selectProd, DataGridViewRow row, CancellationToken token)
{
DataGridViewCell cell = row.Cells["colOpResult"];
Invoke(new Action(() =>
@@ -6891,7 +7021,7 @@ Content-Type: image/jpeg
// 主图
int cnt = 0;
string carousel_gallery = "";
foreach (var img in prodInfo.detail.galleries.Where(g => g.type ==1).ToList())
foreach (var img in prodInfo.detail.galleries.Where(g => g.type == 1).ToList())
{
cnt++;
Invoke(new Action(() =>
@@ -7055,6 +7185,9 @@ Content-Type: image/jpeg
foreach (var propApiInfo in apiCatRuleInfo.properties)
{
if (propApiInfo.name == "成分含量")
{
}
if (propApiInfo.required == true && !propParamLst.Any(p => p.ref_pid == propApiInfo.ref_pid))
{
var contentOther = propApiInfo.values?.FirstOrDefault(c => c.value == "其他");
@@ -7071,7 +7204,7 @@ Content-Type: image/jpeg
if (contentValue != null)
{
var propParam = JsonHelper.DeserializeJsonToObject<ApiPddProperty>(JsonHelper.SerializeObject(propApiInfo));
propParam.values = new List<ApiPddPropertyValue>() { contentOther };
propParam.values = new List<ApiPddPropertyValue>() { contentValue };
propParamLst.Add(propParam);
}
}
@@ -7087,6 +7220,8 @@ Content-Type: image/jpeg
foreach (var pp in propParamLst)
{
var pv = pp.values.FirstOrDefault();
if (pv == null)
continue;
var value_unit = pp.value_unit.FirstOrDefault().ParseToString();
var str = "{\"ref_pid\":" + pp.ref_pid + ",\"vid\":" + pv.vid + ",\"value\":\"" + pv.value + "\",\"value_unit\":\"" + value_unit + "\"},";
string temp = BaseRegex.GetMatchRegexString(ref str, @"(\d{2,4}-\d{1,2}-\d{1,2})"); // 如果有时间替换成最新的
@@ -7110,9 +7245,13 @@ Content-Type: image/jpeg
// 厂商直采获取推单运费模板
#region 厂商直采获取推单运费模板,计算运费加价。
//Invoke(new Action(() =>
//{
// cell.Value = "正在选取运费模板";
//}));
Invoke(new Action(() =>
{
//cell.Value = "正在选取运费模板";
cell.Value = "正在计算加价";
}));
var shippingTemplateJson = "";
@@ -7287,8 +7426,15 @@ Content-Type: image/jpeg
specNameDic[parent_spec_id] = parent_spec_name;
}
Dictionary<string, long?> specNameIdMapDic = new Dictionary<string, long?>();
for (int i = 0; i < addPriceSkuInfoLst.Count; i++)
{
Invoke(new Action(() =>
{
cell.Value = "正在生成Sku规格 " + (i + 1) + "/" + addPriceSkuInfoLst.Count;
}));
for (int j = 0; j < addPriceSkuInfoLst[i].spec.Count; j++)
{
var specInfo = addPriceSkuInfoLst[i].spec[j];
@@ -7304,19 +7450,26 @@ Content-Type: image/jpeg
parent_id = specNameDic.ToList()[j].Key;
specInfo.parent_id = parent_id;
PddApi PddGoodsSpecIdGetApi = new PddApi(shop);
PddGoodsSpecIdGetApi.Data["parent_spec_id"] = parent_id;
PddGoodsSpecIdGetApi.Data["spec_name"] = specInfo.spec_name;
var PddGoodsSpecIdGetApiRst = PddGoodsSpecIdGetApi.PddGoodsSpecIdGet();
if (!PddGoodsSpecIdGetApiRst.Contains("\"goods_spec_id_get_response\""))
if (specNameIdMapDic.Keys.Contains(specInfo.spec_name + specInfo.parent_name))
{
var errMsg = BaseRegex.GetStringJson(ref PddGoodsSpecIdGetApiRst, "error_msg");
if (string.IsNullOrEmpty(errMsg))
errMsg = PddGoodsSpecIdGetApiRst;
return "Sku属性生成失败 " + errMsg;
specInfo.spec_id = specNameIdMapDic[specInfo.spec_name + specInfo.parent_name];
}
else
{
PddApi PddGoodsSpecIdGetApi = new PddApi(shop);
PddGoodsSpecIdGetApi.Data["parent_spec_id"] = parent_id;
PddGoodsSpecIdGetApi.Data["spec_name"] = specInfo.spec_name;
var PddGoodsSpecIdGetApiRst = PddGoodsSpecIdGetApi.PddGoodsSpecIdGet();
if (!PddGoodsSpecIdGetApiRst.Contains("\"goods_spec_id_get_response\""))
{
var errMsg = BaseRegex.GetStringJson(ref PddGoodsSpecIdGetApiRst, "error_msg");
if (string.IsNullOrEmpty(errMsg))
errMsg = PddGoodsSpecIdGetApiRst;
return "Sku属性生成失败 " + errMsg;
}
specInfo.spec_id = BaseRegex.GetLongJson(ref PddGoodsSpecIdGetApiRst, "spec_id");
specNameIdMapDic[specInfo.spec_name + specInfo.parent_name] = specInfo.spec_id;
}
specInfo.spec_id = BaseRegex.GetLongJson(ref PddGoodsSpecIdGetApiRst, "spec_id");
}
}
}
@@ -7327,7 +7480,7 @@ Content-Type: image/jpeg
{
Invoke(new Action(() =>
{
cell.Value = "正在生成Sku " + (i + 1) + "/" + addPriceSkuInfoLst.Count;
cell.Value = "正在拼接Sku " + (i + 1) + "/" + addPriceSkuInfoLst.Count;
}));
string spec = "";
@@ -7736,20 +7889,41 @@ Content-Type: image/jpeg
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
foreach (var shop in GlobalConfig.ShopLoginList)
{
Invoke(new Action(() =>
if (isForceRefresh || (shop.AuthAddTime <= DateTime.Now.AddDays(-1) && shop.AuthExpiresTime <= DateTime.Now))
{
shop.Message = "";
BindShop(shop, selectIds);
}));
PddApiHelper.RefreshApi(shop, isForceRefresh);
Invoke(new Action(() =>
{
shop.Message = "授权更新完成";
BindShop(shop, selectIds);
}));
Invoke(new Action(() =>
{
shop.Message = "";
BindShop(shop, selectIds);
}));
PddApiHelper.RefreshApi(shop, isForceRefresh);
Invoke(new Action(() =>
{
shop.Message = "授权更新完成";
BindShop(shop, selectIds);
}));
}
}
List<List<AuthInfo>> lsts = GlobalConfig.ShopLoginList.Select(s => s.ApiAuthInfoList).ToList();
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_shop_api_auth_info_lists", lsts);
List<List<AuthInfo>> NewApiInfolsts = JsonHelper.DeserializeJsonToList<List<AuthInfo>>(JsonHelper.SerializeObject(GlobalConfig.ShopLoginList.Select(s => s.ApiAuthInfoList).ToList()));
foreach (var newLst in NewApiInfolsts)
{
if (newLst.FirstOrDefault()!= null)
{
var oldApiAuths = PddApiHelper.LstAuthInfos.FirstOrDefault(oldLst => oldLst.FirstOrDefault()?.ShopId == newLst.FirstOrDefault().ShopId);
if (oldApiAuths != null)
{
oldApiAuths.Clear();
oldApiAuths.AddRange(newLst);
}
else
{
PddApiHelper.LstAuthInfos.Add(newLst);
}
}
}
PddApiHelper.LstAuthInfos = PddApiHelper.LstAuthInfos.Where(a => a.OrderBy(o => o.AddTime).LastOrDefault().AddTime > DateTime.Now.AddDays(-30)).ToList();
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_shop_api_auth_info_lists", PddApiHelper.LstAuthInfos);
Invoke(new Action(() => { pbShopLoading.Visible = false; }));
});
}