1记住后台登陆的用户信息
2店铺统计展示 3可选预售设置失败下架
This commit is contained in:
1 parent
0c3d232a16
commit
600c009509
19 files changed
+1114
-626
No files matched your search
@@ -409,6 +409,34 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
currentUrl = e.Address;
|
||||
txtAddress.Text = e.Address;
|
||||
}));
|
||||
|
||||
if (e.Address == "https://po.e57.cn/login?redirect=%2Findex" && shop != null && !string.IsNullOrEmpty(shop.LoginName))
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(2000);
|
||||
// var jsStr = @"var txt1 = document.getElementByClassName('el-input__inner')[0]; txt1.focus(); txt1.click(); keyboardInput(txt1, '" + _account + "');"
|
||||
var _account = shop.LoginName;
|
||||
var _password = DataOpenSSL.DecryptString(shop.Password);
|
||||
|
||||
cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sInputValueChange2);
|
||||
|
||||
var jsStr1 = "var usernameId = document.getElementsByClassName('el-input__inner')[0]; " +
|
||||
"changeReactInputValue(usernameId,'" + _account + "');";
|
||||
var response1 = cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
|
||||
response1.Wait(1000);
|
||||
Thread.Sleep(Randomx.GetId(50, 100));
|
||||
|
||||
if (!string.IsNullOrEmpty(_password))
|
||||
{
|
||||
string jsStr = "var passwordId = document.getElementsByClassName('el-input__inner')[1]; " +
|
||||
"changeReactInputValue(passwordId,'" + _password + "');";
|
||||
var response = cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
||||
response.Wait(1000);
|
||||
Thread.Sleep(Randomx.GetId(500, 1000));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void CefWebBrowser_FrameLoadEnd(object sender, CefSharp.FrameLoadEndEventArgs e)
|
||||
@@ -567,184 +595,6 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
response = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
||||
response.Wait(1000);
|
||||
Thread.Sleep(Randomx.GetId(500, 1000));
|
||||
return;
|
||||
//下面代码原抖音使用,废弃
|
||||
|
||||
#region 输入用js
|
||||
string jsSetValue = @"
|
||||
function keyboardInput(dom, st) {
|
||||
var evt = new InputEvent('input', {
|
||||
//var evt = new Event('input', { // cef57
|
||||
inputType: 'insertText',
|
||||
data: st,
|
||||
dataTransfer: null,
|
||||
isComposing: false
|
||||
});
|
||||
dom.value = st;
|
||||
dom.dispatchEvent(evt);
|
||||
dom.focus();
|
||||
};";
|
||||
|
||||
string jsInputKey = @"
|
||||
function fireKeyEvent(el, evtType, keyCode) {
|
||||
var evtObj;
|
||||
if (document.createEvent)
|
||||
{
|
||||
if (window.KeyEvent)
|
||||
{
|
||||
//firefox 浏览器下模拟事件
|
||||
evtObj = document.createEvent('KeyEvents');
|
||||
evtObj.initKeyEvent(evtType, true, true, window, true, false, false, false, keyCode, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
//chrome 浏览器下模拟事件
|
||||
evtObj = document.createEvent('UIEvents');
|
||||
evtObj.initUIEvent(evtType, true, true, window, 1);
|
||||
|
||||
delete evtObj.keyCode;
|
||||
if (typeof evtObj.keyCode === 'undefined')
|
||||
{
|
||||
//为了模拟keycode
|
||||
Object.defineProperty(evtObj, 'keyCode', { value: keyCode });
|
||||
}
|
||||
else
|
||||
{
|
||||
evtObj.key = String.fromCharCode(keyCode);
|
||||
}
|
||||
|
||||
if (typeof evtObj.ctrlKey === 'undefined')
|
||||
{
|
||||
//为了模拟ctrl键
|
||||
Object.defineProperty(evtObj, 'ctrlKey', { value: true });
|
||||
}
|
||||
else
|
||||
{
|
||||
evtObj.ctrlKey = true;
|
||||
}
|
||||
}
|
||||
el.dispatchEvent(evtObj);
|
||||
}
|
||||
else if (document.createEventObject)
|
||||
{
|
||||
//IE 浏览器下模拟事件
|
||||
evtObj = document.createEventObject();
|
||||
evtObj.keyCode = keyCode
|
||||
el.fireEvent('on' + evtType, evtObj);
|
||||
}
|
||||
}";
|
||||
#endregion
|
||||
|
||||
#region 输入用户名
|
||||
jsStr = @"var txt1 = document.getElementsByName('email')[0]; txt1.focus(); txt1.click(); keyboardInput(txt1, '" + _account + "');"
|
||||
+ "var uname = '" + _account + "';"
|
||||
+ "for(var i = 0; i < uname.length; i++) {"
|
||||
+ " cCode = uname.charCodeAt(i);"
|
||||
+ " fireKeyEvent(txt1, 'keydown', cCode);"
|
||||
+ " fireKeyEvent(txt1, 'keypress', cCode);"
|
||||
+ " fireKeyEvent(txt1, 'keyup', cCode);"
|
||||
+ "}";
|
||||
response = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsSetValue + jsInputKey + jsStr);
|
||||
response.Wait(2000);
|
||||
Thread.Sleep(Randomx.GetId(400, 800));
|
||||
#endregion
|
||||
|
||||
#region 输入密码
|
||||
jsStr = @"var txt2 = document.getElementsByName('password')[0]; txt2.focus(); txt2.click(); keyboardInput(txt2, '" + _password + "');"
|
||||
+ "var pwd = '" + _password + "';"
|
||||
+ "for(var i = 0; i < pwd.length; i++) {"
|
||||
+ " cCode = pwd.charCodeAt(i);"
|
||||
+ " fireKeyEvent(txt2, 'keydown', cCode);"
|
||||
+ " fireKeyEvent(txt2, 'keypress', cCode);"
|
||||
+ " fireKeyEvent(txt2, 'keyup', cCode);"
|
||||
+ "}";
|
||||
response = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsInputKey + jsStr);
|
||||
response.Wait(2000);
|
||||
Thread.Sleep(Randomx.GetId(400, 800));
|
||||
#endregion
|
||||
|
||||
#region 点击登录按钮
|
||||
jsStr = "var btn = document.getElementsByClassName('account-center-action-button')[0]; btn.click(); //btn.dispatchEvent(new Event('change'));";
|
||||
response = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
||||
response.Wait(2000);
|
||||
Thread.Sleep(1500 + Randomx.GetId(1000));
|
||||
#endregion
|
||||
|
||||
#region 获取验证码
|
||||
int getImageCount = 0;
|
||||
getImageAgain:
|
||||
if (!this.Created)
|
||||
return;
|
||||
|
||||
jsStr = "function getImg() { return document.getElementsByClassName('captcha_verify_img--wrapper')[0].innerHTML; }";
|
||||
jsStr += "getImg();";
|
||||
response = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
||||
response.Wait(2000);
|
||||
if (response.Result?.Result == null)
|
||||
{
|
||||
if (getImageCount < 50)
|
||||
{
|
||||
Thread.Sleep(2500);
|
||||
getImageCount++;
|
||||
goto getImageAgain;
|
||||
}
|
||||
}
|
||||
if (response.Result?.Result != null)
|
||||
{
|
||||
var imgStr = response.Result.Result.ToString();
|
||||
var src = BaseRegex.GetMatchRegexString(ref imgStr, "src=\"([\\s\\S]*?)\"");
|
||||
Bitmap bt = (Bitmap)GetHtml.LoadImage(src);
|
||||
if (bt != null)
|
||||
{
|
||||
int Stopxt = 0;
|
||||
int dragButtonWidth = 53;
|
||||
//Stopxt = new Base64ChangeImgUrl().CalculateNick(bt, dragButtonWidth);
|
||||
Thread.Sleep(500 + Randomx.GetId(1000));
|
||||
Stopxt = new Base64ChangeImgUrl().CalculateNickNew(bt, dragButtonWidth);
|
||||
if (Stopxt > 0)
|
||||
{
|
||||
jsStr = "function getImgPos() { return document.getElementsByClassName('secsdk-captcha-drag-icon')[0].getBoundingClientRect().left + '|' "
|
||||
+ " + document.getElementsByClassName('secsdk-captcha-drag-icon')[0].getBoundingClientRect().top;} getImgPos();";
|
||||
response = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
||||
response.Wait(2000);
|
||||
if (response.Result?.Result != null)
|
||||
{
|
||||
var xy = response.Result?.Result.ToString();
|
||||
var xyArr = xy.Split('|');
|
||||
if (xyArr.Length == 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
int x = (int)Convert.ToDecimal(xyArr[0]) + 25;
|
||||
int y = (int)Convert.ToDecimal(xyArr[1]) + 25;
|
||||
|
||||
// 自动滑块图形验证
|
||||
if (GlobalConfig.TemuShopSettingParam.IsAutoDragLogin)
|
||||
{
|
||||
WXShopLoginForm.CefMouseDragDou(cefWebBrowser, x, y, Convert.ToInt32((x + Stopxt * 340m / 552m) - 15), y);
|
||||
for (int i = 0; i < 1; i++)
|
||||
Thread.Sleep(2000 + Randomx.GetId(1000));
|
||||
response = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
||||
response.Wait(2000);
|
||||
if (response.Result?.Result != null && getImageCount < 50)
|
||||
{
|
||||
getImageCount++;
|
||||
goto getImageAgain;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 1; i++)
|
||||
Thread.Sleep(2000 + Randomx.GetId(1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
Thread.Sleep(1500 + Randomx.GetId(1000));
|
||||
#endregion
|
||||
}
|
||||
|
||||
// 鼠标左键按下,移动,移动...左键抬起。
|
||||
@@ -963,5 +813,41 @@ function getElementWithText(sText)
|
||||
{
|
||||
cefWebBrowser.Forward();
|
||||
}
|
||||
|
||||
private void btnSaveUserInfo_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (shop == null)
|
||||
return;
|
||||
|
||||
shop.LoginName = this.txtUserName.Text;
|
||||
shop.Password = DataOpenSSL.EncryptString(this.txtPassWord.Text);
|
||||
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_dian_tong_ling_login_info", shop);
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
// var jsStr = @"var txt1 = document.getElementByClassName('el-input__inner')[0]; txt1.focus(); txt1.click(); keyboardInput(txt1, '" + _account + "');"
|
||||
var _account = shop.LoginName;
|
||||
var _password = DataOpenSSL.DecryptString(shop.Password);
|
||||
|
||||
cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sInputValueChange2);
|
||||
|
||||
var jsStr1 = "var usernameId = document.getElementsByClassName('el-input__inner')[0]; " +
|
||||
"changeReactInputValue(usernameId,'" + _account + "');";
|
||||
var response1 = cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
|
||||
response1.Wait(1000);
|
||||
Thread.Sleep(Randomx.GetId(50, 100));
|
||||
|
||||
if (!string.IsNullOrEmpty(_password))
|
||||
{
|
||||
string jsStr = "var passwordId = document.getElementsByClassName('el-input__inner')[1]; " +
|
||||
"changeReactInputValue(passwordId,'" + _password + "');";
|
||||
var response = cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
|
||||
response.Wait(1000);
|
||||
Thread.Sleep(Randomx.GetId(500, 1000));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user