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

+106 -91
View File
@@ -32,13 +32,13 @@ namespace TemuKJD.WXForms.ProductForms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
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 dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.chkUseWXComplateProd = new TemuKJD.UserComponent.UcCheckBox(this.components);
@@ -93,23 +93,18 @@ namespace TemuKJD.WXForms.ProductForms
this.chkWXComplateProd = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.txtAddCount = new System.Windows.Forms.TextBox();
this.txtSearchGoodsName = new System.Windows.Forms.TextBox();
this.label20 = new System.Windows.Forms.Label();
this.pbSelectProd = new System.Windows.Forms.PictureBox();
this.cmbSourceType = new System.Windows.Forms.ComboBox();
this.cmbJstInitSet = new System.Windows.Forms.ComboBox();
this.lblSourceType = new System.Windows.Forms.Label();
this.cmbCateFilter3 = new System.Windows.Forms.ComboBox();
this.label21 = new System.Windows.Forms.Label();
this.cmbGroupFilter = new System.Windows.Forms.ComboBox();
this.txtIdFilter = new System.Windows.Forms.TextBox();
this.lblGroupFilter = new System.Windows.Forms.Label();
this.lblIdFilter = new System.Windows.Forms.Label();
this.cmbCateFilter2 = new System.Windows.Forms.ComboBox();
this.label19 = new System.Windows.Forms.Label();
this.btnClearFilter = new DevComponents.DotNetBar.PanelEx();
this.lblGoodsCount = new System.Windows.Forms.Label();
this.cmbWxSafe = new System.Windows.Forms.ComboBox();
this.lblWxSafe = new System.Windows.Forms.Label();
this.btnClearUpload = new DevComponents.DotNetBar.PanelEx();
this.cmbCateFilter1 = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
@@ -117,7 +112,12 @@ namespace TemuKJD.WXForms.ProductForms
this.btnRandomAdd = new DevComponents.DotNetBar.PanelEx();
this.chkSevenDays = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkSkipQualification = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.lblSourceType = new System.Windows.Forms.Label();
this.lblGroupFilter = new System.Windows.Forms.Label();
this.lblWxSafe = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label();
this.lblJstInitSet = new System.Windows.Forms.Label();
this.lblIdFilter = new System.Windows.Forms.Label();
this.ucGroupBoxEx1 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.btnRefreshAuthor = new DevComponents.DotNetBar.PanelEx();
this.btnSelectOffline = new DevComponents.DotNetBar.PanelEx();
@@ -186,6 +186,7 @@ namespace TemuKJD.WXForms.ProductForms
this.btnClear = new DevComponents.DotNetBar.PanelEx();
this.panelEx1 = new DevComponents.DotNetBar.PanelEx();
this.panel1 = new System.Windows.Forms.Panel();
this.chkRandomCompanyProd = new TemuKJD.UserComponent.UcCheckBox(this.components);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -243,6 +244,7 @@ namespace TemuKJD.WXForms.ProductForms
this.ucGroupBoxEx2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ucGroupBoxEx2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.ucGroupBoxEx2.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND;
this.ucGroupBoxEx2.Controls.Add(this.chkRandomCompanyProd);
this.ucGroupBoxEx2.Controls.Add(this.chkUseWXComplateProd);
this.ucGroupBoxEx2.Controls.Add(this.chkSaveBound);
this.ucGroupBoxEx2.Controls.Add(this.chkAiShortTitle);
@@ -1023,16 +1025,6 @@ namespace TemuKJD.WXForms.ProductForms
this.txtSearchGoodsName.Size = new System.Drawing.Size(223, 25);
this.txtSearchGoodsName.TabIndex = 795;
//
// label20
//
this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(147, 51);
this.label20.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(32, 17);
this.label20.TabIndex = 794;
this.label20.Text = "标题";
//
// pbSelectProd
//
this.pbSelectProd.Image = global::TemuKJD.Properties.Resources.loading_blue;
@@ -1081,17 +1073,6 @@ namespace TemuKJD.WXForms.ProductForms
this.cmbJstInitSet.Text = "已设置";
this.cmbJstInitSet.Visible = false;
//
// lblSourceType
//
this.lblSourceType.AutoSize = true;
this.lblSourceType.Location = new System.Drawing.Point(16, 78);
this.lblSourceType.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.lblSourceType.Name = "lblSourceType";
this.lblSourceType.Size = new System.Drawing.Size(32, 17);
this.lblSourceType.TabIndex = 672;
this.lblSourceType.Text = "来源";
this.lblSourceType.Visible = false;
//
// cmbCateFilter3
//
this.cmbCateFilter3.FormattingEnabled = true;
@@ -1130,28 +1111,6 @@ namespace TemuKJD.WXForms.ProductForms
this.txtIdFilter.TabIndex = 652;
this.txtIdFilter.Visible = false;
//
// lblGroupFilter
//
this.lblGroupFilter.AutoSize = true;
this.lblGroupFilter.Location = new System.Drawing.Point(147, 78);
this.lblGroupFilter.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.lblGroupFilter.Name = "lblGroupFilter";
this.lblGroupFilter.Size = new System.Drawing.Size(32, 17);
this.lblGroupFilter.TabIndex = 570;
this.lblGroupFilter.Text = "分组";
this.lblGroupFilter.Visible = false;
//
// lblIdFilter
//
this.lblIdFilter.AutoSize = true;
this.lblIdFilter.Location = new System.Drawing.Point(27, 104);
this.lblIdFilter.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.lblIdFilter.Name = "lblIdFilter";
this.lblIdFilter.Size = new System.Drawing.Size(21, 17);
this.lblIdFilter.TabIndex = 651;
this.lblIdFilter.Text = "ID";
this.lblIdFilter.Visible = false;
//
// cmbCateFilter2
//
this.cmbCateFilter2.FormattingEnabled = true;
@@ -1221,16 +1180,6 @@ namespace TemuKJD.WXForms.ProductForms
this.cmbWxSafe.TabIndex = 675;
this.cmbWxSafe.Text = "安全+未校验";
//
// lblWxSafe
//
this.lblWxSafe.AutoSize = true;
this.lblWxSafe.Location = new System.Drawing.Point(4, 50);
this.lblWxSafe.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.lblWxSafe.Name = "lblWxSafe";
this.lblWxSafe.Size = new System.Drawing.Size(44, 17);
this.lblWxSafe.TabIndex = 674;
this.lblWxSafe.Text = "微安检";
//
// btnClearUpload
//
this.btnClearUpload.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -1333,6 +1282,48 @@ namespace TemuKJD.WXForms.ProductForms
this.chkSkipQualification.Text = "跳过资质商品";
this.chkSkipQualification.UseVisualStyleBackColor = true;
//
// lblSourceType
//
this.lblSourceType.AutoSize = true;
this.lblSourceType.Location = new System.Drawing.Point(16, 78);
this.lblSourceType.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.lblSourceType.Name = "lblSourceType";
this.lblSourceType.Size = new System.Drawing.Size(32, 17);
this.lblSourceType.TabIndex = 672;
this.lblSourceType.Text = "来源";
this.lblSourceType.Visible = false;
//
// lblGroupFilter
//
this.lblGroupFilter.AutoSize = true;
this.lblGroupFilter.Location = new System.Drawing.Point(147, 78);
this.lblGroupFilter.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.lblGroupFilter.Name = "lblGroupFilter";
this.lblGroupFilter.Size = new System.Drawing.Size(32, 17);
this.lblGroupFilter.TabIndex = 570;
this.lblGroupFilter.Text = "分组";
this.lblGroupFilter.Visible = false;
//
// lblWxSafe
//
this.lblWxSafe.AutoSize = true;
this.lblWxSafe.Location = new System.Drawing.Point(4, 50);
this.lblWxSafe.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.lblWxSafe.Name = "lblWxSafe";
this.lblWxSafe.Size = new System.Drawing.Size(44, 17);
this.lblWxSafe.TabIndex = 674;
this.lblWxSafe.Text = "微安检";
//
// label20
//
this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(147, 51);
this.label20.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(32, 17);
this.label20.TabIndex = 794;
this.label20.Text = "标题";
//
// lblJstInitSet
//
this.lblJstInitSet.AutoSize = true;
@@ -1344,6 +1335,17 @@ namespace TemuKJD.WXForms.ProductForms
this.lblJstInitSet.Text = "分销";
this.lblJstInitSet.Visible = false;
//
// lblIdFilter
//
this.lblIdFilter.AutoSize = true;
this.lblIdFilter.Location = new System.Drawing.Point(27, 104);
this.lblIdFilter.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.lblIdFilter.Name = "lblIdFilter";
this.lblIdFilter.Size = new System.Drawing.Size(21, 17);
this.lblIdFilter.TabIndex = 651;
this.lblIdFilter.Text = "ID";
this.lblIdFilter.Visible = false;
//
// ucGroupBoxEx1
//
this.ucGroupBoxEx1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -1741,19 +1743,19 @@ namespace TemuKJD.WXForms.ProductForms
//
this.dgvShop.AllowUserToAddRows = false;
this.dgvShop.AllowUserToDeleteRows = false;
dataGridViewCellStyle8.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle8;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgvShop.AutoRowNumber = true;
this.dgvShop.BackgroundColor = System.Drawing.Color.White;
this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
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.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle9;
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,
@@ -1973,19 +1975,19 @@ namespace TemuKJD.WXForms.ProductForms
//
this.dgvSelectProduct.AllowUserToAddRows = false;
this.dgvSelectProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle10.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle10;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
this.dgvSelectProduct.AutoRowNumber = true;
this.dgvSelectProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvSelectProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.dgvSelectProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvSelectProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
@@ -2046,8 +2048,8 @@ namespace TemuKJD.WXForms.ProductForms
//
// colSupplierName
//
dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle12;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle5;
this.colSupplierName.Frozen = true;
this.colSupplierName.HeaderText = "店铺名称";
this.colSupplierName.Name = "colSupplierName";
@@ -2125,8 +2127,8 @@ namespace TemuKJD.WXForms.ProductForms
//
// colProductName
//
dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle13;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle6;
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
@@ -2186,8 +2188,8 @@ namespace TemuKJD.WXForms.ProductForms
//
// colAddTime
//
dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colAddTime.DefaultCellStyle = dataGridViewCellStyle14;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colAddTime.DefaultCellStyle = dataGridViewCellStyle7;
this.colAddTime.HeaderText = "上传时间";
this.colAddTime.Name = "colAddTime";
this.colAddTime.ReadOnly = true;
@@ -2290,6 +2292,18 @@ namespace TemuKJD.WXForms.ProductForms
this.panel1.Size = new System.Drawing.Size(873, 86);
this.panel1.TabIndex = 189;
//
// chkRandomCompanyProd
//
this.chkRandomCompanyProd.Checked = true;
this.chkRandomCompanyProd.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkRandomCompanyProd.Location = new System.Drawing.Point(856, 110);
this.chkRandomCompanyProd.Name = "chkRandomCompanyProd";
this.chkRandomCompanyProd.Size = new System.Drawing.Size(87, 21);
this.chkRandomCompanyProd.TabIndex = 889;
this.chkRandomCompanyProd.Text = "随机工厂商品";
this.chkRandomCompanyProd.UseVisualStyleBackColor = true;
this.chkRandomCompanyProd.Visible = false;
//
// WXDBProdUploadForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -2490,5 +2504,6 @@ namespace TemuKJD.WXForms.ProductForms
private UserComponent.UcCheckBox chkWXComplateProd;
private UserComponent.UcCheckBox chkUseWXComplateProd;
private DevComponents.DotNetBar.PanelEx btnProdDb;
private UserComponent.UcCheckBox chkRandomCompanyProd;
}
}
@@ -814,6 +814,18 @@ namespace TemuKJD.WXForms.ProductForms
this.statusBar.UpdateProgressBar(0);
}));
// 随机厂商商品
var url = BaseClass.BuildObjString("product/get_random_company_product_config");
var data = UserLogin.GetSignaturex();
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
chkRandomCompanyProd.Checked = BaseRegex.GetStringJson(ref html, "is_on") == "1";
int randomComProdInterval = Math.Max(1, BaseRegex.GetIntJson(ref html, "product_interval"));
string randomComProdGroup = BaseRegex.GetStringJson(ref html, "product_group");
int waitCompanyProdCnt = 0;
List<TemuDBProductSelect> CompanyProdLst = new List<TemuDBProductSelect>();
NaiBa.Util.ConcurrentList<ShopLoginInfo> currentShopList = new NaiBa.Util.ConcurrentList<ShopLoginInfo>();
while (lstTemuDBProductSelect.Count > 0)
{
@@ -884,13 +896,7 @@ namespace TemuKJD.WXForms.ProductForms
currentShopList.Remove(randomShop);
break;
}
var selectProd = lstTemuDBProductSelect[0];
if (randomShop != null)
{
selectProd.shop_id = randomShop.ShopId;
selectProd.shop_account = randomShop.ShopAccount = randomShop.ShopAccount;
}
else
if (randomShop == null)
{
currentShopList.Remove(randomShop);
continue;
@@ -898,7 +904,40 @@ namespace TemuKJD.WXForms.ProductForms
if (cancellationTokenSource.IsCancellationRequested)
break;
lstTemuDBProductSelect.RemoveAt(0);
// 每次挑选列表第一件商品
var selectProd = lstTemuDBProductSelect[0];
selectProd.shop_id = randomShop.ShopId;
selectProd.shop_account = randomShop.ShopAccount;
// 每若干个个商品插一件黄总商品包或其他组商品
waitCompanyProdCnt++;
if (chkRandomCompanyProd.Checked && waitCompanyProdCnt > randomComProdInterval)
{
waitCompanyProdCnt = 0;
if (CompanyProdLst.Count == 0)
{
int dbCompanyProdCount;
var dbComProdLst = GetRandomCompanyProductList(out dbCompanyProdCount, randomComProdGroup);
foreach (var comProd in dbComProdLst)
{
var comSelectProd = JsonHelper.DeserializeJsonToObject<TemuDBProductSelect>(JsonHelper.SerializeObject(comProd));
comSelectProd.out_product_Id = comProd.id.ToString();
comSelectProd.id = 1;
if (CompanyProdLst.Count > 0)
comSelectProd.id = CompanyProdLst.Max(p => p.id).ParseToInt() + 1;
CompanyProdLst.Add(comSelectProd);
}
}
selectProd = CompanyProdLst.FirstOrDefault();
selectProd.shop_id = randomShop.ShopId;
selectProd.shop_account = randomShop.ShopAccount;
CompanyProdLst.Remove(selectProd);
}
else
{
lstTemuDBProductSelect.RemoveAt(0);
}
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_db_prod_upload_list", this.lstTemuDBProductSelect);
Invoke(new Action(() =>
{
@@ -4377,7 +4416,67 @@ namespace TemuKJD.WXForms.ProductForms
try
{
list = JsonHelper.DeserializeJsonToList<KJDDBProduct>(sProd);
list = JsonHelper.DeserializeJsonToList<KJDDBProduct>(sProd).OrderBy(x => Randomx.GetId(999999)).ToList();
return list;
}
catch (Exception ex)
{
return new List<KJDDBProduct>();
}
}
/// <summary>
/// 随机添加黄总厂商商品(或其他指定分组产品,由服务端控制)
/// </summary>
/// <param name="totalCount"></param>
/// <param name="page"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
public List<KJDDBProduct> GetRandomCompanyProductList(out int totalCount, string groupName = "黄总数据包", int page = 1, int pageSize = 200)
{
var lstShopId = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
List<KJDDBProduct> list = new List<KJDDBProduct>();
int pageCount = 1;
totalCount = 0;
var url = BaseClass.BuildObjString("product/get_pdd_product_list_random");
var data = "";
Invoke(new Action(() =>
{
data = UserLogin.GetSignaturex() +
"&page=" + 1 +
"&page_size=" + pageSize;
data += "&in_groups=" + groupName;
}));
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
Invoke(new Action(() =>
{
BaseMsgForm.ShowError("获取商品失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg"));
}));
return new List<KJDDBProduct>();
}
int count = BaseRegex.GetIntJson(ref html, "count");
totalCount = count;
pageCount = Math.Ceiling(1.0 * count / pageSize).ParseToInt();
pageCount = Math.Max(pageCount, 1);
var jArr = JObject.Parse(html)["data"];
if (jArr.Count() == 0)
return list;
var sProd = JsonHelper.SerializeObject(jArr);
try
{
list = JsonHelper.DeserializeJsonToList<KJDDBProduct>(sProd).OrderBy(x => Randomx.GetId(999999)).ToList();
return list;
}
catch (Exception ex)
+5 -5
View File
@@ -404,7 +404,7 @@ namespace TemuKJD.WXForms.ProductForms
this.cmbCat3.DropDownWidth = 1;
this.cmbCat3.FormattingEnabled = true;
this.cmbCat3.IntegralHeight = false;
this.cmbCat3.Location = new System.Drawing.Point(883, 5);
this.cmbCat3.Location = new System.Drawing.Point(883, 7);
this.cmbCat3.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbCat3.Name = "cmbCat3";
this.cmbCat3.Size = new System.Drawing.Size(201, 25);
@@ -432,7 +432,7 @@ namespace TemuKJD.WXForms.ProductForms
this.cmbCat2.DropDownWidth = 1;
this.cmbCat2.FormattingEnabled = true;
this.cmbCat2.IntegralHeight = false;
this.cmbCat2.Location = new System.Drawing.Point(625, 5);
this.cmbCat2.Location = new System.Drawing.Point(625, 7);
this.cmbCat2.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbCat2.Name = "cmbCat2";
this.cmbCat2.Size = new System.Drawing.Size(201, 25);
@@ -460,7 +460,7 @@ namespace TemuKJD.WXForms.ProductForms
this.cmbCat1.DropDownWidth = 1;
this.cmbCat1.FormattingEnabled = true;
this.cmbCat1.IntegralHeight = false;
this.cmbCat1.Location = new System.Drawing.Point(348, 5);
this.cmbCat1.Location = new System.Drawing.Point(348, 7);
this.cmbCat1.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbCat1.Name = "cmbCat1";
this.cmbCat1.Size = new System.Drawing.Size(201, 25);
@@ -520,7 +520,7 @@ namespace TemuKJD.WXForms.ProductForms
"安全+未校验",
"安全商品",
"未校验"});
this.cmbWxSafe.Location = new System.Drawing.Point(71, 40);
this.cmbWxSafe.Location = new System.Drawing.Point(71, 42);
this.cmbWxSafe.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbWxSafe.Name = "cmbWxSafe";
this.cmbWxSafe.Size = new System.Drawing.Size(201, 25);
@@ -541,7 +541,7 @@ namespace TemuKJD.WXForms.ProductForms
"机会商品",
"以图搜品",
"外部数据"});
this.cmbSourceType.Location = new System.Drawing.Point(883, 40);
this.cmbSourceType.Location = new System.Drawing.Point(883, 42);
this.cmbSourceType.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbSourceType.Name = "cmbSourceType";
this.cmbSourceType.Size = new System.Drawing.Size(201, 25);
@@ -54,20 +54,31 @@ namespace TemuKJD.WXForms.ProductForms
private void ProductListForm_Load(object sender, EventArgs e)
{
if (BaseClass.MainPath == "binxixi")
{
chkCatBoundLessThan.Visible = false;
chkCatBoundMoreThan.Visible = false;
lblWxSafe.Visible = false;
cmbWxSafe.Visible = false;
tableLayoutPanel1.SetColumn(lblSourceType, 0);
tableLayoutPanel1.SetColumn(cmbSourceType, 1);
dgvDbProduct.Columns["colCatBound"].Visible = false;
dgvDbProduct.Columns["colWxSafe"].Visible = false;
dgvDbProduct.Columns["colMainImg"].FillWeight = 25;
}
Task.Run(() =>
{
PDDDBProdListForm.GetPDDProductGroup(new List<ComboBox> { cmbGroupFilter, });
GetPddProductCate();
});
if (BaseClass.SaLevel == 1 && shop == null) // 一级管理员且不是选品状态
{
this.dgvDbProduct.Columns["colPriceText"].Visible = true;
Task.Run(() =>
{
PDDDBProdListForm.GetPDDProductGroup(new List<ComboBox> { cmbGroupFilter, });
GetPddProductCate();
});
}
else
{
this.dgvDbProduct.Columns["colPriceText"].Visible = true;
lblGroup.Visible = false;
}
if (BaseClass.MainPath != "binxixi")
@@ -103,7 +114,7 @@ namespace TemuKJD.WXForms.ProductForms
ucSplitPage1.cmbPageSize.DropDownStyle = ComboBoxStyle.DropDownList;
ucSplitPage1.cmbPageSize.SelectedIndex = 0;
if (BaseClass.SaLevel > 0 || BaseClass.UserAuthority.Contains("货源选择"))
if (BaseClass.SaLevel > 0 || BaseClass.UserAuthority.ParseToString().Contains("货源选择"))
{
lblSourceType.Visible = true;
cmbSourceType.Visible = true;
@@ -773,14 +784,7 @@ namespace TemuKJD.WXForms.ProductForms
private void cmbSourceType_SelectedIndexChanged(object sender, EventArgs e)
{
if (cmbSourceType.Text != "厂商直采" && cmbSourceType.Text != "1688厂家" && cmbSourceType.Text != "微信店采" && cmbSourceType.Text != "微信小店")
{
fillPddCate();
}
else
{
fillWxCate();
}
fillCate();
if (!string.IsNullOrWhiteSpace(cmbSourceType.Text) && cmbSourceType.Text != "厂商直采")
{
@@ -816,17 +820,23 @@ namespace TemuKJD.WXForms.ProductForms
Invoke(new Action(() =>
{
if (cmbSourceType.Text != "厂商直采")
{
fillPddCate();
}
else
{
fillWxCate();
}
fillCate();
}));
}
public void fillCate()
{
if (!string.IsNullOrWhiteSpace(cmbSourceType.Text) &&
cmbSourceType.Text != "厂商直采" && cmbSourceType.Text != "1688厂家" && cmbSourceType.Text != "微信店采" && cmbSourceType.Text != "微信小店")
{
fillPddCate();
}
else
{
fillWxCate();
}
}
public string pdd_product_cates = "";
void fillPddCate()
{