加入微信客服相关功能 40%

This commit is contained in:
wule committed 2026-01-17 10:36:56 +08:00
1 parent f71cb1bba8
commit c05c7e4f23
93 files changed
+2824 -356

No files matched your search

@@ -16,7 +16,7 @@ using TemuKJD.ToolForms;
namespace TemuKJD.WXForms.ProductForms
{
public partial class WXDBProdUploadCacheForm : LRBaseForm
public partial class WXDBProdUploadCacheForm : BaseGeneralForm
{
NaiBa.Util.ConcurrentList<TemuDBProductSelect> lstTemuDBProductSelect;
public WXDBProdUploadCacheForm(NaiBa.Util.ConcurrentList<TemuDBProductSelect> _lstTemuDBProductSelect)
+19 -59
View File
@@ -40,7 +40,6 @@ namespace TemuKJD.WXForms.ProductForms
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.chkUpDraft = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.并发上传 = new DevComponents.DotNetBar.PanelEx();
this.chkSkipUploaded = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkSameSpecPrice = new TemuKJD.UserComponent.UcCheckBox(this.components);
@@ -72,6 +71,7 @@ namespace TemuKJD.WXForms.ProductForms
this.label4 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.chkStepAddPrice = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkUpDraft = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.ucGroupBoxEx4 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.cmbWxSafe = new System.Windows.Forms.ComboBox();
this.label13 = new System.Windows.Forms.Label();
@@ -107,8 +107,6 @@ namespace TemuKJD.WXForms.ProductForms
this.colUploadCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colRemaining = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.txtTest20981 = new System.Windows.Forms.TextBox();
this.btnTest20981 = new DevComponents.DotNetBar.PanelEx();
this.pbLoading = new System.Windows.Forms.PictureBox();
this.label11 = new System.Windows.Forms.Label();
this.txtSinglePriceAdd = new System.Windows.Forms.TextBox();
@@ -194,7 +192,6 @@ namespace TemuKJD.WXForms.ProductForms
| System.Windows.Forms.AnchorStyles.Right)));
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.并发上传);
this.ucGroupBoxEx2.Controls.Add(this.chkSkipUploaded);
this.ucGroupBoxEx2.Controls.Add(this.chkSameSpecPrice);
this.ucGroupBoxEx2.Controls.Add(this.label5);
@@ -221,7 +218,6 @@ namespace TemuKJD.WXForms.ProductForms
this.ucGroupBoxEx2.Controls.Add(this.label4);
this.ucGroupBoxEx2.Controls.Add(this.label9);
this.ucGroupBoxEx2.Controls.Add(this.chkStepAddPrice);
this.ucGroupBoxEx2.Controls.Add(this.chkUpDraft);
this.ucGroupBoxEx2.Location = new System.Drawing.Point(459, 2);
this.ucGroupBoxEx2.Name = "ucGroupBoxEx2";
this.ucGroupBoxEx2.Size = new System.Drawing.Size(1062, 140);
@@ -229,17 +225,6 @@ namespace TemuKJD.WXForms.ProductForms
this.ucGroupBoxEx2.TabStop = false;
this.ucGroupBoxEx2.Text = "商品上传";
//
// chkUpDraft
//
this.chkUpDraft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.chkUpDraft.AutoSize = true;
this.chkUpDraft.Location = new System.Drawing.Point(770, 105);
this.chkUpDraft.Name = "chkUpDraft";
this.chkUpDraft.Size = new System.Drawing.Size(99, 21);
this.chkUpDraft.TabIndex = 769;
this.chkUpDraft.Text = "上传到草稿箱";
this.chkUpDraft.UseVisualStyleBackColor = true;
//
// 并发上传
//
this.并发上传.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -247,9 +232,9 @@ namespace TemuKJD.WXForms.ProductForms
this.并发上传.Cursor = System.Windows.Forms.Cursors.Hand;
this.并发上传.DisabledBackColor = System.Drawing.Color.Empty;
this.并发上传.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.并发上传.Location = new System.Drawing.Point(865, 104);
this.并发上传.Location = new System.Drawing.Point(1093, 30);
this.并发上传.Name = "并发上传";
this.并发上传.Size = new System.Drawing.Size(84, 23);
this.并发上传.Size = new System.Drawing.Size(118, 23);
this.并发上传.Style.Alignment = System.Drawing.StringAlignment.Center;
this.并发上传.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.并发上传.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
@@ -262,7 +247,8 @@ namespace TemuKJD.WXForms.ProductForms
this.并发上传.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.并发上传.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.并发上传.TabIndex = 768;
this.并发上传.Text = "并发上传";
this.并发上传.Text = "测试并发上传";
this.并发上传.Visible = false;
this.并发上传.Click += new System.EventHandler(this.并发上传_Click);
//
// chkSkipUploaded
@@ -690,6 +676,18 @@ namespace TemuKJD.WXForms.ProductForms
this.chkStepAddPrice.UseVisualStyleBackColor = true;
this.chkStepAddPrice.CheckedChanged += new System.EventHandler(this.chkStepAddPrice_CheckedChanged);
//
// chkUpDraft
//
this.chkUpDraft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.chkUpDraft.AutoSize = true;
this.chkUpDraft.Location = new System.Drawing.Point(999, 31);
this.chkUpDraft.Name = "chkUpDraft";
this.chkUpDraft.Size = new System.Drawing.Size(99, 21);
this.chkUpDraft.TabIndex = 769;
this.chkUpDraft.Text = "上传到草稿箱";
this.chkUpDraft.UseVisualStyleBackColor = true;
this.chkUpDraft.Visible = false;
//
// ucGroupBoxEx4
//
this.ucGroupBoxEx4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -1020,11 +1018,11 @@ namespace TemuKJD.WXForms.ProductForms
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.txtTest20981);
this.splitContainer2.Panel2.Controls.Add(this.btnTest20981);
this.splitContainer2.Panel2.Controls.Add(this.并发上传);
this.splitContainer2.Panel2.Controls.Add(this.pbLoading);
this.splitContainer2.Panel2.Controls.Add(this.label11);
this.splitContainer2.Panel2.Controls.Add(this.txtSinglePriceAdd);
this.splitContainer2.Panel2.Controls.Add(this.chkUpDraft);
this.splitContainer2.Panel2.Controls.Add(this.dgvSelectProduct);
this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0);
this.splitContainer2.Size = new System.Drawing.Size(1523, 372);
@@ -1160,42 +1158,6 @@ namespace TemuKJD.WXForms.ProductForms
this.colMessage.Name = "colMessage";
this.colMessage.ReadOnly = true;
//
// txtTest20981
//
this.txtTest20981.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.txtTest20981.Location = new System.Drawing.Point(996, 30);
this.txtTest20981.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.txtTest20981.Name = "txtTest20981";
this.txtTest20981.Size = new System.Drawing.Size(127, 23);
this.txtTest20981.TabIndex = 650;
this.txtTest20981.Visible = false;
//
// btnTest20981
//
this.btnTest20981.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnTest20981.CanvasColor = System.Drawing.SystemColors.Control;
this.btnTest20981.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnTest20981.DisabledBackColor = System.Drawing.Color.Empty;
this.btnTest20981.Location = new System.Drawing.Point(1127, 30);
this.btnTest20981.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2);
this.btnTest20981.Name = "btnTest20981";
this.btnTest20981.Size = new System.Drawing.Size(84, 23);
this.btnTest20981.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnTest20981.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnTest20981.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnTest20981.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.btnTest20981.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnTest20981.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.btnTest20981.Style.GradientAngle = 90;
this.btnTest20981.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
this.btnTest20981.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnTest20981.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnTest20981.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnTest20981.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.btnTest20981.TabIndex = 649;
this.btnTest20981.Text = "测试20981";
this.btnTest20981.Visible = false;
//
// pbLoading
//
this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None;
@@ -1649,8 +1611,6 @@ namespace TemuKJD.WXForms.ProductForms
private System.Windows.Forms.ComboBox cmbCateFilter;
private System.Windows.Forms.Label label2;
public System.Windows.Forms.Label lblWaitToUp;
private System.Windows.Forms.TextBox txtTest20981;
private DevComponents.DotNetBar.PanelEx btnTest20981;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colSelectId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
@@ -138,6 +138,45 @@ namespace TemuKJD.WXForms.ProductForms
// dgvSelectProduct.Columns["colSkuFakeImg"].Visible = true;
//#endif
upload_draft_product_lst = NaiBa.Util.Helper.ConfigHelper.LoadConfig<NaiBa.Util.ConcurrentList<TemuDBProductSelect>>("wx_select_upload_draft_products");
if (upload_draft_product_lst == null)
upload_draft_product_lst = new ConcurrentList<TemuDBProductSelect>();
foreach (var selectProd in upload_draft_product_lst)
{
int rowIndex = 0;
this.dgvSelectProduct.Rows.Insert(rowIndex,
true,
selectProd.id,
selectProd.shop_id,
selectProd.shop_account,
"登录",
"进店",
selectProd.spu_id,
selectProd.skc_id,
selectProd.main_img,
null,
"",
null,
selectProd.product_name, // 用户端显示商品原名
selectProd.cat_name,
selectProd.ext_code,
selectProd.status,
selectProd.draft_id,
selectProd.notes,
(selectProd.user_notes + " 编辑").Trim(),
"删除",
selectProd.add_time.ToString("yy-MM-dd HH:mm:ss"),
"");
dgvSelectProduct.Rows[rowIndex].Height = 60;
int maxRowCount = 10000;
while (dgvSelectProduct.Rows.Count > maxRowCount)
{
dgvSelectProduct.Rows.RemoveAt(maxRowCount);
}
}
IsLoadComplate = true;
}
@@ -743,7 +782,7 @@ namespace TemuKJD.WXForms.ProductForms
{
row.Cells["colDraftId"].Value = productDraftId; // 草稿箱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["colOpResult"].Value = (selectProd.status == "已上传" ? "已成功上传" : "已上传 注意:") + (" " + error).TrimEnd(' ') + " " + duration.ParseToInt() + "秒";
row.Cells["colMsg"].Value = selectProd.status;
}
}));
@@ -1681,9 +1720,17 @@ namespace TemuKJD.WXForms.ProductForms
}
upProdParam.product.productKey.productId = BaseRegex.GetLongJson(ref uploadDraftRst, "productId").ParseToString();
upload_draft_products.Add(upProdParam);
if (chkUpDraft.Checked)
return "{\"success\":true,\"draftId\":" + upProdParam.product.productKey.productId + ",\"status\":\"草稿箱\",\"errMsg\":\"上架到草稿箱\"}";
{
selectProd.wxDraftProduct = upProdParam;
selectProd.draft_id = upProdParam.product.productKey.productId;
selectProd.status = "草稿箱";
selectProd.add_time = DateTime.Now;
upload_draft_product_lst.Add(selectProd);
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_select_upload_draft_products", upload_draft_product_lst);
return "{\"success\":true,\"draftId\":" + upProdParam.product.productKey.productId + ",\"status\":\"草稿箱\",\"errMsg\":\"指定上传到草稿箱\"}";
}
// 提交商品上架
var uploadProdRst = WXUpload.upProductV2(shop, upProdParam);
@@ -2004,8 +2051,14 @@ namespace TemuKJD.WXForms.ProductForms
foreach (var row in rows)
{
if (row.Cells["colCheck"].Value.ParseToBool() == true)
{
var draft_id = row.Cells["colDraftId"].Value.ParseToString();
upload_draft_product_lst.RemoveAll(p => p.draft_id == draft_id);
this.dgvSelectProduct.Rows.Remove(row);
}
}
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_select_upload_draft_products", upload_draft_product_lst);
}
private void chkAddMorePriceFirst_CheckedChanged(object sender, EventArgs e)
@@ -2048,15 +2101,10 @@ namespace TemuKJD.WXForms.ProductForms
private void 并发上传_Click(object sender, EventArgs e)
{
var draftIdLst = dgvSelectProduct.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colCheck"]?.Value.ParseToBool() == true).Select(r => r.Cells["colDraftId"]?.Value.ToString()).ToList();
// var lst = NaiBa.Util.Helper.ConfigHelper.LoadConfig<NaiBa.Util.ConcurrentList<WXUploadProductParam>>("wx_upload_draft_products");
// if (lst == null)
// lst = new ConcurrentList<WXUploadProductParam>();
var lst = upload_draft_products;
var lst = upload_draft_product_lst.Select(p => p.wxDraftProduct).ToList();
var upLst = lst.Where(l => draftIdLst.Contains(l.product.productKey.productId)).ToList();
DateTime startTime = DateTime.Now;
@@ -2078,12 +2126,14 @@ namespace TemuKJD.WXForms.ProductForms
tLst.Add(t);
}
Task.WaitAll(tLst.ToArray());
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_select_upload_draft_products", upload_draft_product_lst);
var duration = DateTime.Now - startTime;
Invoke(new Action(() => { BaseMsgForm.ShowInfo("并发上传完成,耗时:" + duration.TotalSeconds + " 秒"); }));
});
}
public ConcurrentList<WXUploadProductParam> upload_draft_products = new ConcurrentList<WXUploadProductParam>();
//public ConcurrentList<WXUploadProductParam> upload_draft_products = new ConcurrentList<WXUploadProductParam>();
public ConcurrentList<TemuDBProductSelect> upload_draft_product_lst = new ConcurrentList<TemuDBProductSelect>();
void UploadSameTime(ShopLoginInfo shop, WXUploadProductParam upProdParam, DataGridViewCell cell)
{
@@ -2095,6 +2145,8 @@ namespace TemuKJD.WXForms.ProductForms
uploadProdRst = WXUpload.upProductV2(shop, upProdParam);
if (retryTimes >= 5)
break;
if (uploadProdRst.Contains("今日提审次数已用尽,请明日再试"))
break;
}
if (!uploadProdRst.Contains("\"code\":0") && !uploadProdRst.Contains("\"success\":true"))
{
@@ -2114,7 +2166,7 @@ namespace TemuKJD.WXForms.ProductForms
{
if (cell != null)
{
upload_draft_products.Remove(upProdParam);
upload_draft_product_lst.RemoveAll(p => p.wxDraftProduct == upProdParam);
Invoke(new Action(() =>
{
cell.Value = "商品已上传,重试次数 " + retryTimes;