1上传草稿箱接口改用国际版 2配套相关登录、cookie保存、导出、导入等功能
This commit is contained in:
1 parent
c032747651
commit
096e1a450d
20 files changed
+825
-249
No files matched your search
@@ -27,8 +27,8 @@ namespace AllBase
|
||||
/// <summary>
|
||||
/// 版本ID
|
||||
/// </summary>
|
||||
public static int VersionCount = 388;
|
||||
//public static int VersionCount = 388;
|
||||
public static int VersionCount = 391;
|
||||
//public static int VersionCount = 391;
|
||||
|
||||
/// <summary>
|
||||
/// 版本号
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace AllBase.Model.Result
|
||||
public string Cookies2 { get; set; } = "";
|
||||
public Dictionary<string, string> DictMultiCookies { get; set; } = new Dictionary<string, string>();
|
||||
public string LoginStatus { get; set; }
|
||||
public string LoginStatus2 { get; set; }
|
||||
public string ApiAuthStatus { get; set; }
|
||||
public List<BrandInfo> LstBrand { get; set; }
|
||||
/// <summary>
|
||||
|
||||
@@ -25,6 +25,12 @@ namespace KJD_Web.BLL
|
||||
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes");
|
||||
var search_name = RegexUtils.GetStringQuery(ref inputData, "search_name");
|
||||
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
|
||||
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids")?.Replace("'", "");
|
||||
if (shop_ids != null)
|
||||
{
|
||||
List<string> shopIdLst = shop_ids.Split(',').ToList();
|
||||
shop_ids = "'" + string.Join("','", shopIdLst) + "'";
|
||||
}
|
||||
|
||||
var page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
var page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt();
|
||||
@@ -57,6 +63,8 @@ namespace KJD_Web.BLL
|
||||
where += " and shop_id like '%" + search_id + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_name))
|
||||
where += " and shop_account like '%" + search_name + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(shop_ids))
|
||||
where += " and shop_id in (" + shop_ids + ")";
|
||||
sql += where;
|
||||
|
||||
var count = mySql.ExecuteRowCount(sql);
|
||||
@@ -69,7 +77,7 @@ namespace KJD_Web.BLL
|
||||
else
|
||||
{
|
||||
sql = "select id,login_name,login_pass,cookie,cookie2,shop_id,shop_account,sub_user_name,user_name,company_name,notes,login_status," +
|
||||
" add_product_remaining,add_product_month,add_time,mdy_time,add_sub_sa_time,operate_sub_sa_name" +
|
||||
" login_status2,add_product_remaining,add_product_month,add_time,mdy_time,add_sub_sa_time,operate_sub_sa_name" +
|
||||
" from kjd.shop where 1=1";
|
||||
|
||||
sql += where; // where 子句
|
||||
@@ -99,6 +107,7 @@ namespace KJD_Web.BLL
|
||||
company_name = row["company_name"].ToString(),
|
||||
notes = row["notes"].ToString(),
|
||||
login_status = row["login_status"].ToString(),
|
||||
login_status2 = row["login_status2"].ToString(),
|
||||
add_product_remaining = row["add_product_remaining"].ParseToInt(),
|
||||
add_product_month = row["add_product_month"].ParseToInt(),
|
||||
operate_sub_sa_name = row["operate_sub_sa_name"] as string,
|
||||
@@ -366,6 +375,7 @@ namespace KJD_Web.BLL
|
||||
string cookie = RegexUtils.GetStringQuery(ref inputData, "cookie");
|
||||
string cookie2 = RegexUtils.GetStringQuery(ref inputData, "cookie2");
|
||||
string login_status = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "login_status"));
|
||||
string login_status2 = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "login_status2"));
|
||||
|
||||
int r2 = 0;
|
||||
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
|
||||
@@ -384,6 +394,8 @@ namespace KJD_Web.BLL
|
||||
sql += " cookie2='" + cookie2 + "',";
|
||||
if (login_status != null)
|
||||
sql += " login_status='" + login_status + "',";
|
||||
if (login_status2 != null)
|
||||
sql += " login_status2='" + login_status2 + "',";
|
||||
sql = sql.TrimEnd(',');
|
||||
sql += " where login_name='" + login_name + "'";
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace KJD_Web.Model.ShopModel
|
||||
/// </summary>
|
||||
public string notes { get; set; }
|
||||
public string login_status { get; set; }
|
||||
public string login_status2 { get; set; }
|
||||
public int add_product_remaining { get; set; }
|
||||
public int add_product_month { get; set; }
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace TemuKJD.Helper
|
||||
newBrowser = null;
|
||||
return false;
|
||||
}
|
||||
else if (popWindowType == PopWindowType.NewTitleWindow)
|
||||
else if (popWindowType == PopWindowType.NewTitleWindow && popupFeatures.IsPopup)
|
||||
{
|
||||
PopData p = new PopData() { Url = targetUrl };
|
||||
if (OnPop != null)
|
||||
|
||||
@@ -73,6 +73,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
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();
|
||||
@@ -417,6 +418,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
this.colGotoShop,
|
||||
this.colShopOperate,
|
||||
this.colRelogin,
|
||||
this.colRelogin2,
|
||||
this.colMultiLogin,
|
||||
this.colApiAuth,
|
||||
this.colBuyApiAuth,
|
||||
@@ -593,6 +595,13 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
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;
|
||||
@@ -750,6 +759,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
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;
|
||||
|
||||
@@ -104,6 +104,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
"进入",
|
||||
"检测",
|
||||
string.IsNullOrWhiteSpace(shop.LoginStatus) ? "未登录" : shop.LoginStatus.Trim(),
|
||||
string.IsNullOrWhiteSpace(shop.LoginStatus2) ? "国际版未登录" : shop.LoginStatus2.Trim(),
|
||||
"多重登录",
|
||||
shop.ApiAuthStatus,
|
||||
shop.BuyApiAuth.ApiAuthStatus,
|
||||
@@ -201,11 +202,25 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop);
|
||||
adminLoginForm.openType = EnumOpenType.manage;
|
||||
adminLoginForm.WindowState = FormWindowState.Maximized;
|
||||
adminLoginForm.InitUrl = "https://agentseller.temu.com";
|
||||
adminLoginForm.Show();
|
||||
}
|
||||
IsOperate = false;
|
||||
break;
|
||||
case "复制Cookies":
|
||||
string cook = shop.Cookies;
|
||||
//cook = BaseRegex.GetStringCookie(ref cook, "SUB_PASS_ID");
|
||||
//cook = "SUB_PASS_ID=" + cook;
|
||||
//cook = "document.cookie='" + cook + "';window.location.href='https://seller.kuajingmaihuo.com'";
|
||||
//Clipboard.SetDataObject(cook);
|
||||
|
||||
//var subPassId = cook = BaseRegex.GetStringCookie(ref cook, "SUB_PASS_ID");
|
||||
//var nanoFp = cook = BaseRegex.GetStringCookie(ref cook, "_nano_fp");
|
||||
//var cookJs = sJsSetCookie;
|
||||
//cookJs += "\r\nsetCookie('SUB_PASS_ID', '" + subPassId + "', 'Session', '/', 'seller.kuajingmaihuo.com');";
|
||||
//cookJs += "\r\nsetCookie('_nano_fp', '" + nanoFp + "', 1, '/', 'seller.kuajingmaihuo.com', true);";
|
||||
//cookJs += "\r\nsetTimeout(() => { window.location.href='https://seller.kuajingmaihuo.com'; }, 200)";
|
||||
|
||||
string cookJs = "";
|
||||
foreach (var shopCook in shop.Cookies.Split(';'))
|
||||
{
|
||||
@@ -215,6 +230,11 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
//if (!cookie.StartsWith("SUB_PASS_ID") && !cookie.StartsWith("_nano_fp"))
|
||||
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 shop.Cookies2.Split(';'))
|
||||
{
|
||||
var cookie = shopCook.Trim();
|
||||
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 shop.Cookies.Split(';'))
|
||||
{
|
||||
var cookie = shopCook.Trim();
|
||||
@@ -225,8 +245,20 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
else
|
||||
cookJs += "\r\ndocument.cookie='" + cookie + "; domain=seller.kuajingmaihuo.com;';";
|
||||
}
|
||||
// 全球站cookie
|
||||
foreach (var shopCook in shop.Cookies2.Split(';'))
|
||||
{
|
||||
var cookie = shopCook.Trim();
|
||||
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.AddDays(1).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "; path=/';";
|
||||
else
|
||||
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;
|
||||
@@ -372,6 +404,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
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");
|
||||
|
||||
list.Add(shop);
|
||||
@@ -508,21 +541,36 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
{
|
||||
//var loginResult = "\"code\":0";//GetShopStatus(shop);
|
||||
var loginResult = ShopListForm.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 = "未登录";
|
||||
}
|
||||
}
|
||||
ShopListForm.UpdateServerShopCookies(shop, shop.Cookies); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
|
||||
else
|
||||
{
|
||||
foreach (var sc in campanys)
|
||||
{
|
||||
sc.LoginStatus = "登录成功";
|
||||
}
|
||||
}
|
||||
loginResult = ShopListForm.GetShopStatus2(shop);
|
||||
if (!loginResult.Contains("\"success\":true"))
|
||||
{
|
||||
foreach (var sc in campanys)
|
||||
{
|
||||
sc.LoginStatus2 = "国际版未登录";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var sc in campanys)
|
||||
{
|
||||
sc.LoginStatus2 = "国际版在线";
|
||||
}
|
||||
}
|
||||
ShopListForm.UpdateServerShopCookies(shop); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
|
||||
}
|
||||
if (this.Created && isShowProgress)
|
||||
{
|
||||
|
||||
@@ -165,6 +165,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>
|
||||
|
||||
@@ -25,6 +25,7 @@ using System.Windows.Forms;
|
||||
using Work;
|
||||
using Work.BLL.Tools;
|
||||
using TemuKJD.KJDForms.ShopForms;
|
||||
using TemuKJD.KJDForms.ToolForms;
|
||||
|
||||
namespace TemuKJD.KJDForms.AdminForms
|
||||
{
|
||||
@@ -36,8 +37,10 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
public string MultiLoginCookieName = "";
|
||||
public string InitUrl = "";
|
||||
private string shopCookieHead = "kuajingmaihuo.com";
|
||||
private string shopCookieHead2 = "temu.com";
|
||||
private string shopLoginUrl = "http://seller.kuajingmaihuo.com/login";
|
||||
private string shopMainUrl = "https://seller.kuajingmaihuo.com";
|
||||
private string shopMainUrl2 = "https://agentseller.temu.com";
|
||||
private ChromiumWebBrowser cefWebBrowser = null;
|
||||
private ShopLoginInfo shop = null;
|
||||
private List<ShopCompany> lstShopCompany = new List<ShopCompany>();
|
||||
@@ -116,10 +119,15 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
|
||||
string cookies = "";
|
||||
List<Cookie> cookieList = CEFBrowser.GetCookieList(shopCookieHead, cefWebBrowser.RequestContext.GetCookieManager(null));
|
||||
var keys = new string[] { "a42", "_bee", "_f77", "_nano_fp", "api_uid", "rckk", "ru1k", "ru2k", "SUB_PASS_ID" };
|
||||
|
||||
if (cookieList != null && cookieList.Count > 0)
|
||||
{
|
||||
foreach (var cookie in cookieList)
|
||||
{
|
||||
if (!keys.Contains(cookie.Name))
|
||||
continue;
|
||||
|
||||
//SUB_PASS_ID同时出现两个,domain是seller.kuajingmaihuo.com才是能登录店铺后台的
|
||||
if (cookie.Name == "SUB_PASS_ID" && cookie.Domain != "seller.kuajingmaihuo.com"
|
||||
&& cookieList.Any(c=>c.Name== "SUB_PASS_ID" && c.Domain == "seller.kuajingmaihuo.com"))
|
||||
@@ -165,7 +173,107 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
if (isSuccess)
|
||||
{
|
||||
shop.LoginStatus = "登录成功";
|
||||
ShopListForm.UpdateServerShopCookies(shop, shop.Cookies); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
|
||||
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 == 1 && this.shop != null && currentUrl.TrimEnd('/') == shopMainUrl2)
|
||||
{
|
||||
//https://agentseller.temu.com
|
||||
if (!cefWebBrowser.GetBrowser().MainFrame.IsValid)
|
||||
continue;
|
||||
|
||||
if (openType != EnumOpenType.login)
|
||||
continue;
|
||||
|
||||
if (!lstShopCompany.Any(c => c.LoginName == shop.LoginName))
|
||||
continue;
|
||||
|
||||
string cookies2 = "";
|
||||
List<Cookie> cookieList2 = CEFBrowser.GetCookieList(shopCookieHead2, cefWebBrowser.RequestContext.GetCookieManager(null));
|
||||
if (cookieList2 != null && cookieList2.Count > 0)
|
||||
{
|
||||
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")
|
||||
// continue;
|
||||
|
||||
cookies2 += cookie.Name + "=" + cookie.Value + "; ";
|
||||
}
|
||||
cookies2 = cookies2.Trim().TrimEnd(';');
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(cookies2)
|
||||
&& lstShopCompany.Any(c => c.LoginName == shop.LoginName))
|
||||
{
|
||||
var lstShopCompanyCopy = lstShopCompany.ToList();
|
||||
lstShopCompanyCopy = lstShopCompanyCopy.Where(l => l.LoginName == shop.LoginName).ToList();
|
||||
bool isSuccess = true;
|
||||
|
||||
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,
|
||||
UserName = shop.UserName,
|
||||
Notes = shop.Notes,
|
||||
Cookies2 = cookies2,
|
||||
};
|
||||
|
||||
if (string.IsNullOrEmpty(shop.Cookies)) // 有cookie的认为是已登录过的
|
||||
{
|
||||
newShop.LoginStatus2 = "国际版在线";
|
||||
newShop.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd");
|
||||
var html = AdminShopForm.AdminAddServerShop(newShop); // 店铺写入到服务端
|
||||
if (!html.Contains("\"code\":200"))
|
||||
isSuccess = false;
|
||||
}
|
||||
}
|
||||
shop.Cookies2 = cookies2;
|
||||
if (isSuccess)
|
||||
{
|
||||
shop.LoginStatus2 = "国际版在线";
|
||||
ShopListForm.UpdateServerShopCookies(shop); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
|
||||
}
|
||||
OnSaveComplete(shop);
|
||||
if (this.Created && this.chkCloseAfterLogin.Checked)
|
||||
@@ -259,8 +367,11 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
CustomResourceRequestHandlerLocal resourceRequestHandler = new CustomResourceRequestHandlerLocal();
|
||||
resourceRequestHandler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadComplete;
|
||||
cefWebBrowser.RequestHandler = new CustomRequestHandler(resourceRequestHandler);
|
||||
var lifeSapnHandler = new LifeSpanHandlerLocal(PopWindowType.SelfWindow);
|
||||
cefWebBrowser.LifeSpanHandler = lifeSapnHandler;
|
||||
//var lifeSpanHandler = new LifeSpanHandlerLocal(PopWindowType.SelfWindow);
|
||||
var lifeSpanHandler = new LifeSpanHandlerLocal(PopWindowType.NewTitleWindow);
|
||||
lifeSpanHandler.parent = cefWebBrowser;
|
||||
lifeSpanHandler.OnPop += MainLifeHandler_OnPop;
|
||||
cefWebBrowser.LifeSpanHandler = lifeSpanHandler;
|
||||
cefWebBrowser.KeyboardHandler = new KeyboardHandler();
|
||||
cefWebBrowser.FrameLoadEnd += CefWebBrowser_FrameLoadEnd;
|
||||
cefWebBrowser.AddressChanged += CefWebBrowser_AddressChanged;
|
||||
@@ -280,16 +391,21 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
|
||||
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] : "";
|
||||
|
||||
var cookie2 = shop.Cookies2;
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var t = CEFBrowser.SetCookieAsync(shopCookieHead, cookie, cefWebBrowser.RequestContext.GetCookieManager(null));
|
||||
t.Wait(5000);
|
||||
t = CEFBrowser.SetCookieAsync(shopCookieHead2, cookie2, cefWebBrowser.RequestContext.GetCookieManager(null));
|
||||
t.Wait(5000);
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
@@ -300,9 +416,14 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
//根据登录的具体店铺设置local storage
|
||||
if (!string.IsNullOrEmpty(shop.ShopId))
|
||||
{
|
||||
var storageJsCode = "window.localStorage.setItem('" + "mall-info-id" + "', '" + shop.ShopId + "');\r\n";
|
||||
while (!cefWebBrowser.IsBrowserInitialized || !cefWebBrowser.GetBrowser().MainFrame.IsValid)
|
||||
Thread.Sleep(20);
|
||||
|
||||
var storageJsCode = "window.localStorage.setItem('" + "mall-info-id" + "', '" + shop.ShopId + "');\r\n";
|
||||
cefWebBrowser.GetBrowser().MainFrame.ExecuteJavaScriptAsync(storageJsCode);
|
||||
|
||||
//agentseller-mall-info-id
|
||||
storageJsCode = "window.localStorage.setItem('" + "agentseller-mall-info-id" + "', '" + shop.ShopId + "');\r\n";
|
||||
cefWebBrowser.GetBrowser().MainFrame.ExecuteJavaScriptAsync(storageJsCode);
|
||||
}
|
||||
|
||||
@@ -322,7 +443,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
if (cefWebBrowser.IsLoading)
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
Thread.Sleep(Randomx.GetId(1500,2000));
|
||||
Thread.Sleep(Randomx.GetId(1500, 2000));
|
||||
|
||||
//设置 local storage
|
||||
//if (GlobalConfig.dicLocalStorage != null)
|
||||
@@ -349,6 +470,24 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
});
|
||||
}
|
||||
}
|
||||
private void MainLifeHandler_OnPop(object sender, PopData e)
|
||||
{
|
||||
var targetUrl = e.Url;
|
||||
var lifeHandler = sender as LifeSpanHandlerLocal;
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
if (lifeHandler.parent != null)
|
||||
{
|
||||
var cookies = CEFBrowser.GetCookieList("", lifeHandler.parent.RequestContext.GetCookieManager(null));
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
CefForm cefForm = new CefForm(targetUrl, cookies);
|
||||
cefForm.Show();
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void ShopObj_OnInfoReceived(string information)
|
||||
{
|
||||
@@ -470,7 +609,8 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
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 = @"
|
||||
|
||||
@@ -71,6 +71,74 @@ namespace TemuKJD.KJDForms
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 国际版调用接口
|
||||
/// </summary>
|
||||
/// <param name="shop"></param>
|
||||
/// <param name="_url"></param>
|
||||
/// <param name="_data"></param>
|
||||
/// <param name="referer"></param>
|
||||
/// <returns></returns>
|
||||
public static string PostResponse2(ShopLoginInfo shop, string _url, string _data, string referer)
|
||||
{
|
||||
HttpWebResponse response = null;
|
||||
string result;
|
||||
try
|
||||
{
|
||||
string url = _url;
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
|
||||
request.KeepAlive = true;
|
||||
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
|
||||
request.Headers.Add("Anti-Content", @"0aqWfxid0jQ8y99ATT_XGgVxsfy4jtTaQmZlRu9wW2g__9Zt4t2lsnyOevFqnSSUyXZMpPqVZUDOdlErZ7OEmhxNBhLjtyetvpWiGLBc30pcnYGHrW-JahQSJXHSVaz3_sGqB4FzfTWB9eAO-4-p957LPKscrKS9qQPTVDizDQXbx3zEPk64Cn3aUxjMeU5ovt737YczpQRmqtpc7Riil2boSIvCGPfPppc9UscZP5f4SVEsH2sgGTTc4shYwJJ3R-p-dr3nnmhksQlh20daGKfN-yWRSt_VoXlVtkh6KfXOngZhGQwnS45_G9hBY_bXH2zy4ym32OSSWmk0Z2NYg4nW7l30uIUw9mXV2mwYmN9mE1ngv3WMWCAtf5LupF71ciYOdouvE3uTYzqQMjT1i_4nRszBLSRRQbi7wMPIsxJOwR6OUiYv7DfcoerokcZMsplG-PORulS0avRh-BlkZCUGIir2GAmFjtAAt1rYH2evGrbSQo_7vRxiIHi9778FABRQwR8v");
|
||||
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("mallid", shop.ShopId);
|
||||
//request.Headers.Add("sec-ch-ua", @"""Google Chrome"";v=""137"", ""Chromium"";v=""137"", ""Not/A)Brand"";v=""24""");
|
||||
request.Headers.Add("sec-ch-ua", @"""Not)A;Brand"";v=""8"", ""Chromium"";v=""138"", ""Google Chrome"";v=""138""");
|
||||
request.ContentType = "application/json";
|
||||
request.Headers.Add("sec-ch-ua-mobile", @"?0");
|
||||
request.Accept = "*/*";
|
||||
request.Headers.Add("Origin", @"https://agentseller.temu.com");
|
||||
request.Headers.Add("Sec-Fetch-Site", @"same-origin");
|
||||
request.Headers.Add("Sec-Fetch-Mode", @"cors");
|
||||
request.Headers.Add("Sec-Fetch-Dest", @"empty");
|
||||
request.Referer = referer;
|
||||
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd");
|
||||
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
|
||||
request.Headers.Set(HttpRequestHeader.Cookie, shop.Cookies2);
|
||||
|
||||
request.Method = "POST";
|
||||
request.ServicePoint.Expect100Continue = false;
|
||||
|
||||
string body = _data;
|
||||
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 GetResponse(ShopLoginInfo shop, string _url, string referer="")
|
||||
{
|
||||
HttpWebResponse response = null;
|
||||
|
||||
@@ -105,6 +105,9 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
lstAdminTemuDBProductSelect.AddRange(list);
|
||||
this.ucSplitPage1.TotalPage = pageCount;
|
||||
|
||||
var shopIdLst = list.Select(p => p.shop_id).Distinct().ToList();
|
||||
shopLst = AdminGetServerShopLst(shopIdLst);
|
||||
|
||||
if (defaultBitmap == null)
|
||||
defaultBitmap = new Bitmap(80, 80);
|
||||
// 获取Bitmap的Graphics对象
|
||||
@@ -123,7 +126,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
prodSelect.shop_id,
|
||||
prodSelect.shop_account,
|
||||
"进店",
|
||||
"登录",
|
||||
shopLst.FirstOrDefault(s=>s.ShopId == prodSelect.shop_id)?.LoginStatus2 == "国际版在线" ? "在线" : "登录",
|
||||
"导入Cookies",
|
||||
"复制Cookies",
|
||||
prodSelect.spu_id,
|
||||
@@ -301,7 +304,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
{
|
||||
var shop = GetShop(shopId);
|
||||
AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop);
|
||||
adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" +
|
||||
//adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" +
|
||||
adminLoginForm.InitUrl = "https://agentseller.temu.com/goods/edit?productDraftId=" +
|
||||
draftId + "&from=productDraftList";
|
||||
adminLoginForm.openType = EnumOpenType.manage;
|
||||
adminLoginForm.WindowState = FormWindowState.Maximized;
|
||||
@@ -312,7 +316,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
{
|
||||
var shop = GetShop(shopId);
|
||||
AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop);
|
||||
adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product/draft";
|
||||
//adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product/draft";
|
||||
adminLoginForm.InitUrl = "https://agentseller.temu.com/goods/draft";
|
||||
adminLoginForm.openType = EnumOpenType.manage;
|
||||
adminLoginForm.WindowState = FormWindowState.Maximized;
|
||||
adminLoginForm.ShowDialog();
|
||||
@@ -326,13 +331,20 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
shopLoginForm.openType = EnumOpenType.login;
|
||||
shopLoginForm.SaveComplete += ShopLoginForm_SaveComplete;
|
||||
shopLoginForm.ShowDialog();
|
||||
foreach (DataGridViewRow row in this.dgvSelectProduct.Rows)
|
||||
{
|
||||
if (row.Cells["colSelectId"].Value.ParseToString() == shop.ShopId)
|
||||
{
|
||||
row.Cells["colLogin"].Value = shop.LoginStatus2 == "国际版在线" ? "在线" : "登录";
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "导入Cookies":
|
||||
{
|
||||
var shop = GetShop(shopId);
|
||||
ShopUpdateCookieForm updateCookieForm = new ShopUpdateCookieForm(shop, SetCookieFromEnum.sa);
|
||||
ShopUpdateCookieForm updateCookieForm = new ShopUpdateCookieForm(shop, SetCookieFromEnum.sa, "国际版");
|
||||
updateCookieForm.SaveComplete += UpdateCookieForm_SaveComplete;
|
||||
updateCookieForm.ShowDialog();
|
||||
}
|
||||
@@ -349,6 +361,11 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
//if (!cookie.StartsWith("SUB_PASS_ID") && !cookie.StartsWith("_nano_fp"))
|
||||
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 shop.Cookies2.Split(';'))
|
||||
{
|
||||
var cookie = shopCook.Trim();
|
||||
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 shop.Cookies.Split(';'))
|
||||
{
|
||||
var cookie = shopCook.Trim();
|
||||
@@ -359,8 +376,20 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
else
|
||||
cookJs += "\r\ndocument.cookie='" + cookie + "; domain=seller.kuajingmaihuo.com;';";
|
||||
}
|
||||
// 全球站cookie
|
||||
foreach (var shopCook in shop.Cookies2.Split(';'))
|
||||
{
|
||||
var cookie = shopCook.Trim();
|
||||
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.AddDays(1).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "; path=/';";
|
||||
else
|
||||
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("复制成功");
|
||||
}
|
||||
@@ -504,6 +533,15 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
continue;
|
||||
}
|
||||
|
||||
if (shop.LoginStatus2 != "国际版在线")
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row.Cells["colOpResult"].Value = "店铺" + shop.LoginStatus2;
|
||||
}));
|
||||
continue;
|
||||
}
|
||||
|
||||
//if (prod.status != "待上传")
|
||||
//{
|
||||
// Invoke(new Action(() =>
|
||||
@@ -543,7 +581,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
if (result.Contains("登录过期"))
|
||||
{
|
||||
shop.LoginStatus = "未登录";
|
||||
ShopForms.ShopListForm.UpdateServerShopCookies(shop, shop.Cookies); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
|
||||
ShopForms.ShopListForm.UpdateServerShopCookies(shop); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -607,12 +645,19 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
}
|
||||
|
||||
public ShopLoginInfo AdminGetServerShop(string shop_id)
|
||||
{
|
||||
List<ShopLoginInfo> list = AdminGetServerShopLst(new string[] { shop_id }.ToList());
|
||||
return list.FirstOrDefault();
|
||||
}
|
||||
|
||||
public List<ShopLoginInfo> AdminGetServerShopLst(List<string> shop_ids)
|
||||
{
|
||||
List<ShopLoginInfo> list = new List<ShopLoginInfo>();
|
||||
|
||||
var url = BaseClass.BuildObjString("shop/admin_get_shop_list");
|
||||
var data = UserLogin.GetSignaturex() +
|
||||
"&search_id=" + shop_id;
|
||||
"&shop_ids='" + string.Join("','", shop_ids) + "'";
|
||||
data += "&page_size=200";
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
@@ -621,12 +666,12 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
if (string.IsNullOrEmpty(html)
|
||||
|| !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass"))
|
||||
{
|
||||
return null;
|
||||
return new List<ShopLoginInfo>();
|
||||
}
|
||||
|
||||
var jArr = JObject.Parse(html)["data"];
|
||||
if (jArr.Count() == 0)
|
||||
return null;
|
||||
return new List<ShopLoginInfo>();
|
||||
|
||||
foreach (JObject jObj in jArr)
|
||||
{
|
||||
@@ -649,11 +694,12 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
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");
|
||||
|
||||
list.Add(shop);
|
||||
}
|
||||
return list.FirstOrDefault();
|
||||
return list;
|
||||
}
|
||||
|
||||
public static TemuDBProduct GetProductDetail(string prodDbId)
|
||||
@@ -699,7 +745,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
|
||||
string UploadProduct(ShopLoginInfo shop, TemuDBProduct dbProd, TemuDBProductSelect selectProd)
|
||||
{
|
||||
if (shop == null || string.IsNullOrEmpty(shop.ShopId) || shop.LoginStatus != "登录成功")
|
||||
if (shop == null || string.IsNullOrEmpty(shop.ShopId) || shop.LoginStatus != "登录成功" || shop.LoginStatus2 != "国际版在线")
|
||||
{
|
||||
return "店铺为空或未登录!";
|
||||
}
|
||||
@@ -1030,28 +1076,34 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
|
||||
private string AddDraft(ShopLoginInfo shop, string catId)
|
||||
{
|
||||
string url = "https://seller.kuajingmaihuo.com/bg-visage-mms/product/draft/add";
|
||||
string refere = "https://seller.kuajingmaihuo.com/goods/product-create/category?from=productList";
|
||||
//string url = "https://seller.kuajingmaihuo.com/bg-visage-mms/product/draft/add";
|
||||
string url = "https://agentseller.temu.com/visage-agent-seller/product/draft/add";
|
||||
//string refere = "https://seller.kuajingmaihuo.com/goods/product-create/category?from=productList";
|
||||
string refere = "https://agentseller.temu.com/goods/create/category";
|
||||
string body = @"{""catId"":" + catId + "}";
|
||||
return KJDHttpResponse.PostResponse(shop, url, body, refere);
|
||||
return KJDHttpResponse.PostResponse2(shop, url, body, refere);
|
||||
}
|
||||
|
||||
private string CreateSizeSpec(ShopLoginInfo shop, string draftId, TemuSizeSpecParam sizeParam)
|
||||
{
|
||||
string url = "https://seller.kuajingmaihuo.com/bg-anniston-mms/sizespec/createSizeSpec";
|
||||
//string url = "https://seller.kuajingmaihuo.com/bg-anniston-mms/sizespec/createSizeSpec";
|
||||
string url = "https://agentseller.temu.com/anniston-agent-seller/sizespec/createSizeSpec";
|
||||
string body = JsonHelper.SerializeObject(sizeParam);
|
||||
string refere = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId="+
|
||||
draftId + "&from=productDraftList";
|
||||
return KJDHttpResponse.PostResponse(shop, url, body, refere);
|
||||
//string refere = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId="+
|
||||
// draftId + "&from=productDraftList";
|
||||
string refere = "https://agentseller.temu.com/goods/edit?productDraftId=" + draftId + "&from=productDraftList";
|
||||
return KJDHttpResponse.PostResponse2(shop, url, body, refere);
|
||||
}
|
||||
|
||||
private string SaveDraft(ShopLoginInfo shop, string draftId, TemuProductParam prodParam)
|
||||
{
|
||||
string url = "https://seller.kuajingmaihuo.com/bg-visage-mms/product/draft/save";
|
||||
//string url = "https://seller.kuajingmaihuo.com/bg-visage-mms/product/draft/save";
|
||||
string url = "https://agentseller.temu.com/visage-agent-seller/product/draft/save";
|
||||
string body = JsonHelper.SerializeObject(prodParam);
|
||||
string refere = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" +
|
||||
draftId + "&from=productDraftList";
|
||||
return KJDHttpResponse.PostResponse(shop, url, body, refere);
|
||||
//string refere = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" +
|
||||
// draftId + "&from=productDraftList";
|
||||
string refere = "https://agentseller.temu.com/goods/edit?productDraftId=" + draftId + "&from=productDraftList";
|
||||
return KJDHttpResponse.PostResponse2(shop, url, body, refere);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -105,6 +105,9 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
lstAdminTemuDBProductSelect.AddRange(list);
|
||||
this.ucSplitPage1.TotalPage = pageCount;
|
||||
|
||||
var shopIdLst = list.Select(p => p.shop_id).Distinct().ToList();
|
||||
shopLst = AdminGetServerShopLst(shopIdLst);
|
||||
|
||||
if (defaultBitmap == null)
|
||||
defaultBitmap = new Bitmap(80, 80);
|
||||
// 获取Bitmap的Graphics对象
|
||||
@@ -123,7 +126,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
prodSelect.shop_id,
|
||||
prodSelect.shop_account,
|
||||
"进店",
|
||||
"登录",
|
||||
shopLst.FirstOrDefault(s => s.ShopId == prodSelect.shop_id)?.LoginStatus2 == "国际版在线" ? "在线" : "登录",
|
||||
"导入Cookies",
|
||||
"复制Cookies",
|
||||
prodSelect.spu_id,
|
||||
@@ -301,7 +304,8 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
{
|
||||
var shop = GetShop(shopId);
|
||||
AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop);
|
||||
adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" +
|
||||
//adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" +
|
||||
adminLoginForm.InitUrl = "https://agentseller.temu.com/goods/edit?productDraftId=" +
|
||||
draftId + "&from=productDraftList";
|
||||
adminLoginForm.openType = EnumOpenType.manage;
|
||||
adminLoginForm.WindowState = FormWindowState.Maximized;
|
||||
@@ -312,7 +316,8 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
{
|
||||
var shop = GetShop(shopId);
|
||||
AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop);
|
||||
adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product/draft";
|
||||
//adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product/draft";
|
||||
adminLoginForm.InitUrl = "https://agentseller.temu.com/goods/draft";
|
||||
adminLoginForm.openType = EnumOpenType.manage;
|
||||
adminLoginForm.WindowState = FormWindowState.Maximized;
|
||||
adminLoginForm.ShowDialog();
|
||||
@@ -326,13 +331,20 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
shopLoginForm.openType = EnumOpenType.login;
|
||||
shopLoginForm.SaveComplete += ShopLoginForm_SaveComplete;
|
||||
shopLoginForm.ShowDialog();
|
||||
foreach (DataGridViewRow row in this.dgvSelectProduct.Rows)
|
||||
{
|
||||
if (row.Cells["colSelectId"].Value.ParseToString() == shop.ShopId)
|
||||
{
|
||||
row.Cells["colLogin"].Value = shop.LoginStatus2 == "国际版在线" ? "在线" : "登录";
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "导入Cookies":
|
||||
{
|
||||
var shop = GetShop(shopId);
|
||||
ShopUpdateCookieForm updateCookieForm = new ShopUpdateCookieForm(shop, SetCookieFromEnum.sa);
|
||||
ShopUpdateCookieForm updateCookieForm = new ShopUpdateCookieForm(shop, SetCookieFromEnum.sa, "国际版");
|
||||
updateCookieForm.SaveComplete += UpdateCookieForm_SaveComplete;
|
||||
updateCookieForm.ShowDialog();
|
||||
}
|
||||
@@ -349,6 +361,11 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
//if (!cookie.StartsWith("SUB_PASS_ID") && !cookie.StartsWith("_nano_fp"))
|
||||
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 shop.Cookies2.Split(';'))
|
||||
{
|
||||
var cookie = shopCook.Trim();
|
||||
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 shop.Cookies.Split(';'))
|
||||
{
|
||||
var cookie = shopCook.Trim();
|
||||
@@ -359,8 +376,20 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
else
|
||||
cookJs += "\r\ndocument.cookie='" + cookie + "; domain=seller.kuajingmaihuo.com;';";
|
||||
}
|
||||
// 全球站cookie
|
||||
foreach (var shopCook in shop.Cookies2.Split(';'))
|
||||
{
|
||||
var cookie = shopCook.Trim();
|
||||
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.AddDays(1).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "; path=/';";
|
||||
else
|
||||
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("复制成功");
|
||||
}
|
||||
@@ -504,6 +533,15 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
continue;
|
||||
}
|
||||
|
||||
if (shop.LoginStatus2 != "国际版在线")
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row.Cells["colOpResult"].Value = "店铺" + shop.LoginStatus2;
|
||||
}));
|
||||
continue;
|
||||
}
|
||||
|
||||
//if (prod.status != "待上传")
|
||||
//{
|
||||
// Invoke(new Action(() =>
|
||||
@@ -554,7 +592,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
if (result.Contains("登录过期"))
|
||||
{
|
||||
shop.LoginStatus = "未登录";
|
||||
ShopForms.ShopListForm.UpdateServerShopCookies(shop, shop.Cookies); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
|
||||
ShopForms.ShopListForm.UpdateServerShopCookies(shop); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -618,12 +656,19 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
}
|
||||
|
||||
public ShopLoginInfo AdminGetServerShop(string shop_id)
|
||||
{
|
||||
List<ShopLoginInfo> list = AdminGetServerShopLst(new string[] { shop_id }.ToList());
|
||||
return list.FirstOrDefault();
|
||||
}
|
||||
|
||||
public List<ShopLoginInfo> AdminGetServerShopLst(List<string> shop_ids)
|
||||
{
|
||||
List<ShopLoginInfo> list = new List<ShopLoginInfo>();
|
||||
|
||||
var url = BaseClass.BuildObjString("shop/admin_get_shop_list");
|
||||
var data = UserLogin.GetSignaturex() +
|
||||
"&search_id=" + shop_id;
|
||||
"&shop_ids='" + string.Join("','", shop_ids) + "'";
|
||||
data += "&page_size=200";
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
@@ -632,12 +677,12 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
if (string.IsNullOrEmpty(html)
|
||||
|| !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass"))
|
||||
{
|
||||
return null;
|
||||
return new List<ShopLoginInfo>();
|
||||
}
|
||||
|
||||
var jArr = JObject.Parse(html)["data"];
|
||||
if (jArr.Count() == 0)
|
||||
return null;
|
||||
return new List<ShopLoginInfo>();
|
||||
|
||||
foreach (JObject jObj in jArr)
|
||||
{
|
||||
@@ -660,11 +705,12 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
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");
|
||||
|
||||
list.Add(shop);
|
||||
}
|
||||
return list.FirstOrDefault();
|
||||
return list;
|
||||
}
|
||||
|
||||
public TemuDBProduct GetProductDetail(string prodDbId)
|
||||
@@ -710,7 +756,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
|
||||
string UploadProduct(ShopLoginInfo shop, TemuProductInfo prodInfo, string sTemuSizeSpec = null)
|
||||
{
|
||||
if (shop == null || string.IsNullOrEmpty(shop.ShopId) || shop.LoginStatus != "登录成功")
|
||||
if (shop == null || string.IsNullOrEmpty(shop.ShopId) || shop.LoginStatus != "登录成功" || shop.LoginStatus2 != "国际版在线")
|
||||
{
|
||||
return "店铺为空或未登录!";
|
||||
}
|
||||
@@ -1033,31 +1079,36 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
|
||||
private string AddDraft(ShopLoginInfo shop, string catId)
|
||||
{
|
||||
string url = "https://seller.kuajingmaihuo.com/bg-visage-mms/product/draft/add";
|
||||
string refere = "https://seller.kuajingmaihuo.com/goods/product-create/category?from=productList";
|
||||
//string url = "https://seller.kuajingmaihuo.com/bg-visage-mms/product/draft/add";
|
||||
string url = "https://agentseller.temu.com/visage-agent-seller/product/draft/add";
|
||||
//string refere = "https://seller.kuajingmaihuo.com/goods/product-create/category?from=productList";
|
||||
string refere = "https://agentseller.temu.com/goods/create/category";
|
||||
string body = @"{""catId"":" + catId + "}";
|
||||
return KJDHttpResponse.PostResponse(shop, url, body, refere);
|
||||
return KJDHttpResponse.PostResponse2(shop, url, body, refere);
|
||||
}
|
||||
|
||||
private string CreateSizeSpec(ShopLoginInfo shop, string draftId, TemuSizeSpecParam sizeParam)
|
||||
{
|
||||
string url = "https://seller.kuajingmaihuo.com/bg-anniston-mms/sizespec/createSizeSpec";
|
||||
//string url = "https://seller.kuajingmaihuo.com/bg-anniston-mms/sizespec/createSizeSpec";
|
||||
string url = "https://agentseller.temu.com/anniston-agent-seller/sizespec/createSizeSpec";
|
||||
string body = JsonHelper.SerializeObject(sizeParam);
|
||||
string refere = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId="+
|
||||
draftId + "&from=productDraftList";
|
||||
return KJDHttpResponse.PostResponse(shop, url, body, refere);
|
||||
//string refere = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId="+
|
||||
// draftId + "&from=productDraftList";
|
||||
string refere = "https://agentseller.temu.com/goods/edit?productDraftId=" + draftId + "&from=productDraftList";
|
||||
return KJDHttpResponse.PostResponse2(shop, url, body, refere);
|
||||
}
|
||||
|
||||
private string SaveDraft(ShopLoginInfo shop, string draftId, TemuProductParam prodParam)
|
||||
{
|
||||
string url = "https://seller.kuajingmaihuo.com/bg-visage-mms/product/draft/save";
|
||||
//string url = "https://seller.kuajingmaihuo.com/bg-visage-mms/product/draft/save";
|
||||
string url = "https://agentseller.temu.com/visage-agent-seller/product/draft/save";
|
||||
string body = JsonHelper.SerializeObject(prodParam);
|
||||
string refere = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" +
|
||||
draftId + "&from=productDraftList";
|
||||
return KJDHttpResponse.PostResponse(shop, url, body, refere);
|
||||
//string refere = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" +
|
||||
// draftId + "&from=productDraftList";
|
||||
string refere = "https://agentseller.temu.com/goods/edit?productDraftId=" + draftId + "&from=productDraftList";
|
||||
return KJDHttpResponse.PostResponse2(shop, url, body, refere);
|
||||
}
|
||||
|
||||
|
||||
private string AddProduct(ShopLoginInfo shop, string draftId, TemuProductParam prodParam)
|
||||
{
|
||||
string url = "https://seller.kuajingmaihuo.com/bg-visage-mms/product/add";
|
||||
|
||||
+10
@@ -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;
|
||||
|
||||
@@ -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®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 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>
|
||||
|
||||
@@ -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
@@ -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);
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace TemuKJD.KJDForms.ToolForms
|
||||
}
|
||||
}
|
||||
}
|
||||
if (PddBuyerCookie != null)
|
||||
if (!string.IsNullOrEmpty(PddBuyerCookie))
|
||||
{
|
||||
var t2 = CEFBrowser.SetCookieAsync("mobile.yangkeduo.com", PddBuyerCookie, cefWebBrowser.RequestContext.GetCookieManager(null));
|
||||
t2.Wait(2500);
|
||||
|
||||
+2
-2
@@ -158,8 +158,8 @@ namespace TemuKJD
|
||||
settings.IgnoreCertificateErrors = true;
|
||||
settings.Locale = "zh-CN";
|
||||
settings.LogSeverity = LogSeverity.Disable;
|
||||
//settings.CachePath = Path.Combine(Environment.CurrentDirectory, "Cache");
|
||||
settings.CachePath = null; //禁止缓存
|
||||
settings.CachePath = Path.Combine(Environment.CurrentDirectory, "Cache");
|
||||
//settings.CachePath = null; //禁止缓存
|
||||
Cef.Initialize(settings);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user