营销工具进一步优化并增加删除功能

This commit is contained in:
wule committed 2025-10-22 17:50:35 +08:00
1 parent 5fa6a7e2c1
commit 73f9fcd8bc
20 files changed
+4597 -547

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@ namespace AllBase
/// <summary>
/// 版本ID
/// </summary>
public static int VersionCount = 638;
public static int VersionCount = 650;
//public static int VersionCount = 613;
/// <summary>
@@ -33,6 +33,7 @@ namespace AllBase.Model.Result.PDDResult
public string thumb_url { get; set; } // "https://img.pddpic.com/gaudit-image/2025-10-11/53d910624aa2976ce40a6f86ee7c152d.jpeg",
public bool? is_filtered { get; set; } // false, 如果是true则不能设置优惠券
public string filtered_reason { get; set; } // "该商品已售罄"
public extension_info extension { get; set; }
public int? filtered_reason_type { get; set; } // 0,
public bool? is_selected { get; set; } // false,
public int? recommend_coupon_value { get; set; } // 300,
@@ -45,6 +46,11 @@ namespace AllBase.Model.Result.PDDResult
public string shopName { get; set; }
}
public class extension_info
{
public string hasInstallmentDeliverySku { get; set; }
}
public class recommend_coupon_value_info
{
public int? recommend_coupon_value { get; set; } // 1100,
+9
View File
@@ -441,6 +441,12 @@
<Compile Include="KJDForms\SystemForms\SystemRemoveRestrictionsForm.Designer.cs">
<DependentUpon>SystemRemoveRestrictionsForm.cs</DependentUpon>
</Compile>
<Compile Include="PDDForms\ProductForms\CouponForms\PDDProdActivityToolShouJianLiJianForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PDDForms\ProductForms\CouponForms\PDDProdActivityToolShouJianLiJianForm.Designer.cs">
<DependentUpon>PDDProdActivityToolShouJianLiJianForm.cs</DependentUpon>
</Compile>
<Compile Include="PDDForms\ProductForms\CouponForms\PDDProdCouponForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -954,6 +960,9 @@
<EmbeddedResource Include="KJDForms\SystemForms\SystemRemoveRestrictionsForm.resx">
<DependentUpon>SystemRemoveRestrictionsForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PDDForms\ProductForms\CouponForms\PDDProdActivityToolShouJianLiJianForm.resx">
<DependentUpon>PDDProdActivityToolShouJianLiJianForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PDDForms\ProductForms\CouponForms\PDDProdCouponForm.resx">
<DependentUpon>PDDProdCouponForm.cs</DependentUpon>
</EmbeddedResource>
@@ -39,6 +39,7 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DbProductSelectListManageForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.chkLongTitle = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkSameExtcodeRandomMainImg = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.lblSkuRandomLetterNotes = new System.Windows.Forms.Label();
this.btnAdd = new DevComponents.DotNetBar.PanelEx();
@@ -145,7 +146,6 @@
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();
@@ -224,6 +224,18 @@
this.splitContainer1.SplitterDistance = 100;
this.splitContainer1.TabIndex = 2;
//
// 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;
//
// chkSameExtcodeRandomMainImg
//
this.chkSameExtcodeRandomMainImg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -820,7 +832,7 @@
"核价成功",
"核价成功(重复)",
"重复"});
this.cmbNotes.Location = new System.Drawing.Point(917, 5);
this.cmbNotes.Location = new System.Drawing.Point(917, 8);
this.cmbNotes.Margin = new System.Windows.Forms.Padding(0);
this.cmbNotes.Name = "cmbNotes";
this.cmbNotes.Size = new System.Drawing.Size(65, 25);
@@ -845,7 +857,7 @@
"已上传",
"草稿箱",
"全部"});
this.cmbStatus.Location = new System.Drawing.Point(814, 5);
this.cmbStatus.Location = new System.Drawing.Point(814, 8);
this.cmbStatus.Margin = new System.Windows.Forms.Padding(0);
this.cmbStatus.Name = "cmbStatus";
this.cmbStatus.Size = new System.Drawing.Size(65, 25);
@@ -1212,7 +1224,7 @@
"全部",
"重上",
"已买"});
this.cmbUserNotes.Location = new System.Drawing.Point(1044, 5);
this.cmbUserNotes.Location = new System.Drawing.Point(1044, 8);
this.cmbUserNotes.Margin = new System.Windows.Forms.Padding(0);
this.cmbUserNotes.Name = "cmbUserNotes";
this.cmbUserNotes.Size = new System.Drawing.Size(65, 25);
@@ -1685,18 +1697,6 @@
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;
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,198 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="colSelect.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colShopLoginName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colShopId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colShopNotes.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSelectProduct.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colLoginStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colCanUse.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colRemaining.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colMessage.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colCheck.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSupplierId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSupplierName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_event_sn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colImgUrl.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colImg.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSpuId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colProductName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colPrice.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colActivityPrice.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colStock.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colActivityStock.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colFavorites.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSales.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSalesThirtyDays.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colIsCanSet.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colOpResult.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>
@@ -37,6 +37,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.btnStopActvity = new DevComponents.DotNetBar.PanelEx();
this.pnlTime = new System.Windows.Forms.Panel();
this.dtpCoupon1StartTime = new System.Windows.Forms.DateTimePicker();
this.lblStartTime = new System.Windows.Forms.Label();
@@ -85,7 +86,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn();
this.colProductName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colActivityPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colStock = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colActivityStock = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colFavorites = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSales = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSalesThirtyDays = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -140,7 +143,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer3);
this.splitContainer1.Size = new System.Drawing.Size(1208, 541);
this.splitContainer1.Size = new System.Drawing.Size(1184, 521);
this.splitContainer1.SplitterDistance = 140;
this.splitContainer1.TabIndex = 15;
//
@@ -151,6 +154,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
| 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.btnStopActvity);
this.ucGroupBoxEx2.Controls.Add(this.pnlTime);
this.ucGroupBoxEx2.Controls.Add(this.numQuantity);
this.ucGroupBoxEx2.Controls.Add(this.lblQuantity);
@@ -169,11 +173,36 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.ucGroupBoxEx2.Controls.Add(this.btnCreate);
this.ucGroupBoxEx2.Location = new System.Drawing.Point(147, 2);
this.ucGroupBoxEx2.Name = "ucGroupBoxEx2";
this.ucGroupBoxEx2.Size = new System.Drawing.Size(1058, 140);
this.ucGroupBoxEx2.Size = new System.Drawing.Size(1034, 140);
this.ucGroupBoxEx2.TabIndex = 667;
this.ucGroupBoxEx2.TabStop = false;
this.ucGroupBoxEx2.Text = "商品查询创建";
//
// btnStopActvity
//
this.btnStopActvity.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnStopActvity.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnStopActvity.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnStopActvity.DisabledBackColor = System.Drawing.Color.Empty;
this.btnStopActvity.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnStopActvity.Location = new System.Drawing.Point(898, 87);
this.btnStopActvity.Name = "btnStopActvity";
this.btnStopActvity.Size = new System.Drawing.Size(104, 23);
this.btnStopActvity.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnStopActvity.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnStopActvity.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnStopActvity.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnStopActvity.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnStopActvity.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnStopActvity.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnStopActvity.Style.GradientAngle = 90;
this.btnStopActvity.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnStopActvity.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnStopActvity.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnStopActvity.TabIndex = 746;
this.btnStopActvity.Text = "一键结束活动";
this.btnStopActvity.Click += new System.EventHandler(this.btnStopActvity_Click);
//
// pnlTime
//
this.pnlTime.Controls.Add(this.dtpCoupon1StartTime);
@@ -422,7 +451,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.btnCreate.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCreate.DisabledBackColor = System.Drawing.Color.Empty;
this.btnCreate.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCreate.Location = new System.Drawing.Point(922, 32);
this.btnCreate.Location = new System.Drawing.Point(898, 32);
this.btnCreate.Name = "btnCreate";
this.btnCreate.Size = new System.Drawing.Size(104, 23);
this.btnCreate.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -494,8 +523,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
// splitContainer3.Panel2
//
this.splitContainer3.Panel2.Controls.Add(this.splitContainer4);
this.splitContainer3.Size = new System.Drawing.Size(1208, 397);
this.splitContainer3.SplitterDistance = 367;
this.splitContainer3.Size = new System.Drawing.Size(1184, 377);
this.splitContainer3.SplitterDistance = 347;
this.splitContainer3.TabIndex = 1;
//
// splitContainer2
@@ -516,7 +545,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.splitContainer2.Panel2.Controls.Add(this.panel1);
this.splitContainer2.Panel2.Controls.Add(this.dgvProduct);
this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0);
this.splitContainer2.Size = new System.Drawing.Size(1208, 367);
this.splitContainer2.Size = new System.Drawing.Size(1184, 347);
this.splitContainer2.SplitterDistance = 300;
this.splitContainer2.TabIndex = 0;
//
@@ -554,7 +583,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.dgvShop.ReadOnly = true;
this.dgvShop.RowHeadersWidth = 25;
this.dgvShop.RowTemplate.Height = 23;
this.dgvShop.Size = new System.Drawing.Size(296, 367);
this.dgvShop.Size = new System.Drawing.Size(296, 347);
this.dgvShop.TabIndex = 6;
this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick);
//
@@ -644,7 +673,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
//
this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue;
this.pbLoading.Location = new System.Drawing.Point(427, 158);
this.pbLoading.Location = new System.Drawing.Point(415, 148);
this.pbLoading.Name = "pbLoading";
this.pbLoading.Size = new System.Drawing.Size(50, 50);
this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -660,7 +689,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.panel1.Controls.Add(this.ucSplitPage1);
this.panel1.Location = new System.Drawing.Point(36, 53);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(830, 281);
this.panel1.Size = new System.Drawing.Size(806, 261);
this.panel1.TabIndex = 189;
//
// ucSplitPage1
@@ -668,7 +697,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.ucSplitPage1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ucSplitPage1.CurrentPage = 1;
this.ucSplitPage1.IsShowPageSize = false;
this.ucSplitPage1.Location = new System.Drawing.Point(245, 244);
this.ucSplitPage1.Location = new System.Drawing.Point(221, 224);
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
this.ucSplitPage1.Name = "ucSplitPage1";
this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
@@ -704,7 +733,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.colSpuId,
this.colProductName,
this.colPrice,
this.colActivityPrice,
this.colStock,
this.colActivityStock,
this.colFavorites,
this.colSales,
this.colSalesThirtyDays,
@@ -715,7 +746,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.dgvProduct.Name = "dgvProduct";
this.dgvProduct.ReadOnly = true;
this.dgvProduct.RowTemplate.Height = 23;
this.dgvProduct.Size = new System.Drawing.Size(900, 367);
this.dgvProduct.Size = new System.Drawing.Size(876, 347);
this.dgvProduct.TabIndex = 187;
this.dgvProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvProduct_CellContentClick);
//
@@ -782,6 +813,14 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.colPrice.ReadOnly = true;
this.colPrice.Width = 90;
//
// colActivityPrice
//
this.colActivityPrice.HeaderText = "活动价格";
this.colActivityPrice.Name = "colActivityPrice";
this.colActivityPrice.ReadOnly = true;
this.colActivityPrice.Visible = false;
this.colActivityPrice.Width = 90;
//
// colStock
//
this.colStock.HeaderText = "库存";
@@ -789,6 +828,13 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.colStock.ReadOnly = true;
this.colStock.Width = 70;
//
// colActivityStock
//
this.colActivityStock.HeaderText = "活动库存";
this.colActivityStock.Name = "colActivityStock";
this.colActivityStock.ReadOnly = true;
this.colActivityStock.Visible = false;
//
// colFavorites
//
this.colFavorites.HeaderText = "收藏";
@@ -841,8 +887,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
//
this.splitContainer4.Panel2.Controls.Add(this.btnClear);
this.splitContainer4.Panel2.Controls.Add(this.btnCancel);
this.splitContainer4.Size = new System.Drawing.Size(1208, 26);
this.splitContainer4.SplitterDistance = 517;
this.splitContainer4.Size = new System.Drawing.Size(1184, 26);
this.splitContainer4.SplitterDistance = 493;
this.splitContainer4.TabIndex = 3;
//
// statusBar
@@ -853,7 +899,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
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(517, 26);
this.statusBar.Size = new System.Drawing.Size(493, 26);
this.statusBar.TabIndex = 2;
//
// btnClear
@@ -904,12 +950,13 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.btnCancel.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.btnCancel.TabIndex = 668;
this.btnCancel.Text = "停止当前操作";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// PDDProdActivityToolXianShiXianLiangForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1208, 541);
this.ClientSize = new System.Drawing.Size(1184, 521);
this.Controls.Add(this.splitContainer1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "PDDProdActivityToolXianShiXianLiangForm";
@@ -979,20 +1026,6 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
private System.Windows.Forms.Panel panel1;
private UserControls.UcSplitPage ucSplitPage1;
private UserComponent.DataGridViewEx dgvProduct;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colImg;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductName;
private System.Windows.Forms.DataGridViewTextBoxColumn colPrice;
private System.Windows.Forms.DataGridViewTextBoxColumn colStock;
private System.Windows.Forms.DataGridViewTextBoxColumn colFavorites;
private System.Windows.Forms.DataGridViewTextBoxColumn colSales;
private System.Windows.Forms.DataGridViewTextBoxColumn colSalesThirtyDays;
private System.Windows.Forms.DataGridViewTextBoxColumn colIsCanSet;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
private System.Windows.Forms.SplitContainer splitContainer4;
private UserControls.StatusBarUserControl statusBar;
private DevComponents.DotNetBar.PanelEx btnClear;
@@ -1011,5 +1044,22 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
private DevComponents.DotNetBar.Controls.Line line2;
private UserComponent.UcCheckBox chkTime;
private System.Windows.Forms.Panel pnlTime;
private DevComponents.DotNetBar.PanelEx btnStopActvity;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colImg;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductName;
private System.Windows.Forms.DataGridViewTextBoxColumn colPrice;
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityPrice;
private System.Windows.Forms.DataGridViewTextBoxColumn colStock;
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityStock;
private System.Windows.Forms.DataGridViewTextBoxColumn colFavorites;
private System.Windows.Forms.DataGridViewTextBoxColumn colSales;
private System.Windows.Forms.DataGridViewTextBoxColumn colSalesThirtyDays;
private System.Windows.Forms.DataGridViewTextBoxColumn colIsCanSet;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
}
}
@@ -92,7 +92,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
if (row == null)
{
this.dgvShop.Rows.Add(
!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse),
//!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse),
canUse,
shopEntity.LoginName,
shopEntity.ShopId,
shopEntity.ShopAccount,
@@ -106,7 +107,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
}
else
{
row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse);
//row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse);
row.Cells["colSelect"].Value = selectShopId.Contains(shopEntity.ShopId);
row.Cells["colShopLoginName"].Value = shopEntity.LoginName;
row.Cells["colShopName"].Value = shopEntity.ShopAccount;
row.Cells["colShopNotes"].Value = shopEntity.Notes;
@@ -178,7 +180,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
return result;
}
public string get_xianshixianliang_goods_skus(ShopLoginInfo shop, List<long> goodsIdLst, long startTime, long endTime, int page = 1, int pageSize = 20)
public string get_xianshixianliang_goods_skus(ShopLoginInfo shop, List<long> goodsIdLst)
{
var anti = shop.AntiContents.LastOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
@@ -235,6 +237,56 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
return result;
}
public string get_xianshixianliang_activity_prod_list(ShopLoginInfo shop, int page = 1, int pageSize = 20)
{
var anti = shop.AntiContents.LastOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
string url = "https://mms.pinduoduo.com/libra-backend/mms/activity/marketing/query";
string body = @"{""status_list"":[1,2],""activity_types"":[3,12],""page_no"":" + page + @",""page_size"":" + pageSize + @",""order"":1}";
string refere = "https://mms.pinduoduo.com/tool/promotion?tool_full_channel=10921_77271&activeKey=1";
var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++)
{
shop.AntiContents.Remove(anti);
anti = shop.AntiContents.FirstOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
{
Thread.Sleep(Randomx.GetId(500, 1500));
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
}
}
return result;
}
public string stop_xianshixianliang_activity(ShopLoginInfo shop, long activityId, long goodsId = 20)
{
var anti = shop.AntiContents.LastOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
string url = "https://mms.pinduoduo.com/libra-backend/mms/activity/marketing/stop";
string body = "{\"activity_id\":" + activityId + ",\"goods_id\":" + goodsId + "}";
string refere = "https://mms.pinduoduo.com/tool/promotion?tool_full_channel=10921_77271";
var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++)
{
shop.AntiContents.Remove(anti);
anti = shop.AntiContents.FirstOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
{
Thread.Sleep(Randomx.GetId(500, 1500));
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
}
}
return result;
}
private void btnCreate_Click(object sender, EventArgs e)
{
var lstShopId = dgvShop.Rows.Cast<DataGridViewRow>()
@@ -256,10 +308,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
{
row.Cells["colMessage"].Value = "";
}
this.dgvProduct.Columns["colActivityStock"].Visible = false;
this.dgvProduct.Columns["colActivityPrice"].Visible = false;
if (PDDShopLoginForm.shopLoginInstance != null && PDDShopLoginForm.shopLoginInstance.IsDisposed != true)
PDDShopLoginForm.shopLoginInstance.Dispose();
ucGroupBoxEx2.Enabled = false;
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
@@ -320,24 +371,27 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
int totalPage = 1;
bool isError = false;
string errMsg = "";
while (page < totalPage)
while (page <= totalPage)
{
if (cancellationTokenSource.IsCancellationRequested)
break;
page++;
if (page == 0)
page++;
PDDActivityToolGoodsListInfo pddActivityToolGoodsTmp = new PDDActivityToolGoodsListInfo();
int tryCount = 0;
int pageSpan = 0;
tryAgain:
GetToken(shop);
if (page > 1)
if (page >= 1)
Thread.Sleep(Randomx.GetId(3000, 7000));
long startStamp = BaseClass.DateTimeToTimestampSeconds(dtpCoupon1StartTime.Value);
long endStamp = BaseClass.DateTimeToTimestampSeconds(dtpCoupon1StartTime.Value.Date.AddDays(numCoupon1KeepDays.Value.ParseToInt())) - 1;
string jsonStr = get_xianshixianliang_goods(shop, startStamp, endStamp, chkQuantity.Checked ? 3 : 12, page, pageSize);
string jsonStr = get_xianshixianliang_goods(shop, startStamp, endStamp, chkQuantity.Checked ? 3 : 12, page + pageSpan, pageSize);
jsonStr = GetHtml.Unicode2String(jsonStr);
if (jsonStr.Contains("繁忙") && tryCount < 5)
{
@@ -355,25 +409,43 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
string sErr = BaseRegex.GetStringJson(ref jsonStr, "error_msg");
if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr))
errMsg += sErr + " ";
page++;
continue;
}
if (jsonStr.Contains("\"success\":true"))
{
PDDActivityToolGoodsListInfo pddActivityToolGoodsTmp = new PDDActivityToolGoodsListInfo();
int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt();
totalPage = Math.Ceiling(1m * total / pageSize).ParseToInt();
try
{
var jObj = JObject.Parse(jsonStr);
var rstStr = JsonHelper.SerializeObject(jObj["result"]);
pddActivityToolGoodsTmp = JsonHelper.DeserializeJsonToObject<PDDActivityToolGoodsListInfo>(rstStr);
var pddActivityToolGoodsTmp2 = JsonHelper.DeserializeJsonToObject<PDDActivityToolGoodsListInfo>(rstStr);
pddActivityToolGoodsTmp.remaining_create_num = pddActivityToolGoodsTmp.remaining_create_num;
pddActivityToolGoodsTmp.total = pddActivityToolGoodsTmp.total;
pddActivityToolGoodsTmp.goods_list.AddRange(pddActivityToolGoodsTmp2.goods_list);
this.pddActivityToolGoods.remaining_create_num = pddActivityToolGoodsTmp.remaining_create_num;
this.pddActivityToolGoods.total = pddActivityToolGoodsTmp.total;
}
catch (Exception ex)
{
BaseMsgForm.ShowError(ex.Message);
BaseMsgForm.ShowError(ex.Message);
}
pddActivityToolGoodsTmp.goods_list = pddActivityToolGoodsTmp.goods_list.Where(g => !pddActivityToolGoods.goods_list.Any(a => a.goods_id == g.goods_id)).ToList();
if (pddActivityToolGoodsTmp.goods_list.Count == 0)
{
page++;
continue;
}
if (page + pageSpan < totalPage && pddActivityToolGoodsTmp.goods_list.Count < 8)
{
pageSpan++;
goto tryAgain;
}
pageSpan = 0;
foreach (var pInfo in pddActivityToolGoodsTmp.goods_list)
{
pInfo.shopId = shop.ShopId;
@@ -393,7 +465,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
pInfo.goods_id,
pInfo.goods_name,
string.Join("~", pInfo.sku_group_price.Select(s => s / 100m)),
"",
pInfo.quantity,
"",
"", //收藏
"", //总销量
"", //30日销量
@@ -405,14 +479,14 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
}));
}
}
int discountVal = 0;
Invoke(new Action(() =>
{
discountVal = (numReducedAmount.Value * 100).ParseToInt();
}));
var jsonSkusStr = get_xianshixianliang_goods_skus(shop, pddActivityToolGoodsTmp.goods_list.Select(g => g.goods_id.ParseToLong()).ToList(),
startStamp, endStamp, page, pageSize);
var jsonSkusStr = get_xianshixianliang_goods_skus(shop, pddActivityToolGoodsTmp.goods_list.Select(g => g.goods_id.ParseToLong()).ToList());
jsonSkusStr = GetHtml.Unicode2String(jsonSkusStr);
if (!jsonSkusStr.Contains("\"success\":true"))
{
@@ -424,7 +498,6 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
string sErr = BaseRegex.GetStringJson(ref jsonSkusStr, "error_msg");
if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr))
errMsg += sErr + " ";
page++;
continue;
}
List<PDDActivityToolGoodsSkuListInfo> pddActivityToolGoodsSkuListTmp = new List<PDDActivityToolGoodsSkuListInfo>();
@@ -576,9 +649,6 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); }
}
}
int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt();
totalPage = Math.Ceiling(1m * total / pageSize).ParseToInt();
}
}
@@ -624,30 +694,51 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
{
dicShopGetCount[shop] = 0;
while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed)
{
Thread.Sleep(500);
}
//while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed)
//{
// Thread.Sleep(500);
//}
//Invoke(new Action(() =>
//{
// this.panel1.SendToBack();
// PDDShopLoginForm loginForm = new PDDShopLoginForm(shop);
// loginForm.TopLevel = false;
// loginForm.openType = EnumOpenType.manage;
// loginForm.WindowState = FormWindowState.Maximized;
// loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/";
// loginForm.Dock = DockStyle.Fill;
// this.panel1.Controls.Add(loginForm);
// loginForm.Show();
//}));
//int sleepTime = Randomx.GetId(2000, 3000);
//Thread.Sleep(sleepTime);
//Invoke(new Action(() =>
//{
// if (PDDShopLoginForm.shopLoginInstance != null)
// PDDShopLoginForm.shopLoginInstance.Dispose();
//}));
PDDShopLoginForm loginForm = null;
Invoke(new Action(() =>
{
this.panel1.SendToBack();
PDDShopLoginForm loginForm = new PDDShopLoginForm(shop);
loginForm = new PDDShopLoginForm(shop);
loginForm.TopLevel = false;
loginForm.openType = EnumOpenType.manage;
loginForm.WindowState = FormWindowState.Maximized;
loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/";
loginForm.InitUrl = "https://mms.pinduoduo.com/home/";
loginForm.Dock = DockStyle.Fill;
this.panel1.Controls.Add(loginForm);
loginForm.Show();
}));
int sleepTime = Randomx.GetId(2000, 3000);
Thread.Sleep(sleepTime);
Thread.Sleep(Randomx.GetId(3000, 5000));
Invoke(new Action(() =>
{
if (PDDShopLoginForm.shopLoginInstance != null)
PDDShopLoginForm.shopLoginInstance.Dispose();
if (loginForm != null)
loginForm.Close();
}));
}
}
@@ -717,5 +808,304 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
{
chkDiscountTenth.Checked = !chkReducedAmount.Checked;
}
private void btnStopActvity_Click(object sender, EventArgs e)
{
var lstShopId = dgvShop.Rows.Cast<DataGridViewRow>()
.Where(row => row.Cells["colSelect"]?.Value.ParseToBool() == true && row.Cells["colLoginStatus"]?.Value.ParseToString() == "在线")
.Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
if (lstShopId.Count == 0)
{
BaseMsgForm.ShowInfo("请选择登录的店铺!");
return;
}
pddActivityToolGoods.goods_list.Clear();
pddActivityToolGoods.remaining_create_num = 1;
pddActivityToolGoods.total = 1;
dgvProduct.Rows.Clear();
List<marketing_activity_info> activityGoodsInfoLst = new List<marketing_activity_info>();
var dgvRows = this.dgvShop.Rows.Cast<DataGridViewRow>();//.Where(r => lstShopId.Contains(r.Cells["colShopId"].Value.ParseToString()));
foreach (var row in dgvRows)
{
row.Cells["colMessage"].Value = "";
}
this.dgvProduct.Columns["colActivityStock"].Visible = true;
this.dgvProduct.Columns["colActivityPrice"].Visible = true;
ucGroupBoxEx2.Enabled = false;
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
var lstShopIdTemp = new List<string>();
lstShopIdTemp.AddRange(lstShopId);
int i = 0;
foreach (var shopId in lstShopIdTemp)
{
this.Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "正在查询...";
this.statusBar.pgbTaskProgress.Maximum = lstShopIdTemp.Count;
this.statusBar.UpdateProgressBar(i + 1);
i++;
}));
if (cancellationTokenSource.IsCancellationRequested)
break;
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
if (shop == null)
continue;
#region 检测登录
if (shop.LoginStatus == "登录成功")
{
PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
}
if (shop.LoginStatus != "登录成功")
{
Invoke(new Action(() =>
{
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopLoginName"].Value.ToString() == shop.LoginName);
foreach (var row in rows)
{
row.Cells["colMessage"].Value = "店铺掉线";
row.Cells["colLoginStatus"].Value = "掉线";
row.Cells["colCanUse"].Value = false;
}
}));
continue;
}
#endregion
Invoke(new Action(() =>
{
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
foreach (var row in rows)
{
row.Cells["colMessage"].Value = "正在查询";
}
}));
int page = 0;
int pageSize = 20;
int totalPage = 1;
bool isError = false;
string errMsg = "";
while (page < totalPage)
{
if (cancellationTokenSource.IsCancellationRequested)
break;
if (page == 0)
page++;
int tryCount = 0;
tryAgain:
GetToken(shop);
if (page >= 1)
Thread.Sleep(Randomx.GetId(3000, 7000));
//long startStamp = BaseClass.DateTimeToTimestampSeconds(dtpCoupon1StartTime.Value);
//long endStamp = BaseClass.DateTimeToTimestampSeconds(dtpCoupon1StartTime.Value.Date.AddDays(numCoupon1KeepDays.Value.ParseToInt())) - 1;
string jsonStr = get_xianshixianliang_activity_prod_list(shop, page, pageSize);
jsonStr = GetHtml.Unicode2String(jsonStr);
if (jsonStr.Contains("繁忙") && tryCount < 5)
{
tryCount++;
Thread.Sleep(Randomx.GetId(5000, 10000));
goto tryAgain;
}
if (!jsonStr.Contains("\"success\":true"))
{
PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
if (shop.LoginStatus != "登录成功")
break;
isError = true;
string sErr = BaseRegex.GetStringJson(ref jsonStr, "error_msg");
if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr))
errMsg += sErr + " ";
continue;
}
if (jsonStr.Contains("\"success\":true"))
{
MarketingActivityResult marketingActivityRst = new MarketingActivityResult();
try
{
var jObj = JObject.Parse(jsonStr);
var rstStr = JsonHelper.SerializeObject(jObj["result"]);
marketingActivityRst = JsonHelper.DeserializeJsonToObject<MarketingActivityResult>(rstStr);
}
catch (Exception ex)
{
BaseMsgForm.ShowError(ex.Message);
}
foreach (var pInfo in marketingActivityRst.marketing_activity_list)
{
if (pInfo.online_quantity < pInfo.online_activity_quantity)
{
}
pInfo.shopId = shop.ShopId;
pInfo.shopName = shop.ShopAccount;
if (pInfo != null && !activityGoodsInfoLst.Any(a => a.goods_id == pInfo.goods_id))
{
activityGoodsInfoLst.Add(pInfo);
string url = pInfo.hd_thumb_url;
Invoke(new Action(() =>
{
int rowId = this.dgvProduct.Rows.Add(
/*pInfo.is_filtered !=*/ true,
shop.ShopId,
shop.ShopAccount,
url.Replace("https", "http"),
DataGridViewExtension.defaultBitmap, // 列表图片,public static Bitmap defaultBitmap = new Bitmap(1,1);
pInfo.goods_id,
pInfo.goods_name,
pInfo.min_on_sale_group_price / 100m + "~" + pInfo.max_on_sale_group_price / 100m,
pInfo.price_info.FirstOrDefault()?.min_pre_sale_price / 100m + "~" + pInfo.price_info.FirstOrDefault()?.max_pre_sale_price / 100m, //活动售价
pInfo.online_quantity,
pInfo.online_activity_quantity == 2147483647 ? "不限" : pInfo.online_activity_quantity.ToString(), // 活动库存
"", //收藏
"", //总销量
"", //30日销量
"可结束",
"" // 操作结果,状态
);
dgvProduct.Rows[rowId].Height = 60;
}));
}
}
if (marketingActivityRst.marketing_activity_list.Count == 0)
{
page++;
continue;
}
foreach (var activityGoods in marketingActivityRst.marketing_activity_list)
{
Thread.Sleep(Randomx.GetId(500, 1500));
if (cancellationTokenSource.IsCancellationRequested)
break;
var creatRst = stop_xianshixianliang_activity(shop, activityGoods.activity_id.ParseToLong(), activityGoods.goods_id.ParseToLong());
creatRst = GetHtml.Unicode2String(creatRst);
if (!creatRst.Contains("\"success\":true"))
{
var error = BaseRegex.GetStringJson(ref creatRst, "error_msg");
if (string.IsNullOrEmpty(error))
error = creatRst;
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(
r => r.Cells["colSpuId"].Value.ParseToLong() == activityGoods.goods_id);
if (row != null)
{
row.Cells["colOpResult"].Value = error;
}
}
else
{
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(
r => r.Cells["colSpuId"].Value.ParseToLong() == activityGoods.goods_id);
if (row != null)
{
row.Cells["colOpResult"].Value = "结束活动成功!";
}
}
}
int total = BaseRegex.GetStringJson(ref jsonStr, "online_sum").ParseToInt();
totalPage = Math.Ceiling(1m * total / pageSize).ParseToInt();
}
}
Invoke(new Action(() =>
{
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
if (!isError)
{
foreach (var row in rows)
{
row.Cells["colMessage"].Value = "已结束活动";
}
}
else
{
foreach (var row in rows)
{
row.Cells["colMessage"].Value = "结束活动失败 " + errMsg;
}
}
}));
}
Invoke(new Action(() =>
{
ucGroupBoxEx2.Enabled = true;
string sRst = "结束活动已完成!";
if (cancellationTokenSource.IsCancellationRequested)
sRst = "已取消结束活动!";
BaseMsgForm.ShowInfo(sRst);
this.statusBar.lblTaskStatus.Text = sRst;
}));
}, cancellationTokenSource.Token);
}
}
public class MarketingActivityResult
{
public List<marketing_activity_info> marketing_activity_list { get; set; }
public int? page_no { get; set; } // 1,
public int? page_size { get; set; } // 40,
public int? order { get; set; } // 1,
public int? record_sum { get; set; } // 189,
public int? online_sum { get; set; } // 189,
public int? batch_limit { get; set; } // 50,
public int? total_limit { get; set; } // 10000,
public long? server_time { get; set; } // 1761033081
}
public class marketing_activity_info
{
public long? activity_id { get; set; }
public string activity_name { get; set; }
public int? activity_type { get; set; }
public string activity_type_name
{
get
{
if (activity_type == 3)
return "限量优惠";
if (activity_type == 12)
return "限时优惠";
return "";
}
}
public long? goods_id { get; set; }
public string goods_name { get; set; }
public string hd_thumb_url { get; set; }
public int? min_on_sale_group_price { get; set; }
public int? max_on_sale_group_price { get; set; }
public int? online_quantity { get; set; }// 1584,
public int? online_activity_quantity { get; set; }// 100,
public int? sold_activity_quantity { get; set; }// 0,
public List<price_info> price_info { get; set; }
//自定义参数
public string shopId { get; set; }
public string shopName { get; set; }
}
public class price_info
{
public int? max_pre_sale_price { get; set; }// 8613,
public int? min_pre_sale_price { get; set; }// 8343,
}
}
@@ -168,9 +168,15 @@
<metadata name="colPrice.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colActivityPrice.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colStock.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colActivityStock.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colFavorites.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -17,6 +17,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
public Lazy<PDDProdCouponShangPinLiJianForm> prodCouponShangPinLiJianForm = new Lazy<PDDProdCouponShangPinLiJianForm>();
public Lazy<PDDProdCouponLingQuanZhongXinForm> prodCouponLingQuanZhongXinForm = new Lazy<PDDProdCouponLingQuanZhongXinForm>();
public Lazy<PDDProdActivityToolXianShiXianLiangForm> prodActivityToolXianShiXianLiangForm = new Lazy<PDDProdActivityToolXianShiXianLiangForm>();
public Lazy<PDDProdActivityToolShouJianLiJianForm> prodActivityToolShouJianLiJianForm = new Lazy<PDDProdActivityToolShouJianLiJianForm>();
public PDDProdCouponForm()
{
@@ -30,6 +31,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.ucTabControl1.TabPages.Add("商品立减券");
this.ucTabControl1.TabPages.Add("领券中心券");
this.ucTabControl1.TabPages.Add("限时限量购");
this.ucTabControl1.TabPages.Add("首件立减");
this.ucTabControl1.SelectedIndex = 0;
ucTabControl1_SelectedIndexChanged(null, null);
}
@@ -53,6 +55,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
case "限时限量购":
SetForm(prodActivityToolXianShiXianLiangForm.Value);
break;
case "首件立减":
SetForm(prodActivityToolShouJianLiJianForm.Value);
break;
}
}
@@ -30,13 +30,14 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
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();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = 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();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.btnStopCoupon = new DevComponents.DotNetBar.PanelEx();
this.label14 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.numCouponValue = new System.Windows.Forms.NumericUpDown();
@@ -71,9 +72,14 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.panel1 = new System.Windows.Forms.Panel();
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
this.dgvProduct = new TemuKJD.UserComponent.DataGridViewEx();
this.splitContainer4 = new System.Windows.Forms.SplitContainer();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.btnClear = new DevComponents.DotNetBar.PanelEx();
this.btnCancel = new DevComponents.DotNetBar.PanelEx();
this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSupplierName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col_coupon_sn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colImg = new System.Windows.Forms.DataGridViewImageColumn();
this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn();
@@ -85,10 +91,6 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.colSalesThirtyDays = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colIsCanSet = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.splitContainer4 = new System.Windows.Forms.SplitContainer();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.btnClear = new DevComponents.DotNetBar.PanelEx();
this.btnCancel = new DevComponents.DotNetBar.PanelEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -131,7 +133,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer3);
this.splitContainer1.Size = new System.Drawing.Size(1169, 515);
this.splitContainer1.Size = new System.Drawing.Size(1184, 521);
this.splitContainer1.SplitterDistance = 140;
this.splitContainer1.TabIndex = 14;
//
@@ -142,6 +144,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
| 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.btnStopCoupon);
this.ucGroupBoxEx2.Controls.Add(this.label14);
this.ucGroupBoxEx2.Controls.Add(this.label11);
this.ucGroupBoxEx2.Controls.Add(this.numCouponValue);
@@ -159,11 +162,36 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.ucGroupBoxEx2.Controls.Add(this.label1);
this.ucGroupBoxEx2.Location = new System.Drawing.Point(147, 2);
this.ucGroupBoxEx2.Name = "ucGroupBoxEx2";
this.ucGroupBoxEx2.Size = new System.Drawing.Size(1019, 140);
this.ucGroupBoxEx2.Size = new System.Drawing.Size(1034, 140);
this.ucGroupBoxEx2.TabIndex = 667;
this.ucGroupBoxEx2.TabStop = false;
this.ucGroupBoxEx2.Text = "商品查询";
//
// btnStopCoupon
//
this.btnStopCoupon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnStopCoupon.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnStopCoupon.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnStopCoupon.DisabledBackColor = System.Drawing.Color.Empty;
this.btnStopCoupon.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnStopCoupon.Location = new System.Drawing.Point(898, 87);
this.btnStopCoupon.Name = "btnStopCoupon";
this.btnStopCoupon.Size = new System.Drawing.Size(104, 23);
this.btnStopCoupon.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnStopCoupon.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnStopCoupon.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnStopCoupon.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnStopCoupon.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnStopCoupon.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnStopCoupon.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnStopCoupon.Style.GradientAngle = 90;
this.btnStopCoupon.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnStopCoupon.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnStopCoupon.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnStopCoupon.TabIndex = 750;
this.btnStopCoupon.Text = "一键结束优惠";
this.btnStopCoupon.Click += new System.EventHandler(this.btnStopCoupon_Click);
//
// label14
//
this.label14.AutoSize = true;
@@ -310,7 +338,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.btnCreate.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCreate.DisabledBackColor = System.Drawing.Color.Empty;
this.btnCreate.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCreate.Location = new System.Drawing.Point(883, 32);
this.btnCreate.Location = new System.Drawing.Point(898, 32);
this.btnCreate.Name = "btnCreate";
this.btnCreate.Size = new System.Drawing.Size(104, 23);
this.btnCreate.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -392,8 +420,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
// splitContainer3.Panel2
//
this.splitContainer3.Panel2.Controls.Add(this.splitContainer4);
this.splitContainer3.Size = new System.Drawing.Size(1169, 371);
this.splitContainer3.SplitterDistance = 341;
this.splitContainer3.Size = new System.Drawing.Size(1184, 377);
this.splitContainer3.SplitterDistance = 347;
this.splitContainer3.TabIndex = 1;
//
// splitContainer2
@@ -414,7 +442,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.splitContainer2.Panel2.Controls.Add(this.panel1);
this.splitContainer2.Panel2.Controls.Add(this.dgvProduct);
this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0);
this.splitContainer2.Size = new System.Drawing.Size(1169, 341);
this.splitContainer2.Size = new System.Drawing.Size(1184, 347);
this.splitContainer2.SplitterDistance = 300;
this.splitContainer2.TabIndex = 0;
//
@@ -422,18 +450,18 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
//
this.dgvShop.AllowUserToAddRows = false;
this.dgvShop.AllowUserToDeleteRows = false;
dataGridViewCellStyle6.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgvShop.BackgroundColor = System.Drawing.Color.White;
this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle7.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
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,
@@ -452,7 +480,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.dgvShop.ReadOnly = true;
this.dgvShop.RowHeadersWidth = 25;
this.dgvShop.RowTemplate.Height = 23;
this.dgvShop.Size = new System.Drawing.Size(296, 341);
this.dgvShop.Size = new System.Drawing.Size(296, 347);
this.dgvShop.TabIndex = 6;
this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick);
//
@@ -542,7 +570,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
//
this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue;
this.pbLoading.Location = new System.Drawing.Point(407, 145);
this.pbLoading.Location = new System.Drawing.Point(415, 148);
this.pbLoading.Name = "pbLoading";
this.pbLoading.Size = new System.Drawing.Size(50, 50);
this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -558,7 +586,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.panel1.Controls.Add(this.ucSplitPage1);
this.panel1.Location = new System.Drawing.Point(36, 53);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(791, 255);
this.panel1.Size = new System.Drawing.Size(806, 261);
this.panel1.TabIndex = 189;
//
// ucSplitPage1
@@ -566,7 +594,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.ucSplitPage1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ucSplitPage1.CurrentPage = 1;
this.ucSplitPage1.IsShowPageSize = false;
this.ucSplitPage1.Location = new System.Drawing.Point(206, 218);
this.ucSplitPage1.Location = new System.Drawing.Point(221, 224);
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
this.ucSplitPage1.Name = "ucSplitPage1";
this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
@@ -580,23 +608,24 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
//
this.dgvProduct.AllowUserToAddRows = false;
this.dgvProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle8.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle8;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
this.dgvProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle9.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle9;
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.dgvProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.dgvProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
this.colSupplierId,
this.colSupplierName,
this.col_coupon_sn,
this.colImgUrl,
this.colImg,
this.colSpuId,
@@ -613,10 +642,90 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.dgvProduct.Name = "dgvProduct";
this.dgvProduct.ReadOnly = true;
this.dgvProduct.RowTemplate.Height = 23;
this.dgvProduct.Size = new System.Drawing.Size(861, 341);
this.dgvProduct.Size = new System.Drawing.Size(876, 347);
this.dgvProduct.TabIndex = 187;
this.dgvProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvProduct_CellContentClick);
//
// splitContainer4
//
this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer4.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer4.Location = new System.Drawing.Point(0, 0);
this.splitContainer4.Name = "splitContainer4";
//
// splitContainer4.Panel1
//
this.splitContainer4.Panel1.Controls.Add(this.statusBar);
//
// splitContainer4.Panel2
//
this.splitContainer4.Panel2.Controls.Add(this.btnClear);
this.splitContainer4.Panel2.Controls.Add(this.btnCancel);
this.splitContainer4.Size = new System.Drawing.Size(1184, 26);
this.splitContainer4.SplitterDistance = 493;
this.splitContainer4.TabIndex = 3;
//
// statusBar
//
this.statusBar.BackColor = System.Drawing.Color.White;
this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill;
this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
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(493, 26);
this.statusBar.TabIndex = 2;
//
// btnClear
//
this.btnClear.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.btnClear.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnClear.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnClear.DisabledBackColor = System.Drawing.Color.Empty;
this.btnClear.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnClear.Location = new System.Drawing.Point(4, 1);
this.btnClear.Name = "btnClear";
this.btnClear.Size = new System.Drawing.Size(90, 21);
this.btnClear.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnClear.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClear.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClear.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnClear.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnClear.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnClear.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnClear.Style.GradientAngle = 90;
this.btnClear.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnClear.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnClear.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnClear.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.btnClear.TabIndex = 440;
this.btnClear.Text = "清空结果";
this.btnClear.Visible = false;
//
// btnCancel
//
this.btnCancel.CanvasColor = System.Drawing.SystemColors.Control;
this.btnCancel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnCancel.DisabledBackColor = System.Drawing.Color.Empty;
this.btnCancel.Location = new System.Drawing.Point(568, 1);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(115, 21);
this.btnCancel.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnCancel.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnCancel.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnCancel.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.btnCancel.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnCancel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.btnCancel.Style.GradientAngle = 90;
this.btnCancel.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
this.btnCancel.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnCancel.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnCancel.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnCancel.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.btnCancel.TabIndex = 668;
this.btnCancel.Text = "停止当前操作";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// colCheck
//
this.colCheck.Frozen = true;
@@ -640,6 +749,13 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.colSupplierName.ReadOnly = true;
this.colSupplierName.Width = 110;
//
// col_coupon_sn
//
this.col_coupon_sn.HeaderText = "活动编码";
this.col_coupon_sn.Name = "col_coupon_sn";
this.col_coupon_sn.ReadOnly = true;
this.col_coupon_sn.Visible = false;
//
// colImgUrl
//
this.colImgUrl.HeaderText = "图片地址";
@@ -666,8 +782,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
//
// colProductName
//
dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle10;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle5;
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
@@ -724,91 +840,11 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.colOpResult.ReadOnly = true;
this.colOpResult.Width = 200;
//
// splitContainer4
//
this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer4.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer4.Location = new System.Drawing.Point(0, 0);
this.splitContainer4.Name = "splitContainer4";
//
// splitContainer4.Panel1
//
this.splitContainer4.Panel1.Controls.Add(this.statusBar);
//
// splitContainer4.Panel2
//
this.splitContainer4.Panel2.Controls.Add(this.btnClear);
this.splitContainer4.Panel2.Controls.Add(this.btnCancel);
this.splitContainer4.Size = new System.Drawing.Size(1169, 26);
this.splitContainer4.SplitterDistance = 478;
this.splitContainer4.TabIndex = 3;
//
// statusBar
//
this.statusBar.BackColor = System.Drawing.Color.White;
this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill;
this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
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(478, 26);
this.statusBar.TabIndex = 2;
//
// btnClear
//
this.btnClear.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.btnClear.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnClear.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnClear.DisabledBackColor = System.Drawing.Color.Empty;
this.btnClear.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnClear.Location = new System.Drawing.Point(4, 1);
this.btnClear.Name = "btnClear";
this.btnClear.Size = new System.Drawing.Size(90, 21);
this.btnClear.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnClear.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClear.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClear.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnClear.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnClear.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnClear.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnClear.Style.GradientAngle = 90;
this.btnClear.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnClear.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnClear.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnClear.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.btnClear.TabIndex = 440;
this.btnClear.Text = "清空结果";
this.btnClear.Visible = false;
//
// btnCancel
//
this.btnCancel.CanvasColor = System.Drawing.SystemColors.Control;
this.btnCancel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnCancel.DisabledBackColor = System.Drawing.Color.Empty;
this.btnCancel.Location = new System.Drawing.Point(568, 1);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(115, 21);
this.btnCancel.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnCancel.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnCancel.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnCancel.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.btnCancel.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnCancel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.btnCancel.Style.GradientAngle = 90;
this.btnCancel.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
this.btnCancel.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnCancel.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnCancel.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnCancel.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.btnCancel.TabIndex = 668;
this.btnCancel.Text = "停止当前操作";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// PDDProdCouponJingXiForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1169, 515);
this.ClientSize = new System.Drawing.Size(1184, 521);
this.Controls.Add(this.splitContainer1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "PDDProdCouponJingXiForm";
@@ -883,9 +919,14 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
private System.Windows.Forms.Label label2;
private DevComponents.DotNetBar.PanelEx btnCreate;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.NumericUpDown numCouponValue;
private System.Windows.Forms.Label label14;
private DevComponents.DotNetBar.PanelEx btnStopCoupon;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewTextBoxColumn col_coupon_sn;
private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colImg;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
@@ -897,8 +938,5 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
private System.Windows.Forms.DataGridViewTextBoxColumn colSalesThirtyDays;
private System.Windows.Forms.DataGridViewTextBoxColumn colIsCanSet;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.NumericUpDown numCouponValue;
private System.Windows.Forms.Label label14;
}
}
@@ -92,7 +92,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
if (row == null)
{
this.dgvShop.Rows.Add(
!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse),
//!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse),
canUse,
shopEntity.LoginName,
shopEntity.ShopId,
shopEntity.ShopAccount,
@@ -106,7 +107,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
}
else
{
row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse);
//row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse);
row.Cells["colSelect"].Value = selectShopId.Contains(shopEntity.ShopId);
row.Cells["colShopLoginName"].Value = shopEntity.LoginName;
row.Cells["colShopName"].Value = shopEntity.ShopAccount;
row.Cells["colShopNotes"].Value = shopEntity.Notes;
@@ -201,6 +203,56 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
return result;
}
public string get_jingxi_coupon_goods_list(ShopLoginInfo shop, int batch_status, int page = 1, int pageSize = 20)
{
var anti = shop.AntiContents.LastOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
string url = "https://mms.pinduoduo.com/madrid/query_mms_mall_batch_list";
string body = "{\"page_num\":" + page + ",\"page_size\":" + pageSize + ",\"batch_dimension\":\"2\",\"source_type\":1242,\"batch_status\":" + batch_status + "}";
string refere = "https://mms.pinduoduo.com/tool/coupon?tab=1&tool_full_channel=10921_77272&couponStatusFilter=" + batch_status;
var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++)
{
shop.AntiContents.Remove(anti);
anti = shop.AntiContents.FirstOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
{
Thread.Sleep(Randomx.GetId(500, 1500));
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
}
}
return result;
}
public string close_jingxi_coupon(ShopLoginInfo shop, string event_sn, int batch_status)
{
var anti = shop.AntiContents.LastOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
string url = "https://mms.pinduoduo.com/madrid/close_mall_batch";
string body = @"{""batch_sn"":""" + event_sn + @"""}";
string refere = "https://mms.pinduoduo.com/tool/coupon?tab=1&tool_full_channel=10921_77272&couponStatusFilter=" + batch_status;
var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++)
{
shop.AntiContents.Remove(anti);
anti = shop.AntiContents.FirstOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
{
Thread.Sleep(Randomx.GetId(500, 1500));
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
}
}
return result;
}
private void btnCreate_Click(object sender, EventArgs e)
{
var lstShopId = dgvShop.Rows.Cast<DataGridViewRow>()
@@ -223,10 +275,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
{
row.Cells["colMessage"].Value = "";
}
this.dgvProduct.Columns["colPrice"].HeaderText = "价格";
this.dgvProduct.Columns["colStock"].HeaderText = "库存";
if (PDDShopLoginForm.shopLoginInstance != null && PDDShopLoginForm.shopLoginInstance.IsDisposed != true)
PDDShopLoginForm.shopLoginInstance.Dispose();
ucGroupBoxEx2.Enabled = false;
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
@@ -352,6 +403,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
pInfo.is_filtered != true,
shop.ShopId,
shop.ShopAccount,
"",
url.Replace("https", "http"),
DataGridViewExtension.defaultBitmap, // 列表图片,public static Bitmap defaultBitmap = new Bitmap(1,1);
pInfo.id,
@@ -381,7 +433,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colSpuId"].Value.ParseToLong() == pInfo.id);
if (row != null)
{
row.Cells["colOpResult"].Value = "优惠券金额不在可设置范围内!";
row.Cells["colOpResult"].Value = "优惠券金额过高或过低!" +
pInfo.coupon_value_limit.FirstOrDefault() / 100m + "~" +
pInfo.coupon_value_limit.LastOrDefault() / 100m;
}
}
}
@@ -493,6 +547,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
}));
}, cancellationTokenSource.Token);
}
public void GetToken(ShopLoginInfo shop)
{
if (!dicShopGetCount.Keys.Contains(shop))
@@ -503,30 +558,51 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
{
dicShopGetCount[shop] = 0;
while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed)
{
Thread.Sleep(500);
}
//while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed)
//{
// Thread.Sleep(500);
//}
//Invoke(new Action(() =>
//{
// this.panel1.SendToBack();
// PDDShopLoginForm loginForm = new PDDShopLoginForm(shop);
// loginForm.TopLevel = false;
// loginForm.openType = EnumOpenType.manage;
// loginForm.WindowState = FormWindowState.Maximized;
// loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/";
// loginForm.Dock = DockStyle.Fill;
// this.panel1.Controls.Add(loginForm);
// loginForm.Show();
//}));
//int sleepTime = Randomx.GetId(2000, 3000);
//Thread.Sleep(sleepTime);
//Invoke(new Action(() =>
//{
// if (PDDShopLoginForm.shopLoginInstance != null)
// PDDShopLoginForm.shopLoginInstance.Dispose();
//}));
PDDShopLoginForm loginForm = null;
Invoke(new Action(() =>
{
this.panel1.SendToBack();
PDDShopLoginForm loginForm = new PDDShopLoginForm(shop);
loginForm = new PDDShopLoginForm(shop);
loginForm.TopLevel = false;
loginForm.openType = EnumOpenType.manage;
loginForm.WindowState = FormWindowState.Maximized;
loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/";
loginForm.InitUrl = "https://mms.pinduoduo.com/home/";
loginForm.Dock = DockStyle.Fill;
this.panel1.Controls.Add(loginForm);
loginForm.Show();
}));
int sleepTime = Randomx.GetId(2000, 3000);
Thread.Sleep(sleepTime);
Thread.Sleep(Randomx.GetId(3000, 5000));
Invoke(new Action(() =>
{
if (PDDShopLoginForm.shopLoginInstance != null)
PDDShopLoginForm.shopLoginInstance.Dispose();
if (loginForm != null)
loginForm.Close();
}));
}
}
@@ -566,5 +642,305 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
break;
}
}
private void btnStopCoupon_Click(object sender, EventArgs e)
{
var lstShopId = dgvShop.Rows.Cast<DataGridViewRow>()
.Where(row => row.Cells["colSelect"]?.Value.ParseToBool() == true && row.Cells["colLoginStatus"]?.Value.ParseToString() == "在线")
.Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
if (lstShopId.Count == 0)
{
BaseMsgForm.ShowInfo("请选择登录的店铺!");
return;
}
pddCouponGoods.goods_list.Clear();
pddCouponGoods.remaining_create_num = 1;
pddCouponGoods.total = 1;
dgvProduct.Rows.Clear();
List<jing_xi_coupon_data_info> couponGoodsInfoLst = new List<jing_xi_coupon_data_info>();
var dgvRows = this.dgvShop.Rows.Cast<DataGridViewRow>();//.Where(r => lstShopId.Contains(r.Cells["colShopId"].Value.ParseToString()));
foreach (var row in dgvRows)
{
row.Cells["colMessage"].Value = "";
}
this.dgvProduct.Columns["colPrice"].HeaderText = "面额";
this.dgvProduct.Columns["colStock"].HeaderText = "发行/领取量";
ucGroupBoxEx2.Enabled = false;
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
var lstShopIdTemp = new List<string>();
lstShopIdTemp.AddRange(lstShopId);
int i = 0;
foreach (var shopId in lstShopIdTemp)
{
this.Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "正在查询...";
this.statusBar.pgbTaskProgress.Maximum = lstShopIdTemp.Count;
this.statusBar.UpdateProgressBar(i + 1);
i++;
}));
if (cancellationTokenSource.IsCancellationRequested)
break;
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
if (shop == null)
continue;
#region 检测登录
if (shop.LoginStatus == "登录成功")
{
PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
}
if (shop.LoginStatus != "登录成功")
{
Invoke(new Action(() =>
{
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopLoginName"].Value.ToString() == shop.LoginName);
foreach (var row in rows)
{
row.Cells["colMessage"].Value = "店铺掉线";
row.Cells["colLoginStatus"].Value = "掉线";
row.Cells["colCanUse"].Value = false;
}
}));
continue;
}
#endregion
Invoke(new Action(() =>
{
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
foreach (var row in rows)
{
row.Cells["colMessage"].Value = "正在查询";
}
}));
bool isError = false;
string errMsg = "";
for (int status = 1; status <= 4; status++)
{
if (status != 1 && status != 4)
continue;
int page = 0;
int pageSize = 20;
int totalPage = 1;
while (page < totalPage)
{
if (cancellationTokenSource.IsCancellationRequested)
break;
if (page == 0)
page++;
int tryCount = 0;
tryAgain:
GetToken(shop);
if (page >= 1)
Thread.Sleep(Randomx.GetId(3000, 7000));
string jsonStr = get_jingxi_coupon_goods_list(shop, status, page, pageSize);
jsonStr = GetHtml.Unicode2String(jsonStr);
if (jsonStr.Contains("繁忙") && tryCount < 5)
{
tryCount++;
Thread.Sleep(Randomx.GetId(5000, 10000));
goto tryAgain;
}
if (!jsonStr.Contains("\"success\":true"))
{
PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
if (shop.LoginStatus != "登录成功")
break;
isError = true;
string sErr = BaseRegex.GetStringJson(ref jsonStr, "error_msg");
if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr))
errMsg += sErr + " ";
continue;
}
if (jsonStr.Contains("\"success\":true"))
{
JingXiCouponRst couponRst = new JingXiCouponRst();
try
{
var jObj = JObject.Parse(jsonStr);
var rstStr = JsonHelper.SerializeObject(jObj["result"]);
couponRst = JsonHelper.DeserializeJsonToObject<JingXiCouponRst>(rstStr);
}
catch (Exception ex)
{
BaseMsgForm.ShowError(ex.Message);
}
couponRst.data_list =
couponRst.data_list.Where(p => !couponGoodsInfoLst.Any(a => a.goods_id == p.goods_id)).ToList();
if (couponRst.data_list.Count == 0)
{
page++;
continue;
}
foreach (var pInfo in couponRst.data_list)
{
pInfo.shopId = shop.ShopId;
pInfo.shopName = shop.ShopAccount;
if (pInfo != null)
{
couponGoodsInfoLst.Add(pInfo);
string url = pInfo.image_url;
Invoke(new Action(() =>
{
int rowId = this.dgvProduct.Rows.Add(
/*pInfo.is_filtered !=*/ true,
shop.ShopId,
shop.ShopAccount,
pInfo.batch_sn,
url.Replace("https", "http"),
DataGridViewExtension.defaultBitmap, // 列表图片,public static Bitmap defaultBitmap = new Bitmap(1,1);
pInfo.goods_id,
pInfo.goods_name,
pInfo.discount / 100m,
pInfo.init_quantity + "/" + pInfo.taked_quantity,
"", //收藏
"", //总销量
"", //30日销量
"可结束",
"" // 操作结果,状态
);
dgvProduct.Rows[rowId].Height = 60;
}));
}
}
foreach (var couponGoods in couponRst.data_list)
{
Thread.Sleep(Randomx.GetId(500, 1500));
if (cancellationTokenSource.IsCancellationRequested)
break;
var creatRst = close_jingxi_coupon(shop, couponGoods.batch_sn, status);
creatRst = GetHtml.Unicode2String(creatRst);
if (!creatRst.Contains("\"success\":true"))
{
var error = BaseRegex.GetStringJson(ref creatRst, "error_msg");
if (string.IsNullOrEmpty(error))
error = creatRst;
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(
r => r.Cells["col_coupon_sn"].Value.ParseToString() == couponGoods.batch_sn);
if (row != null)
{
row.Cells["colOpResult"].Value = error;
}
}
else
{
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(
r => r.Cells["col_coupon_sn"].Value.ParseToString() == couponGoods.batch_sn);
if (row != null)
{
row.Cells["colOpResult"].Value = "结束优惠券成功!";
}
}
}
int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt();
totalPage = Math.Ceiling(1m * total / pageSize).ParseToInt();
}
}
}
Invoke(new Action(() =>
{
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
if (!isError)
{
foreach (var row in rows)
{
row.Cells["colMessage"].Value = "已结束优惠券";
}
}
else
{
foreach (var row in rows)
{
row.Cells["colMessage"].Value = "结束优惠券失败 " + errMsg;
}
}
}));
}
Invoke(new Action(() =>
{
ucGroupBoxEx2.Enabled = true;
string sRst = "结束优惠券已完成!";
if (cancellationTokenSource.IsCancellationRequested)
sRst = "已取消结束优惠券!";
BaseMsgForm.ShowInfo(sRst);
this.statusBar.lblTaskStatus.Text = sRst;
}));
}, cancellationTokenSource.Token);
}
}
public class JingXiCouponRst
{
public int? expiring_count { get; set; }
public int? total { get; set; } // 32
public List<jing_xi_coupon_data_info> data_list { get; set; }
public bool? in_expiring_ab_test { get; set; } // true
}
public class jing_xi_coupon_data_info
{
public string batch_id { get; set; } // "40027325682",
public string batch_sn { get; set; } // "A1242VC-811369214315922989",
public string batch_desc { get; set; } // "惊喜券",
public string source_type_str { get; set; } // "惊喜券",
public string batch_dimension_str { get; set; } // "商品券",
public int? discount { get; set; } // 200,
public int? min_amount { get; set; } // 200,
public long? batch_start_time { get; set; } // 1760958000000,
public long? batch_end_time { get; set; } // 1768665599000,
public long? valid_start_time { get; set; } // 1761103931339,
public long? valid_end_time { get; set; } // 1761753599000,
public string init_quantity { get; set; } // "594",
public int? remain_quantity { get; set; } // 592,
public string taked_quantity { get; set; } // "2",
public string used_quantity { get; set; } // "0",
public string status_str { get; set; } // "领取中",
public int? status_code { get; set; } // 2,
public bool? is_force_close_batch { get; set; } // false,
public int? user_limit { get; set; } // 3,
public int? source_type { get; set; } // 1242,
public int? period_type { get; set; } // 0,
public int? duration { get; set; } // 7,
public long? goods_id { get; set; } // 820156693761,
public string goods_name { get; set; } // "Simwood简木男装2021秋季新款纯棉衬衣休闲百搭牛津纺长袖衬衫男",
public string image_url { get; set; } // "https://img.pddpic.com/gaudit-image/2025-09-17/61a216c8e22bf14a313b04a97172ff54.jpeg",
public List<string> scene_codes { get; set; } // [ "全场景通用" ],
public bool? can_end { get; set; } // true,
public bool? can_add_quantity { get; set; } // true,
public bool? can_postpone_close { get; set; } // true,
public int? goods_equity_type { get; set; } // 1,
public object goods_equity_ext_info { get; set; } // { },
public string coupon_time_str { get; set; } // "领取后7天有效"
//自定义店铺参数
public string shopId { get; set; }
public string shopName { get; set; }
}
}
@@ -153,6 +153,9 @@
<metadata name="colSupplierName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_coupon_sn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colImgUrl.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -52,20 +52,6 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.panel1 = new System.Windows.Forms.Panel();
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
this.dgvProduct = new TemuKJD.UserComponent.DataGridViewEx();
this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSupplierName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colImg = new System.Windows.Forms.DataGridViewImageColumn();
this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn();
this.colProductName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colStock = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colFavorites = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSales = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSalesThirtyDays = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colIsCanSet = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.splitContainer4 = new System.Windows.Forms.SplitContainer();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.btnClear = new DevComponents.DotNetBar.PanelEx();
@@ -85,11 +71,27 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.chkCoupon3 = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.btnStopCoupon = new DevComponents.DotNetBar.PanelEx();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.numCoupon2KeepDays = new System.Windows.Forms.NumericUpDown();
this.dtpCoupon2StartTime = new System.Windows.Forms.DateTimePicker();
this.btnCreate = new DevComponents.DotNetBar.PanelEx();
this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSupplierName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col_coupon_sn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colImg = new System.Windows.Forms.DataGridViewImageColumn();
this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn();
this.colProductName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colStock = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colFavorites = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSales = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSalesThirtyDays = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colIsCanSet = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit();
this.splitContainer3.Panel1.SuspendLayout();
this.splitContainer3.Panel2.SuspendLayout();
@@ -131,7 +133,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
// splitContainer3.Panel2
//
this.splitContainer3.Panel2.Controls.Add(this.splitContainer4);
this.splitContainer3.Size = new System.Drawing.Size(1251, 330);
this.splitContainer3.Size = new System.Drawing.Size(1184, 330);
this.splitContainer3.SplitterDistance = 300;
this.splitContainer3.TabIndex = 1;
//
@@ -153,7 +155,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.splitContainer2.Panel2.Controls.Add(this.panel1);
this.splitContainer2.Panel2.Controls.Add(this.dgvProduct);
this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0);
this.splitContainer2.Size = new System.Drawing.Size(1251, 300);
this.splitContainer2.Size = new System.Drawing.Size(1184, 300);
this.splitContainer2.SplitterDistance = 300;
this.splitContainer2.TabIndex = 0;
//
@@ -281,7 +283,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
//
this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue;
this.pbLoading.Location = new System.Drawing.Point(448, 125);
this.pbLoading.Location = new System.Drawing.Point(415, 125);
this.pbLoading.Name = "pbLoading";
this.pbLoading.Size = new System.Drawing.Size(50, 50);
this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -297,7 +299,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.panel1.Controls.Add(this.ucSplitPage1);
this.panel1.Location = new System.Drawing.Point(36, 53);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(873, 214);
this.panel1.Size = new System.Drawing.Size(806, 214);
this.panel1.TabIndex = 189;
//
// ucSplitPage1
@@ -305,7 +307,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.ucSplitPage1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ucSplitPage1.CurrentPage = 1;
this.ucSplitPage1.IsShowPageSize = false;
this.ucSplitPage1.Location = new System.Drawing.Point(288, 177);
this.ucSplitPage1.Location = new System.Drawing.Point(221, 177);
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
this.ucSplitPage1.Name = "ucSplitPage1";
this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
@@ -336,6 +338,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.colCheck,
this.colSupplierId,
this.colSupplierName,
this.col_coupon_sn,
this.colImgUrl,
this.colImg,
this.colSpuId,
@@ -352,117 +355,10 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.dgvProduct.Name = "dgvProduct";
this.dgvProduct.ReadOnly = true;
this.dgvProduct.RowTemplate.Height = 23;
this.dgvProduct.Size = new System.Drawing.Size(943, 300);
this.dgvProduct.Size = new System.Drawing.Size(876, 300);
this.dgvProduct.TabIndex = 187;
this.dgvProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvProduct_CellContentClick);
//
// colCheck
//
this.colCheck.Frozen = true;
this.colCheck.HeaderText = "选择";
this.colCheck.Name = "colCheck";
this.colCheck.ReadOnly = true;
this.colCheck.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colCheck.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colCheck.Width = 30;
//
// colSupplierId
//
this.colSupplierId.HeaderText = "店铺Id";
this.colSupplierId.Name = "colSupplierId";
this.colSupplierId.ReadOnly = true;
//
// colSupplierName
//
this.colSupplierName.HeaderText = "店铺名称";
this.colSupplierName.Name = "colSupplierName";
this.colSupplierName.ReadOnly = true;
this.colSupplierName.Width = 110;
//
// colImgUrl
//
this.colImgUrl.HeaderText = "图片地址";
this.colImgUrl.Name = "colImgUrl";
this.colImgUrl.ReadOnly = true;
this.colImgUrl.Visible = false;
//
// colImg
//
this.colImg.HeaderText = "图片";
this.colImg.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom;
this.colImg.Name = "colImg";
this.colImg.ReadOnly = true;
this.colImg.Width = 60;
//
// colSpuId
//
this.colSpuId.HeaderText = "商品ID";
this.colSpuId.Name = "colSpuId";
this.colSpuId.ReadOnly = true;
this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colSpuId.Width = 80;
//
// colProductName
//
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle5;
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
this.colProductName.Width = 260;
//
// colPrice
//
this.colPrice.HeaderText = "价格";
this.colPrice.Name = "colPrice";
this.colPrice.ReadOnly = true;
this.colPrice.Width = 90;
//
// colStock
//
this.colStock.HeaderText = "库存";
this.colStock.Name = "colStock";
this.colStock.ReadOnly = true;
this.colStock.Width = 70;
//
// colFavorites
//
this.colFavorites.HeaderText = "收藏";
this.colFavorites.Name = "colFavorites";
this.colFavorites.ReadOnly = true;
this.colFavorites.Visible = false;
this.colFavorites.Width = 50;
//
// colSales
//
this.colSales.HeaderText = "总销量";
this.colSales.Name = "colSales";
this.colSales.ReadOnly = true;
this.colSales.Visible = false;
this.colSales.Width = 60;
//
// colSalesThirtyDays
//
this.colSalesThirtyDays.HeaderText = "30日销量";
this.colSalesThirtyDays.Name = "colSalesThirtyDays";
this.colSalesThirtyDays.ReadOnly = true;
this.colSalesThirtyDays.Visible = false;
this.colSalesThirtyDays.Width = 70;
//
// colIsCanSet
//
this.colIsCanSet.HeaderText = "是否可设置";
this.colIsCanSet.Name = "colIsCanSet";
this.colIsCanSet.ReadOnly = true;
//
// colOpResult
//
this.colOpResult.HeaderText = "操作结果";
this.colOpResult.Name = "colOpResult";
this.colOpResult.ReadOnly = true;
this.colOpResult.Width = 200;
//
// splitContainer4
//
this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -478,8 +374,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
//
this.splitContainer4.Panel2.Controls.Add(this.btnClear);
this.splitContainer4.Panel2.Controls.Add(this.btnCancel);
this.splitContainer4.Size = new System.Drawing.Size(1251, 26);
this.splitContainer4.SplitterDistance = 560;
this.splitContainer4.Size = new System.Drawing.Size(1184, 26);
this.splitContainer4.SplitterDistance = 493;
this.splitContainer4.TabIndex = 3;
//
// statusBar
@@ -490,7 +386,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
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(560, 26);
this.statusBar.Size = new System.Drawing.Size(493, 26);
this.statusBar.TabIndex = 2;
//
// btnClear
@@ -719,7 +615,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer3);
this.splitContainer1.Size = new System.Drawing.Size(1251, 474);
this.splitContainer1.Size = new System.Drawing.Size(1184, 474);
this.splitContainer1.SplitterDistance = 140;
this.splitContainer1.TabIndex = 15;
//
@@ -730,6 +626,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
| 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.btnStopCoupon);
this.ucGroupBoxEx2.Controls.Add(this.label5);
this.ucGroupBoxEx2.Controls.Add(this.label6);
this.ucGroupBoxEx2.Controls.Add(this.numCoupon2KeepDays);
@@ -748,11 +645,36 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.ucGroupBoxEx2.Controls.Add(this.btnCreate);
this.ucGroupBoxEx2.Location = new System.Drawing.Point(147, 2);
this.ucGroupBoxEx2.Name = "ucGroupBoxEx2";
this.ucGroupBoxEx2.Size = new System.Drawing.Size(1101, 140);
this.ucGroupBoxEx2.Size = new System.Drawing.Size(1034, 140);
this.ucGroupBoxEx2.TabIndex = 667;
this.ucGroupBoxEx2.TabStop = false;
this.ucGroupBoxEx2.Text = "商品查询";
//
// btnStopCoupon
//
this.btnStopCoupon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnStopCoupon.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnStopCoupon.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnStopCoupon.DisabledBackColor = System.Drawing.Color.Empty;
this.btnStopCoupon.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnStopCoupon.Location = new System.Drawing.Point(898, 87);
this.btnStopCoupon.Name = "btnStopCoupon";
this.btnStopCoupon.Size = new System.Drawing.Size(104, 23);
this.btnStopCoupon.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnStopCoupon.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnStopCoupon.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnStopCoupon.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnStopCoupon.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnStopCoupon.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnStopCoupon.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnStopCoupon.Style.GradientAngle = 90;
this.btnStopCoupon.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnStopCoupon.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnStopCoupon.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnStopCoupon.TabIndex = 754;
this.btnStopCoupon.Text = "一键结束优惠";
this.btnStopCoupon.Click += new System.EventHandler(this.btnStopCoupon_Click);
//
// label5
//
this.label5.AutoSize = true;
@@ -806,7 +728,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.btnCreate.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCreate.DisabledBackColor = System.Drawing.Color.Empty;
this.btnCreate.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCreate.Location = new System.Drawing.Point(965, 32);
this.btnCreate.Location = new System.Drawing.Point(898, 32);
this.btnCreate.Name = "btnCreate";
this.btnCreate.Size = new System.Drawing.Size(104, 23);
this.btnCreate.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -824,11 +746,125 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.btnCreate.Text = "开始创建";
this.btnCreate.Click += new System.EventHandler(this.btnCreate_Click);
//
// colCheck
//
this.colCheck.Frozen = true;
this.colCheck.HeaderText = "选择";
this.colCheck.Name = "colCheck";
this.colCheck.ReadOnly = true;
this.colCheck.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colCheck.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colCheck.Width = 30;
//
// colSupplierId
//
this.colSupplierId.HeaderText = "店铺Id";
this.colSupplierId.Name = "colSupplierId";
this.colSupplierId.ReadOnly = true;
//
// colSupplierName
//
this.colSupplierName.HeaderText = "店铺名称";
this.colSupplierName.Name = "colSupplierName";
this.colSupplierName.ReadOnly = true;
this.colSupplierName.Width = 110;
//
// col_coupon_sn
//
this.col_coupon_sn.HeaderText = "活动编码";
this.col_coupon_sn.Name = "col_coupon_sn";
this.col_coupon_sn.ReadOnly = true;
this.col_coupon_sn.Visible = false;
//
// colImgUrl
//
this.colImgUrl.HeaderText = "图片地址";
this.colImgUrl.Name = "colImgUrl";
this.colImgUrl.ReadOnly = true;
this.colImgUrl.Visible = false;
//
// colImg
//
this.colImg.HeaderText = "图片";
this.colImg.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom;
this.colImg.Name = "colImg";
this.colImg.ReadOnly = true;
this.colImg.Width = 60;
//
// colSpuId
//
this.colSpuId.HeaderText = "商品ID";
this.colSpuId.Name = "colSpuId";
this.colSpuId.ReadOnly = true;
this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colSpuId.Width = 80;
//
// colProductName
//
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle5;
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
this.colProductName.Width = 260;
//
// colPrice
//
this.colPrice.HeaderText = "价格";
this.colPrice.Name = "colPrice";
this.colPrice.ReadOnly = true;
this.colPrice.Width = 90;
//
// colStock
//
this.colStock.HeaderText = "库存";
this.colStock.Name = "colStock";
this.colStock.ReadOnly = true;
this.colStock.Width = 70;
//
// colFavorites
//
this.colFavorites.HeaderText = "收藏";
this.colFavorites.Name = "colFavorites";
this.colFavorites.ReadOnly = true;
this.colFavorites.Visible = false;
this.colFavorites.Width = 50;
//
// colSales
//
this.colSales.HeaderText = "总销量";
this.colSales.Name = "colSales";
this.colSales.ReadOnly = true;
this.colSales.Visible = false;
this.colSales.Width = 60;
//
// colSalesThirtyDays
//
this.colSalesThirtyDays.HeaderText = "30日销量";
this.colSalesThirtyDays.Name = "colSalesThirtyDays";
this.colSalesThirtyDays.ReadOnly = true;
this.colSalesThirtyDays.Visible = false;
this.colSalesThirtyDays.Width = 70;
//
// colIsCanSet
//
this.colIsCanSet.HeaderText = "是否可设置";
this.colIsCanSet.Name = "colIsCanSet";
this.colIsCanSet.ReadOnly = true;
//
// colOpResult
//
this.colOpResult.HeaderText = "操作结果";
this.colOpResult.Name = "colOpResult";
this.colOpResult.ReadOnly = true;
this.colOpResult.Width = 200;
//
// PDDProdCouponLingQuanZhongXinForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1251, 474);
this.ClientSize = new System.Drawing.Size(1184, 474);
this.Controls.Add(this.splitContainer1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "PDDProdCouponLingQuanZhongXinForm";
@@ -883,20 +919,6 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
private System.Windows.Forms.Panel panel1;
private UserControls.UcSplitPage ucSplitPage1;
private UserComponent.DataGridViewEx dgvProduct;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colImg;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductName;
private System.Windows.Forms.DataGridViewTextBoxColumn colPrice;
private System.Windows.Forms.DataGridViewTextBoxColumn colStock;
private System.Windows.Forms.DataGridViewTextBoxColumn colFavorites;
private System.Windows.Forms.DataGridViewTextBoxColumn colSales;
private System.Windows.Forms.DataGridViewTextBoxColumn colSalesThirtyDays;
private System.Windows.Forms.DataGridViewTextBoxColumn colIsCanSet;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
private System.Windows.Forms.SplitContainer splitContainer4;
private UserControls.StatusBarUserControl statusBar;
private DevComponents.DotNetBar.PanelEx btnClear;
@@ -921,5 +943,21 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
private System.Windows.Forms.DateTimePicker dtpCoupon2StartTime;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private DevComponents.DotNetBar.PanelEx btnStopCoupon;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewTextBoxColumn col_coupon_sn;
private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colImg;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductName;
private System.Windows.Forms.DataGridViewTextBoxColumn colPrice;
private System.Windows.Forms.DataGridViewTextBoxColumn colStock;
private System.Windows.Forms.DataGridViewTextBoxColumn colFavorites;
private System.Windows.Forms.DataGridViewTextBoxColumn colSales;
private System.Windows.Forms.DataGridViewTextBoxColumn colSalesThirtyDays;
private System.Windows.Forms.DataGridViewTextBoxColumn colIsCanSet;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
}
}
@@ -92,7 +92,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
if (row == null)
{
this.dgvShop.Rows.Add(
!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse),
//!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse),
canUse,
shopEntity.LoginName,
shopEntity.ShopId,
shopEntity.ShopAccount,
@@ -106,7 +107,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
}
else
{
row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse);
//row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse);
row.Cells["colSelect"].Value = selectShopId.Contains(shopEntity.ShopId);
row.Cells["colShopLoginName"].Value = shopEntity.LoginName;
row.Cells["colShopName"].Value = shopEntity.ShopAccount;
row.Cells["colShopNotes"].Value = shopEntity.Notes;
@@ -200,6 +202,55 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
}
return result;
}
public string get_lingquanzhongxin_coupon_goods_list(ShopLoginInfo shop, int batch_status, int page = 1, int pageSize = 20)
{
var anti = shop.AntiContents.LastOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
string url = "https://mms.pinduoduo.com/madrid/query_mms_mall_batch_list";
string body = "{\"page_num\":" + page + ",\"page_size\":" + pageSize + ",\"batch_dimension\":\"\",\"source_type\":\"\",\"batch_status\":" + batch_status + "}";
string refere = "https://mms.pinduoduo.com/tool/coupon?tab=1&tool_full_channel=10921_77272&couponStatusFilter=" + batch_status;
var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++)
{
shop.AntiContents.Remove(anti);
anti = shop.AntiContents.FirstOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
{
Thread.Sleep(Randomx.GetId(500, 1500));
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
}
}
return result;
}
public string close_lingquanzhongxin_coupon(ShopLoginInfo shop, string event_sn, int batch_status)
{
var anti = shop.AntiContents.LastOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
string url = "https://mms.pinduoduo.com/madrid/close_mall_batch";
string body = @"{""batch_sn"":""" + event_sn + @"""}";
string refere = "https://mms.pinduoduo.com/tool/coupon?tab=1&tool_full_channel=10921_77272&couponStatusFilter=" + batch_status;
var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++)
{
shop.AntiContents.Remove(anti);
anti = shop.AntiContents.FirstOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
{
Thread.Sleep(Randomx.GetId(500, 1500));
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
}
}
return result;
}
private void btnCreate_Click(object sender, EventArgs e)
{
@@ -223,10 +274,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
{
row.Cells["colMessage"].Value = "";
}
this.dgvProduct.Columns["colPrice"].HeaderText = "价格";
this.dgvProduct.Columns["colStock"].HeaderText = "库存";
if (PDDShopLoginForm.shopLoginInstance != null && PDDShopLoginForm.shopLoginInstance.IsDisposed != true)
PDDShopLoginForm.shopLoginInstance.Dispose();
ucGroupBoxEx2.Enabled = false;
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
@@ -352,6 +402,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
pInfo.is_filtered != true,
shop.ShopId,
shop.ShopAccount,
"",
url.Replace("https", "http"),
DataGridViewExtension.defaultBitmap, // 列表图片,public static Bitmap defaultBitmap = new Bitmap(1,1);
pInfo.id,
@@ -381,7 +432,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colSpuId"].Value.ParseToLong() == pInfo.id);
if (row != null)
{
row.Cells["colOpResult"].Value = "优惠券金额不在可设置范围内!";
row.Cells["colOpResult"].Value = "优惠券金额过高或过低!" +
pInfo.coupon_value_limit.FirstOrDefault() / 100m + "~" +
pInfo.coupon_value_limit.LastOrDefault() / 100m;
}
}
}
@@ -418,7 +471,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
duration = cmbCoupon3KeepHours.Text.Trim().Replace("小时", "").Replace("天", ""),
goods_id = pInfo.id,
init_quantity = 10000, //张数固定天一万 //pInfo.quantity,
period_type = 0,
period_type = cmbCoupon3KeepHours.Text.Trim().Contains("天") ? 0 : 2,
status = 2, // 固定填2
user_limit = cmbCoupon3TicketNum.Text.Trim().Replace("张", "").ParseToInt(),
});
@@ -512,30 +565,51 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
{
dicShopGetCount[shop] = 0;
while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed)
{
Thread.Sleep(500);
}
//while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed)
//{
// Thread.Sleep(500);
//}
//Invoke(new Action(() =>
//{
// this.panel1.SendToBack();
// PDDShopLoginForm loginForm = new PDDShopLoginForm(shop);
// loginForm.TopLevel = false;
// loginForm.openType = EnumOpenType.manage;
// loginForm.WindowState = FormWindowState.Maximized;
// loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/";
// loginForm.Dock = DockStyle.Fill;
// this.panel1.Controls.Add(loginForm);
// loginForm.Show();
//}));
//int sleepTime = Randomx.GetId(2000, 3000);
//Thread.Sleep(sleepTime);
//Invoke(new Action(() =>
//{
// if (PDDShopLoginForm.shopLoginInstance != null)
// PDDShopLoginForm.shopLoginInstance.Dispose();
//}));
PDDShopLoginForm loginForm = null;
Invoke(new Action(() =>
{
this.panel1.SendToBack();
PDDShopLoginForm loginForm = new PDDShopLoginForm(shop);
loginForm = new PDDShopLoginForm(shop);
loginForm.TopLevel = false;
loginForm.openType = EnumOpenType.manage;
loginForm.WindowState = FormWindowState.Maximized;
loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/";
loginForm.InitUrl = "https://mms.pinduoduo.com/home/";
loginForm.Dock = DockStyle.Fill;
this.panel1.Controls.Add(loginForm);
loginForm.Show();
}));
int sleepTime = Randomx.GetId(2000, 3000);
Thread.Sleep(sleepTime);
Thread.Sleep(Randomx.GetId(3000, 5000));
Invoke(new Action(() =>
{
if (PDDShopLoginForm.shopLoginInstance != null)
PDDShopLoginForm.shopLoginInstance.Dispose();
if (loginForm != null)
loginForm.Close();
}));
}
}
@@ -575,5 +649,257 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
break;
}
}
private void btnStopCoupon_Click(object sender, EventArgs e)
{
var lstShopId = dgvShop.Rows.Cast<DataGridViewRow>()
.Where(row => row.Cells["colSelect"]?.Value.ParseToBool() == true && row.Cells["colLoginStatus"]?.Value.ParseToString() == "在线")
.Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
if (lstShopId.Count == 0)
{
BaseMsgForm.ShowInfo("请选择登录的店铺!");
return;
}
pddCouponGoods.goods_list.Clear();
pddCouponGoods.remaining_create_num = 1;
pddCouponGoods.total = 1;
dgvProduct.Rows.Clear();
List<jing_xi_coupon_data_info> couponGoodsInfoLst = new List<jing_xi_coupon_data_info>();
var dgvRows = this.dgvShop.Rows.Cast<DataGridViewRow>();//.Where(r => lstShopId.Contains(r.Cells["colShopId"].Value.ParseToString()));
foreach (var row in dgvRows)
{
row.Cells["colMessage"].Value = "";
}
this.dgvProduct.Columns["colPrice"].HeaderText = "面额";
this.dgvProduct.Columns["colStock"].HeaderText = "发行/领取量";
ucGroupBoxEx2.Enabled = false;
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
var lstShopIdTemp = new List<string>();
lstShopIdTemp.AddRange(lstShopId);
int i = 0;
foreach (var shopId in lstShopIdTemp)
{
this.Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "正在查询...";
this.statusBar.pgbTaskProgress.Maximum = lstShopIdTemp.Count;
this.statusBar.UpdateProgressBar(i + 1);
i++;
}));
if (cancellationTokenSource.IsCancellationRequested)
break;
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
if (shop == null)
continue;
#region 检测登录
if (shop.LoginStatus == "登录成功")
{
PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
}
if (shop.LoginStatus != "登录成功")
{
Invoke(new Action(() =>
{
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopLoginName"].Value.ToString() == shop.LoginName);
foreach (var row in rows)
{
row.Cells["colMessage"].Value = "店铺掉线";
row.Cells["colLoginStatus"].Value = "掉线";
row.Cells["colCanUse"].Value = false;
}
}));
continue;
}
#endregion
Invoke(new Action(() =>
{
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
foreach (var row in rows)
{
row.Cells["colMessage"].Value = "正在查询";
}
}));
bool isError = false;
string errMsg = "";
for (int status = 1; status <= 4; status++)
{
if (status != 1 && status != 4)
continue;
int page = 0;
int pageSize = 20;
int totalPage = 1;
while (page < totalPage)
{
if (cancellationTokenSource.IsCancellationRequested)
break;
if (page == 0)
page++;
int tryCount = 0;
tryAgain:
GetToken(shop);
if (page >= 1)
Thread.Sleep(Randomx.GetId(3000, 7000));
string jsonStr = get_lingquanzhongxin_coupon_goods_list(shop, status, page, pageSize);
jsonStr = GetHtml.Unicode2String(jsonStr);
if (jsonStr.Contains("繁忙") && tryCount < 5)
{
tryCount++;
Thread.Sleep(Randomx.GetId(5000, 10000));
goto tryAgain;
}
if (!jsonStr.Contains("\"success\":true"))
{
PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
if (shop.LoginStatus != "登录成功")
break;
isError = true;
string sErr = BaseRegex.GetStringJson(ref jsonStr, "error_msg");
if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr))
errMsg += sErr + " ";
continue;
}
if (jsonStr.Contains("\"success\":true"))
{
JingXiCouponRst couponRst = new JingXiCouponRst();
try
{
var jObj = JObject.Parse(jsonStr);
var rstStr = JsonHelper.SerializeObject(jObj["result"]);
couponRst = JsonHelper.DeserializeJsonToObject<JingXiCouponRst>(rstStr);
}
catch (Exception ex)
{
BaseMsgForm.ShowError(ex.Message);
}
couponRst.data_list =
couponRst.data_list.Where(p => !couponGoodsInfoLst.Any(a => a.batch_sn == p.batch_sn)).ToList();
if (couponRst.data_list.Count == 0)
{
page++;
continue;
}
foreach (var pInfo in couponRst.data_list)
{
pInfo.shopId = shop.ShopId;
pInfo.shopName = shop.ShopAccount;
if (pInfo != null)
{
couponGoodsInfoLst.Add(pInfo);
string url = pInfo.image_url;
Invoke(new Action(() =>
{
int rowId = this.dgvProduct.Rows.Add(
/*pInfo.is_filtered !=*/ true,
shop.ShopId,
shop.ShopAccount,
pInfo.batch_sn,
url.Replace("https", "http"),
DataGridViewExtension.defaultBitmap, // 列表图片,public static Bitmap defaultBitmap = new Bitmap(1,1);
pInfo.goods_id,
pInfo.goods_name,
pInfo.discount / 100m,
pInfo.init_quantity + "/" + pInfo.taked_quantity,
"", //收藏
"", //总销量
"", //30日销量
"可结束",
"" // 操作结果,状态
);
dgvProduct.Rows[rowId].Height = 60;
}));
}
}
foreach (var couponGoods in couponRst.data_list)
{
Thread.Sleep(Randomx.GetId(500, 1500));
if (cancellationTokenSource.IsCancellationRequested)
break;
var creatRst = close_lingquanzhongxin_coupon(shop, couponGoods.batch_sn, status);
creatRst = GetHtml.Unicode2String(creatRst);
if (!creatRst.Contains("\"success\":true"))
{
var error = BaseRegex.GetStringJson(ref creatRst, "error_msg");
if (string.IsNullOrEmpty(error))
error = creatRst;
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(
r => r.Cells["col_coupon_sn"].Value.ParseToString() == couponGoods.batch_sn);
if (row != null)
{
row.Cells["colOpResult"].Value = error;
}
}
else
{
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(
r => r.Cells["col_coupon_sn"].Value.ParseToString() == couponGoods.batch_sn);
if (row != null)
{
row.Cells["colOpResult"].Value = "结束优惠券成功!";
}
}
}
int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt();
totalPage = Math.Ceiling(1m * total / pageSize).ParseToInt();
}
}
}
Invoke(new Action(() =>
{
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
if (!isError)
{
foreach (var row in rows)
{
row.Cells["colMessage"].Value = "已结束优惠券";
}
}
else
{
foreach (var row in rows)
{
row.Cells["colMessage"].Value = "结束优惠券失败 " + errMsg;
}
}
}));
}
Invoke(new Action(() =>
{
ucGroupBoxEx2.Enabled = true;
string sRst = "结束优惠券已完成!";
if (cancellationTokenSource.IsCancellationRequested)
sRst = "已取消结束优惠券!";
BaseMsgForm.ShowInfo(sRst);
this.statusBar.lblTaskStatus.Text = sRst;
}));
}, cancellationTokenSource.Token);
}
}
}
@@ -153,6 +153,9 @@
<metadata name="colSupplierName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_coupon_sn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colImgUrl.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -52,20 +52,6 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.panel1 = new System.Windows.Forms.Panel();
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
this.dgvProduct = new TemuKJD.UserComponent.DataGridViewEx();
this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSupplierName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colImg = new System.Windows.Forms.DataGridViewImageColumn();
this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn();
this.colProductName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colStock = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colFavorites = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSales = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSalesThirtyDays = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colIsCanSet = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.splitContainer4 = new System.Windows.Forms.SplitContainer();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.btnClear = new DevComponents.DotNetBar.PanelEx();
@@ -79,6 +65,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.label5 = new System.Windows.Forms.Label();
this.numCoupon2KeepDays = new System.Windows.Forms.NumericUpDown();
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.btnStopCoupon = new DevComponents.DotNetBar.PanelEx();
this.label6 = new System.Windows.Forms.Label();
this.dtpCoupon2StartTime = new System.Windows.Forms.DateTimePicker();
this.txtCoupon2Name = new System.Windows.Forms.TextBox();
@@ -87,6 +74,21 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.chkCoupon2 = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.btnCreate = new DevComponents.DotNetBar.PanelEx();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSupplierName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.col_coupon_sn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colImg = new System.Windows.Forms.DataGridViewImageColumn();
this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn();
this.colProductName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colStock = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colFavorites = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSales = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSalesThirtyDays = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colIsCanSet = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit();
this.splitContainer3.Panel1.SuspendLayout();
this.splitContainer3.Panel2.SuspendLayout();
@@ -128,7 +130,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
// splitContainer3.Panel2
//
this.splitContainer3.Panel2.Controls.Add(this.splitContainer4);
this.splitContainer3.Size = new System.Drawing.Size(1210, 408);
this.splitContainer3.Size = new System.Drawing.Size(1184, 408);
this.splitContainer3.SplitterDistance = 378;
this.splitContainer3.TabIndex = 1;
//
@@ -150,7 +152,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.splitContainer2.Panel2.Controls.Add(this.panel1);
this.splitContainer2.Panel2.Controls.Add(this.dgvProduct);
this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0);
this.splitContainer2.Size = new System.Drawing.Size(1210, 378);
this.splitContainer2.Size = new System.Drawing.Size(1184, 378);
this.splitContainer2.SplitterDistance = 300;
this.splitContainer2.TabIndex = 0;
//
@@ -278,7 +280,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
//
this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue;
this.pbLoading.Location = new System.Drawing.Point(428, 164);
this.pbLoading.Location = new System.Drawing.Point(415, 164);
this.pbLoading.Name = "pbLoading";
this.pbLoading.Size = new System.Drawing.Size(50, 50);
this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -294,7 +296,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.panel1.Controls.Add(this.ucSplitPage1);
this.panel1.Location = new System.Drawing.Point(36, 53);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(832, 292);
this.panel1.Size = new System.Drawing.Size(806, 292);
this.panel1.TabIndex = 189;
//
// ucSplitPage1
@@ -302,7 +304,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.ucSplitPage1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ucSplitPage1.CurrentPage = 1;
this.ucSplitPage1.IsShowPageSize = false;
this.ucSplitPage1.Location = new System.Drawing.Point(247, 255);
this.ucSplitPage1.Location = new System.Drawing.Point(221, 255);
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
this.ucSplitPage1.Name = "ucSplitPage1";
this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
@@ -333,6 +335,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.colCheck,
this.colSupplierId,
this.colSupplierName,
this.col_coupon_sn,
this.colImgUrl,
this.colImg,
this.colSpuId,
@@ -349,117 +352,10 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.dgvProduct.Name = "dgvProduct";
this.dgvProduct.ReadOnly = true;
this.dgvProduct.RowTemplate.Height = 23;
this.dgvProduct.Size = new System.Drawing.Size(902, 378);
this.dgvProduct.Size = new System.Drawing.Size(876, 378);
this.dgvProduct.TabIndex = 187;
this.dgvProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvProduct_CellContentClick);
//
// colCheck
//
this.colCheck.Frozen = true;
this.colCheck.HeaderText = "选择";
this.colCheck.Name = "colCheck";
this.colCheck.ReadOnly = true;
this.colCheck.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colCheck.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colCheck.Width = 30;
//
// colSupplierId
//
this.colSupplierId.HeaderText = "店铺Id";
this.colSupplierId.Name = "colSupplierId";
this.colSupplierId.ReadOnly = true;
//
// colSupplierName
//
this.colSupplierName.HeaderText = "店铺名称";
this.colSupplierName.Name = "colSupplierName";
this.colSupplierName.ReadOnly = true;
this.colSupplierName.Width = 110;
//
// colImgUrl
//
this.colImgUrl.HeaderText = "图片地址";
this.colImgUrl.Name = "colImgUrl";
this.colImgUrl.ReadOnly = true;
this.colImgUrl.Visible = false;
//
// colImg
//
this.colImg.HeaderText = "图片";
this.colImg.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom;
this.colImg.Name = "colImg";
this.colImg.ReadOnly = true;
this.colImg.Width = 60;
//
// colSpuId
//
this.colSpuId.HeaderText = "商品ID";
this.colSpuId.Name = "colSpuId";
this.colSpuId.ReadOnly = true;
this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colSpuId.Width = 80;
//
// colProductName
//
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle5;
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
this.colProductName.Width = 260;
//
// colPrice
//
this.colPrice.HeaderText = "价格";
this.colPrice.Name = "colPrice";
this.colPrice.ReadOnly = true;
this.colPrice.Width = 90;
//
// colStock
//
this.colStock.HeaderText = "库存";
this.colStock.Name = "colStock";
this.colStock.ReadOnly = true;
this.colStock.Width = 70;
//
// colFavorites
//
this.colFavorites.HeaderText = "收藏";
this.colFavorites.Name = "colFavorites";
this.colFavorites.ReadOnly = true;
this.colFavorites.Visible = false;
this.colFavorites.Width = 50;
//
// colSales
//
this.colSales.HeaderText = "总销量";
this.colSales.Name = "colSales";
this.colSales.ReadOnly = true;
this.colSales.Visible = false;
this.colSales.Width = 60;
//
// colSalesThirtyDays
//
this.colSalesThirtyDays.HeaderText = "30日销量";
this.colSalesThirtyDays.Name = "colSalesThirtyDays";
this.colSalesThirtyDays.ReadOnly = true;
this.colSalesThirtyDays.Visible = false;
this.colSalesThirtyDays.Width = 70;
//
// colIsCanSet
//
this.colIsCanSet.HeaderText = "是否可设置";
this.colIsCanSet.Name = "colIsCanSet";
this.colIsCanSet.ReadOnly = true;
//
// colOpResult
//
this.colOpResult.HeaderText = "操作结果";
this.colOpResult.Name = "colOpResult";
this.colOpResult.ReadOnly = true;
this.colOpResult.Width = 200;
//
// splitContainer4
//
this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -475,8 +371,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
//
this.splitContainer4.Panel2.Controls.Add(this.btnClear);
this.splitContainer4.Panel2.Controls.Add(this.btnCancel);
this.splitContainer4.Size = new System.Drawing.Size(1210, 26);
this.splitContainer4.SplitterDistance = 519;
this.splitContainer4.Size = new System.Drawing.Size(1184, 26);
this.splitContainer4.SplitterDistance = 493;
this.splitContainer4.TabIndex = 3;
//
// statusBar
@@ -487,7 +383,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
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(519, 26);
this.statusBar.Size = new System.Drawing.Size(493, 26);
this.statusBar.TabIndex = 2;
//
// btnClear
@@ -655,6 +551,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
| 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.btnStopCoupon);
this.ucGroupBoxEx2.Controls.Add(this.label14);
this.ucGroupBoxEx2.Controls.Add(this.label11);
this.ucGroupBoxEx2.Controls.Add(this.numCouponValue);
@@ -670,11 +567,36 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.ucGroupBoxEx2.Controls.Add(this.btnCreate);
this.ucGroupBoxEx2.Location = new System.Drawing.Point(147, 2);
this.ucGroupBoxEx2.Name = "ucGroupBoxEx2";
this.ucGroupBoxEx2.Size = new System.Drawing.Size(1060, 140);
this.ucGroupBoxEx2.Size = new System.Drawing.Size(1034, 140);
this.ucGroupBoxEx2.TabIndex = 667;
this.ucGroupBoxEx2.TabStop = false;
this.ucGroupBoxEx2.Text = "商品查询";
//
// btnStopCoupon
//
this.btnStopCoupon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnStopCoupon.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnStopCoupon.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnStopCoupon.DisabledBackColor = System.Drawing.Color.Empty;
this.btnStopCoupon.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnStopCoupon.Location = new System.Drawing.Point(898, 87);
this.btnStopCoupon.Name = "btnStopCoupon";
this.btnStopCoupon.Size = new System.Drawing.Size(104, 23);
this.btnStopCoupon.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnStopCoupon.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnStopCoupon.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnStopCoupon.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnStopCoupon.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnStopCoupon.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnStopCoupon.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnStopCoupon.Style.GradientAngle = 90;
this.btnStopCoupon.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnStopCoupon.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnStopCoupon.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnStopCoupon.TabIndex = 758;
this.btnStopCoupon.Text = "一键结束优惠";
this.btnStopCoupon.Click += new System.EventHandler(this.btnStopCoupon_Click);
//
// label6
//
this.label6.AutoSize = true;
@@ -740,7 +662,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
this.btnCreate.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCreate.DisabledBackColor = System.Drawing.Color.Empty;
this.btnCreate.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCreate.Location = new System.Drawing.Point(924, 32);
this.btnCreate.Location = new System.Drawing.Point(898, 32);
this.btnCreate.Name = "btnCreate";
this.btnCreate.Size = new System.Drawing.Size(104, 23);
this.btnCreate.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -774,15 +696,129 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer3);
this.splitContainer1.Size = new System.Drawing.Size(1210, 552);
this.splitContainer1.Size = new System.Drawing.Size(1184, 552);
this.splitContainer1.SplitterDistance = 140;
this.splitContainer1.TabIndex = 15;
//
// colCheck
//
this.colCheck.Frozen = true;
this.colCheck.HeaderText = "选择";
this.colCheck.Name = "colCheck";
this.colCheck.ReadOnly = true;
this.colCheck.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colCheck.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colCheck.Width = 30;
//
// colSupplierId
//
this.colSupplierId.HeaderText = "店铺Id";
this.colSupplierId.Name = "colSupplierId";
this.colSupplierId.ReadOnly = true;
//
// colSupplierName
//
this.colSupplierName.HeaderText = "店铺名称";
this.colSupplierName.Name = "colSupplierName";
this.colSupplierName.ReadOnly = true;
this.colSupplierName.Width = 110;
//
// col_coupon_sn
//
this.col_coupon_sn.HeaderText = "活动编码";
this.col_coupon_sn.Name = "col_coupon_sn";
this.col_coupon_sn.ReadOnly = true;
this.col_coupon_sn.Visible = false;
//
// colImgUrl
//
this.colImgUrl.HeaderText = "图片地址";
this.colImgUrl.Name = "colImgUrl";
this.colImgUrl.ReadOnly = true;
this.colImgUrl.Visible = false;
//
// colImg
//
this.colImg.HeaderText = "图片";
this.colImg.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom;
this.colImg.Name = "colImg";
this.colImg.ReadOnly = true;
this.colImg.Width = 60;
//
// colSpuId
//
this.colSpuId.HeaderText = "商品ID";
this.colSpuId.Name = "colSpuId";
this.colSpuId.ReadOnly = true;
this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colSpuId.Width = 80;
//
// colProductName
//
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle5;
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
this.colProductName.Width = 260;
//
// colPrice
//
this.colPrice.HeaderText = "价格";
this.colPrice.Name = "colPrice";
this.colPrice.ReadOnly = true;
this.colPrice.Width = 90;
//
// colStock
//
this.colStock.HeaderText = "库存";
this.colStock.Name = "colStock";
this.colStock.ReadOnly = true;
this.colStock.Width = 70;
//
// colFavorites
//
this.colFavorites.HeaderText = "收藏";
this.colFavorites.Name = "colFavorites";
this.colFavorites.ReadOnly = true;
this.colFavorites.Visible = false;
this.colFavorites.Width = 50;
//
// colSales
//
this.colSales.HeaderText = "总销量";
this.colSales.Name = "colSales";
this.colSales.ReadOnly = true;
this.colSales.Visible = false;
this.colSales.Width = 60;
//
// colSalesThirtyDays
//
this.colSalesThirtyDays.HeaderText = "30日销量";
this.colSalesThirtyDays.Name = "colSalesThirtyDays";
this.colSalesThirtyDays.ReadOnly = true;
this.colSalesThirtyDays.Visible = false;
this.colSalesThirtyDays.Width = 70;
//
// colIsCanSet
//
this.colIsCanSet.HeaderText = "是否可设置";
this.colIsCanSet.Name = "colIsCanSet";
this.colIsCanSet.ReadOnly = true;
//
// colOpResult
//
this.colOpResult.HeaderText = "操作结果";
this.colOpResult.Name = "colOpResult";
this.colOpResult.ReadOnly = true;
this.colOpResult.Width = 200;
//
// PDDProdCouponShangPinLiJianForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1210, 552);
this.ClientSize = new System.Drawing.Size(1184, 552);
this.Controls.Add(this.splitContainer1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "PDDProdCouponShangPinLiJianForm";
@@ -837,20 +873,6 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
private System.Windows.Forms.Panel panel1;
private UserControls.UcSplitPage ucSplitPage1;
private UserComponent.DataGridViewEx dgvProduct;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colImg;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductName;
private System.Windows.Forms.DataGridViewTextBoxColumn colPrice;
private System.Windows.Forms.DataGridViewTextBoxColumn colStock;
private System.Windows.Forms.DataGridViewTextBoxColumn colFavorites;
private System.Windows.Forms.DataGridViewTextBoxColumn colSales;
private System.Windows.Forms.DataGridViewTextBoxColumn colSalesThirtyDays;
private System.Windows.Forms.DataGridViewTextBoxColumn colIsCanSet;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
private System.Windows.Forms.SplitContainer splitContainer4;
private UserControls.StatusBarUserControl statusBar;
private DevComponents.DotNetBar.PanelEx btnClear;
@@ -872,5 +894,21 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
private UserComponent.UcCheckBox chkCoupon2;
private DevComponents.DotNetBar.PanelEx btnCreate;
private System.Windows.Forms.SplitContainer splitContainer1;
private DevComponents.DotNetBar.PanelEx btnStopCoupon;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewTextBoxColumn col_coupon_sn;
private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colImg;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductName;
private System.Windows.Forms.DataGridViewTextBoxColumn colPrice;
private System.Windows.Forms.DataGridViewTextBoxColumn colStock;
private System.Windows.Forms.DataGridViewTextBoxColumn colFavorites;
private System.Windows.Forms.DataGridViewTextBoxColumn colSales;
private System.Windows.Forms.DataGridViewTextBoxColumn colSalesThirtyDays;
private System.Windows.Forms.DataGridViewTextBoxColumn colIsCanSet;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
}
}
@@ -92,7 +92,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
if (row == null)
{
this.dgvShop.Rows.Add(
!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse),
//!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse),
canUse,
shopEntity.LoginName,
shopEntity.ShopId,
shopEntity.ShopAccount,
@@ -106,7 +107,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
}
else
{
row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse);
//row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse);
row.Cells["colSelect"].Value = selectShopId.Contains(shopEntity.ShopId);
row.Cells["colShopLoginName"].Value = shopEntity.LoginName;
row.Cells["colShopName"].Value = shopEntity.ShopAccount;
row.Cells["colShopNotes"].Value = shopEntity.Notes;
@@ -201,6 +203,56 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
return result;
}
public string get_shangpinlijian_coupon_goods_list(ShopLoginInfo shop, int batch_status, int page = 1, int pageSize = 20)
{
var anti = shop.AntiContents.LastOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
string url = "https://mms.pinduoduo.com/madrid/query_mms_mall_batch_list";
string body = "{\"page_num\":" + page + ",\"page_size\":" + pageSize + ",\"batch_dimension\":\"2\",\"source_type\":54,\"batch_status\":" + batch_status + "}";
string refere = "https://mms.pinduoduo.com/tool/coupon?tab=1&tool_full_channel=10921_77272&couponStatusFilter=" + batch_status;
var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++)
{
shop.AntiContents.Remove(anti);
anti = shop.AntiContents.FirstOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
{
Thread.Sleep(Randomx.GetId(500, 1500));
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
}
}
return result;
}
public string close_shangpinlijian_coupon(ShopLoginInfo shop, string event_sn, int batch_status)
{
var anti = shop.AntiContents.LastOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
string url = "https://mms.pinduoduo.com/madrid/close_mall_batch";
string body = @"{""batch_sn"":""" + event_sn + @"""}";
string refere = "https://mms.pinduoduo.com/tool/coupon?tab=1&tool_full_channel=10921_77272&couponStatusFilter=" + batch_status;
var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++)
{
shop.AntiContents.Remove(anti);
anti = shop.AntiContents.FirstOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
{
Thread.Sleep(Randomx.GetId(500, 1500));
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
}
}
return result;
}
private void btnCreate_Click(object sender, EventArgs e)
{
var lstShopId = dgvShop.Rows.Cast<DataGridViewRow>()
@@ -223,10 +275,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
{
row.Cells["colMessage"].Value = "";
}
this.dgvProduct.Columns["colPrice"].HeaderText = "价格";
this.dgvProduct.Columns["colStock"].HeaderText = "库存";
if (PDDShopLoginForm.shopLoginInstance != null && PDDShopLoginForm.shopLoginInstance.IsDisposed != true)
PDDShopLoginForm.shopLoginInstance.Dispose();
ucGroupBoxEx2.Enabled = false;
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
@@ -352,6 +403,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
pInfo.is_filtered != true,
shop.ShopId,
shop.ShopAccount,
"",
url.Replace("https", "http"),
DataGridViewExtension.defaultBitmap, // 列表图片,public static Bitmap defaultBitmap = new Bitmap(1,1);
pInfo.id,
@@ -381,7 +433,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colSpuId"].Value.ParseToLong() == pInfo.id);
if (row != null)
{
row.Cells["colOpResult"].Value = "优惠券金额不在可设置范围内!";
row.Cells["colOpResult"].Value = "优惠券金额过高或过低!" +
pInfo.coupon_value_limit.FirstOrDefault() / 100m + "~" +
pInfo.coupon_value_limit.LastOrDefault() / 100m;
}
}
}
@@ -505,30 +559,51 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
{
dicShopGetCount[shop] = 0;
while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed)
{
Thread.Sleep(500);
}
//while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed)
//{
// Thread.Sleep(500);
//}
//Invoke(new Action(() =>
//{
// this.panel1.SendToBack();
// PDDShopLoginForm loginForm = new PDDShopLoginForm(shop);
// loginForm.TopLevel = false;
// loginForm.openType = EnumOpenType.manage;
// loginForm.WindowState = FormWindowState.Maximized;
// loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/";
// loginForm.Dock = DockStyle.Fill;
// this.panel1.Controls.Add(loginForm);
// loginForm.Show();
//}));
//int sleepTime = Randomx.GetId(2000, 3000);
//Thread.Sleep(sleepTime);
//Invoke(new Action(() =>
//{
// if (PDDShopLoginForm.shopLoginInstance != null)
// PDDShopLoginForm.shopLoginInstance.Dispose();
//}));
PDDShopLoginForm loginForm = null;
Invoke(new Action(() =>
{
this.panel1.SendToBack();
PDDShopLoginForm loginForm = new PDDShopLoginForm(shop);
loginForm = new PDDShopLoginForm(shop);
loginForm.TopLevel = false;
loginForm.openType = EnumOpenType.manage;
loginForm.WindowState = FormWindowState.Maximized;
loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/";
loginForm.InitUrl = "https://mms.pinduoduo.com/home/";
loginForm.Dock = DockStyle.Fill;
this.panel1.Controls.Add(loginForm);
loginForm.Show();
}));
int sleepTime = Randomx.GetId(2000, 3000);
Thread.Sleep(sleepTime);
Thread.Sleep(Randomx.GetId(3000, 5000));
Invoke(new Action(() =>
{
if (PDDShopLoginForm.shopLoginInstance != null)
PDDShopLoginForm.shopLoginInstance.Dispose();
if (loginForm != null)
loginForm.Close();
}));
}
}
@@ -568,5 +643,257 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
break;
}
}
private void btnStopCoupon_Click(object sender, EventArgs e)
{
var lstShopId = dgvShop.Rows.Cast<DataGridViewRow>()
.Where(row => row.Cells["colSelect"]?.Value.ParseToBool() == true && row.Cells["colLoginStatus"]?.Value.ParseToString() == "在线")
.Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
if (lstShopId.Count == 0)
{
BaseMsgForm.ShowInfo("请选择登录的店铺!");
return;
}
pddCouponGoods.goods_list.Clear();
pddCouponGoods.remaining_create_num = 1;
pddCouponGoods.total = 1;
dgvProduct.Rows.Clear();
List<jing_xi_coupon_data_info> couponGoodsInfoLst = new List<jing_xi_coupon_data_info>();
var dgvRows = this.dgvShop.Rows.Cast<DataGridViewRow>();//.Where(r => lstShopId.Contains(r.Cells["colShopId"].Value.ParseToString()));
foreach (var row in dgvRows)
{
row.Cells["colMessage"].Value = "";
}
this.dgvProduct.Columns["colPrice"].HeaderText = "面额";
this.dgvProduct.Columns["colStock"].HeaderText = "发行/领取量";
ucGroupBoxEx2.Enabled = false;
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
var lstShopIdTemp = new List<string>();
lstShopIdTemp.AddRange(lstShopId);
int i = 0;
foreach (var shopId in lstShopIdTemp)
{
this.Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "正在查询...";
this.statusBar.pgbTaskProgress.Maximum = lstShopIdTemp.Count;
this.statusBar.UpdateProgressBar(i + 1);
i++;
}));
if (cancellationTokenSource.IsCancellationRequested)
break;
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
if (shop == null)
continue;
#region 检测登录
if (shop.LoginStatus == "登录成功")
{
PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
}
if (shop.LoginStatus != "登录成功")
{
Invoke(new Action(() =>
{
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopLoginName"].Value.ToString() == shop.LoginName);
foreach (var row in rows)
{
row.Cells["colMessage"].Value = "店铺掉线";
row.Cells["colLoginStatus"].Value = "掉线";
row.Cells["colCanUse"].Value = false;
}
}));
continue;
}
#endregion
Invoke(new Action(() =>
{
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
foreach (var row in rows)
{
row.Cells["colMessage"].Value = "正在查询";
}
}));
bool isError = false;
string errMsg = "";
for (int status = 1; status <= 4; status++)
{
if (status != 1 && status != 4)
continue;
int page = 0;
int pageSize = 20;
int totalPage = 1;
while (page < totalPage)
{
if (cancellationTokenSource.IsCancellationRequested)
break;
if (page == 0)
page++;
int tryCount = 0;
tryAgain:
GetToken(shop);
if (page >= 1)
Thread.Sleep(Randomx.GetId(3000, 7000));
string jsonStr = get_shangpinlijian_coupon_goods_list(shop, status, page, pageSize);
jsonStr = GetHtml.Unicode2String(jsonStr);
if (jsonStr.Contains("繁忙") && tryCount < 5)
{
tryCount++;
Thread.Sleep(Randomx.GetId(5000, 10000));
goto tryAgain;
}
if (!jsonStr.Contains("\"success\":true"))
{
PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
if (shop.LoginStatus != "登录成功")
break;
isError = true;
string sErr = BaseRegex.GetStringJson(ref jsonStr, "error_msg");
if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr))
errMsg += sErr + " ";
continue;
}
if (jsonStr.Contains("\"success\":true"))
{
JingXiCouponRst couponRst = new JingXiCouponRst();
try
{
var jObj = JObject.Parse(jsonStr);
var rstStr = JsonHelper.SerializeObject(jObj["result"]);
couponRst = JsonHelper.DeserializeJsonToObject<JingXiCouponRst>(rstStr);
}
catch (Exception ex)
{
BaseMsgForm.ShowError(ex.Message);
}
couponRst.data_list =
couponRst.data_list.Where(p => !couponGoodsInfoLst.Any(a => a.batch_sn == p.batch_sn)).ToList();
if (couponRst.data_list.Count == 0)
{
page++;
continue;
}
foreach (var pInfo in couponRst.data_list)
{
pInfo.shopId = shop.ShopId;
pInfo.shopName = shop.ShopAccount;
if (pInfo != null)
{
couponGoodsInfoLst.Add(pInfo);
string url = pInfo.image_url;
Invoke(new Action(() =>
{
int rowId = this.dgvProduct.Rows.Add(
/*pInfo.is_filtered !=*/ true,
shop.ShopId,
shop.ShopAccount,
pInfo.batch_sn,
url.Replace("https", "http"),
DataGridViewExtension.defaultBitmap, // 列表图片,public static Bitmap defaultBitmap = new Bitmap(1,1);
pInfo.goods_id,
pInfo.goods_name,
pInfo.discount / 100m,
pInfo.init_quantity + "/" + pInfo.taked_quantity,
"", //收藏
"", //总销量
"", //30日销量
"可结束",
"" // 操作结果,状态
);
dgvProduct.Rows[rowId].Height = 60;
}));
}
}
foreach (var couponGoods in couponRst.data_list)
{
Thread.Sleep(Randomx.GetId(500, 1500));
if (cancellationTokenSource.IsCancellationRequested)
break;
var creatRst = close_shangpinlijian_coupon(shop, couponGoods.batch_sn, status);
creatRst = GetHtml.Unicode2String(creatRst);
if (!creatRst.Contains("\"success\":true"))
{
var error = BaseRegex.GetStringJson(ref creatRst, "error_msg");
if (string.IsNullOrEmpty(error))
error = creatRst;
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(
r => r.Cells["col_coupon_sn"].Value.ParseToString() == couponGoods.batch_sn);
if (row != null)
{
row.Cells["colOpResult"].Value = error;
}
}
else
{
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(
r => r.Cells["col_coupon_sn"].Value.ParseToString() == couponGoods.batch_sn);
if (row != null)
{
row.Cells["colOpResult"].Value = "结束优惠券成功!";
}
}
}
int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt();
totalPage = Math.Ceiling(1m * total / pageSize).ParseToInt();
}
}
}
Invoke(new Action(() =>
{
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
if (!isError)
{
foreach (var row in rows)
{
row.Cells["colMessage"].Value = "已结束优惠券";
}
}
else
{
foreach (var row in rows)
{
row.Cells["colMessage"].Value = "结束优惠券失败 " + errMsg;
}
}
}));
}
Invoke(new Action(() =>
{
ucGroupBoxEx2.Enabled = true;
string sRst = "结束优惠券已完成!";
if (cancellationTokenSource.IsCancellationRequested)
sRst = "已取消结束优惠券!";
BaseMsgForm.ShowInfo(sRst);
this.statusBar.lblTaskStatus.Text = sRst;
}));
}, cancellationTokenSource.Token);
}
}
}
@@ -153,6 +153,9 @@
<metadata name="colSupplierName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_coupon_sn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colImgUrl.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>