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

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

No files matched your search

+9 -5
View File
@@ -39,7 +39,8 @@
System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("认领待上传");
System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("库存上传");
System.Windows.Forms.TreeNode treeNode11 = new System.Windows.Forms.TreeNode("商品核价");
System.Windows.Forms.TreeNode treeNode12 = new System.Windows.Forms.TreeNode("超级权限管理", new System.Windows.Forms.TreeNode[] {
System.Windows.Forms.TreeNode treeNode12 = new System.Windows.Forms.TreeNode("随机厂商商品");
System.Windows.Forms.TreeNode treeNode13 = new System.Windows.Forms.TreeNode("超级权限管理", new System.Windows.Forms.TreeNode[] {
treeNode1,
treeNode2,
treeNode3,
@@ -50,7 +51,8 @@
treeNode8,
treeNode9,
treeNode10,
treeNode11});
treeNode11,
treeNode12});
this.panel1 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
@@ -163,10 +165,12 @@
treeNode10.Text = "库存上传";
treeNode11.Name = "商品核价";
treeNode11.Text = "商品核价";
treeNode12.Name = "超级权限管理";
treeNode12.Text = "超级权限管理";
treeNode12.Name = "随机厂商商品";
treeNode12.Text = "随机厂商商品";
treeNode13.Name = "超级权限管理";
treeNode13.Text = "超级权限管理";
this.tv.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
treeNode12});
treeNode13});
this.tv.OverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.tv.Size = new System.Drawing.Size(140, 446);
this.tv.TabIndex = 1;
@@ -26,6 +26,7 @@ namespace TemuKJD.PDDForms.AdminForms
public Lazy<PDDGetChanceProdForm> getChanceProdForm = new Lazy<PDDGetChanceProdForm>();
public Lazy<PDDGetChanceProdByImgForm> getChanceProdByImgForm = new Lazy<PDDGetChanceProdByImgForm>();
public Lazy<GetJuShuitanProdForm> getJuShuitanProdForm = new Lazy<GetJuShuitanProdForm>();
public Lazy<RandomComProductForm> randomComProductForm = new Lazy<RandomComProductForm>();
//public Lazy<DbPriceMarkUpForm> dbPriceMarkUpForm = new Lazy<DbPriceMarkUpForm>();
//public Lazy<DbProductSelectListManageForm> dbProductSelectListManageForm = new Lazy<DbProductSelectListManageForm>();
//public Lazy<ProductThirdSelectListManageForm> productThirdSelectListManageForm = new Lazy<ProductThirdSelectListManageForm>();
@@ -102,6 +103,9 @@ namespace TemuKJD.PDDForms.AdminForms
case "厂家商品采集":
SetForm(getJuShuitanProdForm.Value);
break;
case "随机厂商商品":
SetForm(randomComProductForm.Value);
break;
//case "选品加价管理":
// SetForm(dbPriceMarkUpForm.Value);
// break;
@@ -0,0 +1,158 @@
namespace TemuKJD.PDDForms.AdminForms
{
partial class RandomComProductForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.chkIsOn = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.txtProductInterval = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.cmbProductGroup = new System.Windows.Forms.ComboBox();
this.btnSave = new DevComponents.DotNetBar.PanelEx();
this.pbLoading = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit();
this.SuspendLayout();
//
// ucCheckBox1
//
this.chkIsOn.AutoSize = true;
this.chkIsOn.Checked = true;
this.chkIsOn.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkIsOn.Location = new System.Drawing.Point(38, 39);
this.chkIsOn.Name = "ucCheckBox1";
this.chkIsOn.Size = new System.Drawing.Size(147, 21);
this.chkIsOn.TabIndex = 0;
this.chkIsOn.Text = "打开随机厂商商品功能";
this.chkIsOn.UseVisualStyleBackColor = true;
//
// textBox1
//
this.txtProductInterval.Location = new System.Drawing.Point(274, 38);
this.txtProductInterval.Name = "textBox1";
this.txtProductInterval.Size = new System.Drawing.Size(58, 23);
this.txtProductInterval.TabIndex = 1;
this.txtProductInterval.Text = "50";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(218, 41);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 17);
this.label1.TabIndex = 2;
this.label1.Text = "随机间隔";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(378, 41);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 17);
this.label2.TabIndex = 4;
this.label2.Text = "随机分组";
//
// comboBox1
//
this.cmbProductGroup.FormattingEnabled = true;
this.cmbProductGroup.Location = new System.Drawing.Point(434, 37);
this.cmbProductGroup.Name = "comboBox1";
this.cmbProductGroup.Size = new System.Drawing.Size(121, 25);
this.cmbProductGroup.TabIndex = 5;
//
// btnSave
//
this.btnSave.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnSave.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSave.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSave.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSave.Location = new System.Drawing.Point(609, 38);
this.btnSave.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(60, 23);
this.btnSave.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnSave.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSave.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSave.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnSave.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnSave.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnSave.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnSave.Style.GradientAngle = 90;
this.btnSave.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnSave.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnSave.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnSave.TabIndex = 802;
this.btnSave.Text = "保存";
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// pbLoading
//
this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue;
this.pbLoading.Location = new System.Drawing.Point(375, 200);
this.pbLoading.Name = "pbLoading";
this.pbLoading.Size = new System.Drawing.Size(50, 50);
this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pbLoading.TabIndex = 803;
this.pbLoading.TabStop = false;
this.pbLoading.Visible = false;
//
// RandomComProductForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.pbLoading);
this.Controls.Add(this.btnSave);
this.Controls.Add(this.cmbProductGroup);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.txtProductInterval);
this.Controls.Add(this.chkIsOn);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "RandomComProductForm";
this.Text = "RandomComProductForm";
this.Load += new System.EventHandler(this.RandomComProductForm_Load);
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private UserComponent.UcCheckBox chkIsOn;
private System.Windows.Forms.TextBox txtProductInterval;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox cmbProductGroup;
private DevComponents.DotNetBar.PanelEx btnSave;
private System.Windows.Forms.PictureBox pbLoading;
}
}
@@ -0,0 +1,94 @@
using AllBase;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.BaseForms;
using TemuKJD.PDDForms.ProductSelectForms;
using Work;
namespace TemuKJD.PDDForms.AdminForms
{
public partial class RandomComProductForm : Form
{
public RandomComProductForm()
{
InitializeComponent();
}
private void RandomComProductForm_Load(object sender, EventArgs e)
{
pbLoading.Visible = true;
Task.Run(() =>
{
PDDDBProdListForm.GetPDDProductGroup(new List<ComboBox> { cmbProductGroup, });
var url = BaseClass.BuildObjString("product/get_random_company_product_config");
var data = UserLogin.GetSignaturex();
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
BaseMsgForm.ShowError("获取随机厂商商品配置失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg"));
}
else
{
//this.pictureBox2.ImageLocation = imgListForm.SelectDbImgUrl;
//dbProd.sku_img_replace_id = imgListForm.SelectDbImgId;
//dbProd.sku_img_replace_url = imgListForm.SelectDbImgUrl;
Invoke(new Action(() => {
this.txtProductInterval.Text = BaseRegex.GetStringJson(ref html, "product_interval");
this.cmbProductGroup.Text = BaseRegex.GetStringJson(ref html, "product_group");
this.chkIsOn.Checked = BaseRegex.GetStringJson(ref html, "is_on") == "1";
}));
}
Invoke(new Action(() =>
{
pbLoading.Visible = false;
}));
});
}
private void btnSave_Click(object sender, EventArgs e)
{
pbLoading.Visible = true;
Task.Run(() =>
{
var url = BaseClass.BuildObjString("product/set_random_company_product_config");
var data = UserLogin.GetSignaturex();
Invoke(new Action(() =>
{
data += "&product_interval=" + txtProductInterval.Text.Trim();
data += "&product_group=" + cmbProductGroup.Text.Trim();
data += "&is_on=" + (chkIsOn.Checked ? 1 : 0);
}));
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
BaseMsgForm.ShowError("配置随机厂商商品失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg"));
}
else
{
BaseMsgForm.ShowInfo("配置随机厂商商品成功");
}
Invoke(new Action(() =>
{
pbLoading.Visible = false;
}));
});
}
}
}
@@ -0,0 +1,120 @@
<?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>
</root>