拼多多商品获取逻辑
This commit is contained in:
1 parent
840636d5c9
commit
6639224771
68 files changed
+7132
-692
No files matched your search
@@ -37,11 +37,10 @@ namespace TemuKJD.PDDForms.AdminForms
|
||||
public bool isMultiLogin = false;
|
||||
public string MultiLoginCookieName = "";
|
||||
public string InitUrl = "";
|
||||
private string shopCookieHead = "kuajingmaihuo.com";
|
||||
private string shopCookieHead = "pinduoduo.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 string shopLoginUrl = "https://mms.pinduoduo.com/login";
|
||||
private string shopMainUrl = "https://mms.pinduoduo.com/home";
|
||||
private ChromiumWebBrowser cefWebBrowser = null;
|
||||
private ShopLoginInfo shop = null;
|
||||
private List<ShopCompany> lstShopCompany = new List<ShopCompany>();
|
||||
@@ -125,7 +124,8 @@ namespace TemuKJD.PDDForms.AdminForms
|
||||
string cookies = "";
|
||||
//List<Cookie> cookieList = CEFBrowser.GetCookieList(shopCookieHead, cefWebBrowser.RequestContext.GetCookieManager(null)); // cef138
|
||||
List<Cookie> cookieList = CEFBrowser.GetCookieList(shopCookieHead, cefWebBrowser.GetCookieManager(null));
|
||||
var keys = new string[] { "a42", "_bee", "_f77", "_nano_fp", "api_uid", "rckk", "ru1k", "ru2k", "SUB_PASS_ID" };
|
||||
List<Cookie> cookieListNew = new List<Cookie>();
|
||||
var keys = new string[] { "_a42", "_bee", "_f77", "_nano_fp", "api_uid", "JSESSIONID", "mms_b84d1838", "rckk", "ru1k", "ru2k", "PASS_ID", "webp", "x-visit-time" };
|
||||
|
||||
if (cookieList != null && cookieList.Count > 0)
|
||||
{
|
||||
@@ -134,14 +134,16 @@ namespace TemuKJD.PDDForms.AdminForms
|
||||
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"))
|
||||
//PASS_ID同时出现两个,domain是mms.pinduoduo.com才是能登录店铺后台的
|
||||
if (cookie.Name == "PASS_ID" && cookie.Domain != "mms.pinduoduo.com"
|
||||
&& cookieList.Any(c => c.Name == "PASS_ID" && c.Domain == "mms.pinduoduo.com"))
|
||||
continue;
|
||||
|
||||
cookies += cookie.Name + "=" + cookie.Value + "; ";
|
||||
cookieListNew.Add(cookie);
|
||||
}
|
||||
cookies = cookies.Trim().TrimEnd(';');
|
||||
//cookies = cookies.Trim().TrimEnd(';');
|
||||
cookies = JsonHelper.SerializeObject(cookieListNew);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(cookies)
|
||||
@@ -164,6 +166,7 @@ namespace TemuKJD.PDDForms.AdminForms
|
||||
UserName = shop.UserName,
|
||||
Notes = shop.Notes,
|
||||
Cookies = cookies,
|
||||
AntiContents = new List<string> { sc.AntiContent },
|
||||
};
|
||||
|
||||
if (string.IsNullOrEmpty(shop.Cookies)) // 有cookie的认为是已登录过的
|
||||
@@ -174,6 +177,15 @@ namespace TemuKJD.PDDForms.AdminForms
|
||||
if (!html.Contains("\"code\":200"))
|
||||
isSuccess = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
var urlAddress = BaseClass.BuildObjString("shop/mdy_anti_content");
|
||||
var data = UserLogin.GetSignaturex()
|
||||
+ "&login_name=" + shop.LoginName
|
||||
+ "&shop_id=" + shop.ShopId
|
||||
+ "&anti_contents=" + JsonHelper.SerializeObject(shop.AntiContents);
|
||||
var result = GetHtml.PostUtf8(urlAddress, data);
|
||||
}
|
||||
}
|
||||
shop.Cookies = cookies;
|
||||
if (isSuccess)
|
||||
@@ -181,105 +193,7 @@ namespace TemuKJD.PDDForms.AdminForms
|
||||
shop.LoginStatus = "登录成功";
|
||||
PDDShopListForm.UpdateServerShopCookies(shop); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
|
||||
}
|
||||
//OnSaveComplete(shop);
|
||||
//if (this.Created && this.chkCloseAfterLogin.Checked)
|
||||
//{
|
||||
// Invoke(new Action(() => { this.Close(); }));
|
||||
//}
|
||||
//else
|
||||
// break;
|
||||
}
|
||||
//cefWebBrowser.Load(shopMainUrl2);
|
||||
var shopStatusRst = PDDShopListForm.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 = PDDShopListForm.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");
|
||||
BaseMsgForm.ShowInfo("获取国际版跳转链接失败,请手动跳转并等待Cookie获取结束!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var cookie2 = shop.Cookies2;
|
||||
//var t = CEFBrowser.SetCookieAsync(shopCookieHead2, cookie2, cefWebBrowser.RequestContext.GetCookieManager(null)); // cef138
|
||||
var t = CEFBrowser.SetCookieAsync(shopCookieHead2, cookie2, cefWebBrowser.GetCookieManager(null));
|
||||
t.Wait(5000);
|
||||
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));
|
||||
List<Cookie> cookieList2 = CEFBrowser.GetCookieList(shopCookieHead2, cefWebBrowser.GetCookieManager(null)); // cef138
|
||||
if (cookieList2 != null && cookieList2.Count > 0)
|
||||
{
|
||||
for(int i =0; i < cookieList2.Count; i++)
|
||||
{
|
||||
var cookie = cookieList2[i];
|
||||
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 = ShopBLL.AdminAddServerShop(newShop); // 店铺写入到服务端
|
||||
if (!html.Contains("\"code\":200"))
|
||||
isSuccess = false;
|
||||
}
|
||||
}
|
||||
shop.Cookies2 = cookies2;
|
||||
if (isSuccess)
|
||||
{
|
||||
shop.LoginStatus2 = "国际版在线";
|
||||
PDDShopListForm.UpdateServerShopCookies(shop); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
|
||||
}
|
||||
OnSaveComplete(shop);
|
||||
if (this.Created && this.chkCloseAfterLogin.Checked)
|
||||
{
|
||||
@@ -409,9 +323,19 @@ namespace TemuKJD.PDDForms.AdminForms
|
||||
if (shop.Cookies2 == null)
|
||||
shop.Cookies2 = "";
|
||||
|
||||
var cookie = shop.Cookies;
|
||||
if (isMultiLogin)
|
||||
cookie = shop.DictMultiCookies.Keys.Contains(MultiLoginCookieName) ? shop.DictMultiCookies[MultiLoginCookieName] : "";
|
||||
//var cookie = shop.Cookies;
|
||||
//if (isMultiLogin)
|
||||
// cookie = shop.DictMultiCookies.Keys.Contains(MultiLoginCookieName) ? shop.DictMultiCookies[MultiLoginCookieName] : "";
|
||||
List<Cookie> cookieLst = new List<Cookie>();
|
||||
try
|
||||
{
|
||||
cookieLst = JsonHelper.DeserializeJsonToList<CefSharp.Cookie>(shop.Cookies);
|
||||
if (cookieLst == null)
|
||||
cookieLst = new List<Cookie>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
@@ -424,9 +348,17 @@ namespace TemuKJD.PDDForms.AdminForms
|
||||
Thread.Sleep(20);
|
||||
CEFBrowser.DeleteCookie(cefWebBrowser.GetCookieManager(null));
|
||||
|
||||
//var t = CEFBrowser.SetCookieAsync(shopCookieHead, cookie, cefWebBrowser.RequestContext.GetCookieManager(null)); // cef138
|
||||
var t = CEFBrowser.SetCookieAsync(shopCookieHead, cookie, cefWebBrowser.GetCookieManager(null));
|
||||
t.Wait(5000);
|
||||
//cef 138 如果没有设置RequestContext 可能为空,直接getCookieManager
|
||||
//if (this.openType != EnumOpenType.login)
|
||||
{
|
||||
//var t = CEFBrowser.SetCookieAsync(shopCookieHead, cookie, cefWebBrowser.RequestContext.GetCookieManager(null)); // cef138
|
||||
//var t = CEFBrowser.SetCookieAsync(shopCookieHead, cookie, cefWebBrowser.GetCookieManager(null));
|
||||
foreach (var cook in cookieLst)
|
||||
{
|
||||
var t = CEFBrowser.SetCookieAsync(cook.Domain, cook.Name + "=" + cook.Value + ";", cefWebBrowser.GetCookieManager(null));
|
||||
t.Wait(5000);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.openType != EnumOpenType.login)
|
||||
{
|
||||
@@ -439,17 +371,22 @@ namespace TemuKJD.PDDForms.AdminForms
|
||||
//根据登录的具体店铺设置local storage
|
||||
if (!string.IsNullOrEmpty(shop.ShopId))
|
||||
{
|
||||
while (!cefWebBrowser.IsBrowserInitialized || !cefWebBrowser.GetBrowser().MainFrame.IsValid)
|
||||
Thread.Sleep(20);
|
||||
//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);
|
||||
//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);
|
||||
////agentseller-mall-info-id
|
||||
//storageJsCode = "window.localStorage.setItem('" + "agentseller-mall-info-id" + "', '" + shop.ShopId + "');\r\n";
|
||||
//cefWebBrowser.GetBrowser().MainFrame.ExecuteJavaScriptAsync(storageJsCode);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(InitUrl))
|
||||
cefWebBrowser.Load(InitUrl);
|
||||
else
|
||||
cefWebBrowser.Load(shopMainUrl);
|
||||
|
||||
//不是登录的话就此返回
|
||||
if (openType != EnumOpenType.login)
|
||||
{
|
||||
@@ -468,27 +405,17 @@ namespace TemuKJD.PDDForms.AdminForms
|
||||
}
|
||||
Thread.Sleep(Randomx.GetId(1500, 2000));
|
||||
|
||||
//设置 local storage
|
||||
//if (GlobalConfig.dicLocalStorage != null)
|
||||
//{
|
||||
// Thread.Sleep(500);
|
||||
// string jsCode = "function setStorage() {";
|
||||
// foreach (var item in GlobalConfig.dicLocalStorage)
|
||||
// {
|
||||
// if (item.Key == "$TCC_CONFIG" || item.Key == "$TCC_CONFIG_operate_config" || item.Key == "menuStyleStr")
|
||||
// continue;
|
||||
|
||||
// jsCode += "window.localStorage.setItem('" + item.Key + "', '" + item.Value + "');\r\n";
|
||||
// }
|
||||
// jsCode += "}";
|
||||
// jsCode += "setStorage();";
|
||||
// if (cefWebBrowser.GetBrowser().MainFrame.IsValid)
|
||||
// cefWebBrowser.GetBrowser().MainFrame.ExecuteJavaScriptAsync(jsCode);
|
||||
//}
|
||||
|
||||
if (!this.Created)
|
||||
return;
|
||||
|
||||
while (!cefWebBrowser.Address.StartsWith(shopLoginUrl))
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
if (!this.Created)
|
||||
return;
|
||||
}
|
||||
|
||||
CEFBrowser.DeleteCookie(cefWebBrowser.GetCookieManager(null));
|
||||
InputUserNameAndPassword(cefWebBrowser, shop.LoginName, DataOpenSSL.DecryptString(shop.Password));
|
||||
});
|
||||
}
|
||||
@@ -558,86 +485,81 @@ namespace TemuKJD.PDDForms.AdminForms
|
||||
cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sb.ToString());
|
||||
}
|
||||
|
||||
int GetAntiContentsTimes = 0;
|
||||
private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
|
||||
{
|
||||
var antiContent = request.Headers.AllKeys.Contains("Anti-Content") ? request.Headers["Anti-Content"] : "";
|
||||
if (shop != null && !url.StartsWith("https://mms.pinduoduo.com/janus/api/userinfo") && !string.IsNullOrEmpty(antiContent))
|
||||
{
|
||||
GetAntiContentsTimes++;
|
||||
shop.AntiContents.Add(antiContent);
|
||||
while (shop.AntiContents.Count > 10)
|
||||
shop.AntiContents.RemoveAt(0);
|
||||
if (!string.IsNullOrEmpty(shop.ShopId) && GetAntiContentsTimes > 5)
|
||||
{
|
||||
GetAntiContentsTimes = 0;
|
||||
var antis = shop.AntiContents;
|
||||
Task.Run(() =>
|
||||
{
|
||||
var urlAddress = BaseClass.BuildObjString("shop/mdy_anti_content");
|
||||
var data = UserLogin.GetSignaturex()
|
||||
+ "&login_name=" + shop.LoginName
|
||||
+ "&shop_id=" + shop.ShopId
|
||||
+ "&anti_contents=" + JsonHelper.SerializeObject(antis);
|
||||
var result = GetHtml.PostUtf8(urlAddress, data);
|
||||
});
|
||||
}
|
||||
}
|
||||
Task.Run(() =>
|
||||
{
|
||||
var data = responseData;
|
||||
if (data.Contains("supplierId") && data.Contains("\"success\":true"))
|
||||
{
|
||||
var supplierIds = BaseRegex.GetMatchRegex(ref data, "\"supplierId\":\\d{5,20}");
|
||||
if(supplierIds.Count > 0 && supplierIds[0].Groups.Count > 0)
|
||||
{
|
||||
var supplierId = supplierIds[0].Groups[0].Value.Replace("\"supplierId\":", "").ParseToLong();
|
||||
if (supplierId > 0)
|
||||
this.currentSupplierId = supplierId;
|
||||
}
|
||||
}
|
||||
//var data = responseData;
|
||||
//if (data.Contains("supplierId") && data.Contains("\"success\":true"))
|
||||
//{
|
||||
// var supplierIds = BaseRegex.GetMatchRegex(ref data, "\"supplierId\":\\d{5,20}");
|
||||
// if(supplierIds.Count > 0 && supplierIds[0].Groups.Count > 0)
|
||||
// {
|
||||
// var supplierId = supplierIds[0].Groups[0].Value.Replace("\"supplierId\":", "").ParseToLong();
|
||||
// if (supplierId > 0)
|
||||
// this.currentSupplierId = supplierId;
|
||||
// }
|
||||
//}
|
||||
});
|
||||
if (url.StartsWith("https://seller.kuajingmaihuo.com/settle/site-main"))
|
||||
{
|
||||
cefWebBrowser.Load(shopMainUrl);
|
||||
}
|
||||
//if (url == shopMainUrl)
|
||||
if (url == "https://seller.kuajingmaihuo.com/bg/quiet/api/mms/userInfo")
|
||||
if (url == "https://mms.pinduoduo.com/janus/api/userinfo")
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
var data = responseData;
|
||||
if (this.shop != null && data.Contains("\"success\":true"))
|
||||
{
|
||||
var maskMobile = BaseRegex.GetStringJson(ref data, "maskOwnerMobile");
|
||||
var maskMobile2 = "||||" + BaseRegex.GetStringJson(ref data, "maskMobile").ParseToString();
|
||||
if (maskMobile2.Contains("*"))
|
||||
maskMobile2 = maskMobile2.Substring(maskMobile2.LastIndexOf("*")).Trim('*');
|
||||
if (shop.LoginName.EndsWith(maskMobile) || shop.LoginName.EndsWith(maskMobile2))
|
||||
var maskMobile = BaseRegex.GetStringJson(ref data, "mobile");
|
||||
maskMobile = maskMobile.Split('*').Last();
|
||||
if (!string.IsNullOrEmpty(maskMobile) && shop.LoginName.EndsWith(maskMobile))
|
||||
{
|
||||
lstShopCompany.Clear();
|
||||
var jObj = JObject.Parse(data);
|
||||
var jArr = jObj["result"]?["companyList"]?[0]?["malInfoList"] as JArray;
|
||||
var jArr = jObj["result"] as JArray;
|
||||
if (jArr == null)
|
||||
jArr = new JArray();
|
||||
|
||||
Thread.Sleep(500);
|
||||
foreach (var productObj in jArr)
|
||||
|
||||
ShopCompany sc = new ShopCompany()
|
||||
{
|
||||
var prod = JsonHelper.SerializeObject(productObj);
|
||||
ShopCompany sc = new ShopCompany()
|
||||
{
|
||||
AccountId = BaseRegex.GetStringJson(ref prod, "mallId"),
|
||||
AccountName = BaseRegex.GetStringJson(ref prod, "mallName"),
|
||||
LoginName = shop.LoginName,
|
||||
UserName = BaseClass.UserName,
|
||||
LoginStatus = "登录成功",
|
||||
};
|
||||
this.lstShopCompany.Add(sc);
|
||||
}
|
||||
//AccountId = BaseRegex.GetStringJson(ref data, "mallId"),
|
||||
AccountId = BaseRegex.GetStringJson(ref data, "username"),
|
||||
AccountName = BaseRegex.GetStringJson(ref data, "mall_name"),
|
||||
LoginName = shop.LoginName,
|
||||
UserName = BaseClass.UserName,
|
||||
LoginStatus = "登录成功",
|
||||
AntiContent = antiContent,
|
||||
};
|
||||
this.lstShopCompany.Add(sc);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//if (url.Contains("_signature"))
|
||||
//{
|
||||
// var re = request;
|
||||
// if ((re.Headers != null && re.Headers.AllKeys.Contains("x-secsdk-csrf-token")))
|
||||
// {
|
||||
// }
|
||||
// Task.Run(() =>
|
||||
// {
|
||||
// var _url = url;
|
||||
// var data = responseData;
|
||||
// var signature = url.Substring(url.IndexOf("_signature=") + "_signature=".Length).Split('&')[0];
|
||||
// if (shop != null)
|
||||
// {
|
||||
// shop.Signature = signature;
|
||||
// }
|
||||
// if (url.Contains("x-secsdk-csrf-token") || postData.Contains("x-secsdk-csrf-token") || data.Contains("x-secsdk-csrf-token"))
|
||||
// {
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
if (currentUrl.StartsWith("https://seller.kuajingmaihuo.com/goods/product/list") ||
|
||||
currentUrl.StartsWith("https://agentseller.temu.com/goods/list"))
|
||||
if (currentUrl.StartsWith("https://mms.pinduoduo.com/goods/goods_list"))
|
||||
{
|
||||
Task.Run(() => {
|
||||
string sAddInputJs = @"
|
||||
@@ -663,11 +585,13 @@ namespace TemuKJD.PDDForms.AdminForms
|
||||
addGetProdButton();
|
||||
|
||||
function addGetProdButton() {
|
||||
var productLst = document.getElementsByClassName('product-info_idContent__iDukx');
|
||||
var productLst = document.getElementsByClassName('goods-id');
|
||||
for(i=0; i<productLst.length; i++) {
|
||||
if (productLst[i].innerHTML.indexOf('提取商品') < 0 && productLst[i].innerHTML.indexOf('SPU ID') >= 0) {
|
||||
var sSpuId = productLst[i].innerText.replace('\r','').replace('\n','').replace('SPU ID:', '');
|
||||
productLst[i].innerHTML = productLst[i].innerHTML.replace(""></div>"", ""><input type=\""button\"" style=\""margin-left: 50px; width:60px; text-align:center\"" value=\""提取商品\"" onclick=\""shopObj.getProduct('"" + sSpuId + ""'," + this.currentSupplierId + @")\""></div>"");
|
||||
var addBtnItem = productLst[i].parentElement.parentElement;
|
||||
if (addBtnItem.parentElement.innerHTML.indexOf('提取商品') < 0 && addBtnItem.parentElement.innerHTML.indexOf('ID:') >= 0) {
|
||||
var sSpuId = addBtnItem.innerText.replace('\r','').replace('\n','').replace('ID: ', '');
|
||||
addBtnItem.outerHTML = addBtnItem.outerHTML.replace(""<section>"",""<section style=\""display:inline; float:left; \"">"")
|
||||
.replace(""</section>"", ""</section><input type=\""button\"" style=\""display:inline; width:60px; margin-left:10px; margin-top:0px; cursor:pointer; border:1px solid\"" value =\""提取商品\"" onclick=\""shopObj.getProduct('"" + sSpuId + ""','" + this.shop.ShopId + @"')\"">"");
|
||||
}
|
||||
}
|
||||
}";
|
||||
@@ -684,6 +608,13 @@ namespace TemuKJD.PDDForms.AdminForms
|
||||
/// <param name="_password"></param>
|
||||
private void InputUserNameAndPassword(ChromiumWebBrowser webBrowser, string _account, string _password)
|
||||
{
|
||||
webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sGetElementWithText);
|
||||
|
||||
var jsStr0 = "var clickBox1 = getElementWithText('账号登录'); clickBox1.click()";
|
||||
var response0 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr0);
|
||||
response0.Wait(1000);
|
||||
Thread.Sleep(Randomx.GetId(500, 1000));
|
||||
|
||||
string jsStr1 = "function getInputItem () {var usernameId = document.getElementById('usernameId'); if (usernameId) return 'true';} getInputItem();";
|
||||
Task<JavascriptResponse> response1 = null;
|
||||
while (response1?.Result?.Result == null || !response1.Result.Result.ParseToString().Contains("true"))
|
||||
@@ -700,7 +631,6 @@ namespace TemuKJD.PDDForms.AdminForms
|
||||
}
|
||||
|
||||
webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sInputValueChange2);
|
||||
webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sGetElementWithText);
|
||||
|
||||
jsStr1 = "var usernameId = document.getElementById('usernameId'); " +
|
||||
"changeReactInputValue(usernameId,'" + _account + "');";
|
||||
@@ -708,7 +638,7 @@ namespace TemuKJD.PDDForms.AdminForms
|
||||
response1.Wait(1000);
|
||||
Thread.Sleep(Randomx.GetId(500, 1000));
|
||||
|
||||
string jsStr = "var passwordId = document.getElementById('passwordId'); "+
|
||||
string jsStr = "var passwordId = document.getElementById('passwordId'); " +
|
||||
"changeReactInputValue(passwordId,'" + _password + "');";
|
||||
var response = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
||||
response.Wait(1000);
|
||||
|
||||
Reference in new issue
Block a user