拼多多买手订单抓取推送

This commit is contained in:
wule committed 2026-04-10 16:00:24 +08:00
1 parent fa96cc1444
commit caeea6e0c3
18 files changed
+1703 -215

No files matched your search

+67 -1
View File
@@ -44,6 +44,10 @@
this.panel2 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.btnSaveCookie = new DevComponents.DotNetBar.PanelEx();
this.panel3 = new System.Windows.Forms.Panel();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
@@ -52,12 +56,14 @@
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.panel2.SuspendLayout();
this.panel3.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.splitContainer1.Name = "splitContainer1";
@@ -65,6 +71,7 @@
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White;
this.splitContainer1.Panel2.Controls.Add(this.panel3);
this.splitContainer1.Panel2.Controls.Add(this.label3);
this.splitContainer1.Panel2.Controls.Add(this.panel2);
this.splitContainer1.Panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.splitContainer1_Panel2_Paint);
@@ -241,7 +248,7 @@
this.panel2.Controls.Add(this.btnCopyPassword);
this.panel2.Controls.Add(this.txtPassWord);
this.panel2.Controls.Add(this.btnCopyUserName);
this.panel2.Location = new System.Drawing.Point(79, 195);
this.panel2.Location = new System.Drawing.Point(95, 398);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(376, 257);
this.panel2.TabIndex = 463;
@@ -270,6 +277,59 @@
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label3.Visible = false;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(28, 44);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(144, 17);
this.label4.TabIndex = 465;
this.label4.Text = "导入PDDAccessToken:";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(31, 71);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(389, 108);
this.textBox1.TabIndex = 466;
//
// btnSaveCookie
//
this.btnSaveCookie.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
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(364, 185);
this.btnSaveCookie.Name = "btnSaveCookie";
this.btnSaveCookie.Size = new System.Drawing.Size(56, 25);
this.btnSaveCookie.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnSaveCookie.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSaveCookie.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSaveCookie.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnSaveCookie.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnSaveCookie.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnSaveCookie.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnSaveCookie.Style.GradientAngle = 90;
this.btnSaveCookie.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnSaveCookie.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnSaveCookie.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnSaveCookie.TabIndex = 470;
this.btnSaveCookie.Text = "保存";
this.btnSaveCookie.Click += new System.EventHandler(this.btnSaveCookie_Click);
//
// panel3
//
this.panel3.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.panel3.Controls.Add(this.textBox1);
this.panel3.Controls.Add(this.btnSaveCookie);
this.panel3.Controls.Add(this.label4);
this.panel3.Location = new System.Drawing.Point(51, 135);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(452, 241);
this.panel3.TabIndex = 471;
this.panel3.Visible = false;
//
// PddMobileLoginForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -295,6 +355,8 @@
this.splitContainer2.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.ResumeLayout(false);
}
@@ -316,5 +378,9 @@
private System.Windows.Forms.Panel panel2;
public System.Windows.Forms.Label label3;
public System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label4;
private DevComponents.DotNetBar.PanelEx btnSaveCookie;
private System.Windows.Forms.Panel panel3;
}
}
+96 -50
View File
@@ -61,7 +61,10 @@ namespace TemuKJD.ToolForms
{
//this.splitContainer1.SplitterDistance = this.splitContainer1.Height - 62;
if (openType == EnumOpenType.login)
{
this.label3.Visible = true;
this.panel3.Visible = true;
}
if (CloseAfterSecond > 0)
{
@@ -222,11 +225,26 @@ namespace TemuKJD.ToolForms
//if (this.openType != EnumOpenType.login)
{
var t = CEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(cookieLst), cefWebBrowser.GetCookieManager(null));
//foreach (var cook in cookieLst)
//{
// var t = CEFBrowser.SetCookieAsync(cook.Domain, cook.Name + "=" + cook.Value + ";", cefWebBrowser.GetCookieManager(null));
// t.Wait(5000);
//}
foreach (var cook in cookieLst)
{
//var t = CEFBrowser.SetCookieAsync(cook.Domain.Trim('.'), cook.Name + "=" + cook.Value + ";", cefWebBrowser.GetCookieManager(null));
//t.Wait(5000);
//if (cook.Name == "PDDAccessToken")
//{
// var jsStr = "var date = new Date();" +
// "date.setTime(date.getTime() + (465 * 24 * 60 * 60 * 1000)); " +
// "document.cookie='PDDAccessToken=" + cook.Value + ";domain=mobile.yangkeduo.com; expires=' + date.toUTCString()";
// jsStr = "document.cookie='PDDAccessToken=" + cook.Value + ";domain=mobile.yangkeduo.com;'";
// cefWebBrowser.GetMainFrame().EvaluateScriptAsync(jsStr);
// //cook.Expires = DateTime.Now.AddDays(465);
// //cefWebBrowser.GetCookieManager(null).SetCookie("https://" + cook.Domain.Trim('.'), cook);
//}
////else
//// cefWebBrowser.GetCookieManager(null).SetCookie("https://" + cook.Domain, cook);
}
}
//根据登录的具体店铺设置local storage
@@ -322,63 +340,73 @@ namespace TemuKJD.ToolForms
private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
{
//if (url.Contains("https://mobile.yangkeduo.com/personal.html?refer_page_name=login") && openType == EnumOpenType.login)
if (url.Contains("https://mobile.yangkeduo.com/personal.html") && openType == EnumOpenType.login)
if (url.Contains("https://mobile.yangkeduo.com/index.html") && openType == EnumOpenType.login)
{
Task.Run(() =>
Task.Run(() => { cefWebBrowser.Load("https://mobile.yangkeduo.com/personal.html"); });
}
if (url.Contains("https://mobile.yangkeduo.com/personal.html"))
{
if (openType == EnumOpenType.login)
{
var data = responseData;
if (data.Contains("\"success\":true") || data.Contains("nickname"))
Task.Run(() =>
{
var uid = BaseRegex.GetStringJson(ref data, "uid");
var nickname = BaseRegex.GetStringJson(ref data, "nickname");
var username = nickname;
if (!string.IsNullOrEmpty(nickname) && !string.IsNullOrEmpty(uid))
var data = responseData;
if (data.Contains("\"success\":true") || data.Contains("nickname"))
{
List<Cookie> cookieList = CEFBrowser.GetCookieList(shopCookieHead, cefWebBrowser.GetCookieManager(null));
var uid = BaseRegex.GetStringJson(ref data, "uid");
var nickname = BaseRegex.GetStringJson(ref data, "nickname");
var username = nickname;
var buyerUrl = BaseClass.BuildPDDObjString("user/add_buyer");
if (this.buyer == null)
buyer = GlobalConfig.BuyerLoginList.FirstOrDefault(buyer => buyer.buyer_id == uid);
if (this.buyer != null)
if (!string.IsNullOrEmpty(nickname) && !string.IsNullOrEmpty(uid))
{
this.buyer.user_name = username;
this.buyer.buyer_nick = nickname;
this.buyer.cookie = JsonHelper.SerializeObject(cookieList);
buyerUrl = BaseClass.BuildPDDObjString("user/mdy_buyer");
}
Thread.Sleep(2000);
var buyerData = UserLogin.GetSignaturex()
+ "&buyer_id=" + uid
+ "&buyer_name=" + username
+ "&buyer_nick=" + nickname;
var result = GetHtml.PostUtf8(buyerUrl, buyerData);
if (string.IsNullOrEmpty(result) || !result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(buyerUrl, buyerData);
List<Cookie> cookieList = CEFBrowser.GetCookieList(shopCookieHead, cefWebBrowser.GetCookieManager(null));
buyerUrl = BaseClass.BuildPDDObjString("user/mdy_buyer_cookie");
buyerData = UserLogin.GetSignaturex()
+ "&buyer_id=" + uid
+ "&status=" + "在线"
+ "&cookie=" + GetHtml.UrlEncodeUtf8(JsonHelper.SerializeObject(cookieList));
result = GetHtml.PostUtf8(buyerUrl, buyerData);
if (string.IsNullOrEmpty(result) || !result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(buyerUrl, buyerData);
var buyerUrl = BaseClass.BuildPDDObjString("user/add_buyer");
Invoke(new Action(() =>
{
try
if (this.buyer == null || this.buyer.buyer_id != uid)
this.buyer = GlobalConfig.BuyerLoginList.FirstOrDefault(b => b.buyer_id == uid);
if (this.buyer != null)
{
if (chkCloseAfterLogin.Checked)
this.Close();
this.buyer.user_name = username;
this.buyer.buyer_nick = nickname;
this.buyer.cookie = JsonHelper.SerializeObject(cookieList);
buyerUrl = BaseClass.BuildPDDObjString("user/mdy_buyer");
}
catch (Exception ex)
{ }
}));
var buyerData = UserLogin.GetSignaturex()
+ "&buyer_id=" + uid
+ "&buyer_name=" + username
+ "&buyer_nick=" + nickname;
var result = GetHtml.PostUtf8(buyerUrl, buyerData);
if (string.IsNullOrEmpty(result) || !result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(buyerUrl, buyerData);
buyerUrl = BaseClass.BuildPDDObjString("user/mdy_buyer_cookie");
buyerData = UserLogin.GetSignaturex()
+ "&buyer_id=" + uid
+ "&status=" + "在线"
+ "&cookie=" + GetHtml.UrlEncodeUtf8(JsonHelper.SerializeObject(cookieList));
result = GetHtml.PostUtf8(buyerUrl, buyerData);
if (string.IsNullOrEmpty(result) || !result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(buyerUrl, buyerData);
Invoke(new Action(() =>
{
try
{
if (chkCloseAfterLogin.Checked)
this.Close();
}
catch (Exception ex)
{ }
}));
}
}
}
});
});
}
}
}
@@ -543,5 +571,23 @@ function getElementWithText(sText)
{
}
private void btnSaveCookie_Click(object sender, EventArgs e)
{
Cookie cookie = new Cookie();
cookie.Name = "PDDAccessToken";
cookie.Domain = "mobile.yangkeduo.com";
cookie.Expires = DateTime.Now.AddDays(465);
cookie.HttpOnly = true;
cookie.Secure = true;
cookie.Value = textBox1.Text.Trim();
if (this.cefWebBrowser != null)
{
var t = CEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(new List<Cookie> { cookie }), cefWebBrowser.GetCookieManager(null));
t.Wait(2000);
cefWebBrowser.Load("https://mobile.yangkeduo.com/personal.html");
}
}
}
}