1优化自动登录失效 2优化用户操作界面无法直接登录店铺问题 3优化活动报名操作逻辑防止误报低价折扣活动 4显示aisku图片使用次数

This commit is contained in:
wule committed 2025-11-03 17:36:25 +08:00
1 parent 4d0478a9c5
commit a6b36c64b0
17 files changed
+737 -545

No files matched your search

+2 -1
View File
@@ -83,7 +83,7 @@
this.splitContainer1.Panel2.Controls.Add(this.btnReload);
this.splitContainer1.Panel2.Controls.Add(this.chkCloseAfterLogin);
this.splitContainer1.Size = new System.Drawing.Size(1438, 736);
this.splitContainer1.SplitterDistance = 673;
this.splitContainer1.SplitterDistance = 674;
this.splitContainer1.SplitterWidth = 3;
this.splitContainer1.TabIndex = 4;
//
@@ -345,6 +345,7 @@
this.txtAddress.Name = "txtAddress";
this.txtAddress.Size = new System.Drawing.Size(1432, 23);
this.txtAddress.TabIndex = 7;
this.txtAddress.TextChanged += new System.EventHandler(this.txtAddress_TextChanged);
this.txtAddress.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtAddress_KeyDown);
//
// AdminShopLoginForm
@@ -282,11 +282,22 @@ namespace TemuKJD.KJDForms.AdminForms
OnSaveComplete(shop);
if (this.Created && this.chkCloseAfterLogin.Checked)
{
Invoke(new Action(() => { this.Close(); }));
//Invoke(new Action(() => { this.Close(); }));
}
else
break;
}
var obtainCodeRst = ShopListForm.GetObtainCode(shop);
var obtainCode = BaseRegex.GetStringJson(ref obtainCodeRst, "code");
//https://ads.temu.com/login.html?
//redirectUrl=https%3A%2F%2Fads.temu.com%2Findex.html%3FadAreaOverride%3D2&userType=1&mallType=0
//&ticket=Zjze2NHyZFaGP88ROyjN19a47ae59611391a296ae6403bbbfa39e9046ceba744aafe8227fd6
//&adSellerUniqueId=eyJ1IjoiTVF3NFRGVmN2ZUVyZG1USDdOQ2o5dz09IiwidiI6MX0%3D&source=2&seller_source=11&adAreaOverride=2
string url = "https://ads.temu.com/login.html?" +
"redirectUrl=https%3A%2F%2Fads.temu.com%2Findex.html%3FadAreaOverride%3D2&userType=1&mallType=0&ticket=" + obtainCode +
"&source=2&seller_source=11&adAreaOverride=2";
cefWebBrowser.Load(url);
}
}
});
@@ -683,7 +694,20 @@ namespace TemuKJD.KJDForms.AdminForms
/// <param name="_password"></param>
private void InputUserNameAndPassword(ChromiumWebBrowser webBrowser, string _account, string _password)
{
string jsStr1 = "function getInputItem () {var usernameId = document.getElementById('usernameId'); if (usernameId) return 'true';} getInputItem();";
webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sInputValueChange2);
webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sGetElementWithText);
//扫码登录切换到账号登录
var switchJsStr = "var clickItem = getElementWithText('账号登录'); " +
"clickItem.click()";
var switchResponse = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(switchJsStr);
switchResponse.Wait(1000);
Thread.Sleep(Randomx.GetId(300, 800));
//检查是否有登录框
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"))
{
@@ -698,27 +722,28 @@ namespace TemuKJD.KJDForms.AdminForms
return;
}
webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sInputValueChange2);
webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sGetElementWithText);
//输入用户名
jsStr1 = "var usernameId = document.getElementById('usernameId'); " +
"changeReactInputValue(usernameId,'" + _account + "');";
response1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
response1.Wait(1000);
Thread.Sleep(Randomx.GetId(500, 1000));
//输入密码
string jsStr = "var passwordId = document.getElementById('passwordId'); "+
"changeReactInputValue(passwordId,'" + _password + "');";
var response = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
response.Wait(1000);
Thread.Sleep(Randomx.GetId(500, 1000));
//点击阅读并同意框
jsStr = "var clickBox = getElementWithText('我已阅读并同意'); " +
"clickBox.click()";
response = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
response.Wait(1000);
Thread.Sleep(Randomx.GetId(500, 1000));
//点击登录
jsStr = "var clickBox = getElementWithText('登录'); " +
"clickBox.click()";
response = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr);
@@ -928,5 +953,10 @@ function getElementWithText(sText)
ReturnPackageDetailForm form = new ReturnPackageDetailForm(this.shop);
form.ShowDialog();
}
private void txtAddress_TextChanged(object sender, EventArgs e)
{
var address = txtAddress.Text;
}
}
}