优化自动拍单优惠券逻辑

This commit is contained in:
wule committed 2026-10-23 09:45:39 +08:00
1 parent 8ec1b63f8a
commit f8e68a6322
3 files changed
+30 -20

No files matched your search

@@ -829,7 +829,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
}
else
{
return "获取失败,请关闭拍单窗口重试 " + BaseRegex.GetStringXml(ref sourceCodeRst, "msg", sourceCodeRst);
return "溯源码获取失败,请关闭拍单窗口重试 " + BaseRegex.GetStringXml(ref sourceCodeRst, "msg", sourceCodeRst);
}
}
+11 -2
View File
@@ -73,6 +73,7 @@ namespace TemuKJD.ToolForms
private static readonly object lockObj = new();
private static readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1);
private string sourceCode = string.Empty;
private string shopCookieHead = "yangkeduo.com";
private string shopMainUrl = "https://mobile.yangkeduo.com/index.html";
private ChromiumWebBrowser cefWebBrowser = null;
@@ -767,7 +768,6 @@ namespace TemuKJD.ToolForms
public async Task CheckSourceCode()
{
var sourceCode = txtSourceCode.Text.Trim();
var ts1 = await EvaluateJsBuyTagNameAndInnerHtml("div", sourceCode);
if (ts1.Result?.Value.ParseToString() != "success")
{
@@ -875,6 +875,11 @@ namespace TemuKJD.ToolForms
{
break;
}
var ts2 = await EvaluateJsBuyTagNameAndInnerHtml("div", "立即支付");
if (ts2.Result.Value is string rstStr2 && rstStr2 == "success" && ts1.Result.Value is string rstStr1 && rstStr1 != "success")
{
return "";
}
}
Thread.Sleep(Randomx.GetId(200, 400));
@@ -1356,7 +1361,6 @@ namespace TemuKJD.ToolForms
Invoke(() => { lblErrMsg.Text = "页面未加载!"; });
return;
}
//var sourceCode = txtSourceCode.Text.Trim();
//var jsStr1 = @"(function() { var elements = document.getElementsByTagName('div');
// for (i = elements.length - 1; i >= 0; i--){
// var element = elements[i];
@@ -2011,5 +2015,10 @@ namespace TemuKJD.ToolForms
{
pnlMask.Visible = false;
}
private void txtSourceCode_TextChanged(object sender, EventArgs e)
{
}
}
}
+18 -17
View File
@@ -34,6 +34,7 @@
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.lblErrMsg = new System.Windows.Forms.Label();
this.pnlMask = new DevComponents.DotNetBar.PanelEx();
this.pictureBox5 = new System.Windows.Forms.PictureBox();
this.btnJumpOrderList = new DevComponents.DotNetBar.PanelEx();
this.txtBuySkuName = new System.Windows.Forms.TextBox();
this.label21 = new System.Windows.Forms.Label();
@@ -113,7 +114,6 @@
this.chkAutoChangeWarehouseAddress = new Work.UserComponents.UcCheckBox(this.components);
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pnlMap = new System.Windows.Forms.Panel();
this.pictureBox5 = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
@@ -122,6 +122,7 @@
this.pnlMsg.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
this.pnlMask.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
@@ -133,7 +134,6 @@
this.pnlBuy.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.pnlMap.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
this.SuspendLayout();
//
// pbCloseBase
@@ -174,7 +174,7 @@
this.pnlMsg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.pnlMsg.Controls.Add(this.pictureBox4);
this.pnlMsg.Controls.Add(this.lblErrMsg);
this.pnlMsg.Location = new System.Drawing.Point(47, 538);
this.pnlMsg.Location = new System.Drawing.Point(47, 539);
this.pnlMsg.Name = "pnlMsg";
this.pnlMsg.Size = new System.Drawing.Size(771, 100);
this.pnlMsg.TabIndex = 898;
@@ -234,6 +234,19 @@
this.pnlMask.Text = "自动拍单倒计时\r\n8";
this.pnlMask.Visible = false;
//
// pictureBox5
//
this.pictureBox5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(99)))), ((int)(((byte)(143)))));
this.pictureBox5.Image = global::Work.Properties.Resources.close;
this.pictureBox5.Location = new System.Drawing.Point(829, 3);
this.pictureBox5.Name = "pictureBox5";
this.pictureBox5.Size = new System.Drawing.Size(32, 32);
this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox5.TabIndex = 898;
this.pictureBox5.TabStop = false;
this.pictureBox5.Click += new System.EventHandler(this.pictureBox5_Click);
//
// btnJumpOrderList
//
this.btnJumpOrderList.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -1110,6 +1123,7 @@
this.txtSourceCode.ReadOnly = true;
this.txtSourceCode.Size = new System.Drawing.Size(152, 23);
this.txtSourceCode.TabIndex = 885;
this.txtSourceCode.TextChanged += new System.EventHandler(this.txtSourceCode_TextChanged);
//
// btnReMap
//
@@ -1214,19 +1228,6 @@
this.pnlMap.Size = new System.Drawing.Size(468, 203);
this.pnlMap.TabIndex = 871;
//
// pictureBox5
//
this.pictureBox5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(99)))), ((int)(((byte)(143)))));
this.pictureBox5.Image = global::Work.Properties.Resources.close;
this.pictureBox5.Location = new System.Drawing.Point(829, 3);
this.pictureBox5.Name = "pictureBox5";
this.pictureBox5.Size = new System.Drawing.Size(32, 32);
this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox5.TabIndex = 898;
this.pictureBox5.TabStop = false;
this.pictureBox5.Click += new System.EventHandler(this.pictureBox5_Click);
//
// PddMobileBuyOrderForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -1249,6 +1250,7 @@
this.pnlMsg.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
this.pnlMask.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel1.PerformLayout();
this.splitContainer2.Panel2.ResumeLayout(false);
@@ -1266,7 +1268,6 @@
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.pnlMap.ResumeLayout(false);
this.pnlMap.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
this.ResumeLayout(false);
}