diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs
index d75eab8..af38e29 100644
--- a/AllBase/BaseClass.cs
+++ b/AllBase/BaseClass.cs
@@ -27,7 +27,7 @@ namespace AllBase
///
/// 版本ID
///
- public static int VersionCount = 760;
+ public static int VersionCount = 761;
//public static int VersionCount = 613;
///
diff --git a/AllBase/Model/Param/TemuProductManage/TemuProductParam.cs b/AllBase/Model/Param/TemuProductManage/TemuProductParam.cs
index 003da5c..836a9dd 100644
--- a/AllBase/Model/Param/TemuProductManage/TemuProductParam.cs
+++ b/AllBase/Model/Param/TemuProductManage/TemuProductParam.cs
@@ -369,19 +369,19 @@ namespace AllBase.Model.Param.TemuProductManage
///
///
///
- public string valueUnit { get; set; }
+ public string valueUnit { get; set; } = "";
///
///
///
- public long? valueGroupId { get; set; }
+ public long? valueGroupId { get; set; } = 0;
///
/// 白色系
///
- public string valueGroupName { get; set; }
+ public string valueGroupName { get; set; } = "";
///
///
///
- public string valueExtendInfo { get; set; }
+ public string valueExtendInfo { get; set; } = "";
}
public class ContentListItem
diff --git a/AllBase/Model/Result/TemuCategoryTemplateInfo.cs b/AllBase/Model/Result/TemuCategoryTemplateInfo.cs
index f0f2ce1..3842f85 100644
--- a/AllBase/Model/Result/TemuCategoryTemplateInfo.cs
+++ b/AllBase/Model/Result/TemuCategoryTemplateInfo.cs
@@ -59,11 +59,17 @@ namespace AllBase.Model.Result
public int? vid { get; set; }
public string value { get; set; }
public Dictionary lang2Value { get; set; }
- public object group { get; set; }
+ public TemuCategoryTemplateValueGroup group { get; set; }
public object specId { get; set; }
public object parentVids { get; set; }
public object extendInfo { get; set; }
public object noteText { get; set; }
public object noteImgUrl { get; set; }
}
+
+ public class TemuCategoryTemplateValueGroup
+ {
+ public long? id { get; set; } // 1
+ public string name { get; set; } // "白色系"
+ }
}
diff --git a/TEMUKJD/DYForms/ShopForms/DYShopAddEditForm.Designer.cs b/TEMUKJD/DYForms/ShopForms/DYShopAddEditForm.Designer.cs
new file mode 100644
index 0000000..ada4429
--- /dev/null
+++ b/TEMUKJD/DYForms/ShopForms/DYShopAddEditForm.Designer.cs
@@ -0,0 +1,321 @@
+namespace TemuKJD.DYForms.ShopForms
+{
+ partial class DYShopAddEditForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DYShopAddEditForm));
+ this.panel2 = new System.Windows.Forms.Panel();
+ this.label7 = new System.Windows.Forms.Label();
+ this.cmbGroup = new System.Windows.Forms.ComboBox();
+ this.txtBuyAccount = new DevComponents.DotNetBar.Controls.TextBoxX();
+ this.label6 = new System.Windows.Forms.Label();
+ this.txtChatAccount = new DevComponents.DotNetBar.Controls.TextBoxX();
+ this.label4 = new System.Windows.Forms.Label();
+ this.txtUploadAccount = new DevComponents.DotNetBar.Controls.TextBoxX();
+ this.label3 = new System.Windows.Forms.Label();
+ this.txtShopPassword = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.txtLoginName = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label5 = new System.Windows.Forms.Label();
+ this.btnOk = new TemuKJD.UserControls.ButtonEx();
+ this.txtNotes = new DevComponents.DotNetBar.Controls.TextBoxX();
+ this.label8 = new System.Windows.Forms.Label();
+ this.panel2.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // panel2
+ //
+ this.panel2.BackColor = System.Drawing.Color.White;
+ this.panel2.Controls.Add(this.label8);
+ this.panel2.Controls.Add(this.txtNotes);
+ this.panel2.Controls.Add(this.label7);
+ this.panel2.Controls.Add(this.cmbGroup);
+ this.panel2.Controls.Add(this.txtBuyAccount);
+ this.panel2.Controls.Add(this.label6);
+ this.panel2.Controls.Add(this.txtChatAccount);
+ this.panel2.Controls.Add(this.label4);
+ this.panel2.Controls.Add(this.txtUploadAccount);
+ this.panel2.Controls.Add(this.label3);
+ this.panel2.Controls.Add(this.txtShopPassword);
+ this.panel2.Controls.Add(this.label2);
+ this.panel2.Controls.Add(this.txtLoginName);
+ this.panel2.Controls.Add(this.label1);
+ this.panel2.Controls.Add(this.label5);
+ this.panel2.Controls.Add(this.btnOk);
+ this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.panel2.Location = new System.Drawing.Point(1, 33);
+ this.panel2.Name = "panel2";
+ this.panel2.Size = new System.Drawing.Size(295, 285);
+ this.panel2.TabIndex = 1;
+ this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel2_Paint);
+ //
+ // label7
+ //
+ this.label7.AutoSize = true;
+ this.label7.ForeColor = System.Drawing.Color.DarkGray;
+ this.label7.Location = new System.Drawing.Point(31, 214);
+ this.label7.Name = "label7";
+ this.label7.Size = new System.Drawing.Size(164, 17);
+ this.label7.TabIndex = 384;
+ this.label7.Text = "登录密码为空表示不更新密码";
+ this.label7.Visible = false;
+ //
+ // cmbGroup
+ //
+ this.cmbGroup.FormattingEnabled = true;
+ this.cmbGroup.Items.AddRange(new object[] {
+ "客服",
+ "采购",
+ "上货",
+ "数据",
+ "登录"});
+ this.cmbGroup.Location = new System.Drawing.Point(91, 257);
+ this.cmbGroup.Name = "cmbGroup";
+ this.cmbGroup.Size = new System.Drawing.Size(172, 25);
+ this.cmbGroup.TabIndex = 383;
+ this.cmbGroup.Visible = false;
+ //
+ // txtBuyAccount
+ //
+ //
+ //
+ //
+ this.txtBuyAccount.Border.Class = "CrumbBarBackgroundKey";
+ this.txtBuyAccount.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
+ this.txtBuyAccount.Border.PaddingBottom = 2;
+ this.txtBuyAccount.Border.PaddingLeft = 2;
+ this.txtBuyAccount.Border.PaddingRight = 2;
+ this.txtBuyAccount.Border.PaddingTop = 2;
+ this.txtBuyAccount.Location = new System.Drawing.Point(91, 240);
+ this.txtBuyAccount.Name = "txtBuyAccount";
+ this.txtBuyAccount.Size = new System.Drawing.Size(172, 23);
+ this.txtBuyAccount.TabIndex = 382;
+ this.txtBuyAccount.Visible = false;
+ this.txtBuyAccount.WatermarkText = "点击添加店铺子账户";
+ this.txtBuyAccount.Click += new System.EventHandler(this.txt_Click);
+ this.txtBuyAccount.TextChanged += new System.EventHandler(this.txtBuyAccount_TextChanged);
+ //
+ // label6
+ //
+ this.label6.AutoSize = true;
+ this.label6.Location = new System.Drawing.Point(29, 243);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(56, 17);
+ this.label6.TabIndex = 381;
+ this.label6.Text = "采购账户";
+ this.label6.Visible = false;
+ //
+ // txtChatAccount
+ //
+ //
+ //
+ //
+ this.txtChatAccount.Border.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid;
+ this.txtChatAccount.Border.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid;
+ this.txtChatAccount.Border.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid;
+ this.txtChatAccount.Border.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
+ this.txtChatAccount.Border.Class = "CrumbBarBackgroundKey";
+ this.txtChatAccount.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
+ this.txtChatAccount.Border.PaddingBottom = 2;
+ this.txtChatAccount.Border.PaddingLeft = 2;
+ this.txtChatAccount.Border.PaddingRight = 2;
+ this.txtChatAccount.Border.PaddingTop = 2;
+ this.txtChatAccount.Location = new System.Drawing.Point(91, 99);
+ this.txtChatAccount.Name = "txtChatAccount";
+ this.txtChatAccount.Size = new System.Drawing.Size(172, 23);
+ this.txtChatAccount.TabIndex = 380;
+ this.txtChatAccount.WatermarkText = "点击添加店铺子账户";
+ this.txtChatAccount.Click += new System.EventHandler(this.txt_Click);
+ this.txtChatAccount.TextChanged += new System.EventHandler(this.txtChat_TextChanged);
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(29, 102);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(56, 17);
+ this.label4.TabIndex = 379;
+ this.label4.Text = " 子账户";
+ //
+ // txtUploadAccount
+ //
+ //
+ //
+ //
+ this.txtUploadAccount.Border.Class = "CrumbBarBackgroundKey";
+ this.txtUploadAccount.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
+ this.txtUploadAccount.Border.PaddingBottom = 2;
+ this.txtUploadAccount.Border.PaddingLeft = 2;
+ this.txtUploadAccount.Border.PaddingRight = 2;
+ this.txtUploadAccount.Border.PaddingTop = 2;
+ this.txtUploadAccount.Location = new System.Drawing.Point(91, 99);
+ this.txtUploadAccount.Name = "txtUploadAccount";
+ this.txtUploadAccount.Size = new System.Drawing.Size(172, 23);
+ this.txtUploadAccount.TabIndex = 374;
+ this.txtUploadAccount.Visible = false;
+ this.txtUploadAccount.Click += new System.EventHandler(this.txt_Click);
+ this.txtUploadAccount.TextChanged += new System.EventHandler(this.txtUploadAccount_TextChanged);
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(29, 102);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(56, 17);
+ this.label3.TabIndex = 373;
+ this.label3.Text = "上货账户";
+ this.label3.Visible = false;
+ //
+ // txtShopPassword
+ //
+ this.txtShopPassword.Location = new System.Drawing.Point(91, 64);
+ this.txtShopPassword.Name = "txtShopPassword";
+ this.txtShopPassword.PasswordChar = '●';
+ this.txtShopPassword.Size = new System.Drawing.Size(172, 23);
+ this.txtShopPassword.TabIndex = 338;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(29, 67);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(56, 17);
+ this.label2.TabIndex = 337;
+ this.label2.Text = "登录密码";
+ //
+ // txtLoginName
+ //
+ this.txtLoginName.Location = new System.Drawing.Point(91, 29);
+ this.txtLoginName.Name = "txtLoginName";
+ this.txtLoginName.Size = new System.Drawing.Size(172, 23);
+ this.txtLoginName.TabIndex = 336;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(29, 32);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(56, 17);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "登录账号";
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(29, 260);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(56, 17);
+ this.label5.TabIndex = 377;
+ this.label5.Text = "店铺分组";
+ this.label5.Visible = false;
+ //
+ // btnOk
+ //
+ this.btnOk.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnOk.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.btnOk.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnOk.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.btnOk.ForeColor = System.Drawing.Color.White;
+ this.btnOk.Location = new System.Drawing.Point(208, 209);
+ this.btnOk.Margin = new System.Windows.Forms.Padding(2);
+ this.btnOk.Name = "btnOk";
+ this.btnOk.Size = new System.Drawing.Size(55, 26);
+ this.btnOk.TabIndex = 372;
+ this.btnOk.Text = "新增";
+ this.btnOk.UseVisualStyleBackColor = false;
+ this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
+ //
+ // txtNotes
+ //
+ //
+ //
+ //
+ this.txtNotes.Border.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid;
+ this.txtNotes.Border.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid;
+ this.txtNotes.Border.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid;
+ this.txtNotes.Border.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
+ this.txtNotes.Border.Class = "CrumbBarBackgroundKey";
+ this.txtNotes.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
+ this.txtNotes.Border.PaddingBottom = 2;
+ this.txtNotes.Border.PaddingLeft = 2;
+ this.txtNotes.Border.PaddingRight = 2;
+ this.txtNotes.Border.PaddingTop = 2;
+ this.txtNotes.Location = new System.Drawing.Point(91, 133);
+ this.txtNotes.Name = "txtNotes";
+ this.txtNotes.Size = new System.Drawing.Size(172, 23);
+ this.txtNotes.TabIndex = 385;
+ //
+ // label8
+ //
+ this.label8.AutoSize = true;
+ this.label8.Location = new System.Drawing.Point(29, 135);
+ this.label8.Name = "label8";
+ this.label8.Size = new System.Drawing.Size(56, 17);
+ this.label8.TabIndex = 386;
+ this.label8.Text = " 备注";
+ //
+ // ShopAddEditForm
+ //
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.ClientSize = new System.Drawing.Size(297, 319);
+ this.Controls.Add(this.panel2);
+ this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+ this.Name = "ShopAddEditForm";
+ this.Text = "添加店铺";
+ this.TitleText = "添加店铺";
+ this.Load += new System.EventHandler(this.ShopAddEditForm_Load);
+ this.Controls.SetChildIndex(this.panel2, 0);
+ this.panel2.ResumeLayout(false);
+ this.panel2.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Panel panel2;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox txtShopPassword;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox txtLoginName;
+ private UserControls.ButtonEx btnOk;
+ private System.Windows.Forms.Label label5;
+ private DevComponents.DotNetBar.Controls.TextBoxX txtUploadAccount;
+ private System.Windows.Forms.Label label3;
+ private DevComponents.DotNetBar.Controls.TextBoxX txtBuyAccount;
+ private System.Windows.Forms.Label label6;
+ private DevComponents.DotNetBar.Controls.TextBoxX txtChatAccount;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.ComboBox cmbGroup;
+ private System.Windows.Forms.Label label7;
+ private System.Windows.Forms.Label label8;
+ private DevComponents.DotNetBar.Controls.TextBoxX txtNotes;
+ }
+}
\ No newline at end of file
diff --git a/TEMUKJD/DYForms/ShopForms/DYShopAddEditForm.cs b/TEMUKJD/DYForms/ShopForms/DYShopAddEditForm.cs
new file mode 100644
index 0000000..7581e69
--- /dev/null
+++ b/TEMUKJD/DYForms/ShopForms/DYShopAddEditForm.cs
@@ -0,0 +1,134 @@
+using AllBase.Helper;
+using AllBase.Model.Result;
+using TemuKJD.BaseForms;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace TemuKJD.DYForms.ShopForms
+{
+ public partial class DYShopAddEditForm : LRBaseForm
+ {
+ ShopLoginInfo shopLoginInfo = null;
+ bool isAdd = true;
+
+ public DYShopAddEditForm(ShopLoginInfo shop = null)
+ {
+ InitializeComponent();
+ shopLoginInfo = shop;
+ if (shopLoginInfo != null)
+ isAdd = false;
+ }
+
+ private void btnOk_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(this.txtLoginName.Text.Trim()))
+ {
+ BaseMsgForm.ShowError("用户名不能为空!");
+ return;
+ }
+ if (shopLoginInfo == null && string.IsNullOrEmpty(this.txtShopPassword.Text.Trim()))
+ {
+ BaseMsgForm.ShowError("密码不能为空!");
+ return;
+ }
+
+ if (shopLoginInfo == null)
+ shopLoginInfo = new ShopLoginInfo();
+
+ shopLoginInfo.LoginName = this.txtLoginName.Text.Trim();
+ if (!string.IsNullOrEmpty(this.txtShopPassword.Text.Trim()))
+ shopLoginInfo.Password = DataOpenSSL.EncryptString(this.txtShopPassword.Text.Trim());
+ shopLoginInfo.GroupName = this.cmbGroup.Text;
+ shopLoginInfo.Notes = this.txtNotes.Text;
+ shopLoginInfo.CompanyName = AllBase.BaseClass.CompanyName;
+
+ // 同一个登录账号下的店铺使用同样的groupName和Notes
+ var shopLst = GlobalConfig.ShopLoginList.Where(s => s.LoginName == shopLoginInfo.LoginName && s.ShopId != shopLoginInfo.ShopId).ToList();
+ foreach (var shop in shopLst)
+ {
+ shop.GroupName = shopLoginInfo.GroupName;
+ shop.Notes = shopLoginInfo.Notes;
+ }
+
+ this.OnSaveComplete(shopLoginInfo, isAdd);
+ this.Close();
+ }
+
+ private void panel2_Paint(object sender, PaintEventArgs e)
+ {
+
+ }
+
+ private void ShopAddEditForm_Load(object sender, EventArgs e)
+ {
+ this.cmbGroup.Items.Clear();
+ this.cmbGroup.Items.Add(string.Empty);
+ foreach (var shop in GlobalConfig.ShopLoginList)
+ {
+ if (!string.IsNullOrEmpty(shop.GroupName) && !this.cmbGroup.Items.Contains(shop.GroupName))
+ this.cmbGroup.Items.Add(shop.GroupName);
+ }
+ if (shopLoginInfo != null)
+ {
+ this.txtLoginName.Text = shopLoginInfo.LoginName;
+ this.cmbGroup.Text = shopLoginInfo.GroupName;
+ this.txtNotes.Text = shopLoginInfo.Notes;
+ this.btnOk.Text = "更新";
+ this.TitleText = "编辑店铺 - " + shopLoginInfo.ShopAccount;
+ this.txtBuyAccount.Text = shopLoginInfo.BuyAccount;
+ //this.txtChatAccount.Text = shopLoginInfo.ChatAccount;
+ this.txtChatAccount.Text = shopLoginInfo.SubUserName;
+ this.txtUploadAccount.Text = shopLoginInfo.UploadAccount;
+ this.label7.Visible = true;
+ this.txtLoginName.Enabled = false;
+ }
+ else
+ {
+ this.txtBuyAccount.Enabled = false;
+ this.txtChatAccount.Enabled = false;
+ this.txtUploadAccount.Enabled = false;
+ this.txtBuyAccount.Text = this.txtChatAccount.Text = this.txtUploadAccount.Text = "请在编辑账户时修改子账户";
+ }
+ }
+
+ private void txtUploadAccount_TextChanged(object sender, EventArgs e)
+ {
+
+ }
+
+ private void txtChat_TextChanged(object sender, EventArgs e)
+ {
+
+ }
+
+ private void txtBuyAccount_TextChanged(object sender, EventArgs e)
+ {
+
+ }
+
+ private void txt_Click(object sender, EventArgs e)
+ {
+ DYSubAccountShopEditForm f = new DYSubAccountShopEditForm(shopLoginInfo);
+ f.SaveComplete += F_SaveComplete;
+ f.ShowDialog();
+ }
+
+ private void F_SaveComplete(object obj)
+ {
+ var shop = obj as ShopLoginInfo;
+ if (shop != null)
+ {
+ this.txtBuyAccount.Text = shop.BuyAccount;
+ this.txtChatAccount.Text = shop.ChatAccount;
+ this.txtUploadAccount.Text = shop.UploadAccount;
+ }
+ }
+ }
+}
diff --git a/TEMUKJD/DYForms/ShopForms/DYShopAddEditForm.resx b/TEMUKJD/DYForms/ShopForms/DYShopAddEditForm.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/TEMUKJD/DYForms/ShopForms/DYShopAddEditForm.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/TEMUKJD/DYForms/ShopForms/DYShopBrowserObject.cs b/TEMUKJD/DYForms/ShopForms/DYShopBrowserObject.cs
new file mode 100644
index 0000000..5e02445
--- /dev/null
+++ b/TEMUKJD/DYForms/ShopForms/DYShopBrowserObject.cs
@@ -0,0 +1,886 @@
+using AllBase;
+using AllBase.Helper;
+using AllBase.Model.Param.PDDProdParam;
+using AllBase.Model.Result;
+using AllBase.Model.Result.PDDResult;
+using NaiBa.Util.Extension;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using TemuKJD.BaseForms;
+using TemuKJD.BLL;
+using TemuKJD.PDDForms.AdminForms;
+using TemuKJD.PDDForms.ProductThirdSelectForms;
+using Work;
+
+namespace TemuKJD.DYForms.ShopForms
+{
+ public class DYShopBrowserObject
+ {
+ public delegate void InfoReceivedHandler(string information);
+ public event InfoReceivedHandler OnInfoReceived;
+
+ public string getProduct(string sProdId, string supplierId, PDDProductInfo prodInfo = null, bool notSaveDb = false)
+ {
+ var prodId = sProdId.ParseToLong();
+ if (prodId <= 0)
+ {
+ BaseMsgForm.ShowError("商品Id不存在!");
+ return "failed";
+ }
+ //var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == supplierId.ParseToString());
+ var shop = PDDAdminShopListForm.lstAdminShopInfo.FirstOrDefault(s => s.ShopId == supplierId.ParseToString());
+ if (string.IsNullOrEmpty(supplierId) || shop == null)
+ {
+ BaseMsgForm.ShowError("店铺不存在!");
+ return "failed";
+ }
+
+ Task.Run(() =>
+ {
+ try
+ {
+ var sourceShop = shop;
+ var sourceProdId = prodId;
+ string success_err_msg = "";
+ //string errorMsg = "";
+ var commit_id_rst = GetPddProdCommitId(sourceShop, sourceProdId.ToString());
+ if (!commit_id_rst.Contains("\"success\":true") || !commit_id_rst.Contains("\"result\""))
+ {
+ var errMsg = BaseRegex.GetStringJson(ref commit_id_rst, "error_msg");
+ if (string.IsNullOrEmpty(errMsg))
+ errMsg = commit_id_rst;
+ OnInfoReceived("商品获取失败!" + errMsg);
+ return;
+ }
+ var commitId = BaseRegex.GetStringJson(ref commit_id_rst, "goods_commit_id");
+ if (string.IsNullOrEmpty(commitId))
+ {
+ OnInfoReceived("商品获取失败!商品提交编号获取失败!");
+ return;
+ }
+
+ Thread.Sleep(Randomx.GetId(10, 50));
+ var detail_json = "{}";
+ PDDProductDetailInfo product = null;
+ try
+ {
+ var prod_detail_rst = GetPddProdDetail(sourceShop, sourceProdId.ToString(), commitId);
+ JObject prod_detail_obj = JObject.Parse(prod_detail_rst);
+ detail_json = JsonHelper.SerializeObject(prod_detail_obj["result"]);
+
+ product = JsonHelper.DeserializeJsonToObject(detail_json);
+ if (product == null || detail_json.Length < 10)
+ {
+ OnInfoReceived("商品获取失败!商品数据格式获取失败!");
+ return;
+ }
+ }
+ catch (Exception ex)
+ {
+ OnInfoReceived("商品获取失败!商品数据格式获取失败!" + ex.Message);
+ return;
+ }
+
+ Thread.Sleep(Randomx.GetId(10, 50));
+ var size_json = "{}";
+ if (product.size_spec_id.ParseToLong() != 0)
+ {
+ try
+ {
+ var prod_size_rst = GetPddProdSizeSpec(sourceShop, sourceProdId.ToString(), commitId, product.size_spec_id.ParseToString());
+ prod_size_rst = GetHtml.Unicode2String(prod_size_rst);
+ JObject prod_size_obj = JObject.Parse(prod_size_rst);
+ size_json = JsonHelper.SerializeObject(prod_size_obj["result"]);
+ var size = JsonHelper.DeserializeJsonToObject(size_json);
+ if (size == null)
+ {
+ OnInfoReceived("尺码表获取失败!尺码数据格式获取失败!");
+ return;
+ }
+ }
+ catch (Exception ex)
+ {
+ OnInfoReceived("尺码表获取失败!尺码数据格式获取失败!" + ex.Message);
+ return;
+ }
+ }
+ //temu尺码表暂时注释
+ //if (product.sizeTemplateId > 0)
+ //{
+ // html = SizeSpecQuery(shop1, prodId1.ToString(), product.sizeTemplateId.ToString());
+ // if(!html.Contains("\"success\":true"))
+ // {
+ // success_err_msg += " 尺码表获取失败!" + BaseRegex.GetStringJson(ref html, "errorMsg");
+ // }
+ // else
+ // {
+ // obj = JObject.Parse(html);
+ // sizeRst = JsonHelper.SerializeObject(obj["result"]);
+ // }
+ //}
+
+ Thread.Sleep(Randomx.GetId(10, 50));
+ var property_json = "{}";
+ PDDProductPropertyInfo property = null;
+ try
+ {
+ var prod_property_rst = GetPddProdProperty(sourceShop, sourceProdId.ToString(), commitId);
+ prod_property_rst = GetHtml.Unicode2String(prod_property_rst);
+ JObject prod_property_obj = JObject.Parse(prod_property_rst);
+ property_json = JsonHelper.SerializeObject(prod_property_obj["result"]);
+ property = JsonHelper.DeserializeJsonToObject(property_json);
+ }
+ catch (Exception ex) { }
+ if (property == null)
+ {
+ OnInfoReceived("商品获取失败!商品属性获取失败!");
+ return;
+ }
+
+ // 属性模板暂时注释
+ //var prop_template_json = "{}";
+ //PDDProductTemplateInfo templateInfo = null;
+ //try
+ //{
+ // var prop_template_rst = GetPddCatPropTemplate(sourceShop, product.cat_id.ParseToString(), sourceProdId.ToString(), commitId);
+ // JObject prop_template_obj = JObject.Parse(prop_template_rst);
+ // prop_template_json = JsonHelper.SerializeObject(prop_template_obj["result"]);
+ // templateInfo = JsonHelper.DeserializeJsonToObject(prop_template_json);
+ //}
+ //catch (Exception ex) { }
+ //if (templateInfo == null)
+ //{
+ // OnInfoReceived("商品获取失败!商品属性模板获取失败!");
+ // return;
+ //}
+
+ Thread.Sleep(Randomx.GetId(10, 50));
+ var decoration_json = "{}";
+ PDDProductDecorationInfo decoration = null;
+ try
+ {
+ var prod_decoration_rst = GetPddProdDecoration(sourceShop, sourceProdId.ToString(), commitId);
+ if (!prod_decoration_rst.Contains("\"success\":true"))
+ {
+ var errMsg = BaseRegex.GetStringJson(ref prod_decoration_rst, "error_msg");
+ if (string.IsNullOrEmpty(errMsg))
+ errMsg = prod_decoration_rst;
+ OnInfoReceived("商品获取失败!商品详情图获取失败!" + errMsg);
+ return;
+ }
+ JObject prod_decoration_obj = JObject.Parse(prod_decoration_rst);
+ if (!prod_decoration_obj["result"].IsNullOrEmpty())
+ decoration_json = JsonHelper.SerializeObject(prod_decoration_obj["result"]);
+ decoration = JsonHelper.DeserializeJsonToObject(decoration_json);
+ }
+ catch (Exception ex)
+ {
+ OnInfoReceived("商品获取失败!商品详情图获取失败!" + ex.Message);
+ return;
+ }
+ if (decoration != null && decoration_json.ParseToString().Length < 20)
+ {
+ //try
+ //{ // 获取另一组详情数据,结构和主详情不一样无法通用
+ // var prod_detail_decoration_rst = GetPddProdOnShopDetail(sourceShop, sourceProdId.ToString(), commitId);
+ // JObject prod_detail_decoration_obj = JObject.Parse(prod_detail_decoration_rst);
+ // foreach (JObject ob in prod_detail_decoration_obj["result"]["carousel_gallery"])
+ // {
+
+ // }
+ //}
+ //catch (Exception ex)
+ //{
+ // OnInfoReceived("商品获取失败!商品详情图获取失败!" + ex.Message);
+ // return;
+ //}
+
+ PDDProdDecorationCommitParam decorationParam = new PDDProdDecorationCommitParam();
+ decorationParam.goods_id = product.goods_id;
+ decorationParam.goods_commit_id = commitId.ParseToLong();
+ decorationParam.preview_key = "";
+ decorationParam.decoration_floor_list = new List();
+ foreach (var gallary in product.galleries)
+ {
+ if (gallary.type != 2)
+ continue;
+
+ var floor_param = new decoration_floor_param();
+ //floor_param.floor_id = 0; // floorItem.floor_id;
+ floor_param.type = "image"; // floorItem.type;
+ floor_param.content_list = new List();
+ //foreach (var c in floorItem.content_list)
+ {
+ var decorationContentParam = new decoration_content_param()
+ {
+ //file_id = c.file_id,
+ img_url = gallary.url, //c.img_url,
+ //height = c.height,
+ //text = c.text,
+ //text_module_details = null,
+ //width = c.width,
+ };
+ //try { decorationContentParam.text_module_details = JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(c.text_module_details)); }
+ //catch (Exception ex) { }
+ floor_param.content_list.Add(decorationContentParam);
+ }
+ decorationParam.decoration_floor_list.Add(floor_param);
+ }
+
+ var addDecorationRst = save_decoration(shop, decorationParam, product.goods_id.ParseToString(), commitId);
+ Thread.Sleep(Randomx.GetId(10, 50));
+
+ // 第二次获取详情图
+ try
+ {
+ var prod_decoration_rst = GetPddProdDecoration(sourceShop, sourceProdId.ToString(), commitId);
+ if (!prod_decoration_rst.Contains("\"success\":true"))
+ {
+ var errMsg = BaseRegex.GetStringJson(ref prod_decoration_rst, "error_msg");
+ if (string.IsNullOrEmpty(errMsg))
+ errMsg = prod_decoration_rst;
+ OnInfoReceived("商品获取失败!商品详情图获取失败!" + errMsg);
+ return;
+ }
+ JObject prod_decoration_obj = JObject.Parse(prod_decoration_rst);
+ if (!prod_decoration_obj["result"].IsNullOrEmpty())
+ decoration_json = JsonHelper.SerializeObject(prod_decoration_obj["result"]);
+ decoration = JsonHelper.DeserializeJsonToObject(decoration_json);
+ }
+ catch (Exception ex)
+ {
+ OnInfoReceived("商品获取失败!商品详情图获取失败!" + ex.Message);
+ return;
+ }
+ }
+
+
+ if (decoration == null || decoration_json.ParseToString().Length < 20)
+ {
+ OnInfoReceived("商品获取失败!商品详情图获取失败!");
+ return;
+ }
+
+ Thread.Sleep(Randomx.GetId(10, 50));
+ var material3_json = "{}";
+ PDDMaterialInfo material3 = null;
+ try
+ {
+ var material3_rst = GetPddGoodsMaterial(sourceShop, sourceProdId.ToString(), commitId, 3);
+ if (!material3_rst.Contains("\"success\":true"))
+ {
+ var errMsg = BaseRegex.GetStringJson(ref material3_rst, "error_msg");
+ if (string.IsNullOrEmpty(errMsg))
+ errMsg = material3_rst;
+ OnInfoReceived("商品获取失败!商品长图获取失败!" + errMsg);
+ return;
+ }
+ JObject material3_obj = JObject.Parse(material3_rst);
+ if (!material3_obj["result"].IsNullOrEmpty())
+ material3_json = JsonHelper.SerializeObject(material3_obj["result"]);
+ material3 = JsonHelper.DeserializeJsonToObject(material3_json);
+ }
+ catch (Exception ex)
+ {
+ OnInfoReceived("商品获取失败!商品长图获取失败!" + ex.Message);
+ return;
+ }
+ if (material3 == null)
+ {
+ OnInfoReceived("商品获取失败!商品长图获取失败!");
+ return;
+ }
+
+ Thread.Sleep(Randomx.GetId(10, 50));
+ var material1_json = "{}";
+ PDDMaterialInfo material1 = null;
+ try
+ {
+ var material1_rst = GetPddGoodsMaterial(sourceShop, sourceProdId.ToString(), commitId, 1);
+ if (!material1_rst.Contains("\"success\":true"))
+ {
+ var errMsg = BaseRegex.GetStringJson(ref material1_rst, "error_msg");
+ if (string.IsNullOrEmpty(errMsg))
+ errMsg = material1_rst;
+ OnInfoReceived("商品获取失败!商品白底图获取失败!" + errMsg);
+ return;
+ }
+ JObject material1_obj = JObject.Parse(material1_rst);
+ if (!material1_obj["result"].IsNullOrEmpty())
+ material1_json = JsonHelper.SerializeObject(material1_obj["result"]);
+ material1 = JsonHelper.DeserializeJsonToObject(material1_json);
+ }
+ catch (Exception ex)
+ {
+ OnInfoReceived("商品获取失败!商品白底图获取失败!" + ex.Message);
+ return;
+ }
+ if (material1 == null)
+ {
+ OnInfoReceived("商品获取失败!商品白底图获取失败!");
+ return;
+ }
+
+
+ bool isExist = false;
+ var existUrl = BaseClass.BuildObjString("product/get_product_list");
+ string existData = UserLogin.GetSignaturex() + "&search_spu=" + product.goods_id;
+ string html = GetHtml.PostUtf8(existUrl, existData);
+ if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
+ html = GetHtml.PostUtf8(existUrl, existData);
+ if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
+ html = GetHtml.PostUtf8(existUrl, existData);
+ if (!string.IsNullOrEmpty(html) && html.Contains("\"code\":200"))
+ {
+ if (html.Contains("\"data\":[") && !html.Contains("\"data\":[]"))
+ isExist = true;
+ }
+
+
+ string product_json = "{\"detail\":" + detail_json + ",\"size\":" + size_json + ",\"decoration\":" + decoration_json +
+ ",\"material3\":" + material3_json + ",\"material1\":" + material1_json + ",\"property\":" + property_json + "}";
+
+ if (notSaveDb)
+ {
+ prodInfo = JsonHelper.DeserializeJsonToObject(product_json);
+ }
+ else
+ {
+ string main_img = product.image_url;
+ if (string.IsNullOrEmpty(main_img))
+ main_img = product.hd_thumb_url;
+ if (string.IsNullOrEmpty(main_img))
+ main_img = product.thumb_url;
+ if (string.IsNullOrEmpty(main_img))
+ main_img = (product.galleries?.FirstOrDefault()?.url).ParseToString().Replace("https://", "http://");
+ var url = BaseClass.BuildObjString("product/add_product");
+ if (isExist)
+ {
+ bool isCover = false;
+ MainForm.instance.Invoke(new Action(() =>
+ {
+ var ok = BaseMsgForm.ShowConfirm("产品库内已存在相同id商品,是否更新?").DialogResult;
+ if (ok == DialogResult.OK)
+ isCover = true;
+ }));
+ if (isCover)
+ url = BaseClass.BuildObjString("product/mdy_product");
+ else
+ return;
+ }
+
+ var data = Work.UserLogin.GetSignaturex() +
+ "&from_shop_id=" + shop.ShopId +
+ "&spu_id=" + product.goods_id.ParseToString() +
+ "&skc_id=" + product.goods_id.ParseToString() +
+ "&price_text=" + product.sku.Min(s => s.multi_price).ParseToInt() * 0.01m + "-" + product.sku.Max(s => s.multi_price).ParseToInt() * 0.01m +
+ "&main_cat_id=" + (product.cat_ids?.FirstOrDefault(c => c != null)).ParseToString() +
+ "&main_cat_name=" + HttpUtility.UrlEncode((product.cats?.FirstOrDefault(c => !string.IsNullOrEmpty(c))).ParseToString(), Encoding.UTF8) +
+ "&cat_id=" + (product.cat_id).ParseToString() +
+ "&cat_name=" + HttpUtility.UrlEncode((product.cats?.LastOrDefault(c => !string.IsNullOrEmpty(c))).ParseToString(), Encoding.UTF8) +
+ "&ext_code=" + HttpUtility.UrlEncode(product.out_goods_sn, Encoding.UTF8) +
+ "&product_name=" + HttpUtility.UrlEncode(product.goods_name, Encoding.UTF8) +
+ "&product_json=" + HttpUtility.UrlEncode(product_json, Encoding.UTF8) +
+ "&size_json=" + HttpUtility.UrlEncode(size_json, Encoding.UTF8) +
+ "&main_img=" + HttpUtility.UrlEncode(main_img, Encoding.UTF8);
+
+ html = GetHtml.PostUtf8(url, data);
+ if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
+ html = GetHtml.PostUtf8(url, data);
+ if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
+ html = GetHtml.PostUtf8(url, data);
+ if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
+ {
+ string msg = "选品商品保存失败!请检查网络连接:" + BaseRegex.GetStringJson(ref html, "msg");
+ //OnInfoReceived(msg);
+ MainForm.instance.Invoke(new Action(() =>
+ {
+ BaseMsgForm.ShowError(msg);
+ }));
+ }
+ else
+ {
+ //OnInfoReceived("选品商品保存成功!" + success_err_msg);
+ MainForm.instance.Invoke(new Action(() =>
+ {
+ BaseMsgForm.ShowInfo("选品商品保存成功!" + success_err_msg);
+ }));
+ }
+
+ //// 创建 SaveFileDialog 的实例
+ //SaveFileDialog saveFileDialog = new SaveFileDialog();
+
+ //// 单线程单元(STA)模式运行文件对话框,否则会报错。
+ //System.Threading.Thread InvokeThread = new System.Threading.Thread(new System.Threading.ThreadStart(()=> {
+
+ // // 设置对话框的属性
+ // saveFileDialog.Title = "保存商品";
+ // saveFileDialog.Filter = "商品文件 (*.prd)|*.prd|所有文件 (*.*)|*.*"; // 过滤文件类型
+ // saveFileDialog.FileName = product.productId.ParseToString(); // 默认文件名
+ // saveFileDialog.DefaultExt = "txt"; // 默认文件扩展名
+
+ // // 显示对话框并获取结果
+ // if (saveFileDialog.ShowDialog() == DialogResult.OK)
+ // {
+ // // 用户点击了“保存”按钮,此时可以获取文件的路径
+ // string filePath = saveFileDialog.FileName;
+ // // 在这里处理文件保存逻辑,例如写入数据到文件
+ // System.IO.File.WriteAllText(filePath, result);
+
+ // //BaseMsgForm.ShowInfo("商品保存成功!");
+ // }
+ //}));
+ //InvokeThread.SetApartmentState(System.Threading.ApartmentState.STA);
+ //InvokeThread.Start();
+ //InvokeThread.Join();
+ }
+ }
+ catch (Exception ex)
+ {
+ }
+ });
+
+ return "success";
+ }
+
+ ///
+ /// 第三方获取商品并直接提交到第三方待上传列表
+ ///
+ ///
+ ///
+ ///
+ public string getThirdProduct(string sProdId, string supplierId)
+ {
+ var prodId = sProdId.ParseToLong();
+ if (prodId <= 0)
+ {
+ BaseMsgForm.ShowError("商品Id不存在!");
+ return "failed";
+ }
+ var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == supplierId.ParseToString());
+ if (string.IsNullOrEmpty(supplierId) || shop == null)
+ {
+ BaseMsgForm.ShowError("店铺不存在!");
+ return "failed";
+ }
+
+ Task.Run(() =>
+ {
+ try
+ {
+ var sourceShop = shop;
+ var sourceProdId = prodId;
+ string success_err_msg = "";
+ string errorMsg = "";
+ var html = GetPddProdCommitId(sourceShop, sourceProdId.ToString());
+ if (!html.Contains("\"success\":true") || !html.Contains("\"result\""))
+ {
+ var errMsg = BaseRegex.GetStringJson(ref html, "error_msg");
+ if (string.IsNullOrEmpty(errMsg))
+ errMsg = html;
+ OnInfoReceived("商品获取失败!" + errMsg);
+ return;
+ }
+ var commitId = BaseRegex.GetStringJson(ref html, "goods_commit_id");
+ if (string.IsNullOrEmpty(commitId))
+ {
+ OnInfoReceived("商品获取失败!商品提交编号获取失败!");
+ return;
+ }
+ html = GetPddProdDetail(sourceShop, sourceProdId.ToString(), commitId);
+
+ JObject obj = JObject.Parse(html);
+ var result = JsonHelper.SerializeObject(obj["result"]);
+ var sizeRst = "";
+ PDDProductDetailInfo product = JsonHelper.DeserializeJsonToObject(result);
+ if (product == null)
+ {
+ OnInfoReceived("商品获取失败!商品数据格式获取失败!");
+ return;
+ }
+
+ //拼多多暂时注释尺码
+ //if (product.sizeTemplateId > 0)
+ //{
+ // html = SizeSpecQuery(sourceShop, sourceProdId.ToString(), product.sizeTemplateId.ToString());
+ // if (!html.Contains("\"success\":true"))
+ // {
+ // success_err_msg += " 尺码表获取失败!" + BaseRegex.GetStringJson(ref html, "errorMsg");
+ // }
+ // else
+ // {
+ // obj = JObject.Parse(html);
+ // sizeRst = JsonHelper.SerializeObject(obj["result"]);
+ // }
+ //}
+
+ List shopLst = new List();
+ DYShopListForm.Instance.Invoke(new Action(() =>
+ {
+ PDDThirdProdSelectAddShopForm shopForm = new PDDThirdProdSelectAddShopForm();
+ shopForm.ShowDialog();
+ shopLst.AddRange(shopForm.lstSelectShop);
+ }));
+ if (shopLst.Count == 0)
+ {
+ OnInfoReceived("库存上传操作取消或未选择上传店铺!");
+ return;
+ }
+
+ var main_img = product.image_url;
+ if (string.IsNullOrEmpty(main_img))
+ main_img = product.hd_thumb_url;
+ if (string.IsNullOrEmpty(main_img))
+ main_img = product.thumb_url;
+ if (string.IsNullOrEmpty(main_img))
+ main_img = (product.galleries?.FirstOrDefault()?.url).ParseToString().Replace("https://", "http://");
+ var url = BaseClass.BuildObjString("product_third/add_product");
+ var data = UserLogin.GetSignaturex() +
+ "&from_shop_id=" + shop.ShopId +
+ "&spu_id=" + product.goods_id.ParseToString() +
+ "&skc_id=" + product.goods_id.ParseToString() +
+ "&cat_id=" + (product.cat_id).ParseToString() +
+ "&cat_name=" + HttpUtility.UrlEncode((product.cats?.LastOrDefault(c => !string.IsNullOrEmpty(c))).ParseToString(), Encoding.UTF8) +
+ "&ext_code=" + HttpUtility.UrlEncode(product.out_goods_sn, Encoding.UTF8) +
+ "&product_name=" + HttpUtility.UrlEncode(product.goods_name, Encoding.UTF8) +
+ "&product_json=" + HttpUtility.UrlEncode(result, Encoding.UTF8) +
+ "&size_json=" + HttpUtility.UrlEncode(sizeRst, Encoding.UTF8) +
+ "&main_img=" + HttpUtility.UrlEncode(main_img, Encoding.UTF8);
+ html = GetHtml.PostUtf8(url, data);
+ //if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
+ // html = GetHtml.PostUtf8(url, data);
+ //if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
+ // html = GetHtml.PostUtf8(url, data);
+ if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
+ {
+ errorMsg = "库存商品保存失败!请检查网络连接:" +
+ BaseRegex.GetStringJson(ref html, "msg").ParseToString().Replace("'", "\\'").Replace("\"", "\\\"");
+ }
+ var id = BaseRegex.GetLongJson(ref html, "id");
+ if (id == 0)
+ goto end;
+
+ foreach (var addProdShop in shopLst)
+ {
+ url = BaseClass.BuildObjString("product_third/add_user_select_product");
+ data = UserLogin.GetSignaturex() +
+ "&out_product_id=" + id +
+ "&shop_id=" + addProdShop.ShopId +
+ "&shop_account=" + addProdShop.ShopAccount +
+ "&main_user_name=" + addProdShop.UserName +
+ "&sub_user_name=" + addProdShop.SubUserName +
+ "&add_product_remaining=" + addProdShop.AddProductRemaining +
+ "&status=待上传";
+ html = GetHtml.PostUtf8(url, data);
+ if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
+ html = GetHtml.PostUtf8(url, data);
+ if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
+ html = GetHtml.PostUtf8(url, data);
+ if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
+ {
+ errorMsg += product?.goods_id + " " + BaseRegex.GetStringJson(ref html, "msg") + "; ";
+ }
+ else
+ {
+ addProdShop.AddProductRemaining = addProdShop.AddProductRemaining - 1;
+ }
+ }
+ end:;
+ if (!string.IsNullOrEmpty(errorMsg))
+ {
+ OnInfoReceived(errorMsg);
+ }
+ else
+ {
+ OnInfoReceived("库存上传保存成功!" + success_err_msg);
+ }
+ }
+ catch (Exception ex)
+ {
+ OnInfoReceived("发生错误:" + ex.Message);
+ }
+ });
+
+ return "success";
+ }
+
+ TemuCat GetCat(TemuDetailProductInfo product)
+ {
+ if (product == null)
+ return new TemuCat();
+
+ var cat = product.categories.cat10;
+ if (string.IsNullOrWhiteSpace(cat.catName))
+ cat = product.categories.cat9;
+ if (string.IsNullOrWhiteSpace(cat.catName))
+ cat = product.categories.cat8;
+ if (string.IsNullOrWhiteSpace(cat.catName))
+ cat = product.categories.cat7;
+ if (string.IsNullOrWhiteSpace(cat.catName))
+ cat = product.categories.cat6;
+ if (string.IsNullOrWhiteSpace(cat.catName))
+ cat = product.categories.cat5;
+ if (string.IsNullOrWhiteSpace(cat.catName))
+ cat = product.categories.cat4;
+ if (string.IsNullOrWhiteSpace(cat.catName))
+ cat = product.categories.cat3;
+ if (string.IsNullOrWhiteSpace(cat.catName))
+ cat = product.categories.cat2;
+ if (string.IsNullOrWhiteSpace(cat.catName))
+ cat = product.categories.cat1;
+
+ return cat;
+ }
+
+
+
+ private string GetPddProdCommitId(ShopLoginInfo shop, string prodId)
+ {
+ var anti = shop.AntiContents.LastOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ string url = "https://mms.pinduoduo.com/glide/v2/mms/edit/commit/create_by_sn";
+ string body = @"{""goods_id"":" + prodId + "}";
+ string refere = "https://mms.pinduoduo.com/goods/goods_list?msfrom=mms_sidenav";
+ var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
+ for (int i = 0; i < 5 && result.Contains("网络繁忙,请不要频繁操作"); i++)
+ {
+ shop.AntiContents.Remove(anti);
+ anti = shop.AntiContents.FirstOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ {
+ Thread.Sleep(Randomx.GetId(300, 500));
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
+ }
+ }
+ return result;
+ }
+ private string GetPddProdDetail(ShopLoginInfo shop, string prodId, string commitId)
+ {
+ var anti = shop.AntiContents.LastOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ //string url = "https://mms.pinduoduo.com/glide/v2/mms/query/commit/on_shop/detail"; //on_shop获取到的结构不对
+ string url = "https://mms.pinduoduo.com/glide/v2/mms/query/commit/detail";
+ //string body = @"{""goods_id"":" + prodId + "}";
+ string body = @"{""goods_commit_id"":""" + commitId + @""",""goods_id"":""" + prodId + @"""}";
+ string refere = "https://mms.pinduoduo.com/goods/goods_add/index?id=" + commitId + "&goods_id=" + prodId + "&type=edit";
+ var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
+ for (int i = 0; i < 5 && result.Contains("网络繁忙,请不要频繁操作"); i++)
+ {
+ shop.AntiContents.Remove(anti);
+ anti = shop.AntiContents.FirstOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ {
+ Thread.Sleep(Randomx.GetId(300, 500));
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
+ }
+ }
+ return result;
+ }
+
+
+ private string GetPddProdOnShopDetail(ShopLoginInfo shop, string prodId, string commitId)
+ {
+ var anti = shop.AntiContents.LastOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ string url = "https://mms.pinduoduo.com/glide/v2/mms/query/commit/on_shop/detail"; //获取详情图
+ //string url = "https://mms.pinduoduo.com/glide/v2/mms/query/commit/detail";
+ //string body = @"{""goods_id"":" + prodId + "}";
+ string body = @"{""goods_commit_id"":""" + commitId + @""",""goods_id"":""" + prodId + @"""}";
+ string refere = "https://mms.pinduoduo.com/goods/goods_add/index?id=" + commitId + "&goods_id=" + prodId + "&type=edit";
+ var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
+ for (int i = 0; i < 5 && result.Contains("网络繁忙,请不要频繁操作"); i++)
+ {
+ shop.AntiContents.Remove(anti);
+ anti = shop.AntiContents.FirstOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ {
+ Thread.Sleep(Randomx.GetId(300, 500));
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
+ }
+ }
+ return result;
+ }
+
+ ///
+ /// 保存商品详情图装修列表
+ /// gorse/mms/goods/decoration/commit/save
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private string save_decoration(ShopLoginInfo shop, PDDProdDecorationCommitParam decoration, string goodsId, string commitId)
+ {
+ var anti = shop.AntiContents.LastOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ string url = "https://mms.pinduoduo.com/gorse/mms/goods/decoration/commit/save";
+ string body = @"{""goods_id"":" + goodsId + "}";
+ body = JsonHelper.SerializeObject(decoration);
+ string refere = "https://mms.pinduoduo.com/goods/goods_add/index?id=" + commitId + "&goods_id=" + goodsId + "&type=edit";
+
+ var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
+ for (int i = 0; i < 5 && result.Contains("网络繁忙,请不要频繁操作"); i++)
+ {
+ shop.AntiContents.Remove(anti);
+ anti = shop.AntiContents.FirstOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ {
+ Thread.Sleep(Randomx.GetId(300, 500));
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
+ }
+ }
+ return result;
+ }
+
+
+ private string GetPddProdSizeSpec(ShopLoginInfo shop, string prodId, string commitId, string sizeSpecId)
+ {
+ var anti = shop.AntiContents.LastOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ string url = "https://mms.pinduoduo.com/cabernet/mms/sizespec/query/draft";
+ //string body = @"{""goods_id"":" + prodId + "}";
+ string body = @"{""id"":" + sizeSpecId + @"}";
+ string refere = "https://mms.pinduoduo.com/goods/goods_add/index?id=" + commitId + "&goods_id=" + prodId + "&type=edit";
+ var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
+ for (int i = 0; i < 5 && result.Contains("网络繁忙,请不要频繁操作"); i++)
+ {
+ shop.AntiContents.Remove(anti);
+ anti = shop.AntiContents.FirstOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ {
+ Thread.Sleep(Randomx.GetId(300, 500));
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
+ }
+ }
+ return result;
+ }
+ private string GetPddProdProperty(ShopLoginInfo shop, string prodId, string commitId)
+ {
+ var anti = shop.AntiContents.LastOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ string url = "https://mms.pinduoduo.com/draco-ms/mms/query-goods-property";
+ string body = @"{""goods_id"":" + prodId + "}";
+ string refere = "https://mms.pinduoduo.com/goods/goods_add/index?id=" + commitId + "&goods_id=" + prodId + "&type=edit";
+ var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
+ for (int i = 0; i < 5 && result.Contains("网络繁忙,请不要频繁操作"); i++)
+ {
+ shop.AntiContents.Remove(anti);
+ anti = shop.AntiContents.FirstOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ {
+ Thread.Sleep(Randomx.GetId(300, 500));
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
+ }
+ }
+ return result;
+ }
+ private string GetPddProdDecoration(ShopLoginInfo shop, string prodId, string commitId)
+ {
+ var anti = shop.AntiContents.LastOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ string url = "https://mms.pinduoduo.com/gorse/mms/goods/decoration/commit/query/V2";
+ url = "https://mms.pinduoduo.com/gorse/mms/goods/decoration/commit/query/V2";
+ string body = @"{""goods_commit_id"":" + commitId + @",""goods_id"":" + prodId + @"}";
+ string refere = "https://mms.pinduoduo.com/goods/goods_add/index?id=" + commitId + "&goods_id=" + prodId + "&type=edit";
+ var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
+ for (int i = 0; i < 5 && result.Contains("网络繁忙,请不要频繁操作"); i++)
+ {
+ shop.AntiContents.Remove(anti);
+ anti = shop.AntiContents.FirstOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ {
+ Thread.Sleep(Randomx.GetId(300, 500));
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
+ }
+ }
+ return result;
+ }
+
+ ///
+ /// 获取物料详情 type = 1 或者 3 1是白底图,3是长图
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private string GetPddGoodsMaterial(ShopLoginInfo shop, string prodId, string commitId, int type)
+ {
+ var anti = shop.AntiContents.LastOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ string url = "https://mms.pinduoduo.com/giraffe/mms/material/goodsMaterialInfo";
+ string body = @"{""goods_id"":" + prodId + @",""type"":" + type + "}";
+ string refere = "https://mms.pinduoduo.com/goods/goods_add/index?id=" + commitId + "&goods_id=" + prodId + "&type=edit";
+ var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
+ for (int i = 0; i < 5 && (result.Contains("操作太过频繁") || result.Contains("网络繁忙,请不要频繁操作")); i++)
+ {
+ shop.AntiContents.Remove(anti);
+ anti = shop.AntiContents.LastOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ {
+ Thread.Sleep(Randomx.GetId(300, 500));
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
+ }
+ }
+ return result;
+ }
+
+ private string GetPddCatPropTemplate(ShopLoginInfo shop, string catId, string prodId, string commitId)
+ {
+ var anti = shop.AntiContents.LastOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ string url = "https://mms.pinduoduo.com/draco-ms/mms/template/mall?catId=" + catId +
+ "&goodsCommitId=" + commitId + "&goodsId=" + prodId;
+ string body = @"";
+ string refere = "https://mms.pinduoduo.com/goods/goods_add/index?id=" + commitId + "&goods_id=" + prodId + "&type=edit";
+ var result = HttpResponseBLL.PDDGetResponse(shop, url, body, refere, anti);
+ for (int i = 0; i < 5 && (result.Contains("操作太过频繁") || result.Contains("网络繁忙,请不要频繁操作")); i++)
+ {
+ shop.AntiContents.Remove(anti);
+ anti = shop.AntiContents.LastOrDefault().ParseToString();
+ if (shop.AntiContents.Count > 0)
+ {
+ Thread.Sleep(Randomx.GetId(300, 500));
+ anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
+ result = HttpResponseBLL.PDDGetResponse(shop, url, body, refere, anti);
+ }
+ }
+ return result;
+ }
+
+ private string SizeSpecQuery(ShopLoginInfo shop, string prodId, string sizeSpecId)
+ {
+ //string url = "https://seller.kuajingmaihuo.com/bg-anniston-mms/sizespec/query";
+ //string body = @"{""businessId"":" + sizeSpecId + @",""reusable"":false}";
+ //string refere = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?from=productList&productId=" + prodId;
+ //return HttpResponseBLL.PostResponse(shop, url, body, refere);
+
+ return "";
+ }
+ }
+}
diff --git a/TEMUKJD/DYForms/ShopForms/DYShopListForm.Designer.cs b/TEMUKJD/DYForms/ShopForms/DYShopListForm.Designer.cs
new file mode 100644
index 0000000..bbb22e9
--- /dev/null
+++ b/TEMUKJD/DYForms/ShopForms/DYShopListForm.Designer.cs
@@ -0,0 +1,753 @@
+namespace TemuKJD.DYForms.ShopForms
+{
+ partial class DYShopListForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ 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();
+ this.label1 = new System.Windows.Forms.Label();
+ this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
+ this.panel5 = new System.Windows.Forms.Panel();
+ this.btnRefreshShop = new TemuKJD.UserControls.ButtonEx();
+ this.btnLoginSelect = new TemuKJD.UserControls.ButtonEx();
+ this.btnCheck = new TemuKJD.UserControls.ButtonEx();
+ this.panel4 = new System.Windows.Forms.Panel();
+ this.chkUsePddWorkbanch = new TemuKJD.UserComponent.UcCheckBox(this.components);
+ this.cmbNotes = new System.Windows.Forms.ComboBox();
+ this.pnlEmpty = new DevComponents.DotNetBar.PanelEx();
+ this.btnSearch = new TemuKJD.UserControls.ButtonEx();
+ this.label4 = new System.Windows.Forms.Label();
+ this.txtShopName = new System.Windows.Forms.TextBox();
+ this.label3 = new System.Windows.Forms.Label();
+ this.txtShopId = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.btnImport = new TemuKJD.UserControls.ButtonEx();
+ this.btnAddShop = new TemuKJD.UserControls.ButtonEx();
+ this.splitContainer2 = new System.Windows.Forms.SplitContainer();
+ this.btnRefreshAuth = new TemuKJD.UserControls.ButtonEx();
+ this.pbLoading = new System.Windows.Forms.PictureBox();
+ this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx();
+ this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+ this.colLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.colShopAccount = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.colNotes = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.colCookie = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.colSubUser = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.colGroupName = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.colUploadAccount = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.colBuyAccount = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.colChatAccount = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.colLoginStatus = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.colGotoShop = new System.Windows.Forms.DataGridViewLinkColumn();
+ this.colShopOperate = new System.Windows.Forms.DataGridViewLinkColumn();
+ this.colRelogin = new System.Windows.Forms.DataGridViewLinkColumn();
+ this.colReLogin2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.colMultiLogin = new System.Windows.Forms.DataGridViewLinkColumn();
+ this.colApiAuth = new System.Windows.Forms.DataGridViewLinkColumn();
+ this.colBuyApiAuth = new System.Windows.Forms.DataGridViewLinkColumn();
+ this.colUpdateCookies = new System.Windows.Forms.DataGridViewLinkColumn();
+ this.colCopyCookies = new System.Windows.Forms.DataGridViewLinkColumn();
+ this.colEdit = new System.Windows.Forms.DataGridViewLinkColumn();
+ this.colDelete = new System.Windows.Forms.DataGridViewLinkColumn();
+ this.chkAutoDrag = new System.Windows.Forms.CheckBox();
+ this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
+ this.splitContainer1.Panel1.SuspendLayout();
+ this.splitContainer1.Panel2.SuspendLayout();
+ this.splitContainer1.SuspendLayout();
+ this.tableLayoutPanel2.SuspendLayout();
+ this.panel5.SuspendLayout();
+ this.panel4.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
+ this.splitContainer2.Panel1.SuspendLayout();
+ this.splitContainer2.Panel2.SuspendLayout();
+ this.splitContainer2.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.dgvShop)).BeginInit();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(13, 13);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(201, 17);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "这里显示店铺列表 -- ShopListForm";
+ //
+ // splitContainer1
+ //
+ this.splitContainer1.BackColor = System.Drawing.Color.White;
+ this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
+ this.splitContainer1.Location = new System.Drawing.Point(0, 0);
+ this.splitContainer1.Name = "splitContainer1";
+ this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
+ //
+ // splitContainer1.Panel1
+ //
+ this.splitContainer1.Panel1.Controls.Add(this.tableLayoutPanel2);
+ //
+ // splitContainer1.Panel2
+ //
+ this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
+ this.splitContainer1.Panel2.Margin = new System.Windows.Forms.Padding(4);
+ this.splitContainer1.Size = new System.Drawing.Size(1264, 622);
+ this.splitContainer1.SplitterDistance = 46;
+ this.splitContainer1.TabIndex = 33;
+ //
+ // tableLayoutPanel2
+ //
+ this.tableLayoutPanel2.ColumnCount = 2;
+ this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
+ this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+ this.tableLayoutPanel2.Controls.Add(this.panel5, 1, 0);
+ this.tableLayoutPanel2.Controls.Add(this.panel4, 0, 0);
+ this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0);
+ this.tableLayoutPanel2.Name = "tableLayoutPanel2";
+ this.tableLayoutPanel2.RowCount = 1;
+ this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
+ this.tableLayoutPanel2.Size = new System.Drawing.Size(1264, 46);
+ this.tableLayoutPanel2.TabIndex = 37;
+ //
+ // panel5
+ //
+ this.panel5.Controls.Add(this.btnRefreshShop);
+ this.panel5.Controls.Add(this.btnLoginSelect);
+ this.panel5.Controls.Add(this.btnCheck);
+ this.panel5.Location = new System.Drawing.Point(1032, 3);
+ this.panel5.Name = "panel5";
+ this.panel5.Size = new System.Drawing.Size(229, 40);
+ this.panel5.TabIndex = 1;
+ //
+ // btnRefreshShop
+ //
+ this.btnRefreshShop.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnRefreshShop.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.btnRefreshShop.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnRefreshShop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.btnRefreshShop.ForeColor = System.Drawing.Color.White;
+ this.btnRefreshShop.Location = new System.Drawing.Point(21, 9);
+ this.btnRefreshShop.Margin = new System.Windows.Forms.Padding(2);
+ this.btnRefreshShop.Name = "btnRefreshShop";
+ this.btnRefreshShop.Size = new System.Drawing.Size(66, 26);
+ this.btnRefreshShop.TabIndex = 375;
+ this.btnRefreshShop.Text = "刷新店铺";
+ this.btnRefreshShop.UseVisualStyleBackColor = false;
+ this.btnRefreshShop.Click += new System.EventHandler(this.btnRefreshCookie_Click);
+ //
+ // btnLoginSelect
+ //
+ this.btnLoginSelect.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnLoginSelect.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.btnLoginSelect.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnLoginSelect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.btnLoginSelect.ForeColor = System.Drawing.Color.White;
+ this.btnLoginSelect.Location = new System.Drawing.Point(162, 9);
+ this.btnLoginSelect.Margin = new System.Windows.Forms.Padding(2);
+ this.btnLoginSelect.Name = "btnLoginSelect";
+ this.btnLoginSelect.Size = new System.Drawing.Size(66, 26);
+ this.btnLoginSelect.TabIndex = 373;
+ this.btnLoginSelect.Text = "登录选中";
+ this.btnLoginSelect.UseVisualStyleBackColor = false;
+ this.btnLoginSelect.Click += new System.EventHandler(this.btnLoginSelect_Click);
+ //
+ // btnCheck
+ //
+ this.btnCheck.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnCheck.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.btnCheck.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnCheck.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.btnCheck.ForeColor = System.Drawing.Color.White;
+ this.btnCheck.Location = new System.Drawing.Point(92, 9);
+ this.btnCheck.Margin = new System.Windows.Forms.Padding(2);
+ this.btnCheck.Name = "btnCheck";
+ this.btnCheck.Size = new System.Drawing.Size(66, 26);
+ this.btnCheck.TabIndex = 372;
+ this.btnCheck.Text = "检测选中";
+ this.btnCheck.UseVisualStyleBackColor = false;
+ this.btnCheck.Click += new System.EventHandler(this.btnCheck_Click);
+ //
+ // panel4
+ //
+ this.panel4.Controls.Add(this.chkUsePddWorkbanch);
+ this.panel4.Controls.Add(this.cmbNotes);
+ this.panel4.Controls.Add(this.pnlEmpty);
+ this.panel4.Controls.Add(this.btnSearch);
+ this.panel4.Controls.Add(this.label4);
+ this.panel4.Controls.Add(this.txtShopName);
+ this.panel4.Controls.Add(this.label3);
+ this.panel4.Controls.Add(this.txtShopId);
+ this.panel4.Controls.Add(this.label2);
+ this.panel4.Controls.Add(this.btnImport);
+ this.panel4.Controls.Add(this.btnAddShop);
+ this.panel4.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.panel4.Location = new System.Drawing.Point(3, 3);
+ this.panel4.Name = "panel4";
+ this.panel4.Size = new System.Drawing.Size(1023, 40);
+ this.panel4.TabIndex = 0;
+ //
+ // chkUsePddWorkbanch
+ //
+ this.chkUsePddWorkbanch.AutoSize = true;
+ this.chkUsePddWorkbanch.Location = new System.Drawing.Point(897, 11);
+ this.chkUsePddWorkbanch.Name = "chkUsePddWorkbanch";
+ this.chkUsePddWorkbanch.Size = new System.Drawing.Size(128, 21);
+ this.chkUsePddWorkbanch.TabIndex = 417;
+ this.chkUsePddWorkbanch.Text = "使用工作台Cookie";
+ this.chkUsePddWorkbanch.UseVisualStyleBackColor = true;
+ this.chkUsePddWorkbanch.Visible = false;
+ this.chkUsePddWorkbanch.CheckedChanged += new System.EventHandler(this.chkUsePddWorkbanch_CheckedChanged);
+ //
+ // cmbNotes
+ //
+ this.cmbNotes.FormattingEnabled = true;
+ this.cmbNotes.Location = new System.Drawing.Point(584, 10);
+ this.cmbNotes.Name = "cmbNotes";
+ this.cmbNotes.Size = new System.Drawing.Size(120, 25);
+ this.cmbNotes.TabIndex = 413;
+ this.cmbNotes.Text = "全部";
+ //
+ // pnlEmpty
+ //
+ this.pnlEmpty.CanvasColor = System.Drawing.SystemColors.Control;
+ this.pnlEmpty.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
+ this.pnlEmpty.DisabledBackColor = System.Drawing.Color.Empty;
+ this.pnlEmpty.Location = new System.Drawing.Point(786, 9);
+ this.pnlEmpty.Name = "pnlEmpty";
+ this.pnlEmpty.Size = new System.Drawing.Size(66, 26);
+ this.pnlEmpty.Style.Alignment = System.Drawing.StringAlignment.Center;
+ this.pnlEmpty.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
+ this.pnlEmpty.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
+ this.pnlEmpty.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
+ this.pnlEmpty.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.pnlEmpty.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
+ this.pnlEmpty.Style.GradientAngle = 90;
+ this.pnlEmpty.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
+ this.pnlEmpty.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
+ this.pnlEmpty.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.pnlEmpty.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.pnlEmpty.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
+ this.pnlEmpty.TabIndex = 409;
+ this.pnlEmpty.Text = "清空条件";
+ this.pnlEmpty.Click += new System.EventHandler(this.btnEmpty_Click);
+ //
+ // btnSearch
+ //
+ this.btnSearch.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnSearch.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.btnSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnSearch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.btnSearch.ForeColor = System.Drawing.Color.White;
+ this.btnSearch.Location = new System.Drawing.Point(715, 9);
+ this.btnSearch.Margin = new System.Windows.Forms.Padding(2);
+ this.btnSearch.Name = "btnSearch";
+ this.btnSearch.Size = new System.Drawing.Size(66, 26);
+ this.btnSearch.TabIndex = 372;
+ this.btnSearch.Text = "搜索";
+ this.btnSearch.UseVisualStyleBackColor = false;
+ this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(525, 14);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(68, 17);
+ this.label4.TabIndex = 377;
+ this.label4.Text = "分组备注:";
+ //
+ // txtShopName
+ //
+ this.txtShopName.Location = new System.Drawing.Point(402, 11);
+ this.txtShopName.Name = "txtShopName";
+ this.txtShopName.Size = new System.Drawing.Size(110, 23);
+ this.txtShopName.TabIndex = 374;
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(354, 14);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(56, 17);
+ this.label3.TabIndex = 375;
+ this.label3.Text = "店铺名:";
+ //
+ // txtShopId
+ //
+ this.txtShopId.Location = new System.Drawing.Point(232, 11);
+ this.txtShopId.Name = "txtShopId";
+ this.txtShopId.Size = new System.Drawing.Size(110, 23);
+ this.txtShopId.TabIndex = 372;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(184, 14);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(55, 17);
+ this.label2.TabIndex = 373;
+ this.label2.Text = "店铺id:";
+ //
+ // btnImport
+ //
+ this.btnImport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnImport.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.btnImport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnImport.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.btnImport.ForeColor = System.Drawing.Color.White;
+ this.btnImport.Location = new System.Drawing.Point(71, 9);
+ this.btnImport.Margin = new System.Windows.Forms.Padding(2);
+ this.btnImport.Name = "btnImport";
+ this.btnImport.Size = new System.Drawing.Size(66, 26);
+ this.btnImport.TabIndex = 371;
+ this.btnImport.Text = "导入店铺";
+ this.btnImport.UseVisualStyleBackColor = false;
+ this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
+ //
+ // btnAddShop
+ //
+ this.btnAddShop.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnAddShop.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.btnAddShop.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnAddShop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.btnAddShop.ForeColor = System.Drawing.Color.White;
+ this.btnAddShop.Location = new System.Drawing.Point(1, 9);
+ this.btnAddShop.Margin = new System.Windows.Forms.Padding(2);
+ this.btnAddShop.Name = "btnAddShop";
+ this.btnAddShop.Size = new System.Drawing.Size(66, 26);
+ this.btnAddShop.TabIndex = 370;
+ this.btnAddShop.Text = "添加店铺";
+ this.btnAddShop.UseVisualStyleBackColor = false;
+ this.btnAddShop.Click += new System.EventHandler(this.btnAddShop_Click);
+ //
+ // splitContainer2
+ //
+ this.splitContainer2.BackColor = System.Drawing.Color.White;
+ this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer2.Location = new System.Drawing.Point(0, 0);
+ this.splitContainer2.Name = "splitContainer2";
+ this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
+ //
+ // splitContainer2.Panel1
+ //
+ this.splitContainer2.Panel1.BackColor = System.Drawing.Color.White;
+ this.splitContainer2.Panel1.Controls.Add(this.btnRefreshAuth);
+ this.splitContainer2.Panel1.Controls.Add(this.pbLoading);
+ this.splitContainer2.Panel1.Controls.Add(this.dgvShop);
+ this.splitContainer2.Panel1.Padding = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ //
+ // splitContainer2.Panel2
+ //
+ this.splitContainer2.Panel2.Controls.Add(this.chkAutoDrag);
+ this.splitContainer2.Panel2.Controls.Add(this.statusBar);
+ this.splitContainer2.Size = new System.Drawing.Size(1264, 572);
+ this.splitContainer2.SplitterDistance = 540;
+ this.splitContainer2.TabIndex = 0;
+ //
+ // btnRefreshAuth
+ //
+ this.btnRefreshAuth.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnRefreshAuth.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.btnRefreshAuth.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnRefreshAuth.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.btnRefreshAuth.ForeColor = System.Drawing.Color.White;
+ this.btnRefreshAuth.Location = new System.Drawing.Point(11, 35);
+ this.btnRefreshAuth.Margin = new System.Windows.Forms.Padding(2);
+ this.btnRefreshAuth.Name = "btnRefreshAuth";
+ this.btnRefreshAuth.Size = new System.Drawing.Size(66, 26);
+ this.btnRefreshAuth.TabIndex = 374;
+ this.btnRefreshAuth.Text = "刷新授权";
+ this.btnRefreshAuth.UseVisualStyleBackColor = false;
+ this.btnRefreshAuth.Visible = false;
+ this.btnRefreshAuth.Click += new System.EventHandler(this.btnRefreshAuth_Click);
+ //
+ // pbLoading
+ //
+ this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None;
+ this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue;
+ this.pbLoading.Location = new System.Drawing.Point(607, 245);
+ this.pbLoading.Name = "pbLoading";
+ this.pbLoading.Size = new System.Drawing.Size(50, 50);
+ this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
+ this.pbLoading.TabIndex = 6;
+ this.pbLoading.TabStop = false;
+ //
+ // dgvShop
+ //
+ this.dgvShop.AllowUserToAddRows = false;
+ this.dgvShop.AllowUserToDeleteRows = false;
+ dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
+ this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
+ this.dgvShop.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
+ 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;
+ this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.colSelect,
+ this.colLoginName,
+ this.colShopId,
+ this.colShopAccount,
+ this.colNotes,
+ this.colCookie,
+ this.colSubUser,
+ this.colGroupName,
+ this.colUploadAccount,
+ this.colBuyAccount,
+ this.colChatAccount,
+ this.colLoginStatus,
+ this.colGotoShop,
+ this.colShopOperate,
+ this.colRelogin,
+ this.colReLogin2,
+ this.colMultiLogin,
+ this.colApiAuth,
+ this.colBuyApiAuth,
+ this.colUpdateCookies,
+ this.colCopyCookies,
+ this.colEdit,
+ this.colDelete});
+ this.dgvShop.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.dgvShop.Location = new System.Drawing.Point(4, 0);
+ this.dgvShop.Name = "dgvShop";
+ this.dgvShop.ReadOnly = true;
+ this.dgvShop.RowTemplate.Height = 23;
+ this.dgvShop.Size = new System.Drawing.Size(1256, 540);
+ this.dgvShop.TabIndex = 5;
+ this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick);
+ //
+ // colSelect
+ //
+ this.colSelect.FillWeight = 26F;
+ this.colSelect.HeaderText = "选";
+ this.colSelect.Name = "colSelect";
+ this.colSelect.ReadOnly = true;
+ this.colSelect.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+ this.colSelect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+ //
+ // colLoginName
+ //
+ this.colLoginName.FillWeight = 69.42599F;
+ this.colLoginName.HeaderText = "店铺登录号码";
+ this.colLoginName.Name = "colLoginName";
+ this.colLoginName.ReadOnly = true;
+ //
+ // colShopId
+ //
+ this.colShopId.FillWeight = 69.42599F;
+ this.colShopId.HeaderText = "店铺Id";
+ this.colShopId.Name = "colShopId";
+ this.colShopId.ReadOnly = true;
+ //
+ // colShopAccount
+ //
+ this.colShopAccount.HeaderText = "店铺账号";
+ this.colShopAccount.Name = "colShopAccount";
+ this.colShopAccount.ReadOnly = true;
+ //
+ // colNotes
+ //
+ this.colNotes.HeaderText = "备注";
+ this.colNotes.Name = "colNotes";
+ this.colNotes.ReadOnly = true;
+ //
+ // colCookie
+ //
+ this.colCookie.HeaderText = "店铺Cookie";
+ this.colCookie.Name = "colCookie";
+ this.colCookie.ReadOnly = true;
+ this.colCookie.Visible = false;
+ //
+ // colSubUser
+ //
+ this.colSubUser.FillWeight = 67F;
+ this.colSubUser.HeaderText = "子账户";
+ this.colSubUser.Name = "colSubUser";
+ this.colSubUser.ReadOnly = true;
+ //
+ // colGroupName
+ //
+ this.colGroupName.FillWeight = 69.42599F;
+ this.colGroupName.HeaderText = "店铺分组";
+ this.colGroupName.Name = "colGroupName";
+ this.colGroupName.ReadOnly = true;
+ this.colGroupName.Visible = false;
+ //
+ // colUploadAccount
+ //
+ this.colUploadAccount.FillWeight = 69.42599F;
+ this.colUploadAccount.HeaderText = "上货账户";
+ this.colUploadAccount.Name = "colUploadAccount";
+ this.colUploadAccount.ReadOnly = true;
+ this.colUploadAccount.Visible = false;
+ //
+ // colBuyAccount
+ //
+ this.colBuyAccount.FillWeight = 69.42599F;
+ this.colBuyAccount.HeaderText = "采购账户";
+ this.colBuyAccount.Name = "colBuyAccount";
+ this.colBuyAccount.ReadOnly = true;
+ this.colBuyAccount.Visible = false;
+ //
+ // colChatAccount
+ //
+ this.colChatAccount.FillWeight = 69.42599F;
+ this.colChatAccount.HeaderText = "客服账户";
+ this.colChatAccount.Name = "colChatAccount";
+ this.colChatAccount.ReadOnly = true;
+ this.colChatAccount.Visible = false;
+ //
+ // colLoginStatus
+ //
+ this.colLoginStatus.HeaderText = "登录状态";
+ this.colLoginStatus.Name = "colLoginStatus";
+ this.colLoginStatus.ReadOnly = true;
+ this.colLoginStatus.Visible = false;
+ //
+ // colGotoShop
+ //
+ this.colGotoShop.FillWeight = 46F;
+ this.colGotoShop.HeaderText = "进入店铺";
+ this.colGotoShop.Name = "colGotoShop";
+ this.colGotoShop.ReadOnly = true;
+ this.colGotoShop.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+ this.colGotoShop.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+ //
+ // colShopOperate
+ //
+ this.colShopOperate.FillWeight = 46F;
+ this.colShopOperate.HeaderText = "检测";
+ this.colShopOperate.Name = "colShopOperate";
+ this.colShopOperate.ReadOnly = true;
+ this.colShopOperate.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+ this.colShopOperate.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+ this.colShopOperate.Visible = false;
+ //
+ // colRelogin
+ //
+ this.colRelogin.FillWeight = 40F;
+ this.colRelogin.HeaderText = "登录";
+ this.colRelogin.Name = "colRelogin";
+ this.colRelogin.ReadOnly = true;
+ this.colRelogin.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+ this.colRelogin.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+ //
+ // colReLogin2
+ //
+ this.colReLogin2.FillWeight = 55F;
+ this.colReLogin2.HeaderText = "国际版状态";
+ this.colReLogin2.Name = "colReLogin2";
+ this.colReLogin2.ReadOnly = true;
+ this.colReLogin2.Visible = false;
+ //
+ // colMultiLogin
+ //
+ this.colMultiLogin.FillWeight = 52F;
+ this.colMultiLogin.HeaderText = "多重登录";
+ this.colMultiLogin.Name = "colMultiLogin";
+ this.colMultiLogin.ReadOnly = true;
+ this.colMultiLogin.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+ this.colMultiLogin.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+ this.colMultiLogin.Visible = false;
+ //
+ // colApiAuth
+ //
+ this.colApiAuth.FillWeight = 69.42599F;
+ this.colApiAuth.HeaderText = "上货授权";
+ this.colApiAuth.Name = "colApiAuth";
+ this.colApiAuth.ReadOnly = true;
+ this.colApiAuth.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+ this.colApiAuth.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+ this.colApiAuth.Visible = false;
+ //
+ // colBuyApiAuth
+ //
+ this.colBuyApiAuth.FillWeight = 69.42599F;
+ this.colBuyApiAuth.HeaderText = "拍单授权";
+ this.colBuyApiAuth.Name = "colBuyApiAuth";
+ this.colBuyApiAuth.ReadOnly = true;
+ this.colBuyApiAuth.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+ this.colBuyApiAuth.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+ this.colBuyApiAuth.Visible = false;
+ //
+ // colUpdateCookies
+ //
+ this.colUpdateCookies.FillWeight = 67F;
+ this.colUpdateCookies.HeaderText = "获取Cookie";
+ this.colUpdateCookies.Name = "colUpdateCookies";
+ this.colUpdateCookies.ReadOnly = true;
+ this.colUpdateCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+ this.colUpdateCookies.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+ //
+ // colCopyCookies
+ //
+ this.colCopyCookies.FillWeight = 70F;
+ this.colCopyCookies.HeaderText = "复制Cookie";
+ this.colCopyCookies.Name = "colCopyCookies";
+ this.colCopyCookies.ReadOnly = true;
+ this.colCopyCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+ this.colCopyCookies.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+ //
+ // colEdit
+ //
+ this.colEdit.FillWeight = 46F;
+ this.colEdit.HeaderText = "编辑";
+ this.colEdit.Name = "colEdit";
+ this.colEdit.ReadOnly = true;
+ this.colEdit.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+ this.colEdit.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+ //
+ // colDelete
+ //
+ this.colDelete.FillWeight = 46F;
+ this.colDelete.HeaderText = "删除";
+ this.colDelete.Name = "colDelete";
+ this.colDelete.ReadOnly = true;
+ //
+ // chkAutoDrag
+ //
+ this.chkAutoDrag.Anchor = System.Windows.Forms.AnchorStyles.Right;
+ this.chkAutoDrag.AutoSize = true;
+ this.chkAutoDrag.BackColor = System.Drawing.Color.White;
+ this.chkAutoDrag.Location = new System.Drawing.Point(1108, 2);
+ this.chkAutoDrag.Name = "chkAutoDrag";
+ this.chkAutoDrag.Size = new System.Drawing.Size(159, 21);
+ this.chkAutoDrag.TabIndex = 3;
+ this.chkAutoDrag.Text = "登录时自动滑动拼图验证";
+ this.chkAutoDrag.UseVisualStyleBackColor = false;
+ this.chkAutoDrag.Visible = false;
+ this.chkAutoDrag.Click += new System.EventHandler(this.chkAutoDrag_Click);
+ //
+ // statusBar
+ //
+ this.statusBar.BackColor = System.Drawing.Color.White;
+ this.statusBar.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.statusBar.Location = new System.Drawing.Point(0, -1);
+ this.statusBar.Margin = new System.Windows.Forms.Padding(0);
+ this.statusBar.Name = "statusBar";
+ this.statusBar.Size = new System.Drawing.Size(1264, 29);
+ this.statusBar.TabIndex = 1;
+ //
+ // PDDShopListForm
+ //
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.BackColor = System.Drawing.Color.White;
+ this.ClientSize = new System.Drawing.Size(1264, 622);
+ this.Controls.Add(this.splitContainer1);
+ this.Controls.Add(this.label1);
+ this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
+ this.Name = "PDDShopListForm";
+ this.Text = "ShopListForm";
+ this.Load += new System.EventHandler(this.ShopListForm_Load);
+ this.VisibleChanged += new System.EventHandler(this.ShopListForm_VisibleChanged);
+ this.splitContainer1.Panel1.ResumeLayout(false);
+ this.splitContainer1.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
+ this.splitContainer1.ResumeLayout(false);
+ this.tableLayoutPanel2.ResumeLayout(false);
+ this.panel5.ResumeLayout(false);
+ this.panel4.ResumeLayout(false);
+ this.panel4.PerformLayout();
+ this.splitContainer2.Panel1.ResumeLayout(false);
+ this.splitContainer2.Panel2.ResumeLayout(false);
+ this.splitContainer2.Panel2.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
+ this.splitContainer2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.pbLoading)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.dgvShop)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.SplitContainer splitContainer1;
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
+ private System.Windows.Forms.Panel panel5;
+ private System.Windows.Forms.Panel panel4;
+ private System.Windows.Forms.SplitContainer splitContainer2;
+ private UserControls.ButtonEx btnAddShop;
+ private UserControls.ButtonEx btnLoginSelect;
+ private UserControls.ButtonEx btnCheck;
+ private UserControls.ButtonEx btnImport;
+ private UserControls.StatusBarUserControl statusBar;
+ private UserComponent.DataGridViewEx dgvShop;
+ private System.Windows.Forms.CheckBox chkAutoDrag;
+ private UserControls.ButtonEx btnRefreshAuth;
+ private System.Windows.Forms.PictureBox pbLoading;
+ private System.Windows.Forms.TextBox txtShopName;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.TextBox txtShopId;
+ private System.Windows.Forms.Label label2;
+ private UserControls.ButtonEx btnSearch;
+ private System.Windows.Forms.Label label4;
+ private DevComponents.DotNetBar.PanelEx pnlEmpty;
+ private UserControls.ButtonEx btnRefreshShop;
+ private System.Windows.Forms.ComboBox cmbNotes;
+ private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect;
+ private System.Windows.Forms.DataGridViewTextBoxColumn colLoginName;
+ private System.Windows.Forms.DataGridViewTextBoxColumn colShopId;
+ private System.Windows.Forms.DataGridViewTextBoxColumn colShopAccount;
+ private System.Windows.Forms.DataGridViewTextBoxColumn colNotes;
+ private System.Windows.Forms.DataGridViewTextBoxColumn colCookie;
+ private System.Windows.Forms.DataGridViewTextBoxColumn colSubUser;
+ private System.Windows.Forms.DataGridViewTextBoxColumn colGroupName;
+ private System.Windows.Forms.DataGridViewTextBoxColumn colUploadAccount;
+ private System.Windows.Forms.DataGridViewTextBoxColumn colBuyAccount;
+ private System.Windows.Forms.DataGridViewTextBoxColumn colChatAccount;
+ private System.Windows.Forms.DataGridViewTextBoxColumn colLoginStatus;
+ private System.Windows.Forms.DataGridViewLinkColumn colGotoShop;
+ private System.Windows.Forms.DataGridViewLinkColumn colShopOperate;
+ private System.Windows.Forms.DataGridViewLinkColumn colRelogin;
+ private System.Windows.Forms.DataGridViewTextBoxColumn colReLogin2;
+ private System.Windows.Forms.DataGridViewLinkColumn colMultiLogin;
+ private System.Windows.Forms.DataGridViewLinkColumn colApiAuth;
+ private System.Windows.Forms.DataGridViewLinkColumn colBuyApiAuth;
+ private System.Windows.Forms.DataGridViewLinkColumn colUpdateCookies;
+ private System.Windows.Forms.DataGridViewLinkColumn colCopyCookies;
+ private System.Windows.Forms.DataGridViewLinkColumn colEdit;
+ private System.Windows.Forms.DataGridViewLinkColumn colDelete;
+ private UserComponent.UcCheckBox chkUsePddWorkbanch;
+ }
+}
\ No newline at end of file
diff --git a/TEMUKJD/DYForms/ShopForms/DYShopListForm.cs b/TEMUKJD/DYForms/ShopForms/DYShopListForm.cs
new file mode 100644
index 0000000..268b1fc
--- /dev/null
+++ b/TEMUKJD/DYForms/ShopForms/DYShopListForm.cs
@@ -0,0 +1,1155 @@
+using AllBase;
+using AllBase.Helper;
+using AllBase.Model.Result;
+using TemuKJD.Extension;
+using TemuKJD.BaseForms;
+using NaiBa.Util.Extension;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using Work;
+using NaiBa.Util;
+using System.Globalization;
+using TemuKJD.BLL;
+using System.Diagnostics;
+//using TemuKJD.PDDForms.AdminForms;
+
+namespace TemuKJD.DYForms.ShopForms
+{
+ public partial class DYShopListForm : BaseForm
+ {
+ public static List LstShopListFormInatance = new List();
+ private static DYShopListForm _instance = null;
+ public static DYShopListForm Instance { get { if (_instance == null) { _instance = new DYShopListForm(); } return _instance; } set { _instance = value; } }
+ public static bool IsOperate { get; set; } = false;
+ private bool isLoading { get; set; } = false;
+
+ #region 服务端店铺管理
+ public static void UpdateShop()
+ {
+ // 获取本地店铺和服务端店铺。将服务端相关信息与本地店铺合并后暂时存在内存中(不保存敏感信息)。
+ GlobalConfig.ShopLoginList = new ConcurrentList();
+ // 获取服务端店铺
+ var serverShopList = DYShopListForm.GetServerShop();
+ var localShopList = new ConcurrentList();
+ localShopList.AddRange(serverShopList);
+ foreach (var localShop in localShopList)
+ {
+ if (GlobalConfig.ShopLoginList.Any(s => s.LoginName == localShop.LoginName && s.ShopId == localShop.ShopId))
+ continue;
+
+ var serverShop = serverShopList.FirstOrDefault(s => s.LoginName == localShop.LoginName && s.ShopId == localShop.ShopId);
+ if (serverShop != null)
+ {
+ localShop.ShopAccount = serverShop.ShopAccount;
+ localShop.LoginName = serverShop.LoginName;
+ localShop.Password = serverShop.Password;
+ localShop.Cookies = serverShop.Cookies;
+ localShop.DbId = serverShop.DbId;
+ localShop.UserName = serverShop.UserName;
+ localShop.SubUserName = serverShop.SubUserName;
+ localShop.ApiAuthInfoList = new List();
+ localShop.ApiAuthInfoList.AddRange(serverShop.ApiAuthInfoList);
+ localShop.BuyApiAuth.AccessToken = serverShop.BuyApiAuth.AccessToken;
+ localShop.BuyApiAuth.AddTime = serverShop.BuyApiAuth.AddTime;
+ localShop.BuyApiAuth.AppKey = serverShop.BuyApiAuth.AppKey;
+ localShop.BuyApiAuth.ExpiresTime = serverShop.BuyApiAuth.ExpiresTime;
+ localShop.BuyApiAuth.RefreshToken = serverShop.BuyApiAuth.RefreshToken;
+ localShop.PayStatus = serverShop.PayStatus;
+ localShop.GroupName = serverShop.GroupName;
+ localShop.Notes = serverShop.Notes;
+ localShop.LoginStatus = serverShop.LoginStatus;
+ localShop.LoginStatus2 = serverShop.LoginStatus2;
+ localShop.AntiContents = serverShop.AntiContents;
+ localShop.AddProductRemaining = serverShop.AddProductRemaining;
+ localShop.OperateSubSaName = serverShop.OperateSubSaName;
+ if (localShop.TrialUploadCount < 0)
+ localShop.TrialUploadCount = 0;
+ GlobalConfig.ShopLoginList.Add(localShop);
+ }
+ }
+ }
+
+ public static List GetServerShop()
+ {
+ List list = new List();
+
+ int page = 0;
+ while (true)
+ {
+ page++;
+
+ var url = BaseClass.BuildObjString("shop/get_shop_list");
+ var data = UserLogin.GetSignaturex() + "&page=" + page;
+ var html = GetHtml.PostUtf8(url, data);
+ if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
+ html = GetHtml.PostUtf8(url, data);
+ if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
+ html = GetHtml.PostUtf8(url, data);
+ if (string.IsNullOrEmpty(html)
+ || !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass"))
+ {
+ //return list;
+ break;
+ }
+
+ var jArr = JObject.Parse(html)["data"];
+ if (jArr.Count() == 0)
+ break;
+
+ list.AddRange(ShopBLL.DeserializationShop(html));
+ }
+ return list;
+ }
+
+ public static void UpdateShopTokens(List shops)
+ {
+ string shopIds = "";
+ foreach (var shop in shops)
+ {
+ shopIds += shop.ShopId + ",";
+ }
+
+ var shopTokens = GetServerShopTokens(shopIds); //{"code":200,"msg":"success","data":[{"shop_id":"9050819","app_key":"6876612657718691336","access_token":"fd818b94-b4e7-4707-8073-bebcd81d8e4c","refresh_token":"9a109ef3-2bef-4ca9-8f4e-18369a356255","add_time":"2021-07-09 10:54:56","expires_in":"2021-07-14 18:40:44"}]}
+ for (int i = 0; i < 10 && (string.IsNullOrEmpty(shopTokens) || !shopTokens.Contains("\"code\":200")); i++)
+ {
+ shopTokens = GetServerShopTokens(shopIds);
+ if (i > 0)
+ Thread.Sleep(100);
+ }
+ if (!string.IsNullOrEmpty(shopTokens) && shopTokens.Contains("\"code\":200"))
+ {
+ JObject jShopsObj = JObject.Parse(shopTokens);
+ foreach (JObject jShop in jShopsObj["data"])
+ {
+ string shopStr = JsonHelper.SerializeObject(jShop);
+ string shop_id = BaseRegex.GetStringJson(ref shopStr, "shop_id");
+ var shop = shops.FirstOrDefault(s => s.ShopId == shop_id);
+ if (shop != null)
+ {
+ var appkey = BaseRegex.GetStringJson(ref shopStr, "app_key");
+ // 科尔搬家
+ if (appkey == "7023294452517127719")
+ {
+ shop.ApiAuthInfoList.RemoveAll(a => a.AppKey == appkey);
+ shop.ApiAuthInfoList.Add(new AuthInfo
+ {
+ AppKey = appkey,
+ AccessToken = BaseRegex.GetStringJson(ref shopStr, "access_token"),
+ RefreshToken = BaseRegex.GetStringJson(ref shopStr, "refresh_token"),
+ AddTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime(),
+ ExpiresTime = BaseRegex.GetStringJson(ref shopStr, "expires_in").ParseToDateTime(),
+ });
+ }
+ // 小奶兔工具
+ else if (appkey == "6876612657718691336") // || shop.ShopName == "权益服务齐全的专营店") // 上货appkey,小奶猫工具
+ {
+ shop.ApiAuthInfoList.RemoveAll(a => a.AppKey == appkey);
+ shop.ApiAuthInfoList.Add(new AuthInfo
+ {
+ AppKey = appkey,
+ AccessToken = BaseRegex.GetStringJson(ref shopStr, "access_token"),
+ RefreshToken = BaseRegex.GetStringJson(ref shopStr, "refresh_token"),
+ AddTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime(),
+ ExpiresTime = BaseRegex.GetStringJson(ref shopStr, "expires_in").ParseToDateTime(),
+ });
+ }
+ else if (appkey == "7016502755254683171") // 拍单appkey,小奶兔打单
+ {
+ shop.BuyApiAuth.AppKey = appkey;
+ shop.BuyApiAuth.AccessToken = BaseRegex.GetStringJson(ref shopStr, "access_token");
+ shop.BuyApiAuth.RefreshToken = BaseRegex.GetStringJson(ref shopStr, "refresh_token");
+ shop.BuyApiAuth.AddTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime();
+ shop.BuyApiAuth.ExpiresTime = BaseRegex.GetStringJson(ref shopStr, "expires_in").ParseToDateTime();
+ }
+ }
+ }
+ }
+ }
+
+ public static void DelServerDouShop(string shopId)
+ {
+ var url = BaseClass.BuildObjString("shop/del_shop");
+ var data = UserLogin.GetSignaturex() + "&login_name=" + shopId;
+ var result = GetHtml.PostUtf8(url, data);
+ }
+ #endregion
+
+ #region 服务端店铺Cookie管理
+ ///
+ /// 添加店铺Cookies
+ ///
+ /// 店铺名称
+ /// cookies
+ /// 工具名称(可不填写)
+ public static void UpdateServerShopCookies(ShopLoginInfo shop, string fromTool = null)
+ {
+ var fTool = string.IsNullOrEmpty(fromTool) ? "" : "&from_tool=" + fromTool;
+ var url = BaseClass.BuildObjString("shop/mdy_shop_cookie_and_login_status");
+ var data = UserLogin.GetSignaturex()
+ + "&login_name=" + shop.LoginName
+ + "&login_status=" + shop.LoginStatus
+ + "&login_status2=" + shop.LoginStatus2
+ + "&cookie=" + shop.Cookies.Replace("&", "&").Replace("%", "%").Replace("+", "+")
+ + "&cookie2=" + shop.Cookies2.Replace("&", "&").Replace("%", "%").Replace("+", "+")
+ + "&pddid=" + shop.pddid
+ + fTool;
+ var result = GetHtml.PostUtf8(url, data);
+ if (!result.Contains("\"code\":200"))
+ result = GetHtml.PostUtf8(url, data);
+ if (!result.Contains("\"code\":200"))
+ {
+ BaseMsgForm.ShowError("服务端登录状态保存失败!请检查网络连接。");
+ }
+ }
+ /////
+ ///// 获取店铺Cookies
+ /////
+ ///// 店铺名称,逗号隔开
+ //public static string GetServerShopCookies(string shopNames)
+ //{
+ // var url = BaseClass.BuildObjString("shop&act=get_shop_cookie");
+ // var data = UserLogin.GetSignaturex() + "&shop_name=" + shopNames.Trim(',');
+ // var result = GetHtml.PostUtf8(url, data);
+ // return result;
+ //}
+ #endregion
+
+ public static string GetServerShopTokens(string shopLoginNames)
+ {
+ var url = BaseClass.BuildObjString("shop&act=get_shop_token");
+ var data = UserLogin.GetSignaturex() + "&login_name=" + shopLoginNames.Trim(',');
+ var result = GetHtml.PostUtf8(url, data);
+ return result;
+ }
+
+ public DYShopListForm()
+ {
+ InitializeComponent();
+
+ Instance = this;
+
+ LstShopListFormInatance.Add(this);
+ }
+
+ private void btnAddShop_Click(object sender, EventArgs e)
+ {
+ DYShopAddEditForm sae = new DYShopAddEditForm();
+ sae.SaveCompleteWithDescribe += Sae_SaveComplete;
+ sae.Show();
+ }
+
+ private void Sae_SaveComplete(object obj, object isAdd)
+ {
+ var shopInfo = obj as ShopLoginInfo;
+ if (shopInfo != null)
+ {
+ if ((isAdd as bool?) == true)
+ {
+ var shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == shopInfo.LoginName);
+ if (shop != null)
+ {
+ BaseMsgForm.ShowError("店铺" + shopInfo.LoginName + "已存在!");
+ }
+ else
+ {
+ ShopBLL.AddServerShop(shopInfo);
+ btnRefreshCookie_Click(null, null);
+ }
+ }
+ else
+ {
+ ShopBLL.MdyServerShopSubInfo(shopInfo);
+ btnRefreshCookie_Click(null, null);
+ }
+ }
+ }
+
+ private void shopLoginForm_SaveComplete(object obj)
+ {
+ Task.Run(() =>
+ {
+ //CheckShopListLogin(new string[] { (obj as DouShopLoginInfo).LoginName });
+ });
+ }
+
+ private void UpdateCookieForm_SaveComplete(object obj)
+ {
+ Task.Run(() =>
+ {
+ //CheckShopListLogin(new string[] { (obj as DouShopLoginInfo).LoginName });
+ StartUp.SaveLocalShopLoginInfo();
+ Invoke(new Action(() =>
+ {
+ btnRefreshCookie_Click(null, null);
+ }));
+ });
+ }
+
+ private void btnImport_Click(object sender, EventArgs e)
+ {
+ IsOperate = true;
+ ImportShop();
+ btnRefreshCookie_Click(null, null);
+ }
+
+ void ImportShop()
+ {
+ this.btnImport.Enabled = false;
+ string text = "店铺导入格式:\r\n\r\n1.店铺账号(手机/用户名/邮箱)-----店铺密码\r\n2.店铺账号-----密码-----备注\r\n\r\n多个店铺请每个店铺新起一行。";
+ BaseMsgForm.ShowInfo(text, "", FormLevel.LARGE);
+
+ OpenFileDialog openFileDialog = new OpenFileDialog();
+ openFileDialog.Filter = "文本文件(*.txt)|*.txt";
+ openFileDialog.RestoreDirectory = true;
+ openFileDialog.FilterIndex = 1;
+ if (openFileDialog.ShowDialog() == DialogResult.OK)
+ {
+ using (StreamReader sr = new StreamReader(openFileDialog.FileName, System.Text.Encoding.UTF8))
+ {
+ string fileName = openFileDialog.FileName;
+ string importStr = sr.ReadToEnd().Trim();
+ var strArr = importStr.Replace("\r", "").Split('\n');
+ for (int i = 0; i < strArr.Length; i++)
+ {
+ if (IsOperate == false)
+ break;
+ try
+ {
+ // 通用格式
+ if (strArr[i].Contains("-----"))
+ {
+ var productArr = strArr[i].Split(new string[] { "-----" }, StringSplitOptions.RemoveEmptyEntries);
+ if (productArr.Length > 1)
+ {
+ ShopLoginInfo shop = new ShopLoginInfo
+ {
+ LoginName = productArr[0],
+ Password = DataOpenSSL.EncryptString(productArr[1]),
+ };
+ if (productArr.Length > 2)
+ {
+ shop.Notes = productArr[2];
+ }
+
+ //ShopLoginForm shopLoginForm = new ShopLoginForm(shop);
+ //shopLoginForm.SaveComplete += shopLoginForm_SaveComplete;
+ //shopLoginForm.ShowDialog();
+
+ //StartUp.SaveDouShopLoginInfo();
+ var shopInfo = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == shop.LoginName);
+ if (shopInfo != null)
+ {
+ shopInfo.Password = shop.Password;
+ shopInfo.GroupName = shop.GroupName;
+ }
+ else
+ GlobalConfig.ShopLoginList.Add(shop);
+ StartUp.SaveLocalShopLoginInfo();
+ ShopBLL.AddServerShop(shop);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ }
+ }
+ IsOperate = false;
+ this.btnImport.Enabled = true;
+ }
+
+ private void RefreshDataGridView(bool updateStatus=true)
+ {
+ if (isLoading)
+ {
+ //BaseMsgForm.ShowError("当前正在加载,请稍等");
+ return;
+ }
+
+ Invoke(new Action(() =>
+ {
+ cmbNotes.Items.Clear();
+ var notes = GlobalConfig.ShopLoginList.Select(s => s.Notes).Distinct();
+ cmbNotes.Items.Add("全部");
+ cmbNotes.Items.AddRange(notes.ToArray());
+ }));
+
+ Task.Run(() =>
+ {
+ isLoading = true;
+ while (StartUp.IsShopInit == false)
+ {
+ Thread.Sleep(1000);
+ }
+
+ var shopList = GlobalConfig.ShopLoginList.Where(s => !string.IsNullOrEmpty(s.ShopId)
+ || GlobalConfig.ShopLoginList.Where(ss=>ss.LoginName == s.LoginName).Count() == 1)
+ .OrderBy(s=>s.LoginName).ToList();
+
+ Invoke(new Action(() =>
+ {
+ if (!string.IsNullOrWhiteSpace(cmbNotes.Text) && cmbNotes.Text.Trim() != "全部")
+ {
+ shopList = shopList.Where(s => s.Notes.ParseToString().ToLower().Contains(cmbNotes.Text.ToLower())).ToList();
+ }
+ if (!string.IsNullOrEmpty(txtShopId.Text))
+ {
+ shopList = shopList.Where(s => s.ShopId.ParseToString().ToLower().Contains(txtShopId.Text.ToLower())).ToList();
+ }
+ if (!string.IsNullOrEmpty(txtShopName.Text))
+ {
+ shopList = shopList.Where(s => s.ShopAccount.ParseToString().ToLower().Contains(txtShopName.Text.ToLower())).ToList();
+ }
+ }));
+
+ List shopIdList = GetCheckedShopIdList();
+ this.Invoke(new Action(() =>
+ {
+ this.dgvShop.Rows.Clear();
+ if (updateStatus)
+ this.statusBar.pgbTaskProgress.Maximum = shopList.Count; // 显示总数
+ }));
+
+ for (int i = 0; i < shopList.Count; i++)
+ {
+ if (this.Created && updateStatus && (i % 5 == 0 || i == shopList.Count - 1))
+ {
+ this.Invoke(new Action(() =>
+ {
+ this.statusBar.lblTaskStatus.Text = "正在加载...";
+ this.statusBar.pgbTaskProgress.Value = (i + 1);
+ this.statusBar.pgbTaskProgress.Text = (i + 1) + "/" + shopList.Count;
+ }));
+ }
+ AddDataGridViewRow(shopList[i], true, shopIdList.Contains(shopList[i].ShopId));
+ }
+ if (this.Created)
+ {
+ this.Invoke(new Action(() =>
+ {
+ if (updateStatus)
+ this.statusBar.lblTaskStatus.Text = "加载完毕";
+ this.pbLoading.Visible = false;
+ }));
+ }
+ isLoading = false;
+ });
+ }
+
+ private void AddDataGridViewRow(ShopLoginInfo param, bool isRefresh = false, bool isRowCheck = false)
+ {
+ if (!this.Created)
+ return;
+ this.Invoke(new Action(() =>
+ {
+ DataGridViewRow dgvr = dgvShop.Rows.Cast().Where(p =>
+ p.Cells.GetCellValueFromColumnName("colLoginName").ParseToString() == param.LoginName &&
+ p.Cells.GetCellValueFromColumnName("colShopId").ParseToString() == param.ShopId).FirstOrDefault();
+ if (dgvr != null)
+ {
+ UpdateDataGridViewRowToken(dgvr, param);
+ if (!isRefresh)
+ {
+ // help to scroll to checked
+ dgvShop.CurrentCell = dgvr.Cells[2];
+ }
+ }
+ else
+ {
+ int rowIndex = this.dgvShop.Rows.Add(
+ isRowCheck,
+ param.LoginName,
+ param.ShopId,
+ param.ShopAccount,
+ param.Notes,
+ param.Cookies,
+ param.SubUserName,
+ param.GroupName,
+ param.UploadAccount,
+ param.BuyAccount,
+ param.ChatAccount,
+ "",
+ "进入",
+ "检测",
+ string.IsNullOrWhiteSpace(param.LoginStatus) ? "未登录" : param.LoginStatus.Trim(),
+ string.IsNullOrWhiteSpace(param.LoginStatus2) ? "国际版未登录" : param.LoginStatus2.Trim(),
+ "多重登录",
+ param.ApiAuthStatus,
+ param.BuyApiAuth.ApiAuthStatus,
+ "获取Cookie",
+ "复制Cookie",
+ "编辑",
+ "删除");
+ if (!isRefresh)
+ {
+ // help to scroll to latest checked
+ dgvShop.CurrentCell = this.dgvShop.Rows[rowIndex].Cells[2];
+ }
+ }
+ }));
+ }
+
+ private void UpdateDataGridViewRowToken(DataGridViewRow dgvr, ShopLoginInfo param)
+ {
+ if (dgvr == null || param == null)
+ return;
+ dgvr.Cells["colCookie"].Value = param.Cookies;
+ dgvr.Cells["colApiAuth"].Value = param.ApiAuthStatus;
+ dgvr.Cells["colBuyApiAuth"].Value = param.BuyApiAuth.ApiAuthStatus;
+ dgvr.Cells["colLoginName"].Value = param.LoginName;
+ dgvr.Cells["colShopAccount"].Value = param.ShopAccount;
+ dgvr.Cells["colNotes"].Value = param.Notes;
+ dgvr.Cells["colCookie"].Value = param.Cookies;
+ dgvr.Cells["colGroupName"].Value = param.GroupName;
+ dgvr.Cells["colUploadAccount"].Value = param.UploadAccount;
+ dgvr.Cells["colBuyAccount"].Value = param.BuyAccount;
+ dgvr.Cells["colChatAccount"].Value = param.ChatAccount;
+ dgvr.Cells["colRelogin"].Value = string.IsNullOrWhiteSpace(param.LoginStatus) ? "未登录" : param.LoginStatus.Trim();
+ }
+
+ ///
+ /// 检测店铺授权状态
+ ///
+ ///
+ ///
+ public void CheckShopListLogin(string[] shopNames, bool isShowProgress = true)
+ {
+ if (isShowProgress)
+ {
+ Invoke(new Action(() =>
+ {
+ this.pbLoading.Visible = true;
+ this.statusBar.lblTaskStatus.Text = "正在检测...";
+ this.statusBar.pgbTaskProgress.Value = 0;
+ this.statusBar.pgbTaskProgress.Maximum = shopNames.Length;
+ this.statusBar.pgbTaskProgress.Text = "0" + "/" + shopNames.Length;
+ }));
+ }
+
+ CheckShopLogin(shopNames, isShowProgress);
+
+ if (this.Created && isShowProgress)
+ {
+ this.Invoke(new Action(() =>
+ {
+ this.pbLoading.Visible = true;
+ this.statusBar.lblTaskStatus.Text = "检测完毕";
+ }));
+ }
+ }
+
+ public void CheckShopLogin(string[] shopNames, bool isShowProgress = true)
+ {
+
+ for (int i = 0; i < shopNames.Length; i++)
+ {
+ var campanys = GlobalConfig.ShopLoginList.Where(v => v.LoginName == shopNames[i]).ToList();
+ var shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == shopNames[i]);
+
+ // 先从服务端取最新cookie
+ var serverCampanys = ShopBLL.AdminGetServerShopLstByIds(campanys.Select(c => c.ShopId).ToList());
+ var sss = string.Join(",", serverCampanys.Select(s => s.UserName + s.ShopAccount));
+ var serverShop = serverCampanys.FirstOrDefault();
+ if (shop != null && serverShop != null)
+ {
+ shop.Cookies = serverShop.Cookies;
+ shop.Cookies2 = serverShop.Cookies2;
+ foreach (var sc in campanys)
+ {
+ sc.Cookies = serverShop.Cookies;
+ sc.Cookies2 = serverShop.Cookies2;
+ }
+ }
+
+ if (shop != null)
+ {
+ var loginResult = CheckShopLogin(shop);
+ if (loginResult.Contains("\"success\":true") && !loginResult.Contains("\"login\":true"))
+ {
+ shop.Cookies = "empty=true;";
+ foreach (var sc in campanys)
+ {
+ sc.LoginStatus = "未登录";
+ shop.Cookies = "empty=true;";
+ }
+ }
+ else
+ {
+ foreach(var sc in campanys)
+ {
+ sc.LoginStatus = "登录成功";
+ sc.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd");
+ }
+ }
+ UpdateServerShopCookies(shop); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
+ StartUp.SaveLocalShopLoginInfo();
+ }
+ if (this.Created && isShowProgress)
+ {
+ this.Invoke(new Action(() =>
+ {
+ this.statusBar.lblTaskStatus.Text = "正在检测...";
+ this.statusBar.pgbTaskProgress.Value = (i + 1);
+ this.statusBar.pgbTaskProgress.Text = (i + 1) + "/" + shopNames.Length;
+ }));
+ }
+ }
+ }
+
+ public static string GetShopStatus(ShopLoginInfo shop)
+ {
+ string url = "https://mms.pinduoduo.com/janus/api/userinfo";
+ string refere = "https://mms.pinduoduo.com/login/";
+ refere = "https://mms.pinduoduo.com/home";
+ string body = @"{}";
+ var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere);
+ return result;
+ }
+
+ public static string CheckShopLogin(ShopLoginInfo shop, string refere = "https://mms.pinduoduo.com/home/")
+ {
+ string url = "https://mms.pinduoduo.com/janus/api/checkLogin";
+ string body = @"{}";
+ return HttpResponseBLL.PDDPostResponse(shop, url, body, refere);
+ }
+
+ ///
+ /// 获取国际版登录状态
+ ///
+ ///
+ ///
+ public static string GetShopStatus2(ShopLoginInfo shop)
+ {
+ //string url = "https://agentseller.temu.com/api/seller/auth/userInfo";
+ //string refere = "https://agentseller.temu.com/";
+ //string body = @"{}";
+ //return HttpResponseBLL.PDDPostResponse2(shop, url, body, refere);
+ return "";
+ }
+
+ public static string GetShopLogin2Code(ShopLoginInfo shop)
+ {
+ //string url = "https://seller.kuajingmaihuo.com/bg/quiet/api/auth/obtainCode";
+ //string refere = "https://seller.kuajingmaihuo.com/settle/seller-login?redirectUrl=https%3A%2F%2Fagentseller.temu.com%2F®ion=1&source=https%3A%2F%2Fagentseller.temu.com%2Fmain%2Fauthentication%3FredirectUrl%3Dhttps%253A%252F%252Fagentseller.temu.com%252F";
+ //string body = @"{""redirectUrl"":""https://agentseller.temu.com/main/authentication""}";
+ //return HttpResponseBLL.PostResponse(shop, url, body, refere);
+ return "";
+ }
+
+ private void ShopListForm_VisibleChanged(object sender, EventArgs e)
+ {
+ if (this.Visible == true)
+ {
+ this.pbLoading.Visible = true;
+ RefreshDataGridView(true);
+ }
+ }
+
+ private void ShopListForm_Load(object sender, EventArgs e)
+ {
+ chkUsePddWorkbanch.CheckedChanged -= chkUsePddWorkbanch_CheckedChanged;
+ chkUsePddWorkbanch.Checked = BaseClass.UsePddWorkbanch;
+ chkUsePddWorkbanch.CheckedChanged += chkUsePddWorkbanch_CheckedChanged;
+
+ if (BaseClass.GroupId != 3)
+ {
+ this.dgvShop.Columns["ColEdit"].Visible = false;
+ this.dgvShop.Columns["colDelete"].Visible = false;
+ this.dgvShop.Columns["colSubUser"].Visible = false;
+ this.btnImport.Visible = false;
+ this.btnAddShop.Visible = false;
+ }
+
+ this.dgvShop.AddSelectorColumn("colSelect");
+ this.chkAutoDrag.Checked = GlobalConfig.TemuShopSettingParam.IsAutoDragLogin;
+ this.splitContainer2.FixedPanel = FixedPanel.Panel2;
+
+ //子账号
+ //var url = BaseClass.BuildObjString("shop&act=get_shop_user_sub_group");
+ //var data = UserLogin.GetSignaturex();
+ //var result = GetHtml.PostUtf8(url, data);
+ //if (result?.Contains("\"code\":200") == true)
+ //{
+ // var jObj = JObject.Parse(result);
+ // List shopSubAccountList = JsonHelper.DeserializeJsonToList(jObj["data"].ToString());
+ // foreach (var shop in GlobalConfig.DouShopLoginList)
+ // {
+ // shop.ShopSubAccountList.Clear();
+ // shop.ShopSubAccountList.AddRange(shopSubAccountList.Where(s => s.shop_login_name == shop.LoginName));
+ // }
+ //}
+ foreach (var shop in GlobalConfig.ShopLoginList)
+ {
+ shop.ShopSubAccountList.Clear();
+ if (!string.IsNullOrWhiteSpace(shop.SubUserName))
+ {
+ ShopSubAccountInfo subAccount = new ShopSubAccountInfo();
+ subAccount.sub_user_name = shop.SubUserName;
+ subAccount.user_name = shop.SubUserName;
+ subAccount.shop_login_name = shop.LoginName;
+ subAccount.group_id = "4";
+ shop.ShopSubAccountList.Add(subAccount);
+ }
+ }
+
+ GetWorkBenchCookie();
+ }
+
+ void GetWorkBenchCookie()
+ {
+ return;
+ //FiddlerCore.Utilities.SmartAssembly.Attributes.
+
+ Task.Run(() =>
+ {
+ while (true)
+ {
+ var process = Process.GetProcessesByName("notepad").FirstOrDefault();// 获取Notepad进程的实例
+ if (process != null)
+ {
+ IntPtr handle = process.Handle;
+ MemoryReader.ReadMemory(handle.ToInt32(), 0X1474DEC8, 0X50000000);
+
+ break;
+
+ }
+ //var memory = new Memory(process); // 创建Memory对象来操作进程内存
+ //IntPtr address = new IntPtr(0x12345678); // 假设的内存地址(需要根据实际情况调整)
+ //byte[] buffer = new byte[1024]; // 读取数据的缓冲区大小根据需要调整
+ //if (memory.Read(address, buffer)) // 读取内存到buffer中
+ //{
+ // Console.WriteLine("Read successful.");
+ // Console.WriteLine(Encoding.ASCII.GetString(buffer)); // 打印读取的数据(这里假设是ASCII文本)
+ //}
+ //else
+ //{
+ // Console.WriteLine("Read failed.");
+ //}
+
+ Thread.Sleep(5000);
+ }
+ });
+ }
+
+ private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e)
+ {
+ if (e.ColumnIndex < 0 || e.RowIndex < 0)
+ return;
+ string headerText = dgvShop.Columns[e.ColumnIndex].HeaderText;
+ string loginName = dgvShop.Rows[e.RowIndex].Cells["colLoginName"].Value.ParseToString();
+ string accountId = dgvShop.Rows[e.RowIndex].Cells["colShopId"].Value.ParseToString();
+ var shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == loginName && v.ShopId == accountId);
+
+ switch (headerText)
+ {
+ case "检测":
+ //CheckShopLoginAsync(new string[] { loginName });
+ case "进入店铺":
+ IsOperate = true;
+ {
+ PDDShopLoginForm shopLoginForm = new PDDShopLoginForm(shop);
+ //shopLoginForm.Parent = this;
+ shopLoginForm.openType = EnumOpenType.manage;
+ shopLoginForm.WindowState = FormWindowState.Maximized;
+ shopLoginForm.InitUrl = "https://mms.pinduoduo.com/home/";
+ shopLoginForm.Show();
+ IsOperate = false;
+ }
+ break;
+ case "复制Cookie":
+ List cooks = null;
+ try { cooks = JsonHelper.DeserializeJsonToList(shop.Cookies); } catch (Exception ex) { }
+ if (cooks == null)
+ cooks = new List();
+
+ string cookJs = "";
+ var keys = new string[] { "_a42", "_bee", "_f77", "_nano_fp", "api_uid", "JSESSIONID", "mms_b84d1838", "rckk", "ru1k", "ru2k", "PASS_ID", "webp", "x-visit-time" };
+ var keys2 = new string[] { /*"_bee", "_nano_fp", "api_uid", "dilx", "hfsc", "njrpl", "seller_temp"*/ };
+ foreach (var shopCook in cooks)
+ {
+ var cookie = shopCook.Name + "=" + shopCook.Value;
+ if (!keys.Any(k=>cookie.StartsWith(k)))
+ continue;
+ cookJs += "\r\ndocument.cookie='" + cookie.Substring(0, Math.Max(0, cookie.IndexOf("="))) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';";
+ }
+ foreach (var shopCook in cooks)
+ {
+ var cookie = shopCook.Name + "=" + shopCook.Value;
+ if (!keys.Any(k => cookie.StartsWith(k)))
+ continue;
+ if (!cookie.StartsWith("PASS_ID") && !cookie.StartsWith("_nano_fp") && !cookie.StartsWith("JSESSIONID") &&
+ !cookie.StartsWith("mms_b84d1838") && !cookie.StartsWith("webp") && !cookie.StartsWith("x-visit-time"))
+ cookJs += "\r\ndocument.cookie='" + cookie + "; domain=.pinduoduo.com;expires=" +
+ DateTime.Now.AddMonths(1).ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss 'UTC'", new DateTimeFormatInfo()) + "; path=/';";
+ else
+ cookJs += "\r\ndocument.cookie='" + cookie + "; domain=mms.pinduoduo.com; expires=" +
+ DateTime.Now.AddMonths(1).ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss 'UTC'", new DateTimeFormatInfo()) + "; path=/';";
+ }
+ // 全球站cookie
+ //foreach (var shopCook in shop.Cookies2.Split(';'))
+ //{
+ // var cookie = shopCook.Trim();
+ // if (cookie.StartsWith("mallid"))
+ // cookie = "mallid=" + shop.ShopId;
+ // if (!keys2.Any(k => cookie.StartsWith(k)))
+ // continue;
+ // if (!cookie.StartsWith("seller_temp") && !cookie.StartsWith("_nano_fp") && !cookie.StartsWith("mallid"))
+ // cookJs += "\r\ndocument.cookie='" + cookie + "; domain=.temu.com; expires=" +
+ // DateTime.Now.AddDays(1).ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss 'UTC'", new DateTimeFormatInfo()) + "; path=/';";
+ // else
+ // cookJs += "\r\ndocument.cookie='" + cookie + "; domain=agentseller.temu.com; expires=" +
+ // DateTime.Now.AddDays(1).ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss 'UTC'", new DateTimeFormatInfo()) + "; path=/';";
+ //}
+ //cookJs += "\r\nwindow.localStorage.setItem('" + "mall-info-id" + "', '" + shop.ShopId + "');";
+ //cookJs += "\r\nwindow.localStorage.setItem('" + "agentseller-mall-info-id" + "', '" + shop.ShopId + "');";
+ cookJs += "\r\nsetTimeout(() => { window.location.href='https://mms.pinduoduo.com/home'; }, 200)";
+ Clipboard.SetDataObject(cookJs);
+ BaseMsgForm.ShowInfo("复制成功");
+ break;
+ case "获取Cookie":
+ case "导入Cookie":
+ ////PDDShopUpdateCookieForm updateCookieForm = new PDDShopUpdateCookieForm(shop);
+ ////updateCookieForm.SaveComplete += UpdateCookieForm_SaveComplete;
+ ////updateCookieForm.ShowDialog();
+ //PDDShopUpdateFddlCookieForm updateFddlCookieForm = new PDDShopUpdateFddlCookieForm(shop);
+ //updateFddlCookieForm.SaveComplete += UpdateCookieForm_SaveComplete;
+ //updateFddlCookieForm.ShowDialog();
+ //updateFddlCookieForm.fddlHelper.UninstallFiddler();
+ break;
+ case "删除":
+ if (BaseMsgForm.ShowConfirm("确定删除店铺吗?删除后不可恢复!").DialogResult == DialogResult.Cancel)
+ return;
+ DeleteShop(e.RowIndex);
+ DelServerDouShop(shop.LoginName);
+ StartUp.SaveLocalShopLoginInfo();
+ break;
+ case "编辑":
+ DYShopAddEditForm editForm = new DYShopAddEditForm(shop);
+ editForm.SaveCompleteWithDescribe += Sae_SaveComplete;
+ editForm.ShowDialog();
+ break;
+ case "登录":
+ IsOperate = true;
+ {
+ PDDShopLoginForm shopLoginForm = new PDDShopLoginForm(shop);
+ shopLoginForm.openType = EnumOpenType.login;
+ shopLoginForm.SaveComplete += shopLoginForm_SaveComplete;
+ shopLoginForm.ShowDialog();
+ btnRefreshCookie_Click(null, null);
+ }
+ IsOperate = false;
+ break;
+ //case "多重登录":
+ // IsOperate = true;
+ // ShopLoginForm shopMultiLoginForm = new ShopLoginForm(shop);
+ // shopMultiLoginForm.isMultiLogin = true;
+ // shopMultiLoginForm.SaveComplete += shopLoginForm_SaveComplete;
+ // shopMultiLoginForm.ShowDialog();
+ // IsOperate = false;
+ // break;
+ //case "接口授权":
+ //case "上货授权":
+ // IsOperate = true;
+ // //GetHtml.OpenUrl("https://fuwu.jinritemai.com/authorize?service_id=815");
+ // ShopAuthForm shopAuthForm = new ShopAuthForm(shop);
+ // shopAuthForm.SaveComplete += shopLoginForm_SaveComplete;
+ // shopAuthForm.ShowDialog();
+ // IsOperate = false;
+ // break;
+ //case "拍单授权":
+ // IsOperate = true;
+ // //GetHtml.OpenUrl("https://fuwu.jinritemai.com/detail?from=fuwu_market_orderDetail&service_id=20896");
+ // ShopAuthForm shopAuthForm1 = new ShopAuthForm(shop);
+ // shopAuthForm1.shopAuthUrl = "https://fuwu.jinritemai.com/authorize?service_id=20896";
+ // shopAuthForm1.SaveComplete += shopLoginForm_SaveComplete;
+ // shopAuthForm1.ShowDialog();
+ // IsOperate = false;
+ // break;
+ default:
+ dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value = !(bool)dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value;
+ break;
+ }
+ }
+
+ private void DeleteShop(int rowIndex)
+ {
+ string shopLoginName = this.dgvShop.Rows[rowIndex].Cells["colLoginName"].Value.ParseToString();
+ List dgvRows = dgvShop.Rows.Cast().Where(p =>
+ p.Cells.GetCellValueFromColumnName("colLoginName").ParseToString() == shopLoginName).ToList();
+
+ foreach(var row in dgvRows)
+ dgvShop.Rows.Remove(row);
+ GlobalConfig.ShopLoginList.RemoveAll(v => v.LoginName == shopLoginName);
+ }
+
+ private void btnCheck_Click(object sender, EventArgs e)
+ {
+ if (this.btnCheck.Text == "检测选中")
+ {
+ List shopNameList = GetCheckedList();
+ if (!shopNameList.Any())
+ {
+ BaseMsgForm.ShowError("请选择需要检测的店铺");
+ return;
+ }
+
+ this.pbLoading.Visible = true;
+ this.btnCheck.Enabled = false;
+ var t = Task.Run(() =>
+ {
+ UpdateShop();
+ CheckShopListLogin(shopNameList.Distinct().ToArray());
+ RefreshDataGridView(false);
+ });
+ Task.Run(() =>
+ {
+ while (true)
+ {
+ Thread.Sleep(1000);
+ if (t.IsCompleted || t.IsCanceled || t.IsFaulted)
+ {
+ Invoke(new Action(() =>
+ {
+ this.pbLoading.Visible = false;
+ this.btnCheck.Enabled = true;
+ }));
+ break;
+ }
+ }
+ });
+ }
+ }
+
+ private void btnRefreshCookie_Click(object sender, EventArgs e)
+ {
+ this.pbLoading.Visible = true;
+ this.splitContainer1.Panel1.Enabled = false;
+ var t = Task.Run(() =>
+ {
+ try
+ {
+ UpdateShop();
+ RefreshDataGridView(false);
+ }
+ catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); }
+ });
+ Task.Run(() =>
+ {
+ while (true)
+ {
+ Thread.Sleep(1000);
+ if (t.IsCompleted || t.IsCanceled || t.IsFaulted)
+ {
+ Invoke(new Action(() =>
+ {
+ this.pbLoading.Visible = false;
+ this.splitContainer1.Panel1.Enabled = true;
+ }));
+ break;
+ }
+ }
+ });
+ }
+
+ private List GetCheckedList()
+ {
+ List shopNameList = new List();
+ for (int i = 0; i < dgvShop.Rows.Count; i++)
+ {
+ if (dgvShop.Rows[i].Cells["colSelect"].Value.ParseToBool())
+ {
+ string shopName = dgvShop.Rows[i].Cells["colLoginName"].Value.ParseToString();
+ shopNameList.Add(shopName);
+ }
+ }
+ return shopNameList;
+ }
+
+ private List GetCheckedShopIdList()
+ {
+ List shopNameList = new List();
+ for (int i = 0; i < dgvShop.Rows.Count; i++)
+ {
+ if (dgvShop.Rows[i].Cells["colSelect"].Value.ParseToBool())
+ {
+ string shopName = dgvShop.Rows[i].Cells["colShopId"].Value.ParseToString();
+ shopNameList.Add(shopName);
+ }
+ }
+ return shopNameList;
+ }
+
+ private void btnLoginSelect_Click(object sender, EventArgs e)
+ {
+ DYShopListForm.IsOperate = true;
+ if (this.btnLoginSelect.Text == "登录选中")
+ {
+ List shopLoginNameList = GetCheckedList();
+ if (!shopLoginNameList.Any())
+ {
+ BaseMsgForm.ShowError("请选择需要登录的店铺");
+ DYShopListForm.IsOperate = false;
+ return;
+ }
+
+ shopLoginNameList = shopLoginNameList.Distinct().ToList();
+ foreach (var loginName in shopLoginNameList)
+ {
+ if (DYShopListForm.IsOperate == false)
+ break;
+
+ var shopInfo = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == loginName);
+ if (shopInfo != null && !string.IsNullOrEmpty(shopInfo.LoginName) && !string.IsNullOrEmpty(shopInfo.Password))
+ {
+ PDDShopLoginForm shopLoginForm = new PDDShopLoginForm(shopInfo);
+ shopLoginForm.openType = EnumOpenType.login;
+ shopLoginForm.SaveComplete += shopLoginForm_SaveComplete;
+ shopLoginForm.ShowDialog();
+ }
+ }
+ btnRefreshCookie_Click(null, null);
+ }
+ DYShopListForm.IsOperate = false;
+ }
+
+ private void chkAutoDrag_Click(object sender, EventArgs e)
+ {
+ GlobalConfig.TemuShopSettingParam.IsAutoDragLogin = chkAutoDrag.Checked;
+ StartUp.SaveTemuShopSettingParam();
+ foreach (var i in LstShopListFormInatance)
+ {
+ if (i != null && i.chkAutoDrag.Checked != GlobalConfig.TemuShopSettingParam.IsAutoDragLogin)
+ {
+ if (i.chkAutoDrag.InvokeRequired)
+ {
+ i.chkAutoDrag.Invoke(new Action(() =>
+ {
+ i.chkAutoDrag.Checked = GlobalConfig.TemuShopSettingParam.IsAutoDragLogin;
+ }));
+ }
+ else
+ {
+ i.chkAutoDrag.Checked = GlobalConfig.TemuShopSettingParam.IsAutoDragLogin;
+ }
+ }
+ }
+ }
+
+ private void btnRefreshAuth_Click(object sender, EventArgs e)
+ {
+ if (this.btnRefreshAuth.Text == "刷新授权")
+ {
+ List shopNameList = GetCheckedList();
+ if (!shopNameList.Any())
+ {
+ BaseMsgForm.ShowError("请选择需要刷新授权的店铺");
+ return;
+ }
+
+ UpdateShopTokens(GlobalConfig.ShopLoginList.Where(s => shopNameList.Contains(s.ShopAccount)).ToList());
+ Task.Run(() =>
+ {
+ CheckShopListLogin(shopNameList.ToArray());
+ RefreshDataGridView(false);
+ });
+ }
+ }
+
+ private void btnSearch_Click(object sender, EventArgs e)
+ {
+ //Task.Run(() =>
+ //{
+ // RefreshDataGridView(false);
+ //});
+
+ this.pbLoading.Visible = true;
+ this.splitContainer1.Panel1.Enabled = false;
+ var t = Task.Run(() =>
+ {
+ try
+ {
+ UpdateShop();
+ RefreshDataGridView(false);
+ }
+ catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); }
+ });
+ Task.Run(() =>
+ {
+ while (true)
+ {
+ Thread.Sleep(1000);
+ if (t.IsCompleted || t.IsCanceled || t.IsFaulted)
+ {
+ Invoke(new Action(() =>
+ {
+ this.pbLoading.Visible = false;
+ this.splitContainer1.Panel1.Enabled = true;
+ }));
+ break;
+ }
+ }
+ });
+ }
+
+ private void btnEmpty_Click(object sender, EventArgs e)
+ {
+ this.cmbNotes.Text = "全部";
+ this.txtShopId.Text = "";
+ this.txtShopName.Text = "";
+ }
+
+ private static string sJsSetCookie = @"
+function setCookie(name, value, daysToLive, path, domain, secure, httpOnly, sameSite) {
+ //let cookie = name + '=' + encodeURIComponent(value) + ';';
+ let cookie = name + '=' + value + ';';
+ if (daysToLive) {
+ if (typeof daysToLive === 'string' && daysToLive.toLowerCase() == 'session') {
+ cookie += 'expires=Session;';
+ }
+ else {
+ let date = new Date();
+ date.setTime(date.getTime() + (daysToLive * 24 * 60 * 60 * 1000));
+ cookie += 'expires=' + date.toUTCString() + ';';
+ }
+ }
+ if (path) {
+ cookie += 'path=' + path + ';';
+ }
+ if (domain)
+ {
+ cookie += 'domain=' + domain + ';';
+ }
+ if (secure)
+ {
+ cookie += 'secure;';
+ }
+ if (httpOnly)
+ {
+ cookie += 'HttpOnly;';
+ }
+ if (sameSite)
+ {
+ cookie += 'SameSite=' + sameSite + ';';
+ }
+ document.cookie = cookie;
+}";
+
+ private void chkUsePddWorkbanch_CheckedChanged(object sender, EventArgs e)
+ {
+ BaseMsgForm.ShowInfo("您已切换Cookie来源,请重启软件生效!");
+ NaiBa.Util.Helper.ConfigHelper.SaveConfig("use_pdd_workbanch", chkUsePddWorkbanch.Checked);
+ }
+ }
+}
diff --git a/TEMUKJD/DYForms/ShopForms/DYShopListForm.resx b/TEMUKJD/DYForms/ShopForms/DYShopListForm.resx
new file mode 100644
index 0000000..1635e91
--- /dev/null
+++ b/TEMUKJD/DYForms/ShopForms/DYShopListForm.resx
@@ -0,0 +1,189 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
\ No newline at end of file
diff --git a/TEMUKJD/DYForms/ShopForms/DYShopLoginForm.Designer.cs b/TEMUKJD/DYForms/ShopForms/DYShopLoginForm.Designer.cs
new file mode 100644
index 0000000..88111d4
--- /dev/null
+++ b/TEMUKJD/DYForms/ShopForms/DYShopLoginForm.Designer.cs
@@ -0,0 +1,384 @@
+namespace TemuKJD.DYForms.ShopForms
+{
+ partial class PDDShopLoginForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PDDShopLoginForm));
+ this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.pnlMultiLogin = new System.Windows.Forms.Panel();
+ this.cmbMultiCookieName = new DevComponents.DotNetBar.Controls.ComboBoxEx();
+ this.btnMultiLogin = new DevComponents.DotNetBar.PanelEx();
+ this.btnDel = new DevComponents.DotNetBar.PanelEx();
+ this.btnLoginAgain = new TemuKJD.UserControls.ButtonEx();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label1 = new System.Windows.Forms.Label();
+ this.btnCopyPassword = new TemuKJD.UserControls.ButtonEx();
+ this.btnCopyUserName = new TemuKJD.UserControls.ButtonEx();
+ this.txtPassWord = new System.Windows.Forms.TextBox();
+ this.txtUserName = new System.Windows.Forms.TextBox();
+ this.btnStop = new TemuKJD.UserControls.ButtonEx();
+ this.btnReload = new TemuKJD.UserControls.ButtonEx();
+ this.chkCloseAfterLogin = new DevComponents.DotNetBar.Controls.CheckBoxX();
+ this.splitContainer2 = new System.Windows.Forms.SplitContainer();
+ this.txtAddress = new System.Windows.Forms.TextBox();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
+ this.splitContainer1.Panel1.SuspendLayout();
+ this.splitContainer1.Panel2.SuspendLayout();
+ this.splitContainer1.SuspendLayout();
+ this.pnlMultiLogin.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
+ this.splitContainer2.Panel1.SuspendLayout();
+ this.splitContainer2.Panel2.SuspendLayout();
+ this.splitContainer2.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";
+ this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
+ //
+ // splitContainer1.Panel1
+ //
+ this.splitContainer1.Panel1.Controls.Add(this.pnlMultiLogin);
+ //
+ // splitContainer1.Panel2
+ //
+ this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White;
+ this.splitContainer1.Panel2.Controls.Add(this.btnLoginAgain);
+ this.splitContainer1.Panel2.Controls.Add(this.label2);
+ this.splitContainer1.Panel2.Controls.Add(this.label1);
+ this.splitContainer1.Panel2.Controls.Add(this.btnCopyPassword);
+ this.splitContainer1.Panel2.Controls.Add(this.btnCopyUserName);
+ this.splitContainer1.Panel2.Controls.Add(this.txtPassWord);
+ this.splitContainer1.Panel2.Controls.Add(this.txtUserName);
+ this.splitContainer1.Panel2.Controls.Add(this.btnStop);
+ this.splitContainer1.Panel2.Controls.Add(this.btnReload);
+ this.splitContainer1.Panel2.Controls.Add(this.chkCloseAfterLogin);
+ this.splitContainer1.Size = new System.Drawing.Size(1438, 736);
+ this.splitContainer1.SplitterDistance = 669;
+ this.splitContainer1.SplitterWidth = 3;
+ this.splitContainer1.TabIndex = 4;
+ //
+ // pnlMultiLogin
+ //
+ this.pnlMultiLogin.Controls.Add(this.cmbMultiCookieName);
+ this.pnlMultiLogin.Controls.Add(this.btnMultiLogin);
+ this.pnlMultiLogin.Controls.Add(this.btnDel);
+ this.pnlMultiLogin.Location = new System.Drawing.Point(5, 634);
+ this.pnlMultiLogin.Name = "pnlMultiLogin";
+ this.pnlMultiLogin.Size = new System.Drawing.Size(251, 31);
+ this.pnlMultiLogin.TabIndex = 461;
+ this.pnlMultiLogin.Visible = false;
+ //
+ // cmbMultiCookieName
+ //
+ this.cmbMultiCookieName.DisplayMember = "Text";
+ this.cmbMultiCookieName.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
+ this.cmbMultiCookieName.FormattingEnabled = true;
+ this.cmbMultiCookieName.ItemHeight = 18;
+ this.cmbMultiCookieName.Location = new System.Drawing.Point(3, 3);
+ this.cmbMultiCookieName.Name = "cmbMultiCookieName";
+ this.cmbMultiCookieName.Size = new System.Drawing.Size(158, 24);
+ this.cmbMultiCookieName.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
+ this.cmbMultiCookieName.TabIndex = 379;
+ this.cmbMultiCookieName.Text = "cookie1";
+ //
+ // btnMultiLogin
+ //
+ this.btnMultiLogin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnMultiLogin.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
+ this.btnMultiLogin.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.btnMultiLogin.DisabledBackColor = System.Drawing.Color.Empty;
+ this.btnMultiLogin.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.btnMultiLogin.Location = new System.Drawing.Point(185, 3);
+ this.btnMultiLogin.Name = "btnMultiLogin";
+ this.btnMultiLogin.Size = new System.Drawing.Size(60, 24);
+ this.btnMultiLogin.Style.Alignment = System.Drawing.StringAlignment.Center;
+ this.btnMultiLogin.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnMultiLogin.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnMultiLogin.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
+ this.btnMultiLogin.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
+ this.btnMultiLogin.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
+ this.btnMultiLogin.Style.ForeColor.Color = System.Drawing.Color.White;
+ this.btnMultiLogin.Style.GradientAngle = 90;
+ this.btnMultiLogin.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
+ this.btnMultiLogin.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
+ this.btnMultiLogin.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
+ this.btnMultiLogin.TabIndex = 460;
+ this.btnMultiLogin.Text = "多重登录";
+ this.btnMultiLogin.Click += new System.EventHandler(this.btnMultiLogin_Click);
+ //
+ // btnDel
+ //
+ this.btnDel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnDel.CanvasColor = System.Drawing.SystemColors.Control;
+ this.btnDel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
+ this.btnDel.DisabledBackColor = System.Drawing.Color.Empty;
+ this.btnDel.Location = new System.Drawing.Point(163, 3);
+ this.btnDel.Name = "btnDel";
+ this.btnDel.Size = new System.Drawing.Size(20, 24);
+ this.btnDel.Style.Alignment = System.Drawing.StringAlignment.Center;
+ this.btnDel.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
+ this.btnDel.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
+ this.btnDel.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
+ this.btnDel.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnDel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
+ this.btnDel.Style.GradientAngle = 90;
+ this.btnDel.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
+ this.btnDel.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
+ this.btnDel.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnDel.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnDel.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
+ this.btnDel.TabIndex = 409;
+ this.btnDel.Text = "删";
+ this.btnDel.Click += new System.EventHandler(this.btnDel_Click);
+ //
+ // btnLoginAgain
+ //
+ this.btnLoginAgain.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnLoginAgain.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnLoginAgain.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.btnLoginAgain.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnLoginAgain.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.btnLoginAgain.ForeColor = System.Drawing.Color.White;
+ this.btnLoginAgain.Location = new System.Drawing.Point(1155, 31);
+ this.btnLoginAgain.Margin = new System.Windows.Forms.Padding(2);
+ this.btnLoginAgain.Name = "btnLoginAgain";
+ this.btnLoginAgain.Size = new System.Drawing.Size(91, 25);
+ this.btnLoginAgain.TabIndex = 462;
+ this.btnLoginAgain.Text = "重新登录";
+ this.btnLoginAgain.UseVisualStyleBackColor = false;
+ this.btnLoginAgain.Click += new System.EventHandler(this.btnLoginAgain_Click);
+ //
+ // label2
+ //
+ this.label2.Location = new System.Drawing.Point(9, 35);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(44, 17);
+ this.label2.TabIndex = 378;
+ this.label2.Text = "密码";
+ this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(9, 8);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(44, 17);
+ this.label1.TabIndex = 377;
+ this.label1.Text = "用户名";
+ this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // btnCopyPassword
+ //
+ this.btnCopyPassword.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnCopyPassword.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.btnCopyPassword.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnCopyPassword.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.btnCopyPassword.ForeColor = System.Drawing.Color.White;
+ this.btnCopyPassword.Location = new System.Drawing.Point(276, 31);
+ this.btnCopyPassword.Margin = new System.Windows.Forms.Padding(2);
+ this.btnCopyPassword.Name = "btnCopyPassword";
+ this.btnCopyPassword.Size = new System.Drawing.Size(57, 25);
+ this.btnCopyPassword.TabIndex = 376;
+ this.btnCopyPassword.Text = "复制";
+ this.btnCopyPassword.UseVisualStyleBackColor = false;
+ this.btnCopyPassword.Click += new System.EventHandler(this.btnCopyPassword_Click);
+ //
+ // btnCopyUserName
+ //
+ this.btnCopyUserName.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnCopyUserName.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.btnCopyUserName.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnCopyUserName.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.btnCopyUserName.ForeColor = System.Drawing.Color.White;
+ this.btnCopyUserName.Location = new System.Drawing.Point(276, 4);
+ this.btnCopyUserName.Margin = new System.Windows.Forms.Padding(2);
+ this.btnCopyUserName.Name = "btnCopyUserName";
+ this.btnCopyUserName.Size = new System.Drawing.Size(57, 25);
+ this.btnCopyUserName.TabIndex = 375;
+ this.btnCopyUserName.Text = "复制";
+ this.btnCopyUserName.UseVisualStyleBackColor = false;
+ this.btnCopyUserName.Click += new System.EventHandler(this.btnCopyUserName_Click);
+ //
+ // txtPassWord
+ //
+ this.txtPassWord.Location = new System.Drawing.Point(53, 32);
+ this.txtPassWord.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
+ this.txtPassWord.Name = "txtPassWord";
+ this.txtPassWord.PasswordChar = '●';
+ this.txtPassWord.ReadOnly = true;
+ this.txtPassWord.Size = new System.Drawing.Size(221, 23);
+ this.txtPassWord.TabIndex = 374;
+ //
+ // txtUserName
+ //
+ this.txtUserName.Location = new System.Drawing.Point(53, 5);
+ this.txtUserName.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
+ this.txtUserName.Name = "txtUserName";
+ this.txtUserName.ReadOnly = true;
+ this.txtUserName.Size = new System.Drawing.Size(221, 23);
+ this.txtUserName.TabIndex = 373;
+ //
+ // btnStop
+ //
+ this.btnStop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnStop.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnStop.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.btnStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnStop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.btnStop.ForeColor = System.Drawing.Color.White;
+ this.btnStop.Location = new System.Drawing.Point(1342, 31);
+ this.btnStop.Margin = new System.Windows.Forms.Padding(2);
+ this.btnStop.Name = "btnStop";
+ this.btnStop.Size = new System.Drawing.Size(91, 25);
+ this.btnStop.TabIndex = 372;
+ this.btnStop.Text = "停止操作";
+ this.btnStop.UseVisualStyleBackColor = false;
+ this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
+ //
+ // btnReload
+ //
+ this.btnReload.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnReload.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
+ this.btnReload.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.btnReload.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnReload.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.btnReload.ForeColor = System.Drawing.Color.White;
+ this.btnReload.Location = new System.Drawing.Point(1249, 31);
+ this.btnReload.Margin = new System.Windows.Forms.Padding(2);
+ this.btnReload.Name = "btnReload";
+ this.btnReload.Size = new System.Drawing.Size(91, 25);
+ this.btnReload.TabIndex = 371;
+ this.btnReload.Text = "重新加载";
+ this.btnReload.UseVisualStyleBackColor = false;
+ this.btnReload.Click += new System.EventHandler(this.btnReload_Click);
+ //
+ // chkCloseAfterLogin
+ //
+ this.chkCloseAfterLogin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ //
+ //
+ //
+ this.chkCloseAfterLogin.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
+ this.chkCloseAfterLogin.Checked = true;
+ this.chkCloseAfterLogin.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.chkCloseAfterLogin.CheckValue = "Y";
+ this.chkCloseAfterLogin.Location = new System.Drawing.Point(1306, 6);
+ this.chkCloseAfterLogin.Name = "chkCloseAfterLogin";
+ this.chkCloseAfterLogin.Size = new System.Drawing.Size(135, 23);
+ this.chkCloseAfterLogin.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
+ this.chkCloseAfterLogin.TabIndex = 8;
+ this.chkCloseAfterLogin.Text = "登录成功后关闭窗口";
+ //
+ // splitContainer2
+ //
+ this.splitContainer2.BackColor = System.Drawing.Color.White;
+ this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
+ this.splitContainer2.Location = new System.Drawing.Point(1, 33);
+ this.splitContainer2.Name = "splitContainer2";
+ this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
+ //
+ // splitContainer2.Panel1
+ //
+ this.splitContainer2.Panel1.Controls.Add(this.txtAddress);
+ //
+ // splitContainer2.Panel2
+ //
+ this.splitContainer2.Panel2.Controls.Add(this.splitContainer1);
+ this.splitContainer2.Size = new System.Drawing.Size(1438, 766);
+ this.splitContainer2.SplitterDistance = 26;
+ this.splitContainer2.TabIndex = 5;
+ //
+ // txtAddress
+ //
+ this.txtAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtAddress.Location = new System.Drawing.Point(3, 3);
+ this.txtAddress.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
+ this.txtAddress.Name = "txtAddress";
+ this.txtAddress.Size = new System.Drawing.Size(1432, 23);
+ this.txtAddress.TabIndex = 7;
+ this.txtAddress.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtAddress_KeyDown);
+ //
+ // PDDShopLoginForm
+ //
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.ClientSize = new System.Drawing.Size(1440, 800);
+ this.Controls.Add(this.splitContainer2);
+ this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+ this.Name = "PDDShopLoginForm";
+ this.ShowMaximizeBox = true;
+ this.Text = "店铺登录";
+ this.TitleText = "店铺登录";
+ this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ShopLoginForm_FormClosed);
+ this.Load += new System.EventHandler(this.ShopLoginForm_Load);
+ this.Controls.SetChildIndex(this.splitContainer2, 0);
+ this.splitContainer1.Panel1.ResumeLayout(false);
+ this.splitContainer1.Panel2.ResumeLayout(false);
+ this.splitContainer1.Panel2.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
+ this.splitContainer1.ResumeLayout(false);
+ this.pnlMultiLogin.ResumeLayout(false);
+ this.splitContainer2.Panel1.ResumeLayout(false);
+ this.splitContainer2.Panel1.PerformLayout();
+ this.splitContainer2.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
+ this.splitContainer2.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.SplitContainer splitContainer1;
+ private UserControls.ButtonEx btnStop;
+ private UserControls.ButtonEx btnReload;
+ private System.Windows.Forms.TextBox txtPassWord;
+ private System.Windows.Forms.TextBox txtUserName;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label label1;
+ private UserControls.ButtonEx btnCopyPassword;
+ private UserControls.ButtonEx btnCopyUserName;
+ private System.Windows.Forms.SplitContainer splitContainer2;
+ private System.Windows.Forms.TextBox txtAddress;
+ private UserControls.ButtonEx btnLoginAgain;
+ public DevComponents.DotNetBar.Controls.CheckBoxX chkCloseAfterLogin;
+ private System.Windows.Forms.Panel pnlMultiLogin;
+ private DevComponents.DotNetBar.Controls.ComboBoxEx cmbMultiCookieName;
+ private DevComponents.DotNetBar.PanelEx btnMultiLogin;
+ private DevComponents.DotNetBar.PanelEx btnDel;
+ }
+}
\ No newline at end of file
diff --git a/TEMUKJD/DYForms/ShopForms/DYShopLoginForm.cs b/TEMUKJD/DYForms/ShopForms/DYShopLoginForm.cs
new file mode 100644
index 0000000..b76c590
--- /dev/null
+++ b/TEMUKJD/DYForms/ShopForms/DYShopLoginForm.cs
@@ -0,0 +1,1095 @@
+using AllBase;
+using AllBase.Helper;
+using AllBase.Model.Result;
+using CefSharp;
+using CefSharp.WinForms;
+//using TemuKJD.DashBoardForms;
+using TemuKJD.Helper;
+using TemuKJD.BaseForms;
+using Microsoft.Win32;
+using NaiBa.CefHelper;
+using NaiBa.CefHelper.Handler;
+using NaiBa.Util.Extension;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+//using System.Web.Hosting;
+using System.Windows.Forms;
+using Work;
+using Work.BLL.Tools;
+using TemuKJD.BLL;
+using AllBase.Model.Result.PDDResult;
+
+namespace TemuKJD.DYForms.ShopForms
+{
+ public enum EnumOpenType
+ {
+ login,
+ manage,
+ refresh_cookie,
+ }
+ public partial class PDDShopLoginForm : LRBaseForm
+ {
+ public static PDDShopLoginForm shopLoginInstance { get; set; } = null;
+
+ public string pddUploadGoodsData = "";
+ //public static AllBase.Model.Param.PDDProdParam.PDDProductUploadParam prodParam = null;
+ public string pddSourceGoodsDetail = "";
+ //public static AllBase.Model.Result.PDDResult.PDDProductDetailInfo prodInfo = null;
+ public string pddSourceGoodsDetailTemp = "";
+ public string pddSourceGoodsDecorationTemp = "";
+ public string pddSourceGoodsChanceId = "";
+ public string pddGetChanceGoodsRefere = "";
+ public string pddEditChanceGoodsRefereChanceTab = "";
+
+ public int CloseAfterSecond { get; set; }
+ public EnumOpenType openType = EnumOpenType.manage;
+ public bool isMultiLogin = false;
+ public string MultiLoginCookieName = "";
+ public string InitUrl = "";
+ private string shopCookieHead = "pinduoduo.com";
+ private string shopLoginUrl = "https://mms.pinduoduo.com/login";
+ private string shopMainUrl = "https://mms.pinduoduo.com/home";
+ public ChromiumWebBrowser cefWebBrowser = null;
+ private ShopLoginInfo shop = null;
+ private List lstShopCompany = new List();
+ private string currentUrl = "";
+
+ public PDDShopLoginForm(ShopLoginInfo shopInfo)
+ {
+ //if (shopLoginInstance != null && !shopLoginInstance.IsDisposed)
+ //{
+ // shopLoginInstance.Dispose();
+ //}
+ shopLoginInstance = this;
+
+ InitializeComponent();
+
+ this.shop = shopInfo;
+ this.txtUserName.Text = shopInfo.LoginName;
+ this.txtPassWord.Text = DataOpenSSL.DecryptString(shopInfo.Password);
+ }
+
+ private void ShopLoginForm_Load(object sender, EventArgs e)
+ {
+ this.splitContainer1.SplitterDistance = this.splitContainer1.Height - 62;
+ pddSourceGoodsDetailTemp = "";
+ pddSourceGoodsDecorationTemp = ""; // 详情装修
+ pddSourceGoodsChanceId = "";
+ pddGetChanceGoodsRefere = "";
+ pddEditChanceGoodsRefereChanceTab = "";
+
+ if (isMultiLogin && shop != null)
+ {
+ this.pnlMultiLogin.Visible = true;
+ InitMultiLoginCookies();
+ }
+
+ if (CloseAfterSecond > 0)
+ {
+ Task.Run(() =>
+ {
+ Thread.Sleep(1000 * CloseAfterSecond);
+ if (this.Created)
+ {
+ Invoke(new Action(() => { this.Close(); }));
+ }
+ });
+ }
+
+ if (!isMultiLogin)
+ AutoLogin();
+
+ CheckAndSaveShop(); //判断登录是否成功,成功则保存店铺信息和店铺cookie
+ //ClosePopWindow(); //自动关闭弹窗
+ }
+
+ ///
+ /// 判断登录,保存店铺
+ ///
+ private void CheckAndSaveShop()
+ {
+ Task.Run(() =>
+ {
+ // 自动判断是否登录成功,登录成功后记录cookie保存到服务端。
+ while (this.Created)
+ {
+ Thread.Sleep(3000);
+
+ if (!this.Created)
+ break;
+
+ if (this.shop != null && currentUrl.TrimEnd('/') == shopMainUrl)
+ {
+ if (!cefWebBrowser.GetBrowser().MainFrame.IsValid)
+ continue;
+
+ // 刷新cookie
+ if (openType == EnumOpenType.refresh_cookie)
+ {
+ string cookies = "";
+ List cookieList = CEFBrowser.GetCookieList(shopCookieHead, cefWebBrowser.GetCookieManager(null));
+ foreach (var cookie in cookieList)
+ {
+ cookie.Domain = cookie.Domain.Replace(".mms.pinduoduo.com", "mms.pinduoduo.com");
+ }
+ List cookieListNew = new List();
+ if (cookieList != null && cookieList.Count > 0)
+ {
+ foreach (var cookie in cookieList)
+ {
+ //PASS_ID同时出现两个,domain是mms.pinduoduo.com才是能登录店铺后台的
+ if (cookie.Name == "PASS_ID" && cookie.Domain != "mms.pinduoduo.com"
+ && cookieList.Any(c => c.Name == "PASS_ID" && c.Domain == "mms.pinduoduo.com"))
+ continue;
+
+ cookies += cookie.Name + "=" + cookie.Value + "; ";
+ cookieListNew.Add(cookie);
+ }
+
+ if (cookieListNew.Any(c => c.Name == "PASS_ID" && c.Value.StartsWith("windows_1")) &&
+ !cookieListNew.Any(c => c.Name == "PddBrowser"))
+ {
+ cookieList.Add(new Cookie() { Domain = ".pinduoduo.com", Name = "PddBrowser", Value = "1", Expires = DateTime.Now.AddYears(1), });
+ }
+ cookies = JsonHelper.SerializeObject(cookieListNew);
+
+ if (!string.IsNullOrEmpty(cookies))
+ {
+ shop.Cookies = cookies;
+ shop.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd");
+ DYShopListForm.UpdateServerShopCookies(shop); // 店铺cookie写入服务端
+ if (this.Created && this.chkCloseAfterLogin.Checked)
+ {
+ Invoke(new Action(() => { this.Close(); }));
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ }
+
+ if (openType!= EnumOpenType.login)
+ continue;
+
+ if (!lstShopCompany.Any(c => c.LoginName == shop.LoginName))
+ continue;
+ else // 检测到登录成功后
+ {
+ string cookies = "";
+ List cookieList = CEFBrowser.GetCookieList(shopCookieHead, cefWebBrowser.GetCookieManager(null));
+ foreach (var cookie in cookieList)
+ {
+ cookie.Domain = cookie.Domain.Replace(".mms.pinduoduo.com", "mms.pinduoduo.com");
+ }
+ List cookieListNew = new List();
+ if (cookieList != null && cookieList.Count > 0)
+ {
+ foreach (var cookie in cookieList)
+ {
+ //PASS_ID同时出现两个,domain是mms.pinduoduo.com才是能登录店铺后台的
+ if (cookie.Name == "PASS_ID" && cookie.Domain != "mms.pinduoduo.com"
+ && cookieList.Any(c => c.Name == "PASS_ID" && c.Domain == "mms.pinduoduo.com"))
+ continue;
+
+ cookies += cookie.Name + "=" + cookie.Value + "; ";
+ cookieListNew.Add(cookie);
+ }
+ //cookies = cookies.Trim().TrimEnd(';');
+ cookies = JsonHelper.SerializeObject(cookieListNew);
+ }
+
+ if (!string.IsNullOrEmpty(cookies)
+ && lstShopCompany.Any(c => c.LoginName == shop.LoginName))
+ {
+ var lstShopCompanyCopy = lstShopCompany.ToList();
+ lstShopCompanyCopy = lstShopCompanyCopy.Where(l => l.LoginName == shop.LoginName).ToList();
+
+ foreach (ShopCompany sc in lstShopCompanyCopy)
+ {
+ ShopLoginInfo newShop = new ShopLoginInfo()
+ {
+ LoginName = shop.LoginName,
+ Password = shop.Password,
+ GroupName = shop.GroupName,
+ ShopAccount = sc.AccountName,
+ ShopId = sc.AccountId,
+ SubUserName = shop.SubUserName,
+ Notes = shop.Notes,
+ AntiContents = new NaiBa.Util.ConcurrentList { sc.AntiContent },
+ };
+
+ var oldShop = GlobalConfig.ShopLoginList.FirstOrDefault(l =>
+ l.LoginName == newShop.LoginName);
+ if (oldShop == null)
+ {
+ GlobalConfig.ShopLoginList.Add(newShop);
+ ShopBLL.AddServerShop(newShop); // 店铺写入到服务端
+ }
+ else
+ {
+ oldShop.LoginName = newShop.LoginName;
+ oldShop.Password = newShop.Password;
+ oldShop.GroupName = newShop.GroupName;
+ oldShop.ShopAccount = newShop.ShopAccount;
+ oldShop.ShopId = newShop.ShopId;
+ oldShop.SubUserName = newShop.SubUserName;
+ oldShop.Notes = newShop.Notes;
+ oldShop.AntiContents.AddRange(newShop.AntiContents);
+ while (oldShop.AntiContents.Count > 50)
+ oldShop.AntiContents.RemoveAt(0);
+
+ // 店铺更新写入到服务端
+ var url = BaseClass.BuildObjString("shop/mdy_shop");
+ var data = UserLogin.GetSignaturex()
+ + "&login_name=" + oldShop.LoginName
+ + "&new_shop_id=" + oldShop.ShopId
+ + "&shop_account=" + oldShop.ShopAccount;
+ var result = GetHtml.PostUtf8(url, data);
+
+ ShopBLL.MdyAntiContent(oldShop);
+ }
+ }
+ var lstShop = GlobalConfig.ShopLoginList.Where(l => l.LoginName == shop.LoginName).ToList();
+ foreach (var s in lstShop)
+ {
+ s.LoginStatus = "登录成功";
+ s.Cookies = cookies;
+ s.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd");
+ s.pddid = ""; // 网页登录无拼多多id(pddid)
+ }
+ StartUp.SaveLocalShopLoginInfo(); // 店铺保存到本地
+ DYShopListForm.UpdateServerShopCookies(shop); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
+
+ OnSaveComplete(shop);
+ if (this.Created && this.chkCloseAfterLogin.Checked)
+ {
+ Invoke(new Action(() => { this.Close(); }));
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ }
+ }
+ });
+ }
+
+ ///
+ /// 自动关闭弹窗
+ ///
+ private void ClosePopWindow()
+ {
+ // 关闭弹窗
+ Task.Run(() =>
+ {
+ var sleepTime = 2500;
+ int i = 0;
+ while (true && i++ < 50)
+ {
+ try
+ {
+ Thread.Sleep(sleepTime);
+ var jsStr1 = "function ClosePopWindow(txt) {\r\n" +
+ " var result = 'no_pop'\r\n" +
+ " var item = document.getElementsByClassName(txt);\r\n" +
+ " for(i = 0; i < item.length; i++) {\r\n" +
+ " item[i].click();\r\n" +
+ " result = 'success'\r\n" +
+ " }\r\n" +
+ " return result;\r\n" +
+ "}\r\n" +
+ "ClosePopWindow('anticon-close-circle');\r\n" +
+ "ClosePopWindow('ant-modal-close-x');\r\n";
+ var jsStr2 = "function clickPopWindow(txt) {\r\n"
+ + "var child = document.body.firstElementChild;\r\n"
+ + "var element1 = null;\r\n"
+ + " while (child) {\r\n"
+ + " if (child.innerHTML.indexOf(txt) >= 0) {\r\n"
+ + " element1 = child;\r\n"
+ + " if (child.firstElementChild) {\r\n"
+ + " child = child.firstElementChild; continue;\r\n"
+ + " } else break;\r\n"
+ + " }\r\n"
+ + " child = child.nextElementSibling;\r\n"
+ + " }\r\n"
+ + " if (element1) {\r\n"
+ + " element1.click(); return 'success';\r\n"
+ + " } else return 'no_pop';\r\n"
+ + "}\r\n"
+ + "clickPopWindow('我知道了');\r\n"
+ + "clickPopWindow('知道了');\r\n";
+ if (cefWebBrowser != null && cefWebBrowser.IsBrowserInitialized)
+ {
+ var t1 = cefWebBrowser.GetMainFrame().EvaluateScriptAsync(jsStr1);
+ t1.Wait();
+ var t2 = cefWebBrowser.GetMainFrame().EvaluateScriptAsync(jsStr2);
+ t2.Wait();
+ if (t1.Result?.Result?.ToString() == "success" || t2.Result?.Result?.ToString() == "success")
+ sleepTime = Randomx.GetId(550, 650);
+ else
+ sleepTime = Randomx.GetId(1500, 2000);
+ }
+ }
+ catch (Exception ex) { }
+ }
+ });
+ }
+
+ ///
+ /// 自动登录店铺后台
+ ///
+ private void AutoLogin()
+ {
+ if (shop == null)
+ return;
+
+ if (cefWebBrowser == null)
+ {
+ //cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser("about:blank", false);
+ if (!string.IsNullOrEmpty(InitUrl)) //temu国际版不支持无痕模式多开,此处改为true,每次创建cefwebbrowser时删除cookie
+ cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(InitUrl, false);
+ else
+ cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(shopMainUrl, false);
+ CustomResourceRequestHandlerLocal resourceRequestHandler = new CustomResourceRequestHandlerLocal();
+ resourceRequestHandler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadComplete;
+ resourceRequestHandler.BeforeResourceLoadEvent += RequestHandler_BeforeResourceLoad;
+ cefWebBrowser.RequestHandler = new CustomRequestHandler(resourceRequestHandler);
+ var lifeSapnHandler = new LifeSpanHandlerLocal(PopWindowType.SelfWindow);
+ cefWebBrowser.LifeSpanHandler = lifeSapnHandler;
+ cefWebBrowser.KeyboardHandler = new KeyboardHandler();
+ cefWebBrowser.FrameLoadEnd += CefWebBrowser_FrameLoadEnd;
+ cefWebBrowser.AddressChanged += CefWebBrowser_AddressChanged;
+ cefWebBrowser.LoadError += CefWebBrowser_LoadError;
+ cefWebBrowser.Dock = DockStyle.Fill;
+
+ //js绑定C#对象
+ DYShopBrowserObject shopObj = new DYShopBrowserObject();
+ shopObj.OnInfoReceived += ShopObj_OnInfoReceived;
+ CefSharpSettings.WcfEnabled = true;
+ cefWebBrowser.JavascriptObjectRepository.Register(
+ name: "shopObj",
+ objectToBind: shopObj,
+ isAsync: false,
+ options: new BindingOptions { Binder = BindingOptions.DefaultBinder.Binder /*CamelCaseJavascriptNames = false*/ /*cef79*/ }
+ );
+
+ if (shop.Cookies == null)
+ shop.Cookies = "";
+ if (shop.Cookies2 == null)
+ shop.Cookies2 = "";
+
+ //var cookie = shop.Cookies;
+ //if (isMultiLogin)
+ // cookie = shop.DictMultiCookies.Keys.Contains(MultiLoginCookieName) ? shop.DictMultiCookies[MultiLoginCookieName] : "";
+ List cookieLst = new List();
+ try
+ {
+ cookieLst = JsonHelper.DeserializeJsonToList(shop.Cookies);
+ if (cookieLst == null)
+ cookieLst = new List();
+ }
+ catch
+ {
+ }
+
+ Task.Run(() =>
+ {
+ Invoke(new Action(() =>
+ {
+ splitContainer1.Panel1.Controls.Add(cefWebBrowser);
+ //cefWebBrowser.Load(shopMainUrl);
+ }));
+ // cef138必须init后方可设置或删除cookie
+ while (!cefWebBrowser.IsBrowserInitialized || !cefWebBrowser.GetBrowser().MainFrame.IsValid)
+ Thread.Sleep(20);
+ CEFBrowser.DeleteCookie(cefWebBrowser.GetCookieManager(null));
+
+ //if (cookieLst.Any(c => c.Value.StartsWith("windows_1")))
+ // cefWebBrowser.ExecuteScriptAsync("navigator.__defineGetter__('userAgent', function() { return 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12'; });");
+
+ //cef 138 如果没有设置RequestContext 可能为空,直接getCookieManager
+ //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);
+ }
+ }
+
+ if (this.openType != EnumOpenType.login)
+ {
+ //var cookie2 = shop.Cookies2;
+ //var t2 = CEFBrowser.SetCookieAsync(shopCookieHead2, cookie2, cefWebBrowser.GetCookieManager(null));
+ //t2.Wait(5000);
+ }
+
+ //根据登录的具体店铺设置local storage
+ if (!string.IsNullOrEmpty(shop.ShopId))
+ {
+ //var storageJsCode = "window.localStorage.setItem('" + "mall-info-id" + "', '" + shop.ShopId + "');\r\n";
+ //storageJsCode += "window.localStorage.setItem('" + "agentseller-mall-info-id" + "', '" + shop.ShopId + "');\r\n";
+ //while (!cefWebBrowser.IsBrowserInitialized || !cefWebBrowser.GetBrowser().MainFrame.IsValid)
+ // Thread.Sleep(20);
+ //cefWebBrowser.GetBrowser().MainFrame.ExecuteJavaScriptAsync(storageJsCode);
+ }
+
+ if (!string.IsNullOrEmpty(InitUrl))
+ cefWebBrowser.Load(InitUrl);
+ else
+ cefWebBrowser.Load(shopMainUrl);
+
+ //不是登录的话就此返回
+ if (openType != EnumOpenType.login)
+ {
+ Invoke(new Action(() =>
+ {
+ chkCloseAfterLogin.Visible = false;
+ btnLoginAgain.Visible = false;
+ }));
+ return;
+ }
+
+ for (int i = 0; i < 50; i++)
+ {
+ if (cefWebBrowser.IsLoading)
+ Thread.Sleep(100);
+ }
+ Thread.Sleep(Randomx.GetId(1500,2000));
+
+ if (!this.Created)
+ return;
+
+ while (!cefWebBrowser.Address.StartsWith(shopLoginUrl))
+ {
+ Thread.Sleep(1000);
+ if (!this.Created)
+ return;
+ }
+
+ CEFBrowser.DeleteCookie(cefWebBrowser.GetCookieManager(null));
+ InputUserNameAndPassword(cefWebBrowser, shop.LoginName, DataOpenSSL.DecryptString(shop.Password));
+ });
+ }
+ }
+ private void ShopObj_OnInfoReceived(string information)
+ {
+ //BaseMsgForm.ShowInfo(information);
+ if (!string.IsNullOrEmpty(information))
+ cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync("alert('" + information + "');");
+ }
+
+ private void CefWebBrowser_LoadError(object sender, CefSharp.LoadErrorEventArgs e)
+ {
+ }
+
+ private void CefWebBrowser_AddressChanged(object sender, CefSharp.AddressChangedEventArgs e)
+ {
+ if (this.Created && !this.Disposing && !this.IsDisposed)
+ Invoke(new Action(() =>
+ {
+ currentUrl = e.Address;
+ txtAddress.Text = e.Address;
+ }));
+ }
+
+ private void CefWebBrowser_FrameLoadEnd(object sender, CefSharp.FrameLoadEndEventArgs e)
+ {
+ //js绑定C#对象 html页面内声明绑定的C#对象
+ StringBuilder sb = new StringBuilder();
+ sb.Append("(function(){");
+ sb.Append("CefSharp.BindObjectAsync('shopObj');");
+ sb.Append("})();");
+ cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sb.ToString());
+
+ // 库存上传按钮 pdd不需要
+ if (1 == 2 && currentUrl.StartsWith("https://mms.pinduoduo.com/goods/goods_list"))
+ {
+ Task.Run(() => {
+ string sAddInputJs = @"
+ document.addEventListener('wheel', function(event) {
+ // 检查滚动方向
+ //if (event.deltaY < 0) {
+ // console.log('向上滚动');
+ //} else {
+ // console.log('向下滚动');
+ //}
+ // 或者使用 event.deltaX 来检查水平滚动
+ //if (event.deltaX < 0) {
+ // console.log('向左滚动');
+ //} else if (event.deltaX > 0) {
+ // console.log('向右滚动');
+ //}
+
+ // 阻止默认的滚动行为(如果有需要)
+ //event.preventDefault();
+
+ addGetProdButton();
+ });
+ addGetProdButton();
+
+ function addGetProdButton() {
+ var productLst = document.getElementsByClassName('goods-id');
+ for(i=0; i= 0) {
+ var sSpuId = addBtnItem.innerText.replace('\r','').replace('\n','').replace('ID: ', '');
+ addBtnItem.outerHTML = addBtnItem.outerHTML.replace("""");
+ }
+ }
+ }";
+ cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sAddInputJs);
+ });
+ }
+ }
+
+ //public Func