1.界面优化调整 2.618取消活动 3.清理无流量新 4.用户商品库1688及拼多多外部商品入库逻辑优化 5.带百分号的属性微信上货优化 6.数据库产品在不同用户间迁移 7.删除店铺功能开放给充值用户防止店铺导入错误无法删除

This commit is contained in:
wule committed 2026-06-11 11:38:08 +08:00
1 parent 2759ff0f6d
commit 0a9980335f
59 files changed
+3078 -652

No files matched your search

@@ -32,15 +32,19 @@ namespace TemuKJD.WXForms.ProductForms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
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();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = 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.ucGroupBoxEx3 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.btnCancelActivity = new DevComponents.DotNetBar.PanelEx();
this.label2 = new System.Windows.Forms.Label();
this.txtSkipPriceEnd = new System.Windows.Forms.TextBox();
this.chkSkipPriceEnd = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.label1 = new System.Windows.Forms.Label();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.label4 = new System.Windows.Forms.Label();
@@ -52,6 +56,7 @@ namespace TemuKJD.WXForms.ProductForms
this.btnStopOp = new DevComponents.DotNetBar.PanelEx();
this.btnSetActivity = new DevComponents.DotNetBar.PanelEx();
this.ucGroupBoxEx4 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.chkProdInActivity = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.btnEmpty = new DevComponents.DotNetBar.PanelEx();
this.txtPage = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
@@ -111,9 +116,6 @@ namespace TemuKJD.WXForms.ProductForms
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.btnClear = new DevComponents.DotNetBar.PanelEx();
this.panelEx1 = new DevComponents.DotNetBar.PanelEx();
this.chkSkipPriceEnd = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.txtSkipPriceEnd = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -169,6 +171,7 @@ namespace TemuKJD.WXForms.ProductForms
this.ucGroupBoxEx3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ucGroupBoxEx3.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.ucGroupBoxEx3.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND;
this.ucGroupBoxEx3.Controls.Add(this.btnCancelActivity);
this.ucGroupBoxEx3.Controls.Add(this.label2);
this.ucGroupBoxEx3.Controls.Add(this.txtSkipPriceEnd);
this.ucGroupBoxEx3.Controls.Add(this.chkSkipPriceEnd);
@@ -184,6 +187,62 @@ namespace TemuKJD.WXForms.ProductForms
this.ucGroupBoxEx3.TabStop = false;
this.ucGroupBoxEx3.Text = "活动设置";
//
// btnCancelActivity
//
this.btnCancelActivity.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancelActivity.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnCancelActivity.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCancelActivity.DisabledBackColor = System.Drawing.Color.Empty;
this.btnCancelActivity.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancelActivity.Location = new System.Drawing.Point(933, 69);
this.btnCancelActivity.Name = "btnCancelActivity";
this.btnCancelActivity.Size = new System.Drawing.Size(84, 23);
this.btnCancelActivity.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnCancelActivity.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnCancelActivity.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnCancelActivity.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnCancelActivity.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnCancelActivity.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnCancelActivity.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnCancelActivity.Style.GradientAngle = 90;
this.btnCancelActivity.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnCancelActivity.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnCancelActivity.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnCancelActivity.TabIndex = 865;
this.btnCancelActivity.Text = "批量取消报名";
this.btnCancelActivity.Click += new System.EventHandler(this.btnCancelActivity_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(177, 75);
this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(32, 17);
this.label2.TabIndex = 855;
this.label2.Text = "商品";
//
// txtSkipPriceEnd
//
this.txtSkipPriceEnd.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.txtSkipPriceEnd.Font = new System.Drawing.Font("微软雅黑", 10F);
this.txtSkipPriceEnd.Location = new System.Drawing.Point(128, 71);
this.txtSkipPriceEnd.Margin = new System.Windows.Forms.Padding(0);
this.txtSkipPriceEnd.Name = "txtSkipPriceEnd";
this.txtSkipPriceEnd.Size = new System.Drawing.Size(47, 25);
this.txtSkipPriceEnd.TabIndex = 854;
this.txtSkipPriceEnd.Text = ".66";
//
// chkSkipPriceEnd
//
this.chkSkipPriceEnd.AutoSize = true;
this.chkSkipPriceEnd.Location = new System.Drawing.Point(25, 73);
this.chkSkipPriceEnd.Name = "chkSkipPriceEnd";
this.chkSkipPriceEnd.Size = new System.Drawing.Size(111, 21);
this.chkSkipPriceEnd.TabIndex = 853;
this.chkSkipPriceEnd.Text = "跳过价格尾数为";
this.chkSkipPriceEnd.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.AutoSize = true;
@@ -335,6 +394,7 @@ namespace TemuKJD.WXForms.ProductForms
| System.Windows.Forms.AnchorStyles.Left)));
this.ucGroupBoxEx4.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.ucGroupBoxEx4.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND;
this.ucGroupBoxEx4.Controls.Add(this.chkProdInActivity);
this.ucGroupBoxEx4.Controls.Add(this.btnEmpty);
this.ucGroupBoxEx4.Controls.Add(this.txtPage);
this.ucGroupBoxEx4.Controls.Add(this.label5);
@@ -347,6 +407,17 @@ namespace TemuKJD.WXForms.ProductForms
this.ucGroupBoxEx4.TabStop = false;
this.ucGroupBoxEx4.Text = "活动商品查询";
//
// chkProdInActivity
//
this.chkProdInActivity.AutoSize = true;
this.chkProdInActivity.Location = new System.Drawing.Point(17, 75);
this.chkProdInActivity.Name = "chkProdInActivity";
this.chkProdInActivity.Size = new System.Drawing.Size(123, 21);
this.chkProdInActivity.TabIndex = 854;
this.chkProdInActivity.Text = "查询成功报名商品";
this.chkProdInActivity.UseVisualStyleBackColor = true;
this.chkProdInActivity.Visible = false;
//
// btnEmpty
//
this.btnEmpty.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -789,19 +860,19 @@ namespace TemuKJD.WXForms.ProductForms
//
this.dgvShop.AllowUserToAddRows = false;
this.dgvShop.AllowUserToDeleteRows = false;
dataGridViewCellStyle15.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle15;
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)))));
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.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle16;
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,
@@ -963,19 +1034,19 @@ namespace TemuKJD.WXForms.ProductForms
//
this.dgvSelectProduct.AllowUserToAddRows = false;
this.dgvSelectProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle17.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle17;
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)))));
dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle18.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle18.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle18.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle18.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle18.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle18;
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,
@@ -1023,8 +1094,8 @@ namespace TemuKJD.WXForms.ProductForms
//
// colSupplierName
//
dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle19;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle5;
this.colSupplierName.HeaderText = "店铺名称";
this.colSupplierName.Name = "colSupplierName";
this.colSupplierName.ReadOnly = true;
@@ -1081,8 +1152,8 @@ namespace TemuKJD.WXForms.ProductForms
//
// colProductName
//
dataGridViewCellStyle20.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle20;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle6;
this.colProductName.HeaderText = "商品名称";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
@@ -1109,8 +1180,8 @@ namespace TemuKJD.WXForms.ProductForms
//
// colStock
//
dataGridViewCellStyle21.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colStock.DefaultCellStyle = dataGridViewCellStyle21;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colStock.DefaultCellStyle = dataGridViewCellStyle7;
this.colStock.HeaderText = "库存";
this.colStock.Name = "colStock";
this.colStock.ReadOnly = true;
@@ -1203,37 +1274,6 @@ namespace TemuKJD.WXForms.ProductForms
this.panelEx1.Text = "停止当前操作";
this.panelEx1.Visible = false;
//
// chkSkipPriceEnd
//
this.chkSkipPriceEnd.AutoSize = true;
this.chkSkipPriceEnd.Location = new System.Drawing.Point(25, 73);
this.chkSkipPriceEnd.Name = "chkSkipPriceEnd";
this.chkSkipPriceEnd.Size = new System.Drawing.Size(111, 21);
this.chkSkipPriceEnd.TabIndex = 853;
this.chkSkipPriceEnd.Text = "跳过价格尾数为";
this.chkSkipPriceEnd.UseVisualStyleBackColor = true;
//
// txtSkipPriceEnd
//
this.txtSkipPriceEnd.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.txtSkipPriceEnd.Font = new System.Drawing.Font("微软雅黑", 10F);
this.txtSkipPriceEnd.Location = new System.Drawing.Point(128, 71);
this.txtSkipPriceEnd.Margin = new System.Windows.Forms.Padding(0);
this.txtSkipPriceEnd.Name = "txtSkipPriceEnd";
this.txtSkipPriceEnd.Size = new System.Drawing.Size(47, 25);
this.txtSkipPriceEnd.TabIndex = 854;
this.txtSkipPriceEnd.Text = ".66";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(177, 75);
this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(32, 17);
this.label2.TabIndex = 855;
this.label2.Text = "商品";
//
// WXActivity618Form
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -1355,5 +1395,7 @@ namespace TemuKJD.WXForms.ProductForms
private System.Windows.Forms.TextBox txtSkipPriceEnd;
private UserComponent.UcCheckBox chkSkipPriceEnd;
private System.Windows.Forms.Label label2;
private DevComponents.DotNetBar.PanelEx btnCancelActivity;
private UserComponent.UcCheckBox chkProdInActivity;
}
}
@@ -475,83 +475,171 @@ namespace TemuKJD.WXForms.ProductForms
break;
// 查找报名商品
var getActivityProdRst = WXActivity.getActivityProdList(shop, page, pageSize);
Thread.Sleep(Randomx.GetId(150, 300));
if (!getActivityProdRst.Contains("\"code\":0"))
var getActivityProdRst = "";
if (chkProdInActivity.Checked)
{
ShowShopError(shop, getActivityProdRst);
break;
}
totalPage = BaseRegex.GetIntJson(ref getActivityProdRst, "totalPage");
try
{
Invoke(new Action(() =>
getActivityProdRst = WXActivity.getProdInActivityList(shop, page, pageSize);
//getActivityProdRst = WXActivity.getActivityProdList(shop, page, pageSize);
Thread.Sleep(Randomx.GetId(150, 300));
if (!getActivityProdRst.Contains("\"code\":0"))
{
this.pbLoading.Visible = true;
this.statusBar.lblTaskStatus.Text = "正在查询店铺:" + shop.ShopAccount + " " + page + "/" + Math.Min(PageEnd, totalPage);
}));
var prodObjs = JsonHelper.JObjectParse(getActivityProdRst)["data"];
WxActivityData dataTmp = JsonHelper.DeserializeJsonToObject<WxActivityData>(JsonHelper.SerializeObject(prodObjs));
foreach (var prodRequest in dataTmp.requestProductInfoList.resultList)
{
if (this.wxActivityData.requestProductInfoList.resultList.Any(r => r.product.productId == prodRequest.product.productId && r.product.skuId == prodRequest.product.skuId))
continue;
prodRequest.shopId = shop.ShopId;
wxActivityData.requestProductInfoList.resultList.Add(prodRequest);
ShowShopError(shop, getActivityProdRst);
break;
}
foreach (var prod in dataTmp.productList)
var totalNum = BaseRegex.GetIntJson(ref getActivityProdRst, "totalNum");
totalPage = Math.Ceiling(totalNum * 1.0m / pageSize).ParseToInt();
try
{
if (this.wxActivityData.productList.Any(p => p.productKey.productId == prod.productKey.productId))
continue;
wxActivityData.productList.Add(prod);
var signCnt = wxActivityData.requestProductInfoList.resultList
.Where(r => r.product.productId == prod.productKey.productId && r.isAdded == true).ToList().Count;
var signCntStr = signCnt > 0 ? "," + signCnt + "个已报名" : "";
Invoke(new Action(() =>
{
var rowIndex = this.dgvSelectProduct.Rows.Add(
false,
shop.ShopId,
shop.ShopAccount,
"登录",
"进店",
prod.productKey.productId,
"",
prod.info.headImg.FirstOrDefault(),
DataGridViewExtension.defaultBitmap,
prod.info.title,
"sku数量:" + prod.productSkus.Count + "个" + signCntStr,
prod.productSkus.Min(s => s.productSkuInfo.salePrice) * 0.01m + " - " + prod.productSkus.Max(s => s.productSkuInfo.salePrice) * 0.01m,
prod.productSkus.Min(s => s.productSkuInfo.salePrice) * 0.01m + " - " + prod.productSkus.Max(s => s.productSkuInfo.salePrice) * 0.01m,
prod.info.totalStockNum,
""
);
if (prod.productKey.productId == "10000852942152")
{
var x = JsonHelper.SerializeObject(prod);
}
dgvSelectProduct.Rows[rowIndex].Height = 60;
//Color color = Color.Red;
//if (dgvSelectProduct.Rows[rowIndex].Cells["colMsg"].Value.ParseToString() == "在售")
// color = Color.Blue;
//if (dgvSelectProduct.Rows[rowIndex].Cells["colMsg"].Value.ParseToString() == "下架")
// color = Color.Purple;
//if (dgvSelectProduct.Rows[rowIndex].Cells["colMsg"].Value.ParseToString() == "草稿箱")
// color = Color.DarkOrange;
//if (dgvSelectProduct.Rows[rowIndex].Cells["colMsg"].Value.ParseToString() == "回收站")
// color = Color.Gray;
//dgvSelectProduct.Rows[rowIndex].Cells["colMsg"].Style.ForeColor = color;
this.pbLoading.Visible = true;
this.statusBar.lblTaskStatus.Text = "正在查询店铺:" + shop.ShopAccount + " " + page + "/" + Math.Min(PageEnd, totalPage);
}));
var prodObjs = JsonHelper.JObjectParse(getActivityProdRst)["data"];
WxActivityData dataTmp = JsonHelper.DeserializeJsonToObject<WxActivityData>(JsonHelper.SerializeObject(prodObjs));
foreach (var prodRequest in dataTmp.requestProductInfoList.resultList)
{
if (this.wxActivityData.requestProductInfoList.resultList.Any(r => r.product.productId == prodRequest.product.productId && r.product.skuId == prodRequest.product.skuId))
continue;
prodRequest.shopId = shop.ShopId;
wxActivityData.requestProductInfoList.resultList.Add(prodRequest);
}
foreach (var prod in dataTmp.productList)
{
if (this.wxActivityData.productList.Any(p => p.productKey.productId == prod.productKey.productId))
continue;
wxActivityData.productList.Add(prod);
var signCnt = wxActivityData.requestProductInfoList.resultList
.Where(r => r.product.productId == prod.productKey.productId && r.isAdded == true).ToList().Count;
var signCntStr = signCnt > 0 ? "," + signCnt + "个已报名" : "";
Invoke(new Action(() =>
{
var rowIndex = this.dgvSelectProduct.Rows.Add(
false,
shop.ShopId,
shop.ShopAccount,
"登录",
"进店",
prod.productKey.productId,
"",
prod.info.headImg.FirstOrDefault(),
DataGridViewExtension.defaultBitmap,
prod.info.title,
"sku数量:" + prod.productSkus.Count + "个" + signCntStr,
prod.productSkus.Min(s => s.productSkuInfo.salePrice) * 0.01m + " - " + prod.productSkus.Max(s => s.productSkuInfo.salePrice) * 0.01m,
prod.productSkus.Min(s => s.productSkuInfo.salePrice) * 0.01m + " - " + prod.productSkus.Max(s => s.productSkuInfo.salePrice) * 0.01m,
prod.info.totalStockNum,
""
);
if (prod.productKey.productId == "10000852942152")
{
var x = JsonHelper.SerializeObject(prod);
}
dgvSelectProduct.Rows[rowIndex].Height = 60;
//Color color = Color.Red;
//if (dgvSelectProduct.Rows[rowIndex].Cells["colMsg"].Value.ParseToString() == "在售")
// color = Color.Blue;
//if (dgvSelectProduct.Rows[rowIndex].Cells["colMsg"].Value.ParseToString() == "下架")
// color = Color.Purple;
//if (dgvSelectProduct.Rows[rowIndex].Cells["colMsg"].Value.ParseToString() == "草稿箱")
// color = Color.DarkOrange;
//if (dgvSelectProduct.Rows[rowIndex].Cells["colMsg"].Value.ParseToString() == "回收站")
// color = Color.Gray;
//dgvSelectProduct.Rows[rowIndex].Cells["colMsg"].Style.ForeColor = color;
}));
}
}
catch (Exception ex)
{
}
}
catch (Exception ex)
else
{
getActivityProdRst = WXActivity.getActivityProdList(shop, page, pageSize);
Thread.Sleep(Randomx.GetId(150, 300));
if (!getActivityProdRst.Contains("\"code\":0"))
{
ShowShopError(shop, getActivityProdRst);
break;
}
totalPage = BaseRegex.GetIntJson(ref getActivityProdRst, "totalPage");
try
{
Invoke(new Action(() =>
{
this.pbLoading.Visible = true;
this.statusBar.lblTaskStatus.Text = "正在查询店铺:" + shop.ShopAccount + " " + page + "/" + Math.Min(PageEnd, totalPage);
}));
var prodObjs = JsonHelper.JObjectParse(getActivityProdRst)["data"];
WxActivityData dataTmp = JsonHelper.DeserializeJsonToObject<WxActivityData>(JsonHelper.SerializeObject(prodObjs));
foreach (var prodRequest in dataTmp.requestProductInfoList.resultList)
{
if (this.wxActivityData.requestProductInfoList.resultList.Any(r => r.product.productId == prodRequest.product.productId && r.product.skuId == prodRequest.product.skuId))
continue;
prodRequest.shopId = shop.ShopId;
wxActivityData.requestProductInfoList.resultList.Add(prodRequest);
}
foreach (var prod in dataTmp.productList)
{
if (this.wxActivityData.productList.Any(p => p.productKey.productId == prod.productKey.productId))
continue;
wxActivityData.productList.Add(prod);
var signCnt = wxActivityData.requestProductInfoList.resultList
.Where(r => r.product.productId == prod.productKey.productId && r.isAdded == true).ToList().Count;
var signCntStr = signCnt > 0 ? "," + signCnt + "个已报名" : "";
Invoke(new Action(() =>
{
var rowIndex = this.dgvSelectProduct.Rows.Add(
false,
shop.ShopId,
shop.ShopAccount,
"登录",
"进店",
prod.productKey.productId,
"",
prod.info.headImg.FirstOrDefault(),
DataGridViewExtension.defaultBitmap,
prod.info.title,
"sku数量:" + prod.productSkus.Count + "个" + signCntStr,
prod.productSkus.Min(s => s.productSkuInfo.salePrice) * 0.01m + " - " + prod.productSkus.Max(s => s.productSkuInfo.salePrice) * 0.01m,
prod.productSkus.Min(s => s.productSkuInfo.salePrice) * 0.01m + " - " + prod.productSkus.Max(s => s.productSkuInfo.salePrice) * 0.01m,
prod.info.totalStockNum,
""
);
if (prod.productKey.productId == "10000852942152")
{
var x = JsonHelper.SerializeObject(prod);
}
dgvSelectProduct.Rows[rowIndex].Height = 60;
//Color color = Color.Red;
//if (dgvSelectProduct.Rows[rowIndex].Cells["colMsg"].Value.ParseToString() == "在售")
// color = Color.Blue;
//if (dgvSelectProduct.Rows[rowIndex].Cells["colMsg"].Value.ParseToString() == "下架")
// color = Color.Purple;
//if (dgvSelectProduct.Rows[rowIndex].Cells["colMsg"].Value.ParseToString() == "草稿箱")
// color = Color.DarkOrange;
//if (dgvSelectProduct.Rows[rowIndex].Cells["colMsg"].Value.ParseToString() == "回收站")
// color = Color.Gray;
//dgvSelectProduct.Rows[rowIndex].Cells["colMsg"].Style.ForeColor = color;
}));
}
}
catch (Exception ex)
{
}
}
}
}
}
@@ -929,6 +1017,180 @@ namespace TemuKJD.WXForms.ProductForms
}
}
void cancelSignActivity(List<DataGridViewRow> rowLst)
{
Invoke(new Action(() =>
{
this.pbLoading.Visible = true;
this.statusBar.lblTaskStatus.Text = "正在报名活动" + "...".Substring(0, DateTime.Now.Second % 4);
this.statusBar.pgbTaskProgress.Maximum = rowLst.Count;
this.statusBar.UpdateProgressBar(0);
}));
while (rowLst.Count > 0)
{
if (cancellationTokenSource.IsCancellationRequested)
break;
var r0 = rowLst.FirstOrDefault();
var shopId = r0.Cells["colSupplierId"].Value.ParseToString();
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
var rowLstTmp = rowLst.Where(r => r.Cells["colSupplierId"].Value.ParseToString() == shopId).Take(50).ToList();
foreach (var r in rowLstTmp)
{
rowLst.RemoveAll(rw => rw.Cells["colDraftId"].Value == r.Cells["colDraftId"].Value);
Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "正在取消报名活动" + "...".Substring(0, DateTime.Now.Second % 4);
this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1);
r.Cells["colOpResult"].Value = "";
}));
}
if (shop == null)
{
Invoke(new Action(() =>
{
foreach (var r in rowLstTmp)
{
r.Cells["colOpResult"].Value = "店铺不存在";
}
}));
continue;
}
if (shop.LoginStatus != "登录成功")
{
Invoke(new Action(() =>
{
foreach (var r in rowLstTmp)
{
r.Cells["colOpResult"].Value = "店铺掉线";
}
}));
continue;
}
//{"cosignmentOrderId":"4436464658179189760","cosignmentProductList":[{"spuId":"10000826730228","skuId":"14511204738","cancelScene":2}],"orderId":"3736464645960385280"}
JObject signActivityObj = new JObject();
signActivityObj["platformActivityId"] = "1016";
var jArr = new JArray();
bool hasProdForCancelActivity = false;
foreach (var row in rowLstTmp)
{
Thread.Sleep(Randomx.GetId(10, 20));
var prodId = row.Cells["colDraftId"].Value.ParseToString();
var skus = this.wxActivityData.requestProductInfoList.resultList.Where(p => p.product.productId == prodId).ToList();
//if (chkSkipPriceEnd.Checked && txtSkipPriceEnd.Text.Trim().Length > 0 && skus.Any(s => (s.salePrice.ParseToInt() * 0.01m).ParseToString().EndsWith(txtSkipPriceEnd.Text.Trim())))
//{
// row.Cells["colOpResult"].Value = "价格尾数命中跳过";
// continue;
//}
if (skus.All(s => s.isAdded != true))
{
Invoke(new Action(() => { row.Cells["colOpResult"].Value = "已取消报名"; }));
}
else
{
hasProdForCancelActivity = true;
Invoke(new Action(() => { row.Cells["colOpResult"].Value = "正在取消报名"; }));
}
skus = skus.Where(s => s.isAdded == true).ToList();
foreach (var sku in skus)
{
JObject prodObj = new JObject();
prodObj["productId"] = prodId;
prodObj["skuId"] = sku.product.skuId;
//prodObj["activityStockNum"] = 0;
//Invoke(new Action(() =>
//{
// if (cmbType.Text == "价格比例")
// prodObj["activityPrice"] = (sku.salePrice.ParseToInt() * (100 - discountPercent) * 0.01m).ParseToInt();
// else
// prodObj["activityPrice"] = sku.salePrice.ParseToInt() - discountPrice;
//}));
//prodObj["stockMode"] = sku.defaultStockMode;
jArr.Add(prodObj);
}
}
signActivityObj["productList"] = jArr;
signActivityObj["actionType"] = 1;
if (!hasProdForCancelActivity)
continue;
var signRst = WXActivity.signWxActivity(shop, signActivityObj);
Thread.Sleep(Randomx.GetId(500, 1000));
if (!signRst.Contains("\"code\":0"))
{
if (signRst.Contains("biz magic invalid"))
{
WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
if (shop.LoginStatus != "登录成功")
{
Invoke(new Action(() =>
{
foreach (var row in rowLstTmp)
{
row.Cells["colOpResult"].Value = "店铺掉线";
}
}));
continue;
}
}
var errmsg = BaseRegex.GetStringJson(ref signRst, "msg");
if (string.IsNullOrWhiteSpace(errmsg))
errmsg = signRst;
Invoke(new Action(() =>
{
foreach (var row in rowLstTmp)
{
row.Cells["colOpResult"].Value = errmsg;
}
}));
}
JArray rstArr = new JArray();
try
{
rstArr = JsonHelper.JObjectParse(signRst)["checkResultList"] as JArray;
if (rstArr == null)
rstArr = new JArray();
}
catch
{ }
if (signRst.Contains("\"code\":0"))
{
foreach (var row in rowLstTmp)
{
if (row.Cells["colOpResult"].Value.ParseToString() == "已取消报名")
continue;
var errStr = "";
var prodId = row.Cells["colDraftId"].Value.ParseToString();
var jObjs = rstArr.Where(a => a["product"]["productId"].ParseToString() == prodId).ToList();
foreach (var jObj in jObjs)
{
if (!string.IsNullOrWhiteSpace(jObj["invalidString"].ParseToString()))
errStr += jObj["product"]["skuId"] + ":" + jObj["invalidString"] + ";";
}
errStr = errStr.Trim(';');
Invoke(new Action(() =>
{
row.Cells["colOpResult"].Value = "取消报名成功 " + errStr;
}));
}
}
}
}
private void btnFiltSelect_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow row in dgvSelectProduct.Rows)
@@ -1013,6 +1275,40 @@ namespace TemuKJD.WXForms.ProductForms
{
discountPercent = txtPercent.Text.ParseToInt();
}
private void btnCancelActivity_Click(object sender, EventArgs e)
{
var rowLst = dgvSelectProduct.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true).ToList();
if (rowLst.Count <= 0)
{
BaseMsgForm.ShowError("请勾选需要取消报名的商品!");
return;
}
this.pbLoading.Visible = true;
if (cancellationTokenSource != null && !cancellationTokenSource.IsCancellationRequested)
cancellationTokenSource.Cancel();
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
cancelSignActivity(rowLst);
Invoke(new Action(() =>
{
if (cancellationTokenSource.IsCancellationRequested)
{
this.statusBar.lblTaskStatus.Text = "取消报名活动中断";
BaseMsgForm.ShowInfo("取消报名活动中断");
}
else
{
this.statusBar.lblTaskStatus.Text = "取消报名活动完毕";
BaseMsgForm.ShowInfo("取消报名活动完毕");
}
this.pbLoading.Visible = false;
}));
}, cancellationTokenSource.Token);
}
}
public class WXActivity
@@ -1056,6 +1352,74 @@ namespace TemuKJD.WXForms.ProductForms
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, data, refere);
return result;
}
public static string getProdInActivityList(ShopLoginInfo shop, int page, int pageSize = 10, string activityId = "1016")
{
//{"keyword":"","pageNum":1,"pageSize":10,"platformActivityId":"1016"}
string url = "https://store.weixin.qq.com/shop-faas/mmeckolmarketingnode/activity/cgi/getPlatformInvestmentProductInfoList?token=&lang=zh_CN";
string refere = "https://store.weixin.qq.com/shop/marketingkol/activity/detail?id=" + activityId + "&curTab=2";
string data = @"{""platformActivityId"":""" + activityId + @""",""pageNum"":" + page + @",""pageSize"":" + pageSize + @",""auditStatus"":2,""productId"":""""}";
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, data, refere);
return result;
}
}
public class ActivityProd
{
public string requestTime { get; set; } // "1781096322",
public string shopNickname { get; set; } // "夜笙供应链",
public string shopAppid { get; set; } // "wx2664a142d76831dd",
public string productName { get; set; } // "行川9K MAX广角镜新款升级直播广角镜头主播网红自拍大范围取景神器送便携全屏手机补光灯",
public string skuName { get; set; } // "行川9K max广角镜头(送全屏手机补光灯)",
public string productId { get; set; } // "10000671183000",
public string skuId { get; set; } // "11262798360",
public string originPrice { get; set; } // "10100",
public string activityPrice { get; set; } // "10090",
public string verifyPrice { get; set; } // "0",
public string beforePlatformDiscountCommPrice { get; set; } // "10090",
public string beforePlatformDiscountMinPrice { get; set; } // "10090",
public string afterPlatformDiscountCommPrice { get; set; } // "9090",
public string afterPlatformDiscountMinPrice { get; set; } // "8829",
public string platformDiscountValue { get; set; } // "0",
public string platformDiscountStockNum { get; set; } // "0",
public string activityStockNum { get; set; } // "0",
public string totalStockNum { get; set; } // "998",
public int? auditStatus { get; set; } // 2,
public string auditReason { get; set; } // "",
public string productImgUrl { get; set; } // "https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/69c8e2040008c0af0c19954af1b91b15000000a100004f50",
public int? originStatus { get; set; } // 30,
public string clearReason { get; set; } // "",
public int? clearSource { get; set; } // 0,
public long? delTime { get; set; } // 0,
public long? updateTime { get; set; } // 1781096635,
public string reductionPriceCap { get; set; } // "0",
public string reductionPricePerFriendLike { get; set; } // "0",
public int? needFriendLikeCnt { get; set; } // 0,
public int? passStatus { get; set; } // 0,
public int? auditFailStage { get; set; } // 0,
public int? subsidyUpdateStatus { get; set; } // 0,
public int? subsidyChangeType { get; set; } // 0,
public int? subsidyChangePlatformDiscountValue { get; set; } // 0,
public string subsidyChangeReductionPriceCap { get; set; } // "0",
public int? subsidyChangeNeedFriendLikeCnt { get; set; } // 0,
public int? dailyStock { get; set; } // 0,
public int? stockMode { get; set; } // 1,
public int? goodPresentAuditStatus { get; set; } // 0,
public string sellingPointWording { get; set; } // "",
public string atmosphereWording { get; set; } // "",
public string merchantLowestPrice { get; set; } // "0",
public int? platformDiscountCal { get; set; } // 0,
public int? priceEqual { get; set; } // 0,
public int? maxPlatform_618Discount { get; set; } // 201,
public string promotionImgUrl { get; set; } // "",
public int? maxPlatform_618DiscountMerchant { get; set; } // 1059,
public string spuCode { get; set; } // "EC110000290936659A",
public string skuCode { get; set; } // "",
public string maxPlatformSubsidy { get; set; } // "201",
public string maxMerchantSubsidy { get; set; } // "1059",
public int? delStatus { get; set; } // 0,
public bool? canModify { get; set; } // true
}
}