1更新cef版本到138 2其他一些小改动

This commit is contained in:
wule_5900x committed 2025-08-13 15:22:25 +08:00
1 parent 800ccb857d
commit c5be88568c
161 files changed
+1670 -6757

No files matched your search

@@ -24,36 +24,36 @@ namespace TemuKJD.KJDForms.ShopForms
public partial class FreightTemplateAddForm : BaseForm
{
public static List<string> ids = new List<string>();
public FreightTemplateAddForm()
{
InitializeComponent();
}
private void btnSave_Click(object sender, EventArgs e)
{
string template_name = txtTemplate.Text.ToString();
int num =0;
int num = 0;
decimal price = 0;
int addnum = 0;
decimal addPrcie = 0;
if (rbcost0.Checked)
{
num = Convert.ToInt32(txtNum.Text);
price = Convert.ToDecimal(txtPrice.Text);
addnum = Convert.ToInt32(txtAddNum.Text);
addPrcie = Convert.ToDecimal(txtAddPrcie.Text);
num = Convert.ToInt32(txtNum.Text);
price = Convert.ToDecimal(txtPrice.Text);
addnum = Convert.ToInt32(txtAddNum.Text);
addPrcie = Convert.ToDecimal(txtAddPrcie.Text);
}
var prov = cobProvince.SelectedItem as ListItem;
int pid = int.Parse(prov.Value);
var city = cobCity.SelectedItem as ListItem;
int cid = int.Parse(city.Value);
ids = dgvShop.Rows.Cast<DataGridViewRow>()
.Where(r1 => r1.Cells["colSelect"].Value.ToString().ToLower() == "true")
.Select(r2 => r2.Cells["colShopId"].Value?.ToString()).ToList();
ids = dgvShop.Rows.Cast<DataGridViewRow>()
.Where(r1 => r1.Cells["colSelect"].Value.ToString().ToLower() == "true")
.Select(r2 => r2.Cells["colShopId"].Value?.ToString()).ToList();
Task.Run(()=> {
Task.Run(() => {
for (int i = 0; i < GlobalConfig.ShopLoginList.Count; i++)
{
var shop = GlobalConfig.ShopLoginList[i];
@@ -99,32 +99,32 @@ namespace TemuKJD.KJDForms.ShopForms
data = HttpUtility.UrlEncode(data, Encoding.UTF8).Replace("%3d", "=").Replace("%26", "&");
string html = GetPostTaobaoHtml.UploadFxgPost(url, refere, true, data, shop.Cookies);
long template_id = BaseRegex.GetLongJson(ref html, "template_id");
if (template_id>0)
if (template_id > 0)
{
RefreshDataGridView(shop, "运费模板设置成功");
RefreshLog(shop.ShopAccount+"运费模板设置成功");
RefreshLog(shop.ShopAccount + "运费模板设置成功");
}
else
{
RefreshDataGridView(shop, "运费模板设置失败");
RefreshLog(shop.ShopAccount + "运费模板设置失败");
}
}
});
}
int count = 0;
public void RefreshDataGridView(ShopLoginInfo shop,string message)
public void RefreshDataGridView(ShopLoginInfo shop, string message)
{
this.Invoke(new Action(() =>
{
count++;
for (int i = 0; i < dgvShop.Rows.Count; i++)
{
if (shop.ShopId== dgvShop.Rows[i].Cells["colShopId"].Value.ToString())
if (shop.ShopId == dgvShop.Rows[i].Cells["colShopId"].Value.ToString())
{
dgvShop.Rows[i].Cells["colStatus"].Value = message;
break;
@@ -185,7 +185,7 @@ namespace TemuKJD.KJDForms.ShopForms
{
if (rbtype1.Checked)
{
label5.Text= "件以内,";
label5.Text = "件以内,";
label7.Text = "件,增加运费";
}
}
@@ -203,7 +203,7 @@ namespace TemuKJD.KJDForms.ShopForms
{
var area = cobProvince.SelectedItem as ListItem;
int id = int.Parse(area.Value);
var shop = GlobalConfig.ShopLoginList.Where(s=>s.LoginStatus=="登录成功").FirstOrDefault();
var shop = GlobalConfig.ShopLoginList.Where(s => s.LoginStatus == "登录成功").FirstOrDefault();
if (shop == null)
return;
List<ListItem> list = new List<ListItem>();
@@ -219,7 +219,7 @@ namespace TemuKJD.KJDForms.ShopForms
string temp = m[i].Groups[0].Value;
long pid = BaseRegex.GetLongJson(ref temp, "city_id");
string pname = BaseRegex.GetStringJson(ref temp, "city");
list.Add(new ListItem(pname,pid.ToString()));
list.Add(new ListItem(pname, pid.ToString()));
}
cobCity.DisplayMember = "Text";
cobCity.ValueMember = "Value";
@@ -257,7 +257,7 @@ namespace TemuKJD.KJDForms.ShopForms
{
string item = striparr[i];
string pname = item.Split(':')[0];
string pid= item.Split(':')[1];
string pid = item.Split(':')[1];
list.Add(new ListItem(pname, pid));
}
cobProvince.DisplayMember = "Text";
+36 -5
View File
@@ -957,11 +957,15 @@ namespace TemuKJD.KJDForms.ShopForms
private void btnRefreshCookie_Click(object sender, EventArgs e)
{
this.pbLoading.Visible = true;
this.btnRefreshShop.Enabled = false;
this.splitContainer1.Panel1.Enabled = false;
var t = Task.Run(() =>
{
UpdateShop();
RefreshDataGridView(false);
try
{
UpdateShop();
RefreshDataGridView(false);
}
catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); }
});
Task.Run(() =>
{
@@ -973,7 +977,7 @@ namespace TemuKJD.KJDForms.ShopForms
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
this.btnRefreshShop.Enabled = true;
this.splitContainer1.Panel1.Enabled = true;
}));
}
}
@@ -1086,9 +1090,36 @@ namespace TemuKJD.KJDForms.ShopForms
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(() =>
{
RefreshDataGridView(false);
while (true)
{
Thread.Sleep(1000);
if (t.IsCompleted || t.IsCanceled || t.IsFaulted)
{
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
this.splitContainer1.Panel1.Enabled = true;
}));
}
}
});
}
+23 -18
View File
@@ -3,7 +3,7 @@ using AllBase.Helper;
using AllBase.Model.Result;
using CefSharp;
using CefSharp.WinForms;
using TemuKJD.DashBoardForms;
//using TemuKJD.DashBoardForms;
using TemuKJD.Helper;
using TemuKJD.KJDForms.BaseForms;
using Microsoft.Win32;
@@ -20,7 +20,7 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Hosting;
//using System.Web.Hosting;
using System.Windows.Forms;
using Work;
using Work.BLL.Tools;
@@ -122,7 +122,7 @@ namespace TemuKJD.KJDForms.ShopForms
continue;
string cookies = "";
List<Cookie> cookieList = CEFBrowser.GetCookieList(shopCookieHead, cefWebBrowser.RequestContext.GetCookieManager(null));
List<Cookie> cookieList = CEFBrowser.GetCookieList(shopCookieHead, cefWebBrowser.GetCookieManager(null));
if (cookieList != null && cookieList.Count > 0)
{
foreach (var cookie in cookieList)
@@ -213,7 +213,7 @@ namespace TemuKJD.KJDForms.ShopForms
else
{
var cookie2 = shop.Cookies2;
var t = CEFBrowser.SetCookieAsync(shopCookieHead2, cookie2, cefWebBrowser.RequestContext.GetCookieManager(null));
var t = CEFBrowser.SetCookieAsync(shopCookieHead2, cookie2, cefWebBrowser.GetCookieManager(null));
t.Wait(5000);
cefWebBrowser.Load("https://agentseller.temu.com");
}
@@ -233,7 +233,7 @@ namespace TemuKJD.KJDForms.ShopForms
continue;
string cookies2 = "";
List<Cookie> cookieList2 = CEFBrowser.GetCookieList(shopCookieHead2, cefWebBrowser.RequestContext.GetCookieManager(null));
List<Cookie> cookieList2 = CEFBrowser.GetCookieList(shopCookieHead2, cefWebBrowser.GetCookieManager(null));
if (cookieList2 != null && cookieList2.Count > 0)
{
for (int i = 0; i < cookieList2.Count; i++)
@@ -375,10 +375,10 @@ namespace TemuKJD.KJDForms.ShopForms
if (cefWebBrowser == null)
{
//cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser("about:blank", false);
if (!string.IsNullOrEmpty(InitUrl))
cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(InitUrl, false);
if (!string.IsNullOrEmpty(InitUrl)) //temu国际版不支持无痕模式多开,此处改为true,每次创建cefwebbrowser时删除cookie
cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(InitUrl, true);
else
cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(shopMainUrl, false);
cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(shopMainUrl, true);
CustomResourceRequestHandlerLocal resourceRequestHandler = new CustomResourceRequestHandlerLocal();
resourceRequestHandler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadComplete;
cefWebBrowser.RequestHandler = new CustomRequestHandler(resourceRequestHandler);
@@ -413,21 +413,26 @@ namespace TemuKJD.KJDForms.ShopForms
Task.Run(() =>
{
var t = CEFBrowser.SetCookieAsync(shopCookieHead, cookie, cefWebBrowser.RequestContext.GetCookieManager(null));
t.Wait(5000);
if (this.openType != EnumOpenType.login)
{
var cookie2 = shop.Cookies2;
var t2 = CEFBrowser.SetCookieAsync(shopCookieHead2, cookie2, cefWebBrowser.RequestContext.GetCookieManager(null));
t2.Wait(5000);
}
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));
//cef 138 如果没有设置RequestContext 可能为空,直接getCookieManager
var t = CEFBrowser.SetCookieAsync(shopCookieHead, cookie, 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))
+208 -83
View File
@@ -30,138 +30,251 @@
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShopUpdateCookieForm));
this.panel2 = new System.Windows.Forms.Panel();
this.buttonEx1 = new TemuKJD.UserControls.ButtonEx();
this.label8 = new System.Windows.Forms.Label();
this.txtCookieJs = new DevComponents.DotNetBar.Controls.TextBoxX();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.txtCookieJs1 = new DevComponents.DotNetBar.Controls.TextBoxX();
this.label3 = new System.Windows.Forms.Label();
this.txtSubPassId = new System.Windows.Forms.TextBox();
this.txtLoginName = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.btnOk = new TemuKJD.UserControls.ButtonEx();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.label2 = new System.Windows.Forms.Label();
this.txtSellerTemp = new System.Windows.Forms.TextBox();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.buttonEx1 = new TemuKJD.UserControls.ButtonEx();
this.label8 = new System.Windows.Forms.Label();
this.txtCookieJs2 = new DevComponents.DotNetBar.Controls.TextBoxX();
this.btnOk = new TemuKJD.UserControls.ButtonEx();
this.label4 = new System.Windows.Forms.Label();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.White;
this.panel2.Controls.Add(this.radioButton2);
this.panel2.Controls.Add(this.radioButton1);
this.panel2.Controls.Add(this.buttonEx1);
this.panel2.Controls.Add(this.label8);
this.panel2.Controls.Add(this.txtCookieJs);
this.panel2.Controls.Add(this.txtLoginName);
this.panel2.Controls.Add(this.label1);
this.panel2.Controls.Add(this.btnOk);
this.panel2.Controls.Add(this.splitContainer1);
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(575, 492);
this.panel2.Size = new System.Drawing.Size(698, 686);
this.panel2.TabIndex = 1;
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
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.label4);
this.splitContainer1.Panel1.Controls.Add(this.txtCookieJs1);
this.splitContainer1.Panel1.Controls.Add(this.label3);
this.splitContainer1.Panel1.Controls.Add(this.txtSubPassId);
this.splitContainer1.Panel1.Controls.Add(this.txtLoginName);
this.splitContainer1.Panel1.Controls.Add(this.label1);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.label2);
this.splitContainer1.Panel2.Controls.Add(this.txtSellerTemp);
this.splitContainer1.Panel2.Controls.Add(this.radioButton2);
this.splitContainer1.Panel2.Controls.Add(this.radioButton1);
this.splitContainer1.Panel2.Controls.Add(this.buttonEx1);
this.splitContainer1.Panel2.Controls.Add(this.label8);
this.splitContainer1.Panel2.Controls.Add(this.txtCookieJs2);
this.splitContainer1.Panel2.Controls.Add(this.btnOk);
this.splitContainer1.Size = new System.Drawing.Size(698, 686);
this.splitContainer1.SplitterDistance = 340;
this.splitContainer1.TabIndex = 394;
//
// txtCookieJs1
//
this.txtCookieJs1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
//
//
//
this.txtCookieJs1.Border.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtCookieJs1.Border.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtCookieJs1.Border.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtCookieJs1.Border.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtCookieJs1.Border.Class = "CrumbBarBackgroundKey";
this.txtCookieJs1.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.txtCookieJs1.Border.PaddingBottom = 2;
this.txtCookieJs1.Border.PaddingLeft = 2;
this.txtCookieJs1.Border.PaddingRight = 2;
this.txtCookieJs1.Border.PaddingTop = 2;
this.txtCookieJs1.Location = new System.Drawing.Point(100, 101);
this.txtCookieJs1.Multiline = true;
this.txtCookieJs1.Name = "txtCookieJs1";
this.txtCookieJs1.Size = new System.Drawing.Size(569, 219);
this.txtCookieJs1.TabIndex = 398;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(16, 72);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(84, 17);
this.label3.TabIndex = 397;
this.label3.Text = "SUB_PASS_ID";
//
// txtSubPassId
//
this.txtSubPassId.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtSubPassId.Location = new System.Drawing.Point(100, 69);
this.txtSubPassId.Name = "txtSubPassId";
this.txtSubPassId.Size = new System.Drawing.Size(569, 23);
this.txtSubPassId.TabIndex = 396;
//
// txtLoginName
//
this.txtLoginName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtLoginName.Location = new System.Drawing.Point(100, 15);
this.txtLoginName.Name = "txtLoginName";
this.txtLoginName.Size = new System.Drawing.Size(569, 23);
this.txtLoginName.TabIndex = 395;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(44, 18);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 17);
this.label1.TabIndex = 394;
this.label1.Text = "登录账号";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(26, 18);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(74, 17);
this.label2.TabIndex = 399;
this.label2.Text = "seller_temp";
//
// txtSellerTemp
//
this.txtSellerTemp.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtSellerTemp.Location = new System.Drawing.Point(100, 15);
this.txtSellerTemp.Name = "txtSellerTemp";
this.txtSellerTemp.Size = new System.Drawing.Size(569, 23);
this.txtSellerTemp.TabIndex = 398;
//
// radioButton2
//
this.radioButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(354, 297);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(62, 21);
this.radioButton2.TabIndex = 397;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "国际版";
this.radioButton2.UseVisualStyleBackColor = true;
this.radioButton2.Visible = false;
//
// radioButton1
//
this.radioButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(286, 297);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(62, 21);
this.radioButton1.TabIndex = 396;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "国内版";
this.radioButton1.UseVisualStyleBackColor = true;
this.radioButton1.Visible = false;
//
// buttonEx1
//
this.buttonEx1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonEx1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.buttonEx1.Cursor = System.Windows.Forms.Cursors.Hand;
this.buttonEx1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonEx1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonEx1.ForeColor = System.Drawing.Color.White;
this.buttonEx1.Location = new System.Drawing.Point(91, 443);
this.buttonEx1.Location = new System.Drawing.Point(100, 292);
this.buttonEx1.Margin = new System.Windows.Forms.Padding(2);
this.buttonEx1.Name = "buttonEx1";
this.buttonEx1.Size = new System.Drawing.Size(171, 26);
this.buttonEx1.TabIndex = 387;
this.buttonEx1.TabIndex = 395;
this.buttonEx1.Text = "去Temu首页获取cookie js";
this.buttonEx1.UseVisualStyleBackColor = false;
this.buttonEx1.Click += new System.EventHandler(this.btnGetCookie_Click);
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(25, 60);
this.label8.Location = new System.Drawing.Point(40, 50);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(60, 17);
this.label8.TabIndex = 386;
this.label8.Text = "CookieJs";
this.label8.Size = new System.Drawing.Size(60, 34);
this.label8.TabIndex = 394;
this.label8.Text = " 国际版\r\nCookieJs";
//
// txtCookieJs
// txtCookieJs2
//
this.txtCookieJs2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
//
//
//
//
this.txtCookieJs.Border.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtCookieJs.Border.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtCookieJs.Border.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtCookieJs.Border.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtCookieJs.Border.Class = "CrumbBarBackgroundKey";
this.txtCookieJs.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.txtCookieJs.Border.PaddingBottom = 2;
this.txtCookieJs.Border.PaddingLeft = 2;
this.txtCookieJs.Border.PaddingRight = 2;
this.txtCookieJs.Border.PaddingTop = 2;
this.txtCookieJs.Location = new System.Drawing.Point(91, 58);
this.txtCookieJs.Multiline = true;
this.txtCookieJs.Name = "txtCookieJs";
this.txtCookieJs.Size = new System.Drawing.Size(452, 342);
this.txtCookieJs.TabIndex = 385;
//
// txtLoginName
//
this.txtLoginName.Location = new System.Drawing.Point(91, 29);
this.txtLoginName.Name = "txtLoginName";
this.txtLoginName.Size = new System.Drawing.Size(452, 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 = "登录账号";
this.txtCookieJs2.Border.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtCookieJs2.Border.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtCookieJs2.Border.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtCookieJs2.Border.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtCookieJs2.Border.Class = "CrumbBarBackgroundKey";
this.txtCookieJs2.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.txtCookieJs2.Border.PaddingBottom = 2;
this.txtCookieJs2.Border.PaddingLeft = 2;
this.txtCookieJs2.Border.PaddingRight = 2;
this.txtCookieJs2.Border.PaddingTop = 2;
this.txtCookieJs2.Location = new System.Drawing.Point(100, 47);
this.txtCookieJs2.Multiline = true;
this.txtCookieJs2.Name = "txtCookieJs2";
this.txtCookieJs2.Size = new System.Drawing.Size(569, 227);
this.txtCookieJs2.TabIndex = 393;
//
// btnOk
//
this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
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(488, 443);
this.btnOk.Location = new System.Drawing.Point(614, 292);
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.TabIndex = 392;
this.btnOk.Text = "保存";
this.btnOk.UseVisualStyleBackColor = false;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// radioButton1
// label4
//
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(91, 407);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(62, 21);
this.radioButton1.TabIndex = 388;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "国内版";
this.radioButton1.UseVisualStyleBackColor = true;
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(159, 407);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(62, 21);
this.radioButton2.TabIndex = 389;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "国际版";
this.radioButton2.UseVisualStyleBackColor = true;
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(40, 103);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(60, 34);
this.label4.TabIndex = 399;
this.label4.Text = " 国内版\r\nCookieJs";
//
// ShopUpdateCookieForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(577, 526);
this.ClientSize = new System.Drawing.Size(700, 720);
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")));
@@ -171,7 +284,12 @@
this.Load += new System.EventHandler(this.ShopUpdateCookieForm_Load);
this.Controls.SetChildIndex(this.panel2, 0);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -179,13 +297,20 @@
#endregion
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.SplitContainer splitContainer1;
private DevComponents.DotNetBar.Controls.TextBoxX txtCookieJs1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtSubPassId;
private System.Windows.Forms.TextBox txtLoginName;
private UserControls.ButtonEx btnOk;
private System.Windows.Forms.Label label8;
private DevComponents.DotNetBar.Controls.TextBoxX txtCookieJs;
private UserControls.ButtonEx buttonEx1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtSellerTemp;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton1;
private UserControls.ButtonEx buttonEx1;
private System.Windows.Forms.Label label8;
private DevComponents.DotNetBar.Controls.TextBoxX txtCookieJs2;
private UserControls.ButtonEx btnOk;
private System.Windows.Forms.Label label4;
}
}
+167 -147
View File
@@ -35,7 +35,7 @@ namespace TemuKJD.KJDForms.ShopForms
shopLoginInfo = shop;
updateFrom = from;
cookieVersion = _cookieVersion;
this.TitleText = "更新" + cookieVersion + "Cookie";
this.TitleText = "更新Cookie";
if (cookieVersion == "国内版")
this.radioButton1.Checked = true;
else
@@ -84,159 +84,179 @@ namespace TemuKJD.KJDForms.ShopForms
}
cookieVersion = this.radioButton1.Checked ? "国内版" : "国际版";
if (cookieVersion == "国内版")
bool ok1 = false;
bool ok2 = false;
if (this.txtCookieJs1.Text.Contains("SUB_PASS_ID") || !string.IsNullOrWhiteSpace(txtSubPassId.Text))
{
string txt = this.txtCookieJs.Text;
txt = txt.Replace("SUB_PASS_ID=;", "").Replace("_nano_fp=;", "").Replace("api_uid=;", "")
.Replace("_bee=;", "").Replace("ru2k=;", "").Replace("_f77=;", "")
.Replace("_a42=;", "").Replace("rckk=;", "").Replace("ru1k=;", "");
ok1 = GetCookie1();
}
if (this.txtCookieJs2.Text.Contains("seller_temp") || !string.IsNullOrWhiteSpace(txtSellerTemp.Text)) // 国际版
{
ok2 = GetCookie2();
}
string api_uid = BaseRegex.GetStringCookie(ref txt, "api_uid").ParseToString().Trim('\'');
string _nano_fp = BaseRegex.GetStringCookie(ref txt, "_nano_fp").ParseToString().Trim('\'');
string _bee = BaseRegex.GetStringCookie(ref txt, "_bee").ParseToString().Trim('\'');
string _f77 = BaseRegex.GetStringCookie(ref txt, "_f77").ParseToString().Trim('\'');
string _a42 = BaseRegex.GetStringCookie(ref txt, "_a42").ParseToString().Trim('\'');
string rckk = BaseRegex.GetStringCookie(ref txt, "rckk").ParseToString().Trim('\'');
string ru1k = BaseRegex.GetStringCookie(ref txt, "ru1k").ParseToString().Trim('\'');
string ru2k = BaseRegex.GetStringCookie(ref txt, "ru2k").ParseToString().Trim('\'');
string SUB_PASS_ID = BaseRegex.GetStringCookie(ref txt, "SUB_PASS_ID").ParseToString().Trim('\'');
string cookie = "api_uid=" + api_uid + ";" +
"_nano_fp=" + _nano_fp + ";" +
"_bee=" + _bee + ";" +
"_f77=" + _f77 + ";" +
"_a42=" + _a42 + ";" +
"rckk=" + rckk + ";" +
"ru1k=" + ru1k + ";" +
"ru2k=" + ru2k + ";" +
"SUB_PASS_ID=" + SUB_PASS_ID + ";";
if (string.IsNullOrEmpty(SUB_PASS_ID))
{
BaseMsgForm.ShowError("Cookie缺少关键字段,请检查!");
return;
}
var cookieShop = new ShopLoginInfo();
cookieShop.Cookies = cookie;
var data = "";
data = ShopListForm.GetShopStatus(cookieShop);
if (!data.Contains("\"success\":true"))
{
BaseMsgForm.ShowError("cookie已失效!");
return;
}
var maskMobile = BaseRegex.GetStringJson(ref data, "maskOwnerMobile");
if (!shopLoginInfo.LoginName.EndsWith(maskMobile))
{
BaseMsgForm.ShowError("cookie与店铺不匹配,请核对店铺!");
return;
}
List<ShopLoginInfo> serverShopLst = new List<ShopLoginInfo>();
var rst = AdminShopListForm.AdminGetServerShopLstForSetCookie(shopLoginInfo, serverShopLst);
if (rst != "success")
{
BaseMsgForm.ShowError(rst);
return;
}
//如果店铺没有cookie登录过,处理店铺第一次登录(分裂cookie下的所有店铺)
GetShopFirstLogin(data, serverShopLst);
if (updateFrom == SetCookieFromEnum.normal_user) // 普通用户更新本地店铺
{
var localShop = GlobalConfig.ShopLoginList.Where(v => v.LoginName == shopLoginInfo.LoginName).ToList();
foreach (var sc in localShop)
{
sc.Cookies = cookie;
sc.LoginStatus = "登录成功";
}
}
shopLoginInfo.Cookies = cookie;
shopLoginInfo.LoginStatus = "登录成功";
ShopListForm.UpdateServerShopCookies(shopLoginInfo); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
if (ok1 || ok2)
{
this.OnSaveComplete(shopLoginInfo);
this.Close();
}
else // 国际版
}
bool GetCookie1()
{
string txt = this.txtCookieJs1.Text;
txt = txt.Replace("SUB_PASS_ID=;", "").Replace("_nano_fp=;", "").Replace("api_uid=;", "")
.Replace("_bee=;", "").Replace("ru2k=;", "").Replace("_f77=;", "")
.Replace("_a42=;", "").Replace("rckk=;", "").Replace("ru1k=;", "");
string api_uid = BaseRegex.GetStringCookie(ref txt, "api_uid").ParseToString().Trim('\'');
string _nano_fp = BaseRegex.GetStringCookie(ref txt, "_nano_fp").ParseToString().Trim('\'');
string _bee = BaseRegex.GetStringCookie(ref txt, "_bee").ParseToString().Trim('\'');
string _f77 = BaseRegex.GetStringCookie(ref txt, "_f77").ParseToString().Trim('\'');
string _a42 = BaseRegex.GetStringCookie(ref txt, "_a42").ParseToString().Trim('\'');
string rckk = BaseRegex.GetStringCookie(ref txt, "rckk").ParseToString().Trim('\'');
string ru1k = BaseRegex.GetStringCookie(ref txt, "ru1k").ParseToString().Trim('\'');
string ru2k = BaseRegex.GetStringCookie(ref txt, "ru2k").ParseToString().Trim('\'');
string SUB_PASS_ID = BaseRegex.GetStringCookie(ref txt, "SUB_PASS_ID").ParseToString().Trim('\'');
if (!string.IsNullOrWhiteSpace(this.txtSubPassId.Text))
SUB_PASS_ID = this.txtSubPassId.Text.Trim();
string cookie = "api_uid=" + api_uid + ";" +
"_nano_fp=" + _nano_fp + ";" +
"_bee=" + _bee + ";" +
"_f77=" + _f77 + ";" +
"_a42=" + _a42 + ";" +
"rckk=" + rckk + ";" +
"ru1k=" + ru1k + ";" +
"ru2k=" + ru2k + ";" +
"SUB_PASS_ID=" + SUB_PASS_ID + ";";
if (string.IsNullOrEmpty(SUB_PASS_ID))
{
string txt = this.txtCookieJs.Text;
txt = txt.Replace("_bee=;", "").Replace("_nano_fp=;", "").Replace("api_uid=;", "")
.Replace("dilx=;", "").Replace("hfsc=;", "").Replace("mallid=;", "")
.Replace("njrpl=;", "").Replace("seller_temp=;", "");
string api_uid = BaseRegex.GetStringCookie(ref txt, "api_uid").ParseToString().Trim('\'');
string _nano_fp = BaseRegex.GetStringCookie(ref txt, "_nano_fp").ParseToString().Trim('\'');
string _bee = BaseRegex.GetStringCookie(ref txt, "_bee").ParseToString().Trim('\'');
string dilx = BaseRegex.GetStringCookie(ref txt, "dilx").ParseToString().Trim('\'');
string hfsc = BaseRegex.GetStringCookie(ref txt, "hfsc").ParseToString().Trim('\'');
string mallid = BaseRegex.GetStringCookie(ref txt, "mallid").ParseToString().Trim('\'');
string njrpl = BaseRegex.GetStringCookie(ref txt, "njrpl").ParseToString().Trim('\'');
string seller_temp = BaseRegex.GetStringCookie(ref txt, "seller_temp").ParseToString().Trim('\'');
string cookie2 = "api_uid=" + api_uid + ";" +
"_nano_fp=" + _nano_fp + ";" +
"_bee=" + _bee + ";" +
"dilx=" + dilx + ";" +
"hfsc=" + hfsc + ";" +
"mallid=" + mallid + ";" +
"njrpl=" + njrpl + ";" +
"seller_temp=" + seller_temp + ";";
if (string.IsNullOrEmpty(seller_temp))
{
BaseMsgForm.ShowError("Cookie缺少关键字段,请检查!\r\n请从Temu国际版https://agentseller.temu.com处获得cookie");
return;
}
var cookieShop = new ShopLoginInfo();
cookieShop.Cookies2 = cookie2;
var data = ShopListForm.GetShopStatus2(cookieShop);
if (!data.Contains("\"success\":true"))
{
BaseMsgForm.ShowError("cookie已失效!");
return;
}
//var maskMobile = BaseRegex.GetStringJson(ref data, "maskOwnerMobile");
//if (!shopLoginInfo.LoginName.EndsWith(maskMobile))
if(!data.Contains(shopLoginInfo.ShopAccount))
{
BaseMsgForm.ShowError("cookie与店铺不匹配,请核对店铺!");
return;
}
List<ShopLoginInfo> serverShopLst = new List<ShopLoginInfo>();
var rst = AdminShopListForm.AdminGetServerShopLstForSetCookie(shopLoginInfo, serverShopLst);
if (rst != "success")
{
BaseMsgForm.ShowError(rst);
return;
}
//如果店铺没有cookie登录过,处理店铺第一次登录(分裂cookie下的所有店铺)
GetShopFirstLogin(data, serverShopLst);
if (updateFrom == SetCookieFromEnum.normal_user) // 普通用户更新本地店铺
{
var localShop = GlobalConfig.ShopLoginList.Where(v => v.LoginName == shopLoginInfo.LoginName).ToList();
foreach (var sc in localShop)
{
sc.Cookies = cookie2;
sc.LoginStatus = "登录成功";
}
}
shopLoginInfo.Cookies = cookie2;
shopLoginInfo.LoginStatus = "登录成功";
ShopListForm.UpdateServerShopCookies(shopLoginInfo); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
this.OnSaveComplete(shopLoginInfo);
this.Close();
BaseMsgForm.ShowError("Cookie缺少关键字段,请检查!");
return false;
}
var cookieShop = new ShopLoginInfo();
cookieShop.Cookies = cookie;
var data = "";
data = ShopListForm.GetShopStatus(cookieShop);
if (!data.Contains("\"success\":true"))
{
BaseMsgForm.ShowError("cookie已失效!");
return false;
}
var maskMobile = BaseRegex.GetStringJson(ref data, "maskOwnerMobile");
if (!shopLoginInfo.LoginName.EndsWith(maskMobile))
{
BaseMsgForm.ShowError("cookie与国内版店铺不匹配,请核对店铺!");
return false;
}
List<ShopLoginInfo> serverShopLst = new List<ShopLoginInfo>();
var rst = AdminShopListForm.AdminGetServerShopLstForSetCookie(shopLoginInfo, serverShopLst);
if (rst != "success")
{
BaseMsgForm.ShowError(rst);
return false;
}
//如果店铺没有cookie登录过,处理店铺第一次登录(分裂cookie下的所有店铺)
GetShopFirstLogin(data, serverShopLst);
if (updateFrom == SetCookieFromEnum.normal_user) // 普通用户更新本地店铺
{
var localShop = GlobalConfig.ShopLoginList.Where(v => v.LoginName == shopLoginInfo.LoginName).ToList();
foreach (var sc in localShop)
{
sc.Cookies = cookie;
sc.LoginStatus = "登录成功";
}
}
shopLoginInfo.Cookies = cookie;
shopLoginInfo.LoginStatus = "登录成功";
ShopListForm.UpdateServerShopCookies(shopLoginInfo); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
return true;
}
bool GetCookie2()
{
string txt = this.txtCookieJs2.Text;
txt = txt.Replace("_bee=;", "").Replace("_nano_fp=;", "").Replace("api_uid=;", "")
.Replace("dilx=;", "").Replace("hfsc=;", "").Replace("mallid=;", "")
.Replace("njrpl=;", "").Replace("seller_temp=;", "");
string api_uid = BaseRegex.GetStringCookie(ref txt, "api_uid").ParseToString().Trim('\'');
string _nano_fp = BaseRegex.GetStringCookie(ref txt, "_nano_fp").ParseToString().Trim('\'');
string _bee = BaseRegex.GetStringCookie(ref txt, "_bee").ParseToString().Trim('\'');
string dilx = BaseRegex.GetStringCookie(ref txt, "dilx").ParseToString().Trim('\'');
string hfsc = BaseRegex.GetStringCookie(ref txt, "hfsc").ParseToString().Trim('\'');
string mallid = BaseRegex.GetStringCookie(ref txt, "mallid").ParseToString().Trim('\'');
string njrpl = BaseRegex.GetStringCookie(ref txt, "njrpl").ParseToString().Trim('\'');
string seller_temp = BaseRegex.GetStringCookie(ref txt, "seller_temp").ParseToString().Trim('\'');
if (!string.IsNullOrWhiteSpace(txtSellerTemp.Text))
seller_temp = txtSellerTemp.Text.Trim();
string cookie2 = "api_uid=" + api_uid + ";" +
"_nano_fp=" + _nano_fp + ";" +
"_bee=" + _bee + ";" +
"dilx=" + dilx + ";" +
"hfsc=" + hfsc + ";" +
"mallid=" + mallid + ";" +
"njrpl=" + njrpl + ";" +
"seller_temp=" + seller_temp + ";";
if (string.IsNullOrEmpty(seller_temp))
{
BaseMsgForm.ShowError("Cookie缺少关键字段,请检查!\r\n请从Temu国际版https://agentseller.temu.com处获得cookie");
return false;
}
var cookieShop = new ShopLoginInfo();
cookieShop.Cookies2 = cookie2;
var data = ShopListForm.GetShopStatus2(cookieShop);
if (!data.Contains("\"success\":true"))
{
BaseMsgForm.ShowError("cookie已失效!");
return false;
}
//var maskMobile = BaseRegex.GetStringJson(ref data, "maskOwnerMobile");
//if (!shopLoginInfo.LoginName.EndsWith(maskMobile))
if (!data.Contains(shopLoginInfo.ShopAccount))
{
BaseMsgForm.ShowError("cookie与国际版店铺不匹配,请核对店铺!");
return false;
}
List<ShopLoginInfo> serverShopLst = new List<ShopLoginInfo>();
var rst = AdminShopListForm.AdminGetServerShopLstForSetCookie(shopLoginInfo, serverShopLst);
if (rst != "success")
{
BaseMsgForm.ShowError(rst);
return false;
}
//如果店铺没有cookie登录过,处理店铺第一次登录(分裂cookie下的所有店铺)
GetShopFirstLogin(data, serverShopLst);
if (updateFrom == SetCookieFromEnum.normal_user) // 普通用户更新本地店铺
{
var localShop = GlobalConfig.ShopLoginList.Where(v => v.LoginName == shopLoginInfo.LoginName).ToList();
foreach (var sc in localShop)
{
sc.Cookies2 = cookie2;
sc.LoginStatus2 = "国际版在线";
}
}
shopLoginInfo.Cookies2 = cookie2;
shopLoginInfo.LoginStatus2 = "国际版在线";
ShopListForm.UpdateServerShopCookies(shopLoginInfo); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
return true;
}
/// <summary>