1上传草稿箱接口改用国际版 2配套相关登录、cookie保存、导出、导入等功能

This commit is contained in:
wule committed 2025-07-30 19:22:43 +08:00
1 parent c032747651
commit 096e1a450d
20 files changed
+825 -249

No files matched your search

+10
View File
@@ -69,6 +69,7 @@
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();
@@ -418,6 +419,7 @@
this.colGotoShop,
this.colShopOperate,
this.colRelogin,
this.colReLogin2,
this.colMultiLogin,
this.colApiAuth,
this.colBuyApiAuth,
@@ -575,6 +577,13 @@
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;
//
// colMultiLogin
//
this.colMultiLogin.FillWeight = 52F;
@@ -713,6 +722,7 @@
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;
+116 -78
View File
@@ -130,6 +130,7 @@ namespace TemuKJD.KJDForms.ShopForms
localShop.GroupName = serverShop.GroupName;
localShop.Notes = serverShop.Notes;
localShop.LoginStatus = serverShop.LoginStatus;
localShop.LoginStatus2 = serverShop.LoginStatus2;
localShop.AddProductRemaining = serverShop.AddProductRemaining;
localShop.OperateSubSaName = serverShop.OperateSubSaName;
if (localShop.TrialUploadCount < 0)
@@ -188,6 +189,7 @@ namespace TemuKJD.KJDForms.ShopForms
shop.CompanyName = BaseRegex.GetStringJson(ref shopStr, "company_name");
shop.Notes = BaseRegex.GetStringJson(ref shopStr, "notes");
shop.LoginStatus = BaseRegex.GetStringJson(ref shopStr, "login_status");
shop.LoginStatus2 = BaseRegex.GetStringJson(ref shopStr, "login_status2");
shop.AddProductRemaining = BaseRegex.GetIntJson(ref shopStr, "add_product_remaining");
shop.OperateSubSaName = BaseRegex.GetStringJson(ref shopStr, "operate_sub_sa_name");
//shop.PayStatus = BaseRegex.GetIntJson(ref shopStr, "shop_pay_status");
@@ -316,14 +318,15 @@ namespace TemuKJD.KJDForms.ShopForms
/// <param name="shopName">店铺名称</param>
/// <param name="shopCookies">cookies</param>
/// <param name="fromTool">工具名称(可不填写)</param>
public static void UpdateServerShopCookies(ShopLoginInfo shop, string shopCookies, string fromTool = null)
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
+ "&cookie=" + shopCookies.Replace("&", "&").Replace("%", "%").Replace("+", "+")
+ "&login_status2=" + shop.LoginStatus2
+ "&cookie=" + shop.Cookies.Replace("&", "&").Replace("%", "%").Replace("+", "+")
+ "&cookie2=" + shop.Cookies2.Replace("&", "&").Replace("%", "%").Replace("+", "+")
+ fTool;
var result = GetHtml.PostUtf8(url, data);
@@ -590,6 +593,7 @@ namespace TemuKJD.KJDForms.ShopForms
"进入",
"检测",
string.IsNullOrWhiteSpace(param.LoginStatus) ? "未登录" : param.LoginStatus.Trim(),
string.IsNullOrWhiteSpace(param.LoginStatus2) ? "国际版未登录" : param.LoginStatus2.Trim(),
"多重登录",
param.ApiAuthStatus,
param.BuyApiAuth.ApiAuthStatus,
@@ -665,23 +669,38 @@ namespace TemuKJD.KJDForms.ShopForms
{
//var loginResult = "\"code\":0";//GetShopStatus(shop);
var loginResult = GetShopStatus(shop);
if (loginResult.Contains("\"success\":true"))
{
foreach(var sc in campanys)
{
sc.LoginStatus = "登录成功";
}
}
else
if (!loginResult.Contains("\"success\":true"))
{
foreach (var sc in campanys)
{
sc.LoginStatus = "未登录";
}
}
else
{
foreach(var sc in campanys)
{
sc.LoginStatus = "登录成功";
}
}
//if (!string.IsNullOrEmpty(loginResult))
// shop.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd");
UpdateServerShopCookies(shop, shop.Cookies); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
loginResult = ShopListForm.GetShopStatus2(shop);
if (!loginResult.Contains("\"success\":true"))
{
foreach (var sc in campanys)
{
sc.LoginStatus2 = "国际版未登录";
}
}
else
{
foreach (var sc in campanys)
{
sc.LoginStatus2 = "国际版在线";
}
}
UpdateServerShopCookies(shop); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
StartUp.SaveLocalShopLoginInfo();
}
if (this.Created && isShowProgress)
@@ -698,73 +717,89 @@ namespace TemuKJD.KJDForms.ShopForms
public static string GetShopStatus(ShopLoginInfo shop)
{
//if (shop.ShopAccount == "权益服务齐全的专营店")
string url = "https://seller.kuajingmaihuo.com/bg/quiet/api/mms/userInfo";
string refere = "https://seller.kuajingmaihuo.com/";
string body = @"{}";
return KJDHttpResponse.PostResponse(shop, url, body, refere);
//HttpWebResponse response = null;
//string result;
//try
//{
// return "{\"st\":0,\"msg\":\"账号未登录\",\"code\":10008,\"data\":{},\"page\":0,\"size\":0,\"total\":0}";
// string url = "https://seller.kuajingmaihuo.com/bg/quiet/api/mms/userInfo";
// HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
// request.KeepAlive = true;
// request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
// request.Headers.Add("Anti-Content", @"0aqAfqFyXcGvBgd9Q0HiJJ7kvWcKK7muUHnJ6oMAdmem0tmm_enmX1DBr-nJNxmoki33dqHTkZU18BU2p8P72Cg2uEZ_acOOBCxGmIs-Gym4EtKpTdZ6kWRCSClS9L6maLm0imx0GIjodHtLnwpx4ayHnhzNnCXEFecZSC8lBRHb9WCAoyY79kMLIWxBMZZSZrR2_LYUJ5UXzf-82ob455f7OvJa6s895N4wiMGR4vbVH8gFN2VuCxS27RpXDa2WCQQQd6XsJPw7amSUaob6oZ2MXuYb9K3ZqoCX5-nJimNZDR0rNCLB13sYgWq9jy0Q3gjnsFY2dJQDh3ewXS2vvf2DN9IAEzInwWTY31Fn0B6-s8DqwIm61OlXsfYt1AYOOyNMLzkw5llaDaqK21f7vspAuXwnJdAdKXJXSyyEimvTyF_AYLp1gkNqBqN1_ik_jc6cKTDJtGUgFjRojR4g4zM7Ww3wfW63WQrJftYhiTIJiS1tZcsceZht3Zu3MsvyxpAbx4bxFrvL0A6OFx752XsVi04Tm6HDhgt7MmpsrTO5WD_KjgjxNX8VNoGndD0OmriAYVn6kwmZXE6Y_khGedxumIGy4sOQI36__CeiuiPIvB8itfOqd7eyqyeCIaEODrh9dSLBQz8AxQ2xt60OTn4HSiPmlwo1J0TFtjUw2DUZB68tdrINb7ugulMsaIwMKr8S0bilSKW6JuYw3oAsmK3daQfJWy3mzVowY1UwPQfTB4Ibz6uRQxHkvhsRTXkrAygGeZIc9S");
// request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
// request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36";
// request.Headers.Add("sec-ch-ua", @"""Google Chrome"";v=""137"", ""Chromium"";v=""137"", ""Not/A)Brand"";v=""24""");
// request.Headers.Add("Sec-Purpose", @"prefetch;prerender");
// request.ContentType = "application/json";
// request.Headers.Add("sec-ch-ua-mobile", @"?0");
// request.Accept = "*/*";
// request.Headers.Add("Origin", @"https://seller.kuajingmaihuo.com");
// request.Headers.Add("Purpose", @"prefetch");
// request.Headers.Add("Sec-Fetch-Site", @"same-origin");
// request.Headers.Add("Sec-Fetch-Mode", @"cors");
// request.Headers.Add("Sec-Fetch-Dest", @"empty");
// request.Referer = "https://seller.kuajingmaihuo.com/";
// request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd");
// //request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
// request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
// request.Headers.Set(HttpRequestHeader.Cookie, shop.Cookies);
// request.Method = "POST";
// request.ServicePoint.Expect100Continue = false;
// string body = @"{}";
// byte[] postBytes = System.Text.Encoding.UTF8.GetBytes(body);
// request.ContentLength = postBytes.Length;
// Stream stream = request.GetRequestStream();
// stream.Write(postBytes, 0, postBytes.Length);
// stream.Close();
// response = (HttpWebResponse)request.GetResponse();
//}
//catch (WebException ex)
//{
// if (ex.Status == WebExceptionStatus.ProtocolError)
// {
// response = (HttpWebResponse)ex.Response;
// result = GetProxyHtml.ReadResponse(response);
// return result;
// }
// else return ex.Message;
//}
//catch (Exception e)
//{
// if (response != null) response.Close();
// return e.Message;
//}
//result = GetProxyHtml.ReadResponse(response);
//return result;
}
var timeStamp = AllBase.BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now);
var _lid = timeStamp.ToString().Substring(5) + Randomx.GetId(10) + Randomx.GetId(10) + Randomx.GetId(10) + Randomx.GetId(10);
/// <summary>
/// 获取国际版登录状态
/// </summary>
/// <param name="shop"></param>
/// <returns></returns>
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 KJDHttpResponse.PostResponse2(shop, url, body, refere);
}
HttpWebResponse response = null;
string result;
try
{
//string url = "https://fxg.jinritemai.com/common/index/index?_lid=" + _lid;
//url = "https://fxg.jinritemai.com/common/index/index?_=" + timeStamp + "&appid=1";
string url = "https://seller.kuajingmaihuo.com/bg/quiet/api/mms/userInfo";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.KeepAlive = true;
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
request.Headers.Add("Anti-Content", @"0aqAfqFyXcGvBgd9Q0HiJJ7kvWcKK7muUHnJ6oMAdmem0tmm_enmX1DBr-nJNxmoki33dqHTkZU18BU2p8P72Cg2uEZ_acOOBCxGmIs-Gym4EtKpTdZ6kWRCSClS9L6maLm0imx0GIjodHtLnwpx4ayHnhzNnCXEFecZSC8lBRHb9WCAoyY79kMLIWxBMZZSZrR2_LYUJ5UXzf-82ob455f7OvJa6s895N4wiMGR4vbVH8gFN2VuCxS27RpXDa2WCQQQd6XsJPw7amSUaob6oZ2MXuYb9K3ZqoCX5-nJimNZDR0rNCLB13sYgWq9jy0Q3gjnsFY2dJQDh3ewXS2vvf2DN9IAEzInwWTY31Fn0B6-s8DqwIm61OlXsfYt1AYOOyNMLzkw5llaDaqK21f7vspAuXwnJdAdKXJXSyyEimvTyF_AYLp1gkNqBqN1_ik_jc6cKTDJtGUgFjRojR4g4zM7Ww3wfW63WQrJftYhiTIJiS1tZcsceZht3Zu3MsvyxpAbx4bxFrvL0A6OFx752XsVi04Tm6HDhgt7MmpsrTO5WD_KjgjxNX8VNoGndD0OmriAYVn6kwmZXE6Y_khGedxumIGy4sOQI36__CeiuiPIvB8itfOqd7eyqyeCIaEODrh9dSLBQz8AxQ2xt60OTn4HSiPmlwo1J0TFtjUw2DUZB68tdrINb7ugulMsaIwMKr8S0bilSKW6JuYw3oAsmK3daQfJWy3mzVowY1UwPQfTB4Ibz6uRQxHkvhsRTXkrAygGeZIc9S");
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36";
request.Headers.Add("sec-ch-ua", @"""Google Chrome"";v=""137"", ""Chromium"";v=""137"", ""Not/A)Brand"";v=""24""");
request.Headers.Add("Sec-Purpose", @"prefetch;prerender");
request.ContentType = "application/json";
request.Headers.Add("sec-ch-ua-mobile", @"?0");
request.Accept = "*/*";
request.Headers.Add("Origin", @"https://seller.kuajingmaihuo.com");
request.Headers.Add("Purpose", @"prefetch");
request.Headers.Add("Sec-Fetch-Site", @"same-origin");
request.Headers.Add("Sec-Fetch-Mode", @"cors");
request.Headers.Add("Sec-Fetch-Dest", @"empty");
request.Referer = "https://seller.kuajingmaihuo.com/";
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd");
//request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
request.Headers.Set(HttpRequestHeader.Cookie, shop.Cookies);
request.Method = "POST";
request.ServicePoint.Expect100Continue = false;
string body = @"{}";
byte[] postBytes = System.Text.Encoding.UTF8.GetBytes(body);
request.ContentLength = postBytes.Length;
Stream stream = request.GetRequestStream();
stream.Write(postBytes, 0, postBytes.Length);
stream.Close();
response = (HttpWebResponse)request.GetResponse();
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.ProtocolError)
{
response = (HttpWebResponse)ex.Response;
result = GetProxyHtml.ReadResponse(response);
return result;
}
else return ex.Message;
}
catch (Exception e)
{
if (response != null) response.Close();
return e.Message;
}
result = GetProxyHtml.ReadResponse(response);
return result;
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&region=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 KJDHttpResponse.PostResponse(shop, url, body, refere);
}
private void ShopListForm_VisibleChanged(object sender, EventArgs e)
@@ -837,9 +872,10 @@ namespace TemuKJD.KJDForms.ShopForms
IsOperate = true;
{
ShopLoginForm shopLoginForm = new ShopLoginForm(shop);
shopLoginForm.openType = EnumOpenType.manage;
//shopLoginForm.Parent = this;
shopLoginForm.openType = EnumOpenType.manage;
shopLoginForm.WindowState = FormWindowState.Maximized;
shopLoginForm.InitUrl = "https://agentseller.temu.com";
shopLoginForm.Show();
IsOperate = false;
}
@@ -890,12 +926,13 @@ namespace TemuKJD.KJDForms.ShopForms
if (cookie.StartsWith("mc-pc-cookie-captcha-token="))
continue;
if (!cookie.StartsWith("seller_temp") && !cookie.StartsWith("_nano_fp") && !cookie.StartsWith("mallid"))
cookJs += "\r\ndocument.cookie='" + cookie + "; domain=.temu.com; expires=" + DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "; path=/';";
cookJs += "\r\ndocument.cookie='" + cookie + "; domain=.temu.com; expires=" + DateTime.Now.AddDays(1).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "; path=/';";
else
cookJs += "\r\ndocument.cookie='" + cookie + "; agentseller.temu.com; expires=" + DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "; path=/';";
cookJs += "\r\ndocument.cookie='" + cookie + "; domain=agentseller.temu.com; expires=" + DateTime.Now.AddDays(1).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "; path=/';";
}
cookJs += "\r\nwindow.localStorage.setItem('" + "mall-info-id" + "', '" + shop.ShopId + "');";
cookJs += "\r\nsetTimeout(() => { window.location.href='https://seller.kuajingmaihuo.com'; }, 200)";
cookJs += "\r\nwindow.localStorage.setItem('" + "agentseller-mall-info-id" + "', '" + shop.ShopId + "');";
cookJs += "\r\nsetTimeout(() => { window.location.href='https://agentseller.temu.com'; }, 200)";
Clipboard.SetDataObject(cookJs);
BaseMsgForm.ShowInfo("复制成功");
break;
@@ -1001,6 +1038,7 @@ namespace TemuKJD.KJDForms.ShopForms
this.pbLoading.Visible = false;
this.btnCheck.Enabled = true;
}));
break;
}
}
});
@@ -162,6 +162,9 @@
<metadata name="colRelogin.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colReLogin2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colMultiLogin.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
+43 -18
View File
@@ -182,21 +182,43 @@ namespace TemuKJD.KJDForms.ShopForms
s.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd");
}
StartUp.SaveLocalShopLoginInfo(); // 店铺保存到本地
ShopListForm.UpdateServerShopCookies(shop, shop.Cookies); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
OnSaveComplete(shop);
if (this.Created && this.chkCloseAfterLogin.Checked)
{
Invoke(new Action(() => { this.Close(); }));
}
else
break;
ShopListForm.UpdateServerShopCookies(shop); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
//OnSaveComplete(shop);
//if (this.Created && this.chkCloseAfterLogin.Checked)
//{
// Invoke(new Action(() => { this.Close(); }));
//}
//else
// break;
}
//cefWebBrowser.Load(shopMainUrl2);
var shopStatusRst = ShopListForm.GetShopStatus2(shop);
if (!shopStatusRst.Contains("\"success\":true"))
{
//https://agentseller.temu.com/main/authentication?redirectUrl=https%3A%2F%2Fagentseller.temu.com&mallId=634418217169109&asCode=7PaagItuW7ZD1xw2IXNU198596bf60a24327b02d32da6d43f9bcbc40a4b925d0b2ba8c28bd
var codeRst = ShopListForm.GetShopLogin2Code(shop);
if (codeRst.Contains("\"success\":true"))
{
string code = BaseRegex.GetStringJson(ref codeRst, "code");
cefWebBrowser.Load("https://agentseller.temu.com/main/authentication" +
"?redirectUrl=https%3A%2F%2Fagentseller.temu.com&mallId=" + shop.ShopId +
"&asCode=" + code);
}
else
{
cefWebBrowser.Load("https://agentseller.temu.com");
}
}
else
{
cefWebBrowser.Load("https://agentseller.temu.com");
}
}
if (1 == 2 && this.shop != null && currentUrl.TrimEnd('/') == shopMainUrl2)
{//https://agentseller.temu.com
if (1 == 1 && this.shop != null && currentUrl.TrimEnd('/') == shopMainUrl2)
{
//https://agentseller.temu.com
if (!cefWebBrowser.GetBrowser().MainFrame.IsValid)
continue;
@@ -213,10 +235,10 @@ namespace TemuKJD.KJDForms.ShopForms
foreach (var cookie in cookieList2)
{
//SUB_PASS_ID同时出现两个,domain是seller.kuajingmaihuo.com才是能登录店铺后台的
if (cookie.Name == "seller_temp" && cookie.Domain != "agentseller.temu.com")
continue;
if (cookie.Name == "mallid" && cookie.Domain != "agentseller.temu.com")
continue;
//if (cookie.Name == "seller_temp" && cookie.Domain != "agentseller.temu.com")
// continue;
//if (cookie.Name == "mallid" && cookie.Domain != "agentseller.temu.com")
// continue;
cookies2 += cookie.Name + "=" + cookie.Value + "; ";
}
@@ -263,12 +285,12 @@ namespace TemuKJD.KJDForms.ShopForms
var lstShop = GlobalConfig.ShopLoginList.Where(l => l.LoginName == shop.LoginName).ToList();
foreach (var s in lstShop)
{
s.LoginStatus = "登录成功";
s.LoginStatus2 = "国际版在线";
s.Cookies2 = cookies2;
s.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd");
}
StartUp.SaveLocalShopLoginInfo(); // 店铺保存到本地
ShopListForm.UpdateServerShopCookies(shop, shop.Cookies); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
ShopListForm.UpdateServerShopCookies(shop); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
OnSaveComplete(shop);
if (this.Created && this.chkCloseAfterLogin.Checked)
{
@@ -380,9 +402,10 @@ namespace TemuKJD.KJDForms.ShopForms
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)
@@ -407,6 +430,7 @@ namespace TemuKJD.KJDForms.ShopForms
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);
@@ -577,7 +601,8 @@ namespace TemuKJD.KJDForms.ShopForms
// });
//}
// 库存上传按钮
if (currentUrl.StartsWith("https://seller.kuajingmaihuo.com/goods/product/list"))
if (currentUrl.StartsWith("https://seller.kuajingmaihuo.com/goods/product/list") ||
currentUrl.StartsWith("https://agentseller.temu.com/goods/list"))
{
Task.Run(() => {
string sAddInputJs = @"
+44 -16
View File
@@ -30,18 +30,22 @@
{
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.txtLoginName = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.btnOk = new TemuKJD.UserControls.ButtonEx();
this.buttonEx1 = new TemuKJD.UserControls.ButtonEx();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.panel2.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);
@@ -54,6 +58,22 @@
this.panel2.Size = new System.Drawing.Size(575, 492);
this.panel2.TabIndex = 1;
//
// buttonEx1
//
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.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.Text = "去Temu首页获取cookie js";
this.buttonEx1.UseVisualStyleBackColor = false;
this.buttonEx1.Click += new System.EventHandler(this.btnGetCookie_Click);
//
// label8
//
this.label8.AutoSize = true;
@@ -81,7 +101,7 @@
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, 370);
this.txtCookieJs.Size = new System.Drawing.Size(452, 342);
this.txtCookieJs.TabIndex = 385;
//
// txtLoginName
@@ -116,21 +136,27 @@
this.btnOk.UseVisualStyleBackColor = false;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// buttonEx1
// radioButton1
//
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.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.Text = "去Temu首页获取cookie js";
this.buttonEx1.UseVisualStyleBackColor = false;
this.buttonEx1.Click += new System.EventHandler(this.btnGetCookie_Click);
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;
//
// ShopUpdateCookieForm
//
@@ -159,5 +185,7 @@
private System.Windows.Forms.Label label8;
private DevComponents.DotNetBar.Controls.TextBoxX txtCookieJs;
private UserControls.ButtonEx buttonEx1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton1;
}
}
@@ -27,12 +27,19 @@ namespace TemuKJD.KJDForms.ShopForms
{
ShopLoginInfo shopLoginInfo = null;
SetCookieFromEnum updateFrom;
string cookieVersion = "";
public ShopUpdateCookieForm(ShopLoginInfo shop = null, SetCookieFromEnum from = SetCookieFromEnum.normal_user)
public ShopUpdateCookieForm(ShopLoginInfo shop = null, SetCookieFromEnum from = SetCookieFromEnum.normal_user, string _cookieVersion="国内版")
{
InitializeComponent();
shopLoginInfo = shop;
updateFrom = from;
cookieVersion = _cookieVersion;
this.TitleText = "更新" + cookieVersion + "Cookie";
if (cookieVersion == "国内版")
this.radioButton1.Checked = true;
else
this.radioButton2.Checked = true;
}
private void ShopUpdateCookieForm_Load(object sender, EventArgs e)
@@ -76,80 +83,158 @@ namespace TemuKJD.KJDForms.ShopForms
return;
}
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=;", "");
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))
cookieVersion = this.radioButton1.Checked ? "国内版" : "国际版";
if (cookieVersion == "国内版")
{
BaseMsgForm.ShowError("Cookie缺少关键字段,请检查!");
return;
}
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=;", "");
var cookieShop = new ShopLoginInfo();
cookieShop.Cookies = cookie;
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 + ";";
var 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 = AdminGetServerShopListForSetCookie(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)
if (string.IsNullOrEmpty(SUB_PASS_ID))
{
sc.Cookies = cookie;
sc.LoginStatus = "登录成功";
BaseMsgForm.ShowError("Cookie缺少关键字段,请检查!");
return;
}
}
shopLoginInfo.Cookies = cookie;
shopLoginInfo.LoginStatus = "登录成功";
ShopListForm.UpdateServerShopCookies(shopLoginInfo, shopLoginInfo.Cookies); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
this.OnSaveComplete(shopLoginInfo);
this.Close();
var cookieShop = new ShopLoginInfo();
cookieShop.Cookies = cookie;
var 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 = AdminGetServerShopListForSetCookie(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
this.OnSaveComplete(shopLoginInfo);
this.Close();
}
else // 国际版
{
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 = AdminGetServerShopListForSetCookie(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();
}
}
/// <summary>
@@ -256,6 +341,7 @@ namespace TemuKJD.KJDForms.ShopForms
shop.CompanyName = BaseRegex.GetStringJson(ref shopStr, "company_name");
shop.Notes = BaseRegex.GetStringJson(ref shopStr, "notes");
shop.LoginStatus = BaseRegex.GetStringJson(ref shopStr, "login_status");
shop.LoginStatus2 = BaseRegex.GetStringJson(ref shopStr, "login_status2");
shop.OperateSubSaName = BaseRegex.GetStringJson(ref shopStr, "operate_sub_sa_name");
lstRst.Add(shop);