微信调用外部插件修改订单,拼多多获取token等部分功能

This commit is contained in:
wule committed 2026-03-31 09:51:15 +08:00
1 parent 81d5107b32
commit ff42506091
24 files changed
+2728 -193

No files matched your search

@@ -30,15 +30,16 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
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 dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.btnApiUpload = new DevComponents.DotNetBar.PanelEx();
this.btnUpload = new DevComponents.DotNetBar.PanelEx();
this.label7 = new System.Windows.Forms.Label();
this.txtWaitSeconds = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
@@ -80,7 +81,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.txtAddMorePrice = new System.Windows.Forms.TextBox();
this.txtAddTimes = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.btnUpload = new DevComponents.DotNetBar.PanelEx();
this.txtStockNum = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
@@ -211,6 +211,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
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.btnApiUpload);
this.ucGroupBoxEx2.Controls.Add(this.btnUpload);
this.ucGroupBoxEx2.Controls.Add(this.label7);
this.ucGroupBoxEx2.Controls.Add(this.txtWaitSeconds);
this.ucGroupBoxEx2.Controls.Add(this.label6);
@@ -248,7 +249,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.ucGroupBoxEx2.Controls.Add(this.txtAddMorePrice);
this.ucGroupBoxEx2.Controls.Add(this.txtAddTimes);
this.ucGroupBoxEx2.Controls.Add(this.label10);
this.ucGroupBoxEx2.Controls.Add(this.btnUpload);
this.ucGroupBoxEx2.Controls.Add(this.txtStockNum);
this.ucGroupBoxEx2.Controls.Add(this.label4);
this.ucGroupBoxEx2.Controls.Add(this.label9);
@@ -270,7 +270,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnApiUpload.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnApiUpload.DisabledBackColor = System.Drawing.Color.Empty;
this.btnApiUpload.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnApiUpload.Location = new System.Drawing.Point(965, 67);
this.btnApiUpload.Location = new System.Drawing.Point(965, 40);
this.btnApiUpload.Name = "btnApiUpload";
this.btnApiUpload.Size = new System.Drawing.Size(84, 23);
this.btnApiUpload.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -285,10 +285,35 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnApiUpload.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnApiUpload.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnApiUpload.TabIndex = 742;
this.btnApiUpload.Text = "接口上传";
this.btnApiUpload.Text = "批量上传";
this.btnApiUpload.Visible = false;
this.btnApiUpload.Click += new System.EventHandler(this.btnApiUpload_Click);
//
// btnUpload
//
this.btnUpload.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnUpload.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnUpload.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnUpload.DisabledBackColor = System.Drawing.Color.Empty;
this.btnUpload.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUpload.Location = new System.Drawing.Point(965, 81);
this.btnUpload.Name = "btnUpload";
this.btnUpload.Size = new System.Drawing.Size(84, 23);
this.btnUpload.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnUpload.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnUpload.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnUpload.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnUpload.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnUpload.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnUpload.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnUpload.Style.GradientAngle = 90;
this.btnUpload.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnUpload.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnUpload.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnUpload.TabIndex = 517;
this.btnUpload.Text = "模拟上传";
this.btnUpload.Click += new System.EventHandler(this.btnUpload_Click);
//
// label7
//
this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -406,8 +431,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// chkUpgradeVersion
//
this.chkUpgradeVersion.AutoSize = true;
this.chkUpgradeVersion.Checked = true;
this.chkUpgradeVersion.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkUpgradeVersion.Location = new System.Drawing.Point(531, 82);
this.chkUpgradeVersion.Name = "chkUpgradeVersion";
this.chkUpgradeVersion.Size = new System.Drawing.Size(83, 21);
@@ -445,8 +468,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// chk15996
//
this.chk15996.AutoSize = true;
this.chk15996.Checked = true;
this.chk15996.CheckState = System.Windows.Forms.CheckState.Checked;
this.chk15996.Location = new System.Drawing.Point(870, 52);
this.chk15996.Name = "chk15996";
this.chk15996.Size = new System.Drawing.Size(62, 21);
@@ -458,8 +479,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// chk21365
//
this.chk21365.AutoSize = true;
this.chk21365.Checked = true;
this.chk21365.CheckState = System.Windows.Forms.CheckState.Checked;
this.chk21365.Location = new System.Drawing.Point(815, 52);
this.chk21365.Name = "chk21365";
this.chk21365.Size = new System.Drawing.Size(62, 21);
@@ -471,8 +490,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// chk20981
//
this.chk20981.AutoSize = true;
this.chk20981.Checked = true;
this.chk20981.CheckState = System.Windows.Forms.CheckState.Checked;
this.chk20981.Location = new System.Drawing.Point(760, 52);
this.chk20981.Name = "chk20981";
this.chk20981.Size = new System.Drawing.Size(62, 21);
@@ -484,8 +501,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// chk22347
//
this.chk22347.AutoSize = true;
this.chk22347.Checked = true;
this.chk22347.CheckState = System.Windows.Forms.CheckState.Checked;
this.chk22347.Location = new System.Drawing.Point(705, 52);
this.chk22347.Name = "chk22347";
this.chk22347.Size = new System.Drawing.Size(62, 21);
@@ -576,8 +591,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// chkActivity
//
this.chkActivity.AutoSize = true;
this.chkActivity.Checked = true;
this.chkActivity.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkActivity.Location = new System.Drawing.Point(531, 52);
this.chkActivity.Name = "chkActivity";
this.chkActivity.Size = new System.Drawing.Size(135, 21);
@@ -848,31 +861,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.label10.TabIndex = 534;
this.label10.Text = "倍再加";
//
// btnUpload
//
this.btnUpload.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnUpload.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnUpload.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnUpload.DisabledBackColor = System.Drawing.Color.Empty;
this.btnUpload.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUpload.Location = new System.Drawing.Point(965, 40);
this.btnUpload.Name = "btnUpload";
this.btnUpload.Size = new System.Drawing.Size(84, 23);
this.btnUpload.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnUpload.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnUpload.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnUpload.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnUpload.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnUpload.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnUpload.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnUpload.Style.GradientAngle = 90;
this.btnUpload.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnUpload.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnUpload.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnUpload.TabIndex = 517;
this.btnUpload.Text = "批量上传";
this.btnUpload.Click += new System.EventHandler(this.btnUpload_Click);
//
// txtStockNum
//
this.txtStockNum.Location = new System.Drawing.Point(486, 110);
@@ -932,8 +920,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// chkLowPriceSku
//
this.chkLowPriceSku.AutoSize = true;
this.chkLowPriceSku.Checked = true;
this.chkLowPriceSku.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkLowPriceSku.Location = new System.Drawing.Point(531, 111);
this.chkLowPriceSku.Name = "chkLowPriceSku";
this.chkLowPriceSku.Size = new System.Drawing.Size(83, 21);
@@ -1302,19 +1288,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.dgvShop.AllowUserToAddRows = false;
this.dgvShop.AllowUserToDeleteRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle13.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13;
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)))));
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;
dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14;
this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colSelect,
@@ -1473,19 +1459,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.dgvSelectProduct.AllowUserToAddRows = false;
this.dgvSelectProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
dataGridViewCellStyle15.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle15;
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)))));
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;
dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle16.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle16.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle16.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle16.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle16.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle16;
this.dgvSelectProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvSelectProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
@@ -1547,8 +1533,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colSupplierName
//
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle17.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle17;
this.colSupplierName.Frozen = true;
this.colSupplierName.HeaderText = "店铺名称";
this.colSupplierName.Name = "colSupplierName";
@@ -1626,8 +1612,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colProductName
//
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle18;
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
@@ -195,12 +195,13 @@ namespace TemuKJD.PDDForms.ProductSelectForms
shop.ApiAuthInfoList = new List<AuthInfo>();
shop.ApiAuthInfoList.Add(new AuthInfo { AccessToken = accessToken });
}
//var shop = GlobalConfig.ShopLoginList.First(s => s.ShopAccount == "阿杰小铺浦哈哈");
//shop.ApiAuthInfoList = new List<AuthInfo>();
//shop.ApiAuthInfoList.Add(new AuthInfo { AccessToken = "9ebbf9cc47834f7685af90c87cea1c7d4ff8d3dc" });
}
}
// 测试写死
var shop1 = GlobalConfig.ShopLoginList.First(s => s.ShopAccount == "阿杰小铺浦哈哈");
shop1.ApiAuthInfoList = new List<AuthInfo>();
shop1.ApiAuthInfoList.Add(new AuthInfo { AccessToken = "269a0baaca9b42abb443756fac90f88b0836f610" });
}
private void chkSelectAll_CheckedChanged(object sender, EventArgs e)
@@ -6630,7 +6631,15 @@ Content-Type: image/jpeg
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
GetShopAndUpProduct();
// 随机店铺并分配商品
try
{
GetShopAndUpProduct();
}
catch (Exception ex)
{
BaseMsgForm.ShowError("店铺分配错误:" + ex.Message);
}
Invoke(new Action(() =>
{
this.btnUpload.Enabled = true;
@@ -6680,19 +6689,107 @@ Content-Type: image/jpeg
{
lblWaitToUp.Text = "待上传 " + lstTemuDBProductSelect.Count + " 件";
}));
// 开启一个上传线程
// 启动一个上传线程
Task.Run(() =>
{
string result;
DateTime startTime = DateTime.Now;
double duration = 0;
string result = "";
try
{
ApiUploadProduct(canUpShop, selectProd);
// 列表显示选择到的商品
DataGridViewRow row = null;
Invoke(new Action(() =>
{
int rowIndex = 0;
this.dgvSelectProduct.Rows.Insert(rowIndex,
true,
selectProd.id,
selectProd.shop_id,
selectProd.shop_account,
"登录",
"进店",
//prod.spu_id,
BaseClass.SaLevel > 0 ? selectProd.spu_id : selectProd.spu_id.ParseToString().GetHashCode().ParseToString().Trim('-'),
selectProd.skc_id,
selectProd.main_img,
null,
"",
null,
selectProd.product_name, // 用户端显示商品原名
selectProd.cat_name,
//prod.secret_spu_id == null ? prod.ext_code : prod.secret_spu_id,
BaseClass.SaLevel > 0 ? selectProd.ext_code : selectProd.ext_code.ParseToString().GetHashCode().ParseToString().Trim('-'),
selectProd.status,
selectProd.draft_id,
selectProd.notes,
(selectProd.user_notes + " 编辑").Trim(),
"删除",
"",
"");
row = dgvSelectProduct.Rows[rowIndex];
row.Height = 60;
int maxRowCount = 10000;
while (dgvSelectProduct.Rows.Count > maxRowCount)
{
dgvSelectProduct.Rows.RemoveAt(maxRowCount);
}
}));
// 接口上传
try
{
result = ApiUploadProduct(canUpShop, selectProd, row);
}
catch (Exception ex)
{
result = "{\"success\":false,\"status\":\"未上传\",\"errMsg\":\"" + ex.Message + "\"}";
}
var error = "";
// 上传失败
if (!result.Contains("\"success\":true") && !result.Contains("上传成功"))
{
error = BaseRegex.GetStringJson(ref result, "errMsg");
if (string.IsNullOrWhiteSpace(error))
error = result;
Invoke(new Action(() =>
{
if (row.Index >= 0)
{
var endTime = DateTime.Now;
var timeSpan = endTime - startTime;
duration = timeSpan.TotalSeconds;
row.Cells["colOpResult"].Value = error + " " + duration.ParseToInt() + "秒";
}
}));
}
else // 上传成功
{
selectProd.status = BaseRegex.GetStringJson(ref result, "status");
if (string.IsNullOrWhiteSpace(selectProd.status))
selectProd.status = "待上传";
var goodsId = BaseRegex.GetStringJson(ref result, "goodsId");
Invoke(new Action(() =>
{
if (row.Index >= 0)
{
row.Cells["colDraftId"].Value = goodsId; // 草稿箱id
row.Cells["colAddTime"].Value = DateTime.Now.ToString("yy-MM-dd HH:mm:ss");
row.Cells["colOpResult"].Value = (selectProd.status == "已上传" ? "已成功上传" : "已上传 发生错误:") + (" " + error).TrimEnd(' ') + " " + duration.ParseToInt() + "秒";
row.Cells["colMsg"].Value = selectProd.status;
}
}));
}
}
catch (Exception ex)
{
result = "{\"success\":false,\"status\":\"未上传\",\"errMsg\":\"" + ex.Message + "\"}";
BaseMsgForm.ShowError("上传启动错误:" + ex.Message);
}
// 额外休眠
// 额外等待时间,休眠
Thread.Sleep(1000 * WaitUploadTime);
// 店铺移出上货队列,等待下次随机
currentUpShopLst.Remove(canUpShop);
@@ -6701,48 +6798,9 @@ Content-Type: image/jpeg
}
}
string ApiUploadProduct(ShopLoginInfo shop, TemuDBProductSelect selectProd)
string ApiUploadProduct(ShopLoginInfo shop, TemuDBProductSelect selectProd, DataGridViewRow row)
{
DataGridViewRow row = null;
DataGridViewCell cell = null;
Invoke(new Action(() =>
{
int rowIndex = 0;
this.dgvSelectProduct.Rows.Insert(rowIndex,
true,
selectProd.id,
selectProd.shop_id,
selectProd.shop_account,
"登录",
"进店",
//prod.spu_id,
BaseClass.SaLevel > 0 ? selectProd.spu_id : selectProd.spu_id.ParseToString().GetHashCode().ParseToString().Trim('-'),
selectProd.skc_id,
selectProd.main_img,
null,
"",
null,
selectProd.product_name, // 用户端显示商品原名
selectProd.cat_name,
//prod.secret_spu_id == null ? prod.ext_code : prod.secret_spu_id,
BaseClass.SaLevel > 0 ? selectProd.ext_code : selectProd.ext_code.ParseToString().GetHashCode().ParseToString().Trim('-'),
selectProd.status,
selectProd.draft_id,
selectProd.notes,
(selectProd.user_notes + " 编辑").Trim(),
"删除",
"",
"");
row = dgvSelectProduct.Rows[rowIndex];
cell = row.Cells["colOpResult"];
row.Height = 60;
int maxRowCount = 10000;
while (dgvSelectProduct.Rows.Count > maxRowCount)
{
dgvSelectProduct.Rows.RemoveAt(maxRowCount);
}
}));
DataGridViewCell cell = row.Cells["colOpResult"];
KJDDBProduct dbProd = selectProd.kjdDbProduct;
if (dbProd == null)
@@ -6775,6 +6833,15 @@ Content-Type: image/jpeg
prodInfo = JsonHelper.DeserializeJsonToObject<PDDProductInfo>(dbProd.product_json);
var pddApi = new PddApi(shop);
pddApi.Data["cat_id"] = prodInfo.detail.cat_id;
var carRuleGetRst = pddApi.PddGoodsCatRuleGet();
// 临时刷新token
//var rst1 = pddApi.PddPopAuthTokenCreate();
//满两件折扣,todo通过pdd.goods.cat.rule.get查询具体规则
//{"cat_rule_get_response":{"goods_properties_rule":{"input_max_spec_num":0,"properties":[{"is_sale":false,"is_important":false,"is_sku":false,"values":[{"vid":4643510,"value":"无品牌/无注册商标"},{"vid":1280848,"value":"画南头"},{"vid":30601,"value":"固竹匠"},{"vid":220778,"value":"浪漫喜事"},{"vid":334660,"value":"梦瑾"},{"vid":130470,"value":"朋意"},{"vid":12034,"value":"THEBEAST/野兽派"},{"vid":1942,"value":"Uchino/内野"},{"vid":34231,"value":"NITORI/宜得利家居"},{"vid":6439,"value":"Brother/兄弟"},{"vid":8553,"value":"Zara Home"},{"vid":8554,"value":"MUJI/无印良品"},{"vid":14223,"value":"VERSACE/范思哲"},{"vid":18534,"value":"Mtg"},{"vid":19991,"value":"SINGER/胜家"},{"vid":196848,"value":"Hoyo"},{"vid":224544,"value":"亚朵星球"},{"vid":280,"value":"KING SHORE/金号"},{"vid":327,"value":"SEMIR/森马"},{"vid":68,"value":"MERCURY/水星家纺"},{"vid":44617,"value":"LUOLAI/罗莱"},{"vid":386,"value":"Xiaomi/小米"},{"vid":394,"value":"Lock&Lock/乐扣乐扣"},{"vid":53109,"value":"CHRISTY"},{"vid":5702,"value":"东升"},{"vid":5727,"value":"DOHIA/多喜爱"},{"vid":561,"value":"Purcotton/全棉时代"},{"vid":6159,"value":"金蝉"},{"vid":6770,"value":"MENDALE/梦洁"},{"vid":8882,"value":"HLA/海澜之家"},{"vid":9570,"value":"MINISO/名创优品"},{"vid":119495,"value":"AUSTTBABY"},{"vid":119914,"value":"棉森"},{"vid":12031,"value":"大朴"},{"vid":128592,"value":"亿恩忆"},{"vid":12598,"value":"怡沁园"},{"vid":134564,"value":"茱莉亚"},{"vid":14220,"value":"JEANSWEST/真维斯"},{"vid":16898,"value":"奥帝罗"},{"vid":16900,"value":"德奇力"},{"vid":17523,"value":"Bravo/馨而乐"},{"vid":17529,"value":"Grace·orchid/洁丽雅·兰"},{"vid":165321,"value":"孩子王"},{"vid":17819,"value":"EverShine/永亮"},{"vid":172186,"value":"BULULOM/布鲁罗曼"},{"vid":173,"value":"南极人"},{"vid":192015,"value":"Mionsoo/棉上"},{"vid":192617,"value":"Lovhome/乐巢家居"},{"vid":193562,"value":"Tumei Home Collection/图美寝饰"},{"vid":195662,"value":"Jrb/嘉瑞宝"},{"vid":197759,"value":"Gafuhome"},{"vid":202708,"value":"LATEX SYSTEMS CO.,LTD."},{"vid":1746,"value":"梦雅莉"},{"vid":1747,"value":"虹原风尚"},{"vid":1748,"value":"LUOLANNI/罗兰妮"},{"vid":1749,"value":"梓晨"},{"vid":1752,"value":"LORiCA/骆易家"},{"vid":1769,"value":"BLISS/百丽丝"},{"vid":215899,"value":"竹月阁"},{"vid":216546,"value":"荣邦"},{"vid":200,"value":"GRACE/洁丽雅"},{"vid":1957,"value":"黄古林"},{"vid":245780,"value":"yesland雅熙莱帝"},{"vid":2105,"value":"SANLI/三利"},{"vid":2106,"value":"CARESEEN/康尔馨"},{"vid":262384,"value":"爱络"},{"vid":27838,"value":"ABS/爱彼此"},{"vid":275849,"value":"伊丝绮"},{"vid":280996,"value":"Qisilove/前世有约"},{"vid":281160,"value":"Ppw"},{"vid":252,"value":"BEJIROG/北极绒"},{"vid":283511,"value":"梦蝶莎"},{"vid":2675,"value":"芳华"},{"vid":32611,"value":"TY LIVE/田园生活"},{"vid":302922,"value":"一米"},{"vid":32853,"value":"温恋"},{"vid":32879,"value":"WS/伟殳家居"},{"vid":32881,"value":"港龙"},{"vid":32882,"value":"亚亨"},{"vid":273,"value":"Disney/迪士尼"},{"vid":33880,"value":"Aqara"},{"vid":294,"value":"洁玉"},{"vid":303,"value":"网易严选"},{"vid":3274,"value":"A-LIFE/最生活"},{"vid":369086,"value":"山花"},{"vid":373614,"value":"五洲"},{"vid":329,"value":"BOBDOG/巴布豆"},{"vid":382380,"value":"SouthLife/南方生活"},{"vid":330,"value":"Montagut/梦特娇"},{"vid":69,"value":"LOVO/乐蜗"},{"vid":3602,"value":"Curbblan/卡伴"},{"vid":3897,"value":"知梦人"},{"vid":45598,"value":"SAINTMARC/尚玛可"},{"vid":45746,"value":"SINOMAX/赛诺"},{"vid":45808,"value":"SOMERELLE/安睡宝"},{"vid":45938,"value":"SUNVIM/孚日"},{"vid":397,"value":"童泰"},{"vid":464223,"value":"Yuniku/优尼可"},{"vid":4602,"value":"Jago/佳奥"},{"vid":4657,"value":"四季帘华"},{"vid":517644,"value":"家顿"},{"vid":519506,"value":"MENBORY/梦宝莉"},{"vid":532306,"value":"MENDALE HOME"},{"vid":781538,"value":"4monster"},{"vid":5240,"value":"春天十字绣"},{"vid":5247,"value":"HD/惠多"},{"vid":65402,"value":"梦雯"},{"vid":842952,"value":"赛勒"},{"vid":846015,"value":"墨斗鱼"},{"vid":5832,"value":"8H"},{"vid":923181,"value":"大江(地垫)"},{"vid":950059,"value":"甄简良品"},{"vid":79195,"value":"伊佳仁"},{"vid":79198,"value":"雅熙莱帝"},{"vid":6958,"value":"轻生活"},{"vid":7347,"value":"TANGY/天意"},{"vid":7351,"value":"FREETEX"},{"vid":94190,"value":"冬阳"},{"vid":96868,"value":"硕木"},{"vid":97393,"value":"LOFTEX/亚光"},{"vid":97771,"value":"彩朵朵"},{"vid":9254,"value":"AiSleep/睡眠博士"},{"vid":9709,"value":"HD/华德"},{"vid":9780,"value":"欧意"},{"vid":9942,"value":"百思寒"},{"vid":107350,"value":"布蝶轩"},{"vid":108166,"value":"夕姿"},{"vid":12165,"value":"一朵"},{"vid":12549,"value":"金柒"},{"vid":1286,"value":"BONAS/宝娜斯"},{"vid":17569,"value":"恩兴"},{"vid":18231,Line truncated
// 主图
string carousel_gallery = "";
foreach (var img in prodInfo.detail.galleries.Where(g => g.type ==1).ToList())
@@ -6852,7 +6919,7 @@ Content-Type: image/jpeg
pddApi.Data["goods_name"] = prodInfo.detail.goods_name;
//todo 非必填
pddApi.Data["goods_properties"] = new object();
pddApi.Data["goods_properties"] = "[]";
pddApi.Data["goods_type"] = 1;
if (!string.IsNullOrEmpty(prodInfo.detail.image_url))
@@ -7124,14 +7191,14 @@ Content-Type: image/jpeg
retry:
var upLoadRst = pddApi.PddGoodsAdd();
retryTimes--;
if (upLoadRst.Contains("该分类下只能选择7天无理由退货"))
if (upLoadRst.Contains("该分类下只能选择7天无理由退货") && retryTimes >= 0)
{
pddApi.Data["is_refundable"] = true;
goto retry;
}
return "上传成功";
var goods_id = BaseRegex.GetStringJson(ref upLoadRst, "goods_id");
return "{\"success\":true,\"goods_id\":" + goods_id + ",\"status\":\"已上传\",\"msg\":\"上传成功\"}";
}
public void MatchPddProperty(ShopLoginInfo shop, PDDProductUploadParam prodParam, PDDProductInfo prodInfo, PDDProductTemplateInfo prodCatTemplateInfo, DataGridViewCell cell)