微信类目获取

This commit is contained in:
wule committed 2026-01-26 22:33:05 +08:00
1 parent c2c4c8da1a
commit ddc5f6490f
24 files changed
+1082 -268

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
using AllBase;
using AllBase.Helper;
using AllBase.Model.Result.WXResult;
using NaiBa.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TemuKJD.BaseForms;
using Work;
namespace TemuKJD.BLL
{
public class WxApiBLL
{
public string GetWxToken()
{
if (GlobalConfig.WxTokenList.Count == 0 || GlobalConfig.WxTokenList.Any(t => t.isExpire == true))
{
var url = BaseClass.BuildPDDObjString("product/get_wx_tokens");
var data = UserLogin.GetSignaturex();
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
BaseMsgForm.ShowError("获取类目失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg"));
return "";
}
var tokenStr = JsonHelper.SerializeObject(JsonHelper.JObjectParse(html)["tokens"].FirstOrDefault());
GlobalConfig.WxTokenList = new ConcurrentList<WXShopTokenInfo>();
GlobalConfig.WxTokenList.AddRange(JsonHelper.DeserializeJsonToList<WXShopTokenInfo>(tokenStr));
}
return GlobalConfig.WxTokenList.OrderBy(x => Guid.NewGuid()).FirstOrDefault()?.accessToken;
}
}
}
+1
View File
@@ -125,6 +125,7 @@
<Compile Include="BLL\MemoryReader.cs" />
<Compile Include="BLL\PDDProdFormConverter.cs" />
<Compile Include="BLL\ProductSelectBLL.cs" />
<Compile Include="BLL\WxApiBLL.cs" />
<Compile Include="BLL\WXHttpResponseBLL.cs" />
<Compile Include="BoundObject.cs" />
<Compile Include="ChangeForm.cs">
+27
View File
@@ -46,6 +46,7 @@ using TemuKJD.KJDForms.JITForms;
using TemuKJD.WXForms.ShopForms;
using TemuKJD.WXForms.AdminForms;
using TemuKJD.WXForms.ProductForms;
using AllBase.Model.Result.WXResult;
namespace TemuKJD
{
@@ -303,6 +304,32 @@ namespace TemuKJD
//ViolateManageForm.GetAllViolateRuleName();
//GetShopViolation();
//});
Task.Run(()=>
{
ReadWxCate();
});
}
void ReadWxCate()
{
string filePath = Path.Combine(Environment.CurrentDirectory, "temp\\wxCat");
if (!File.Exists(filePath))
return;
using (StreamReader sr = new StreamReader(filePath, System.Text.Encoding.UTF8))
{
try
{
string cateStr = sr.ReadToEnd().Trim();
GlobalConfig.WxCatList.AddRange(JsonHelper.DeserializeJsonToList<WxCatInfo>(cateStr));
}
catch (Exception ex)
{
BaseMsgForm.ShowError("商品列表获取失败:" + ex.Message);
}
if (GlobalConfig.WxCatList == null)
GlobalConfig.WxCatList = new ConcurrentList<WxCatInfo>();
}
}
public void SetTitle()
@@ -48,7 +48,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
if(string.IsNullOrWhiteSpace(dbProd?.product_json))
{
var prodTmp = GetProductDetail(dbProd.id.ToString());
var prodTmp = GetPddProductDetail(dbProd.id.ToString());
if (prodTmp != null)
dbProd = prodTmp;
}
@@ -100,14 +100,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms
imgFrom.ShowDialog();
}
public KJDDBProduct GetProductDetail(string prodDbId)
public static KJDDBProduct GetPddProductDetail(string prodDbId)
{
if (string.IsNullOrEmpty(prodDbId))
return new KJDDBProduct();
List<KJDDBProduct> list = new List<KJDDBProduct>();
var url = BaseClass.BuildObjString("product/get_product_detail_list");
var url = BaseClass.BuildPDDObjString("product/get_product_detail_list");
var data = "";
data = UserLogin.GetSignaturex() + "&search_db_ids=" + prodDbId;
@@ -37,8 +37,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PDDDBProdListForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.cmbWxCat = new System.Windows.Forms.ComboBox();
this.label12 = new System.Windows.Forms.Label();
this.btnGetProdWxCate = new DevComponents.DotNetBar.PanelEx();
this.cmbSetWxSafe = new System.Windows.Forms.ComboBox();
this.btnSetWxSafe = new DevComponents.DotNetBar.PanelEx();
this.btnImport = new DevComponents.DotNetBar.PanelEx();
@@ -77,6 +81,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnSetGroup = new DevComponents.DotNetBar.PanelEx();
this.label7 = new System.Windows.Forms.Label();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.btnGetAllCate = new DevComponents.DotNetBar.PanelEx();
this.pnlEditExtCodePrice = new System.Windows.Forms.Panel();
this.lblExtCode = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
@@ -148,6 +153,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.cmbWxCat);
this.splitContainer1.Panel1.Controls.Add(this.label12);
this.splitContainer1.Panel1.Controls.Add(this.btnGetProdWxCate);
this.splitContainer1.Panel1.Controls.Add(this.cmbSetWxSafe);
this.splitContainer1.Panel1.Controls.Add(this.btnSetWxSafe);
this.splitContainer1.Panel1.Controls.Add(this.btnImport);
@@ -171,6 +179,57 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.splitContainer1.SplitterDistance = 76;
this.splitContainer1.TabIndex = 1;
//
// cmbWxCat
//
this.cmbWxCat.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.cmbWxCat.FormattingEnabled = true;
this.cmbWxCat.Items.AddRange(new object[] {
"",
"有",
"无"});
this.cmbWxCat.Location = new System.Drawing.Point(676, 9);
this.cmbWxCat.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbWxCat.Name = "cmbWxCat";
this.cmbWxCat.Size = new System.Drawing.Size(49, 25);
this.cmbWxCat.TabIndex = 802;
this.cmbWxCat.Text = "无";
//
// label12
//
this.label12.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(619, 13);
this.label12.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(68, 17);
this.label12.TabIndex = 801;
this.label12.Text = "微信类目:";
//
// btnGetProdWxCate
//
this.btnGetProdWxCate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnGetProdWxCate.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnGetProdWxCate.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnGetProdWxCate.DisabledBackColor = System.Drawing.Color.Empty;
this.btnGetProdWxCate.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnGetProdWxCate.Location = new System.Drawing.Point(731, 9);
this.btnGetProdWxCate.Name = "btnGetProdWxCate";
this.btnGetProdWxCate.Size = new System.Drawing.Size(84, 25);
this.btnGetProdWxCate.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnGetProdWxCate.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnGetProdWxCate.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnGetProdWxCate.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnGetProdWxCate.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnGetProdWxCate.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnGetProdWxCate.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnGetProdWxCate.Style.GradientAngle = 90;
this.btnGetProdWxCate.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnGetProdWxCate.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnGetProdWxCate.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnGetProdWxCate.TabIndex = 781;
this.btnGetProdWxCate.Text = "微信类目识别";
this.btnGetProdWxCate.Click += new System.EventHandler(this.btnGetProdWxCate_Click);
//
// cmbSetWxSafe
//
this.cmbSetWxSafe.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -180,7 +239,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
"安全商品",
"违规商品",
"未校验"});
this.cmbSetWxSafe.Location = new System.Drawing.Point(750, 44);
this.cmbSetWxSafe.Location = new System.Drawing.Point(861, 43);
this.cmbSetWxSafe.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbSetWxSafe.Name = "cmbSetWxSafe";
this.cmbSetWxSafe.Size = new System.Drawing.Size(85, 25);
@@ -193,7 +252,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnSetWxSafe.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSetWxSafe.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSetWxSafe.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSetWxSafe.Location = new System.Drawing.Point(837, 44);
this.btnSetWxSafe.Location = new System.Drawing.Point(948, 43);
this.btnSetWxSafe.Name = "btnSetWxSafe";
this.btnSetWxSafe.Size = new System.Drawing.Size(84, 25);
this.btnSetWxSafe.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -218,7 +277,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnImport.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnImport.DisabledBackColor = System.Drawing.Color.Empty;
this.btnImport.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnImport.Location = new System.Drawing.Point(1045, 26);
this.btnImport.Location = new System.Drawing.Point(1048, 43);
this.btnImport.Name = "btnImport";
this.btnImport.Size = new System.Drawing.Size(84, 25);
this.btnImport.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -350,7 +409,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(727, 71);
this.tableLayoutPanel1.Size = new System.Drawing.Size(609, 71);
this.tableLayoutPanel1.TabIndex = 679;
//
// cmbSpProdType
@@ -361,17 +420,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
"",
"普通商品",
"书籍"});
this.cmbSpProdType.Location = new System.Drawing.Point(444, 43);
this.cmbSpProdType.Location = new System.Drawing.Point(381, 40);
this.cmbSpProdType.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbSpProdType.Name = "cmbSpProdType";
this.cmbSpProdType.Size = new System.Drawing.Size(70, 25);
this.cmbSpProdType.Size = new System.Drawing.Size(49, 25);
this.cmbSpProdType.TabIndex = 677;
//
// label11
//
this.label11.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(376, 44);
this.label11.Location = new System.Drawing.Point(313, 44);
this.label11.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(68, 17);
@@ -388,17 +447,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
"厂商直采",
"机会商品",
"外部数据"});
this.cmbSourceType.Location = new System.Drawing.Point(300, 43);
this.cmbSourceType.Location = new System.Drawing.Point(258, 40);
this.cmbSourceType.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbSourceType.Name = "cmbSourceType";
this.cmbSourceType.Size = new System.Drawing.Size(70, 25);
this.cmbSourceType.Size = new System.Drawing.Size(49, 25);
this.cmbSourceType.TabIndex = 654;
//
// label10
//
this.label10.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(256, 44);
this.label10.Location = new System.Drawing.Point(214, 44);
this.label10.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(44, 17);
@@ -422,14 +481,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.txtSPU.Location = new System.Drawing.Point(60, 6);
this.txtSPU.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.txtSPU.Name = "txtSPU";
this.txtSPU.Size = new System.Drawing.Size(70, 23);
this.txtSPU.Size = new System.Drawing.Size(49, 23);
this.txtSPU.TabIndex = 434;
//
// label2
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(136, 9);
this.label2.Location = new System.Drawing.Point(115, 9);
this.label2.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 17);
@@ -439,17 +498,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// txtCat
//
this.txtCat.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txtCat.Location = new System.Drawing.Point(180, 6);
this.txtCat.Location = new System.Drawing.Point(159, 6);
this.txtCat.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.txtCat.Name = "txtCat";
this.txtCat.Size = new System.Drawing.Size(70, 23);
this.txtCat.Size = new System.Drawing.Size(49, 23);
this.txtCat.TabIndex = 425;
//
// label3
//
this.label3.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(256, 9);
this.label3.Location = new System.Drawing.Point(214, 9);
this.label3.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 17);
@@ -459,17 +518,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// txtProdName
//
this.txtProdName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txtProdName.Location = new System.Drawing.Point(300, 6);
this.txtProdName.Location = new System.Drawing.Point(258, 6);
this.txtProdName.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.txtProdName.Name = "txtProdName";
this.txtProdName.Size = new System.Drawing.Size(70, 23);
this.txtProdName.Size = new System.Drawing.Size(49, 23);
this.txtProdName.TabIndex = 427;
//
// label4
//
this.label4.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(400, 9);
this.label4.Location = new System.Drawing.Point(337, 9);
this.label4.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 17);
@@ -479,17 +538,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// txtExtCode
//
this.txtExtCode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txtExtCode.Location = new System.Drawing.Point(444, 6);
this.txtExtCode.Location = new System.Drawing.Point(381, 6);
this.txtExtCode.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.txtExtCode.Name = "txtExtCode";
this.txtExtCode.Size = new System.Drawing.Size(70, 23);
this.txtExtCode.Size = new System.Drawing.Size(49, 23);
this.txtExtCode.TabIndex = 429;
//
// label6
//
this.label6.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(544, 9);
this.label6.Location = new System.Drawing.Point(460, 9);
this.label6.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(44, 17);
@@ -503,9 +562,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.cmbSort.Items.AddRange(new object[] {
"入库时间",
"认领总数"});
this.cmbSort.Location = new System.Drawing.Point(591, 7);
this.cmbSort.Location = new System.Drawing.Point(507, 5);
this.cmbSort.Name = "cmbSort";
this.cmbSort.Size = new System.Drawing.Size(67, 25);
this.cmbSort.Size = new System.Drawing.Size(46, 25);
this.cmbSort.TabIndex = 448;
this.cmbSort.Text = "入库时间";
//
@@ -516,9 +575,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnSearch.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSearch.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSearch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSearch.Location = new System.Drawing.Point(664, 5);
this.btnSearch.Location = new System.Drawing.Point(559, 5);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(56, 25);
this.btnSearch.Size = new System.Drawing.Size(46, 25);
this.btnSearch.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnSearch.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSearch.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
@@ -551,14 +610,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.txtNotes.Location = new System.Drawing.Point(60, 41);
this.txtNotes.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.txtNotes.Name = "txtNotes";
this.txtNotes.Size = new System.Drawing.Size(70, 23);
this.txtNotes.Size = new System.Drawing.Size(49, 23);
this.txtNotes.TabIndex = 439;
//
// lblGroup
//
this.lblGroup.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblGroup.AutoSize = true;
this.lblGroup.Location = new System.Drawing.Point(136, 44);
this.lblGroup.Location = new System.Drawing.Point(115, 44);
this.lblGroup.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.lblGroup.Name = "lblGroup";
this.lblGroup.Size = new System.Drawing.Size(44, 17);
@@ -569,10 +628,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.cmbGroupFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.cmbGroupFilter.FormattingEnabled = true;
this.cmbGroupFilter.Location = new System.Drawing.Point(180, 43);
this.cmbGroupFilter.Location = new System.Drawing.Point(159, 40);
this.cmbGroupFilter.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbGroupFilter.Name = "cmbGroupFilter";
this.cmbGroupFilter.Size = new System.Drawing.Size(70, 25);
this.cmbGroupFilter.Size = new System.Drawing.Size(49, 25);
this.cmbGroupFilter.TabIndex = 653;
//
// cmbWxSafe
@@ -584,17 +643,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
"安全商品",
"违规商品",
"未校验"});
this.cmbWxSafe.Location = new System.Drawing.Point(588, 43);
this.cmbWxSafe.Location = new System.Drawing.Point(504, 40);
this.cmbWxSafe.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbWxSafe.Name = "cmbWxSafe";
this.cmbWxSafe.Size = new System.Drawing.Size(70, 25);
this.cmbWxSafe.Size = new System.Drawing.Size(49, 25);
this.cmbWxSafe.TabIndex = 676;
//
// lblWxSafe
//
this.lblWxSafe.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblWxSafe.AutoSize = true;
this.lblWxSafe.Location = new System.Drawing.Point(520, 44);
this.lblWxSafe.Location = new System.Drawing.Point(436, 44);
this.lblWxSafe.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.lblWxSafe.Name = "lblWxSafe";
this.lblWxSafe.Size = new System.Drawing.Size(68, 17);
@@ -607,9 +666,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.pnlEmpty.CanvasColor = System.Drawing.SystemColors.Control;
this.pnlEmpty.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.pnlEmpty.DisabledBackColor = System.Drawing.Color.Empty;
this.pnlEmpty.Location = new System.Drawing.Point(664, 40);
this.pnlEmpty.Location = new System.Drawing.Point(559, 40);
this.pnlEmpty.Name = "pnlEmpty";
this.pnlEmpty.Size = new System.Drawing.Size(56, 25);
this.pnlEmpty.Size = new System.Drawing.Size(46, 25);
this.pnlEmpty.Style.Alignment = System.Drawing.StringAlignment.Center;
this.pnlEmpty.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.pnlEmpty.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
@@ -623,7 +682,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.pnlEmpty.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.pnlEmpty.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.pnlEmpty.TabIndex = 431;
this.pnlEmpty.Text = "清空条件";
this.pnlEmpty.Text = "清空";
this.pnlEmpty.Click += new System.EventHandler(this.pnlEmpty_Click);
//
// btnExportTxt
@@ -658,7 +717,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnDelSelect.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnDelSelect.DisabledBackColor = System.Drawing.Color.Empty;
this.btnDelSelect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDelSelect.Location = new System.Drawing.Point(941, 26);
this.btnDelSelect.Location = new System.Drawing.Point(1048, 9);
this.btnDelSelect.Name = "btnDelSelect";
this.btnDelSelect.Size = new System.Drawing.Size(84, 25);
this.btnDelSelect.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -680,7 +739,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.cmbGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cmbGroup.FormattingEnabled = true;
this.cmbGroup.Location = new System.Drawing.Point(750, 10);
this.cmbGroup.Location = new System.Drawing.Point(861, 9);
this.cmbGroup.Name = "cmbGroup";
this.cmbGroup.Size = new System.Drawing.Size(85, 25);
this.cmbGroup.TabIndex = 640;
@@ -692,7 +751,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnSetGroup.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSetGroup.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSetGroup.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSetGroup.Location = new System.Drawing.Point(837, 10);
this.btnSetGroup.Location = new System.Drawing.Point(948, 9);
this.btnSetGroup.Name = "btnSetGroup";
this.btnSetGroup.Size = new System.Drawing.Size(84, 25);
this.btnSetGroup.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -731,6 +790,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.btnGetAllCate);
this.splitContainer2.Panel1.Controls.Add(this.pnlEditExtCodePrice);
this.splitContainer2.Panel1.Controls.Add(this.pbLoading);
this.splitContainer2.Panel1.Controls.Add(this.txtSKC);
@@ -747,6 +807,31 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.splitContainer2.SplitterDistance = 577;
this.splitContainer2.TabIndex = 0;
//
// btnGetAllCate
//
this.btnGetAllCate.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnGetAllCate.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnGetAllCate.DisabledBackColor = System.Drawing.Color.Empty;
this.btnGetAllCate.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnGetAllCate.Location = new System.Drawing.Point(15, 33);
this.btnGetAllCate.Name = "btnGetAllCate";
this.btnGetAllCate.Size = new System.Drawing.Size(84, 25);
this.btnGetAllCate.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnGetAllCate.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnGetAllCate.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnGetAllCate.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnGetAllCate.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnGetAllCate.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnGetAllCate.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnGetAllCate.Style.GradientAngle = 90;
this.btnGetAllCate.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnGetAllCate.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnGetAllCate.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnGetAllCate.TabIndex = 777;
this.btnGetAllCate.Text = "取微信全类目";
this.btnGetAllCate.Visible = false;
this.btnGetAllCate.Click += new System.EventHandler(this.btnGetAllCate_Click);
//
// pnlEditExtCodePrice
//
this.pnlEditExtCodePrice.Anchor = System.Windows.Forms.AnchorStyles.None;
@@ -1025,6 +1110,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.colSkuReplaceImg.ReadOnly = true;
this.colSkuReplaceImg.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colSkuReplaceImg.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colSkuReplaceImg.Visible = false;
//
// col_spu_id
//
@@ -1041,6 +1127,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// col_cat_name
//
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.col_cat_name.DefaultCellStyle = dataGridViewCellStyle4;
this.col_cat_name.HeaderText = "类目";
this.col_cat_name.Name = "col_cat_name";
this.col_cat_name.ReadOnly = true;
@@ -1105,16 +1193,16 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// col_notes
//
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.col_notes.DefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.col_notes.DefaultCellStyle = dataGridViewCellStyle5;
this.col_notes.HeaderText = "备注";
this.col_notes.Name = "col_notes";
this.col_notes.ReadOnly = true;
//
// colHeadWords
//
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colHeadWords.DefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colHeadWords.DefaultCellStyle = dataGridViewCellStyle6;
this.colHeadWords.HeaderText = "标题前缀";
this.colHeadWords.Name = "colHeadWords";
this.colHeadWords.ReadOnly = true;
@@ -1122,8 +1210,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colEndWords
//
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colEndWords.DefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colEndWords.DefaultCellStyle = dataGridViewCellStyle7;
this.colEndWords.HeaderText = "标题后缀";
this.colEndWords.Name = "colEndWords";
this.colEndWords.ReadOnly = true;
@@ -1131,8 +1219,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colFissionWords
//
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colFissionWords.DefaultCellStyle = dataGridViewCellStyle7;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colFissionWords.DefaultCellStyle = dataGridViewCellStyle8;
this.colFissionWords.HeaderText = "裂变词";
this.colFissionWords.Name = "colFissionWords";
this.colFissionWords.ReadOnly = true;
@@ -1203,12 +1291,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.ucSplitPage1.CurrentPage = 1;
this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right;
this.ucSplitPage1.IsShowPageSize = true;
this.ucSplitPage1.Location = new System.Drawing.Point(1024, 0);
this.ucSplitPage1.Location = new System.Drawing.Point(985, 0);
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);
this.ucSplitPage1.PageSize = 50;
this.ucSplitPage1.Size = new System.Drawing.Size(414, 25);
this.ucSplitPage1.PageSize = 100;
this.ucSplitPage1.Size = new System.Drawing.Size(453, 25);
this.ucSplitPage1.TabIndex = 6;
this.ucSplitPage1.TotalPage = 1;
//
@@ -1313,6 +1401,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private DevComponents.DotNetBar.PanelEx btnSetWxSafe;
private System.Windows.Forms.ComboBox cmbSpProdType;
private System.Windows.Forms.Label label11;
private DevComponents.DotNetBar.PanelEx btnGetAllCate;
private DevComponents.DotNetBar.PanelEx btnGetProdWxCate;
private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect;
private System.Windows.Forms.DataGridViewTextBoxColumn col_db_id;
private System.Windows.Forms.DataGridViewTextBoxColumn colFromShopId;
@@ -1344,5 +1434,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private System.Windows.Forms.DataGridViewLinkColumn col_edit;
private System.Windows.Forms.DataGridViewLinkColumn col_delete;
private System.Windows.Forms.DataGridViewLinkColumn col_select_product;
private System.Windows.Forms.ComboBox cmbWxCat;
private System.Windows.Forms.Label label12;
}
}
@@ -1,6 +1,8 @@
using AllBase;
using AllBase.Helper;
using AllBase.Model.Result;
using AllBase.Model.Result.PDDResult;
using AllBase.Model.Result.WXResult;
using NaiBa.Util;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
@@ -155,6 +157,39 @@ namespace TemuKJD.PDDForms.ProductSelectForms
}
foreach (var prod in lstTemuDbProduct)
{
string catName = prod.cat_name;
if (prod.wx_cat_leaf != null)
{
var catN = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == prod.wx_cat_leaf.ParseToString())?.name;
if (!string.IsNullOrEmpty(catN))
{
catName = catN;
}
}
if (prod.wx_cat_3 != null)
{
var catN = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == prod.wx_cat_3.ParseToString())?.name;
if (!string.IsNullOrEmpty(catN))
{
catName = catN + " >> " + catName;
}
}
if (prod.wx_cat_2 != null)
{
var catN = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == prod.wx_cat_2.ParseToString())?.name;
if (!string.IsNullOrEmpty(catN))
{
catName = catN + " >> " + catName;
}
}
if (prod.wx_cat_1 != null)
{
var catN = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == prod.wx_cat_1.ParseToString())?.name;
if (!string.IsNullOrEmpty(catN))
{
catName = catN + " >> " + catName;
}
}
Invoke(new Action(() =>
{
int rowIndex = this.dgvDbProduct.Rows.Add(
@@ -168,7 +203,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
DataGridViewExtension.defaultBitmap,
prod.spu_id,
prod.skc_id,
prod.cat_name,
catName,
prod.ext_code,
prod.group,
prod.price_text, // 母店价格
@@ -279,6 +314,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms
"&search_prod_name=" + txtProdName.Text.Trim() +
"&wx_safe_status=" + cmbWxSafe.Text.Trim() +
"&special_prod_type=" + cmbSpProdType.Text.Trim();
if(!string.IsNullOrEmpty(cmbWxCat.Text))
{
data += "&has_wx_cat=" + (cmbWxCat.Text.Trim() == "有").ParseToString().ToLower();
}
if (cmbSourceType.Text.Trim() != "全部")
{
data += "&product_get_type=" + cmbSourceType.Text.Trim();
@@ -390,7 +430,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
imgFrom.ShowDialog();
break;
case "认领":
Task.Run(() => { SelectProduct(new KJDDBProduct[] { dbProduct }); });
//Task.Run(() => { SelectProduct(new KJDDBProduct[] { dbProduct }); });
break;
case "编辑":
this.lblExtCodePrice.Text = "调整货号 " + dgvDbProduct.Rows[e.RowIndex].Cells["col_ext_code"].Value.ParseToString() + " 价格";
@@ -406,162 +446,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
}
}
private void SelectProduct(KJDDBProduct[] prods)
{
if (shop == null)
{
BaseMsgForm.ShowError("店铺不能为空!");
return;
}
if (prods == null || prods.Count() == 0)
{
BaseMsgForm.ShowError("认领商品不能为空!");
return;
}
Invoke(new Action(() =>
{
this.pbLoading.Visible = true;
this.statusBar.lblTaskStatus.Text = "正在认领...";
this.statusBar.pgbTaskProgress.Maximum = prods.Length;
this.statusBar.UpdateProgressBar(0);
}));
string errorMsg = "";
foreach (var prod in prods)
{
Invoke(new Action(() =>
{
this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1);
}));
if (prod == null)
{
errorMsg += "prod null; ";
continue;
}
if (shop.AddProductRemaining <=0)
{
if (!errorMsg.Contains("本月商品认领限额已用完"))
errorMsg += " 本月商品认领限额已用完,请下个月再操作!";
continue;
}
try
{
var fissionProductName = GetFissionProductName(prod);
var url = BaseClass.BuildObjString("product/add_user_select_product");
var data = UserLogin.GetSignaturex() +
"&out_product_id=" + prod.id +
"&shop_id=" + shop.ShopId +
"&shop_account=" + shop.ShopAccount +
"&main_user_name=" + shop.UserName +
"&sub_user_name=" + shop.SubUserName +
"&add_product_remaining=" + shop.AddProductRemaining +
"&add_fission_product_name=" + GetHtml.UrlEncodeUtf8(fissionProductName) +
"&status=待上传";
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"))
{
errorMsg += prod.spu_id + " " + BaseRegex.GetStringJson(ref html, "msg") + "; ";
}
else
{
prod.select_count++;
prod.select_total_count++;
Invoke(new Action(() =>
{
var row = this.dgvDbProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["col_db_id"].Value.ParseToInt() == prod.id);
if (row != null)
{
row.Cells["colAddTimes"].Value = prod.select_count;
row.Cells["colSelectTotalCount"].Value = prod.select_total_count;
}
}));
shop.AddProductRemaining = shop.AddProductRemaining - 1;
}
}
catch (Exception ex) {
errorMsg += ex.Message + "; ";
}
}
if (!string.IsNullOrEmpty(errorMsg))
{
Invoke(new Action(() =>
{
BaseMsgForm.ShowError("认领商品失败,请重试!\r\n" + errorMsg.Trim());
}));
}
else
{
Invoke(new Action(() =>
{
BaseMsgForm.ShowInfo("认领商品成功!");
}));
}
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
this.statusBar.lblTaskStatus.Text = "认领完成";
this.statusBar.UpdateProgressBar(prods.Length);
}));
}
public static string GetFissionProductName(KJDDBProduct prod)
{
string headWords = "";
if (!string.IsNullOrWhiteSpace(prod.head_words))
{
var numberRegex = BaseRegex.GetMatchRegex(prod.head_words.Trim(), "\\d{1,9}");
var numbers = numberRegex.Cast<Match>().Select(m => m.Value.ParseToInt()).ToList();
//var numbers = prod.head_words.Split(new string[] { "-", "个" }, StringSplitOptions.RemoveEmptyEntries).Select(w => w.ParseToInt()).ToList();
int minNum = 5;
int maxNum = 19;
if (numbers.Count > 0 && numbers[0] > 0)
{
minNum = numbers[0];
if (numbers.Count > 1 && numbers[1] > 0)
{
maxNum = numbers[1];
}
if (maxNum < minNum)
{
maxNum = minNum;
}
headWords += Randomx.GetId(minNum, maxNum + 1) + prod.head_words.Trim().Replace(minNum + "-" + maxNum, "");
}
}
//string endWords = string.IsNullOrEmpty(prod.end_words) ? "适合不同的搭配风格" : prod.end_words;
string endWords = string.IsNullOrWhiteSpace(prod.end_words) ? "" : prod.end_words;
List<string> fissionLst = new List<string>();
fissionLst.AddRange(prod.fission_words.ParseToString().Split(new string[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries));
string centerWords = ",";
while (fissionLst.Count > 0)
{
int id = Randomx.GetId(fissionLst.Count);
var fissionTxt = fissionLst[id];
fissionLst.RemoveAt(id);
var allTxt = headWords + prod.product_name + centerWords + fissionTxt + "," + endWords;
byte[] bytes = Encoding.GetEncoding("gb2312").GetBytes(allTxt);
if (bytes.Length > 250)
{
break;
}
centerWords += fissionTxt + ",";
}
return (headWords + prod.product_name + centerWords + endWords).Trim(',');
}
private void DeleteProduct(string dbId, bool isUpdate = true)
{
var url = BaseClass.BuildPDDObjString("product/del_db_product");
@@ -594,7 +478,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
{
this.btnSelect.Enabled = false;
Task.Run(() => {
SelectProduct(prodList);
//SelectProduct(prodList);
Invoke(new Action(() =>
{
this.btnSelect.Enabled = true;
@@ -1065,5 +949,225 @@ namespace TemuKJD.PDDForms.ProductSelectForms
}
}
}
private void btnGetAllCate_Click(object sender, EventArgs e)
{
new WxApiBLL().GetWxToken();
var url1 = BaseClass.BuildPDDObjString("product/get_wx_all_cate");
var data1 = UserLogin.GetSignaturex();
data1 += "&token=" + GlobalConfig.WxTokenList.OrderBy(x => Guid.NewGuid()).FirstOrDefault()?.accessToken;
var html1 = GetHtml.PostUtf8(url1, data1);
var catDataObj = JsonHelper.JObjectParse(html1)["cats_v2"];
var catDataObjLst = JsonHelper.JObjectParse(html1)["cats_v2"].Take(10).ToList();
GlobalConfig.WxCatList.Clear();
foreach (var catAndQuaObj in catDataObj)
{
foreach (var catObj in catAndQuaObj["cat_and_qua"])
{
WxCatInfo catInfo = new WxCatInfo()
{
cat_id = catObj["cat"]["cat_id"].ParseToString(),
f_cat_id = catObj["cat"]["f_cat_id"].ParseToString(),
is_local_life = catObj["cat"]["is_local_life"].ParseToBool(),
leaf = catObj["cat"]["leaf"].ParseToBool(),
level = catObj["cat"]["level"].ParseToInt(),
name = catObj["cat"]["name"].ParseToString(),
};
if (!GlobalConfig.WxCatList.Any(c => c.cat_id == catInfo.cat_id))
GlobalConfig.WxCatList.Add(catInfo);
}
}
var catV2Str = JsonHelper.SerializeObject(GlobalConfig.WxCatList);
}
private void btnGetProdWxCate_Click(object sender, EventArgs e)
{
var lstProdId = dgvDbProduct.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["col_spu_id"]?.Value.ToString()).ToList();
var prodList = this.lstTemuDbProduct.Where(p => lstProdId.Contains(p.spu_id)).ToArray();
if (prodList.Length == 0)
return;
this.statusBar.pgbTaskProgress.Maximum = prodList.Length;
this.statusBar.UpdateProgressBar(0);
this.pbLoading.Visible = true;
Task.Run(() =>
{
try
{
GetProdWxCat(prodList);
}
catch (Exception ex)
{
BaseMsgForm.ShowError(ex.Message);
}
// 刷新结果
SearchDbProd(this.ucSplitPage1.CurrentPage);
Invoke(new Action(() =>
{
pbLoading.Visible = false;
BaseMsgForm.ShowInfo("操作完成!");
}));
});
}
void GetProdWxCat(KJDDBProduct[] prodList)
{
foreach (var prod in prodList)
{
// 获取微信accessToken
var token = new WxApiBLL().GetWxToken();
try
{
JObject obj = new JObject();
obj["req_type"] = 1;
obj["head_imgs"] = new JArray();
var dbProd = PDDDBProdEditForm.GetPddProductDetail(prod.id.ParseToString());
var prodObj = JsonHelper.JObjectParse(dbProd.product_json);
List<string> mainImgLst = new List<string>();
if (!prodObj["jstProd"].IsNullOrEmpty())
{
var jstProd = JsonHelper.DeserializeJsonToObject<JSTListProductInfo>(JsonHelper.SerializeObject(prodObj["jstProd"]));
mainImgLst = jstProd.itemMainImage.Take(3).ToList();
foreach (var img in mainImgLst)
{
var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image");
var upDate = UserLogin.GetSignaturex();
upDate += "&token=" + token;
upDate += "&post_data=" + GetHtml.UrlEncodeUtf8("{\"img_url\":\"" + img + "\"}");
var upDateRst = GetHtml.PostUtf8(urlImg, upDate);
var upImgUrl = BaseRegex.GetStringJson(ref upDateRst, "img_url");
(obj["head_imgs"] as JArray).Add(upImgUrl);
}
obj["title"] = jstProd.itemName;
string post_data = JsonHelper.SerializeObject(obj);
var url1 = BaseClass.BuildPDDObjString("product/wx_api_category_classify");
var data1 = UserLogin.GetSignaturex();
data1 += "&token=" + token;
data1 += "&post_data=" + GetHtml.UrlEncodeUtf8(post_data);
var html1 = GetHtml.PostUtf8(url1, data1);
var catId = BaseRegex.GetStringJson(ref html1, "cat_id");
var jCatFirstLst = JsonHelper.JObjectParse(html1)["categories"].FirstOrDefault()["cats"] as JArray;
int index = 0;
foreach (JObject jCatObj in jCatFirstLst)
{
index++;
if (index == 1)
{
var catStr = jCatObj["cat_info"]["cat_id"].ParseToString();
dbProd.wx_cat_1 = catStr.ParseToLong();
dbProd.main_cat_id = catStr;
dbProd.main_cat_name = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == dbProd.wx_cat_1.ParseToString()).name;
}
if (index == 2)
{
var catStr = jCatObj["cat_info"]["cat_id"].ParseToString();
dbProd.wx_cat_2 = catStr.ParseToLong();
var wxCat = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == dbProd.wx_cat_2.ParseToString()).name;
}
if (index == 3)
{
var catStr = jCatObj["cat_info"]["cat_id"].ParseToString();
dbProd.wx_cat_3 = catStr.ParseToLong();
var wxCat = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == dbProd.wx_cat_3.ParseToString()).name;
}
if (index == jCatFirstLst.Count)
{
var catStr = jCatObj["cat_info"]["cat_id"].ParseToString();
dbProd.wx_cat_leaf = catStr.ParseToLong();
dbProd.cat_id = catStr;
dbProd.cat_name = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == dbProd.wx_cat_leaf.ParseToString()).name;
}
}
}
if (dbProd.wx_cat_1 != null && dbProd.wx_cat_leaf != null)
{
var row = dgvDbProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["col_spu_id"].Value.ParseToString() == dbProd.spu_id);
var url = BaseClass.BuildPDDObjString("product/mdy_product");
var data = Work.UserLogin.GetSignaturex() +
"&spu_id=" + dbProd.spu_id +
"&wx_cat_1=" + dbProd.wx_cat_1 +
"&wx_cat_2=" + dbProd.wx_cat_2 +
"&wx_cat_3=" + dbProd.wx_cat_3 +
"&wx_cat_leaf=" + dbProd.wx_cat_leaf +
"&cat_id=" + dbProd.cat_id +
"&cat_name=" + HttpUtility.UrlEncode(dbProd.cat_name, Encoding.UTF8) +
"&main_cat_id=" + dbProd.main_cat_id +
"&main_cat_name=" + HttpUtility.UrlEncode(dbProd.main_cat_name, Encoding.UTF8);
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"))
{
if (row != null)
Invoke(new Action(() =>
{
row.Cells["col_cat_name"].Value = "类目获取失败" + BaseRegex.GetStringJson(ref html, "msg");
}));
}
else
{
if (row != null)
{
string catName = dbProd.cat_name;
if (dbProd.wx_cat_leaf != null)
{
var catN = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == dbProd.wx_cat_leaf.ParseToString())?.name;
if (!string.IsNullOrEmpty(catN))
{
catName = catN;
}
}
if (dbProd.wx_cat_3 != null)
{
var catN = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == dbProd.wx_cat_3.ParseToString())?.name;
if (!string.IsNullOrEmpty(catN))
{
catName = catN + " >> " + catName;
}
}
if (dbProd.wx_cat_2 != null)
{
var catN = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == dbProd.wx_cat_2.ParseToString())?.name;
if (!string.IsNullOrEmpty(catN))
{
catName = catN + " >> " + catName;
}
}
if (prod.wx_cat_1 != null)
{
var catN = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == dbProd.wx_cat_1.ParseToString())?.name;
if (!string.IsNullOrEmpty(catN))
{
catName = catN + " >> " + catName;
}
}
Invoke(new Action(() =>
{
row.Cells["col_cat_name"].Value = catName;
}));
}
}
}
}
catch (Exception ex)
{
}
Invoke(new Action(() =>
{
this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1);
}));
}
}
}
}
+29 -29
View File
@@ -107,7 +107,7 @@ namespace TemuKJD.ToolForms
this.tabControl1.Multiline = true;
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1904, 469);
this.tabControl1.Size = new System.Drawing.Size(1404, 470);
this.tabControl1.TabIndex = 0;
//
// tabPage1
@@ -117,7 +117,7 @@ namespace TemuKJD.ToolForms
this.tabPage1.Location = new System.Drawing.Point(4, 28);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(1896, 437);
this.tabPage1.Size = new System.Drawing.Size(1396, 438);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = " 商品页面 ";
this.tabPage1.UseVisualStyleBackColor = true;
@@ -136,7 +136,7 @@ namespace TemuKJD.ToolForms
this.splitContainer2.Panel1.Controls.Add(this.btnNext);
this.splitContainer2.Panel1.Controls.Add(this.btnPrev);
this.splitContainer2.Panel1.Controls.Add(this.txtAddress);
this.splitContainer2.Size = new System.Drawing.Size(1888, 429);
this.splitContainer2.Size = new System.Drawing.Size(1388, 430);
this.splitContainer2.SplitterDistance = 26;
this.splitContainer2.TabIndex = 6;
//
@@ -167,7 +167,7 @@ namespace TemuKJD.ToolForms
this.txtAddress.Location = new System.Drawing.Point(64, 3);
this.txtAddress.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.txtAddress.Name = "txtAddress";
this.txtAddress.Size = new System.Drawing.Size(1824, 23);
this.txtAddress.Size = new System.Drawing.Size(1324, 23);
this.txtAddress.TabIndex = 7;
this.txtAddress.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtAddress_KeyDown);
//
@@ -363,8 +363,8 @@ namespace TemuKJD.ToolForms
this.splitContainer1.Panel2.Controls.Add(this.btnSaveCookie);
this.splitContainer1.Panel2.Controls.Add(this.btnImportCookie);
this.splitContainer1.Panel2.Controls.Add(this.label2);
this.splitContainer1.Size = new System.Drawing.Size(1904, 561);
this.splitContainer1.SplitterDistance = 469;
this.splitContainer1.Size = new System.Drawing.Size(1404, 561);
this.splitContainer1.SplitterDistance = 470;
this.splitContainer1.SplitterWidth = 3;
this.splitContainer1.TabIndex = 4;
//
@@ -446,7 +446,7 @@ namespace TemuKJD.ToolForms
this.chkSkip.AutoSize = true;
this.chkSkip.Checked = true;
this.chkSkip.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkSkip.Location = new System.Drawing.Point(1560, 33);
this.chkSkip.Location = new System.Drawing.Point(1060, 33);
this.chkSkip.Name = "chkSkip";
this.chkSkip.Size = new System.Drawing.Size(171, 21);
this.chkSkip.TabIndex = 942;
@@ -457,7 +457,7 @@ namespace TemuKJD.ToolForms
//
this.chkOverride.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.chkOverride.AutoSize = true;
this.chkOverride.Location = new System.Drawing.Point(1736, 33);
this.chkOverride.Location = new System.Drawing.Point(1236, 33);
this.chkOverride.Name = "chkOverride";
this.chkOverride.Size = new System.Drawing.Size(171, 21);
this.chkOverride.TabIndex = 920;
@@ -468,7 +468,7 @@ namespace TemuKJD.ToolForms
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(817, 8);
this.label1.Location = new System.Drawing.Point(317, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(32, 17);
this.label1.TabIndex = 898;
@@ -483,7 +483,7 @@ namespace TemuKJD.ToolForms
"抖音",
"淘宝",
"微信"});
this.cmbPlatformType.Location = new System.Drawing.Point(849, 4);
this.cmbPlatformType.Location = new System.Drawing.Point(349, 4);
this.cmbPlatformType.Name = "cmbPlatformType";
this.cmbPlatformType.Size = new System.Drawing.Size(67, 25);
this.cmbPlatformType.TabIndex = 897;
@@ -497,7 +497,7 @@ namespace TemuKJD.ToolForms
this.cmbSaleCount.Items.AddRange(new object[] {
"7日销量≥",
"30日销量≥"});
this.cmbSaleCount.Location = new System.Drawing.Point(1120, 4);
this.cmbSaleCount.Location = new System.Drawing.Point(620, 4);
this.cmbSaleCount.Name = "cmbSaleCount";
this.cmbSaleCount.Size = new System.Drawing.Size(76, 25);
this.cmbSaleCount.TabIndex = 875;
@@ -511,7 +511,7 @@ namespace TemuKJD.ToolForms
this.btnStopStop.CanvasColor = System.Drawing.SystemColors.Control;
this.btnStopStop.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnStopStop.DisabledBackColor = System.Drawing.Color.Empty;
this.btnStopStop.Location = new System.Drawing.Point(1559, 58);
this.btnStopStop.Location = new System.Drawing.Point(1059, 58);
this.btnStopStop.Name = "btnStopStop";
this.btnStopStop.Size = new System.Drawing.Size(83, 23);
this.btnStopStop.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -537,7 +537,7 @@ namespace TemuKJD.ToolForms
this.btnSaveDb.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSaveDb.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSaveDb.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSaveDb.Location = new System.Drawing.Point(1814, 58);
this.btnSaveDb.Location = new System.Drawing.Point(1314, 58);
this.btnSaveDb.Name = "btnSaveDb";
this.btnSaveDb.Size = new System.Drawing.Size(83, 23);
this.btnSaveDb.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -562,7 +562,7 @@ namespace TemuKJD.ToolForms
this.btnGetDetail.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnGetDetail.DisabledBackColor = System.Drawing.Color.Empty;
this.btnGetDetail.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnGetDetail.Location = new System.Drawing.Point(1729, 58);
this.btnGetDetail.Location = new System.Drawing.Point(1229, 58);
this.btnGetDetail.Name = "btnGetDetail";
this.btnGetDetail.Size = new System.Drawing.Size(83, 23);
this.btnGetDetail.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -585,7 +585,7 @@ namespace TemuKJD.ToolForms
this.statusBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.statusBar.BackColor = System.Drawing.Color.White;
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(817, 60);
this.statusBar.Location = new System.Drawing.Point(317, 60);
this.statusBar.Margin = new System.Windows.Forms.Padding(0);
this.statusBar.Name = "statusBar";
this.statusBar.Size = new System.Drawing.Size(740, 25);
@@ -595,7 +595,7 @@ namespace TemuKJD.ToolForms
//
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(1015, 8);
this.label4.Location = new System.Drawing.Point(515, 8);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 17);
this.label4.TabIndex = 810;
@@ -604,7 +604,7 @@ namespace TemuKJD.ToolForms
// txtPageEnd
//
this.txtPageEnd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.txtPageEnd.Location = new System.Drawing.Point(1059, 5);
this.txtPageEnd.Location = new System.Drawing.Point(559, 5);
this.txtPageEnd.Name = "txtPageEnd";
this.txtPageEnd.Size = new System.Drawing.Size(43, 23);
this.txtPageEnd.TabIndex = 809;
@@ -614,7 +614,7 @@ namespace TemuKJD.ToolForms
// txtPageStart
//
this.txtPageStart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.txtPageStart.Location = new System.Drawing.Point(966, 5);
this.txtPageStart.Location = new System.Drawing.Point(466, 5);
this.txtPageStart.Name = "txtPageStart";
this.txtPageStart.Size = new System.Drawing.Size(43, 23);
this.txtPageStart.TabIndex = 808;
@@ -625,7 +625,7 @@ namespace TemuKJD.ToolForms
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(922, 8);
this.label3.Location = new System.Drawing.Point(422, 8);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 17);
this.label3.TabIndex = 807;
@@ -638,7 +638,7 @@ namespace TemuKJD.ToolForms
this.btnCollect.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCollect.DisabledBackColor = System.Drawing.Color.Empty;
this.btnCollect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCollect.Location = new System.Drawing.Point(1644, 58);
this.btnCollect.Location = new System.Drawing.Point(1144, 58);
this.btnCollect.Name = "btnCollect";
this.btnCollect.Size = new System.Drawing.Size(83, 23);
this.btnCollect.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -660,7 +660,7 @@ namespace TemuKJD.ToolForms
//
this.line1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.line1.ForeColor = System.Drawing.SystemColors.AppWorkspace;
this.line1.Location = new System.Drawing.Point(796, 7);
this.line1.Location = new System.Drawing.Point(296, 7);
this.line1.Name = "line1";
this.line1.Size = new System.Drawing.Size(25, 74);
this.line1.TabIndex = 790;
@@ -670,7 +670,7 @@ namespace TemuKJD.ToolForms
// txtSupplierName
//
this.txtSupplierName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.txtSupplierName.Location = new System.Drawing.Point(1292, 5);
this.txtSupplierName.Location = new System.Drawing.Point(792, 5);
this.txtSupplierName.Name = "txtSupplierName";
this.txtSupplierName.ReadOnly = true;
this.txtSupplierName.Size = new System.Drawing.Size(605, 23);
@@ -679,7 +679,7 @@ namespace TemuKJD.ToolForms
// txtFilterSaleCount
//
this.txtFilterSaleCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.txtFilterSaleCount.Location = new System.Drawing.Point(1199, 5);
this.txtFilterSaleCount.Location = new System.Drawing.Point(699, 5);
this.txtFilterSaleCount.Name = "txtFilterSaleCount";
this.txtFilterSaleCount.Size = new System.Drawing.Size(43, 23);
this.txtFilterSaleCount.TabIndex = 787;
@@ -693,7 +693,7 @@ namespace TemuKJD.ToolForms
this.btnRefreshCookie.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnRefreshCookie.DisabledBackColor = System.Drawing.Color.Empty;
this.btnRefreshCookie.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnRefreshCookie.Location = new System.Drawing.Point(671, 57);
this.btnRefreshCookie.Location = new System.Drawing.Point(171, 57);
this.btnRefreshCookie.Name = "btnRefreshCookie";
this.btnRefreshCookie.Size = new System.Drawing.Size(125, 25);
this.btnRefreshCookie.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -719,7 +719,7 @@ namespace TemuKJD.ToolForms
this.txtCookie.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.txtCookie.Multiline = true;
this.txtCookie.Name = "txtCookie";
this.txtCookie.Size = new System.Drawing.Size(664, 78);
this.txtCookie.Size = new System.Drawing.Size(164, 78);
this.txtCookie.TabIndex = 766;
this.txtCookie.Text = "填写cookie后点击导入cookie并刷新";
//
@@ -730,7 +730,7 @@ namespace TemuKJD.ToolForms
this.btnSaveCookie.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSaveCookie.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSaveCookie.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSaveCookie.Location = new System.Drawing.Point(671, 30);
this.btnSaveCookie.Location = new System.Drawing.Point(171, 30);
this.btnSaveCookie.Name = "btnSaveCookie";
this.btnSaveCookie.Size = new System.Drawing.Size(125, 25);
this.btnSaveCookie.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -755,7 +755,7 @@ namespace TemuKJD.ToolForms
this.btnImportCookie.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnImportCookie.DisabledBackColor = System.Drawing.Color.Empty;
this.btnImportCookie.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnImportCookie.Location = new System.Drawing.Point(671, 3);
this.btnImportCookie.Location = new System.Drawing.Point(171, 3);
this.btnImportCookie.Name = "btnImportCookie";
this.btnImportCookie.Size = new System.Drawing.Size(125, 25);
this.btnImportCookie.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -777,7 +777,7 @@ namespace TemuKJD.ToolForms
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(1248, 8);
this.label2.Location = new System.Drawing.Point(748, 8);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 17);
this.label2.TabIndex = 789;
@@ -786,7 +786,7 @@ namespace TemuKJD.ToolForms
// GetJuShuitanProdForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1904, 561);
this.ClientSize = new System.Drawing.Size(1404, 561);
this.Controls.Add(this.splitContainer1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "GetJuShuitanProdForm";
+9 -2
View File
@@ -490,13 +490,17 @@ namespace TemuKJD.ToolForms
private void btnSaveDb_Click(object sender, EventArgs e)
{
Task.Run(() => { });
//"&product_get_type=" + HttpUtility.UrlEncode("厂商直采", Encoding.UTF8);
ConcurrentList<DataGridViewRow> rowLst = new ConcurrentList<DataGridViewRow>();
rowLst.AddRange(dgvProduct.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true));
if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested)
cancellationTokenSource = new CancellationTokenSource();
this.pbLoading.Visible = true;
Task.Run(() =>
var t = Task.Run(() =>
{
List<Cookie> cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null));
var shop = new ShopLoginInfo();
@@ -572,6 +576,8 @@ namespace TemuKJD.ToolForms
"&product_name=" + HttpUtility.UrlEncode(prod.dbProduct.product_name, Encoding.UTF8) +
"&product_json=" + HttpUtility.UrlEncode(dbProd.product_json, Encoding.UTF8) +
"&size_json=" + HttpUtility.UrlEncode(dbProd.size_json, Encoding.UTF8) +
"&sale_count=" + dbProd.sale_count +
"&sale_count_text=" + HttpUtility.UrlEncode(dbProd.sale_count_text, Encoding.UTF8) +
"&main_img=" + HttpUtility.UrlEncode(dbProd.main_img, Encoding.UTF8) +
"&product_get_type=" + HttpUtility.UrlEncode("厂商直采", Encoding.UTF8);
if (SetPartnerSpuRst.Contains("\"success\":true"))
@@ -730,7 +736,8 @@ namespace TemuKJD.ToolForms
var jObj = JsonHelper.JObjectParse(getDetailRst)["data"];
prod.dbProduct.cat_id = jObj["catId"].ParseToString();
prod.dbProduct.main_cat_id = jObj["categoryData"].FirstOrDefault().ParseToString();
prod.dbProduct.product_json = "{\"pddData\":" + JsonHelper.SerializeObject(jObj) + ",\"jstProd\":" + prod.jstProductJson + "}";
var prodDataJson = JsonHelper.SerializeObject(jObj);
prod.dbProduct.product_json = "{\"pddData\":" + prodDataJson + ",\"jstProd\":" + prod.jstProductJson + "}";
var priceMin = jObj["skuInfo"]["goodsSkuDetail"].Min(s => s["supplyPrice"].ParseToDecimal());
var priceMax = jObj["skuInfo"]["goodsSkuDetail"].Max(s => s["supplyPrice"].ParseToDecimal());
prod.dbProduct.price_text = priceMin + "-" + priceMax;