优化自动回复
This commit is contained in:
1 parent
e80d281017
commit
43587dbdd4
2 files changed
+46
-27
No files matched your search
+15
-17
@@ -46,7 +46,6 @@ namespace TemuKJD.WXForms.TalkForms
|
|||||||
this.line4 = new DevComponents.DotNetBar.Controls.Line();
|
this.line4 = new DevComponents.DotNetBar.Controls.Line();
|
||||||
this.chkIsAutoReply = new System.Windows.Forms.CheckBox();
|
this.chkIsAutoReply = new System.Windows.Forms.CheckBox();
|
||||||
this.splitContainer4 = new System.Windows.Forms.SplitContainer();
|
this.splitContainer4 = new System.Windows.Forms.SplitContainer();
|
||||||
this.progressBarX1 = new DevComponents.DotNetBar.Controls.ProgressBarX();
|
|
||||||
this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx();
|
this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx();
|
||||||
this.colSelect = new TemuKJD.UserComponent.UcDataGridViewCheckBoxColumn(this.components);
|
this.colSelect = new TemuKJD.UserComponent.UcDataGridViewCheckBoxColumn(this.components);
|
||||||
this.colShopLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.colShopLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
@@ -103,6 +102,7 @@ namespace TemuKJD.WXForms.TalkForms
|
|||||||
this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.dataGridViewLinkColumn2 = new System.Windows.Forms.DataGridViewLinkColumn();
|
this.dataGridViewLinkColumn2 = new System.Windows.Forms.DataGridViewLinkColumn();
|
||||||
|
this.lblAutoReplyStatus = new System.Windows.Forms.Label();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pbLogo)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pbLogo)).BeginInit();
|
||||||
this.panel3.SuspendLayout();
|
this.panel3.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||||
@@ -136,7 +136,7 @@ namespace TemuKJD.WXForms.TalkForms
|
|||||||
// lblVersionName
|
// lblVersionName
|
||||||
//
|
//
|
||||||
this.lblVersionName.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
this.lblVersionName.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||||
this.lblVersionName.Location = new System.Drawing.Point(31161, 33);
|
this.lblVersionName.Location = new System.Drawing.Point(31695, 33);
|
||||||
//
|
//
|
||||||
// panel3
|
// panel3
|
||||||
//
|
//
|
||||||
@@ -359,7 +359,6 @@ namespace TemuKJD.WXForms.TalkForms
|
|||||||
//
|
//
|
||||||
// splitContainer4.Panel1
|
// splitContainer4.Panel1
|
||||||
//
|
//
|
||||||
this.splitContainer4.Panel1.Controls.Add(this.progressBarX1);
|
|
||||||
this.splitContainer4.Panel1.Controls.Add(this.dgvShop);
|
this.splitContainer4.Panel1.Controls.Add(this.dgvShop);
|
||||||
//
|
//
|
||||||
// splitContainer4.Panel2
|
// splitContainer4.Panel2
|
||||||
@@ -385,19 +384,6 @@ namespace TemuKJD.WXForms.TalkForms
|
|||||||
this.splitContainer4.SplitterDistance = 450;
|
this.splitContainer4.SplitterDistance = 450;
|
||||||
this.splitContainer4.TabIndex = 7;
|
this.splitContainer4.TabIndex = 7;
|
||||||
//
|
//
|
||||||
// progressBarX1
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
this.progressBarX1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
|
||||||
this.progressBarX1.Location = new System.Drawing.Point(21, 46);
|
|
||||||
this.progressBarX1.Name = "progressBarX1";
|
|
||||||
this.progressBarX1.Size = new System.Drawing.Size(98, 10);
|
|
||||||
this.progressBarX1.TabIndex = 224;
|
|
||||||
this.progressBarX1.Text = "下载中";
|
|
||||||
this.progressBarX1.Visible = false;
|
|
||||||
//
|
|
||||||
// dgvShop
|
// dgvShop
|
||||||
//
|
//
|
||||||
this.dgvShop.AllowUserToAddRows = false;
|
this.dgvShop.AllowUserToAddRows = false;
|
||||||
@@ -965,6 +951,7 @@ namespace TemuKJD.WXForms.TalkForms
|
|||||||
//
|
//
|
||||||
// pnlTalk
|
// pnlTalk
|
||||||
//
|
//
|
||||||
|
this.pnlTalk.Controls.Add(this.lblAutoReplyStatus);
|
||||||
this.pnlTalk.Controls.Add(this.chkShowAutoReplyNum);
|
this.pnlTalk.Controls.Add(this.chkShowAutoReplyNum);
|
||||||
this.pnlTalk.Controls.Add(this.chkShowShopStatistics);
|
this.pnlTalk.Controls.Add(this.chkShowShopStatistics);
|
||||||
this.pnlTalk.Controls.Add(this.chkIsAutoReLogin);
|
this.pnlTalk.Controls.Add(this.chkIsAutoReLogin);
|
||||||
@@ -1125,6 +1112,17 @@ namespace TemuKJD.WXForms.TalkForms
|
|||||||
this.dataGridViewLinkColumn2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
this.dataGridViewLinkColumn2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||||
this.dataGridViewLinkColumn2.Width = 106;
|
this.dataGridViewLinkColumn2.Width = 106;
|
||||||
//
|
//
|
||||||
|
// label5
|
||||||
|
//
|
||||||
|
this.lblAutoReplyStatus.AutoSize = true;
|
||||||
|
this.lblAutoReplyStatus.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
|
this.lblAutoReplyStatus.Location = new System.Drawing.Point(0, 527);
|
||||||
|
this.lblAutoReplyStatus.Name = "label5";
|
||||||
|
this.lblAutoReplyStatus.Size = new System.Drawing.Size(43, 17);
|
||||||
|
this.lblAutoReplyStatus.TabIndex = 207;
|
||||||
|
this.lblAutoReplyStatus.Text = "label5";
|
||||||
|
this.lblAutoReplyStatus.Visible = false;
|
||||||
|
//
|
||||||
// WxTalkForm
|
// WxTalkForm
|
||||||
//
|
//
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||||
@@ -1241,8 +1239,8 @@ namespace TemuKJD.WXForms.TalkForms
|
|||||||
private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse;
|
private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse;
|
||||||
private DevComponents.DotNetBar.PanelEx btnMultiLogin;
|
private DevComponents.DotNetBar.PanelEx btnMultiLogin;
|
||||||
private DevComponents.DotNetBar.PanelEx btnChangeAddress;
|
private DevComponents.DotNetBar.PanelEx btnChangeAddress;
|
||||||
private DevComponents.DotNetBar.Controls.ProgressBarX progressBarX1;
|
|
||||||
private System.Windows.Forms.Label lblProgress;
|
private System.Windows.Forms.Label lblProgress;
|
||||||
private System.Windows.Forms.TabPage tabPage3;
|
private System.Windows.Forms.TabPage tabPage3;
|
||||||
|
private System.Windows.Forms.Label lblAutoReplyStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -242,13 +242,26 @@ namespace TemuKJD.WXForms.TalkForms
|
|||||||
|
|
||||||
if (chkIsAutoReply.Checked && 1==1)
|
if (chkIsAutoReply.Checked && 1==1)
|
||||||
{
|
{
|
||||||
while (lstAutoReplayParam.Count > 0)
|
Invoke(new Action(() => { lblAutoReplyStatus.Visible = true; lblAutoReplyStatus.Text = "自动回复中... " + DateTime.Now.ToString("HH:mm:ss"); }));
|
||||||
|
|
||||||
|
if (lstAutoReplayParam.Count > 0)
|
||||||
{
|
{
|
||||||
AutoReplayParam autoReplayParam = lstAutoReplayParam.FirstOrDefault();
|
var tmpAutoReplayParamLst = new List<AutoReplayParam>();
|
||||||
|
foreach (var rp in lstAutoReplayParam)
|
||||||
|
{
|
||||||
|
if (!tmpAutoReplayParamLst.Any(r => r.nickName == rp.nickName))
|
||||||
|
tmpAutoReplayParamLst.Add(rp);
|
||||||
|
}
|
||||||
|
foreach (AutoReplayParam autoReplayParam in tmpAutoReplayParamLst)
|
||||||
|
{
|
||||||
|
//AutoReplayParam autoReplayParam = lstAutoReplayParam.FirstOrDefault();
|
||||||
var autoReplayParamLst = lstAutoReplayParam.Where(r => r.nickName == autoReplayParam.nickName).ToList();
|
var autoReplayParamLst = lstAutoReplayParam.Where(r => r.nickName == autoReplayParam.nickName).ToList();
|
||||||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == autoReplayParam.shopId);
|
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == autoReplayParam.shopId);
|
||||||
if (shop == null)
|
if (shop == null)
|
||||||
|
{
|
||||||
|
lstAutoReplayParam.RemoveAll(r => r.shopId == autoReplayParam.shopId);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// 选择正确的用户
|
// 选择正确的用户
|
||||||
var jsStr1 = @"function clickUser() {
|
var jsStr1 = @"function clickUser() {
|
||||||
@@ -267,8 +280,9 @@ namespace TemuKJD.WXForms.TalkForms
|
|||||||
response1.Wait(2000);
|
response1.Wait(2000);
|
||||||
if (response1.Result.Result.ParseToString() != "success")
|
if (response1.Result.Result.ParseToString() != "success")
|
||||||
{
|
{
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(Randomx.GetId(500, 1000));
|
||||||
jsStr1 = @"function clickUser() {
|
Invoke(new Action(() => { lblAutoReplyStatus.Text = "当前用户获取失败,尝试获取全部用户 " + DateTime.Now.ToString("HH:mm:ss"); }));
|
||||||
|
var jsStr2 = @"function clickAllUser() {
|
||||||
var users = document.getElementsByClassName('tab-list-item');
|
var users = document.getElementsByClassName('tab-list-item');
|
||||||
for (i=0; i<users.length; i++) {
|
for (i=0; i<users.length; i++) {
|
||||||
if (users[i].innerHTML == '全部' && users[i].parentElement.innerHTML.indexOf('当前会话') !== -1) {
|
if (users[i].innerHTML == '全部' && users[i].parentElement.innerHTML.indexOf('当前会话') !== -1) {
|
||||||
@@ -276,14 +290,15 @@ namespace TemuKJD.WXForms.TalkForms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clickUser();";
|
clickAllUser();";
|
||||||
|
var response2 = shop.Chat.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr2);
|
||||||
|
response2.Wait(2000);
|
||||||
|
Thread.Sleep(Randomx.GetId(500, 1000));
|
||||||
|
|
||||||
response1 = shop.Chat.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
|
response1 = shop.Chat.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
|
||||||
response1.Wait(2000);
|
response1.Wait(2000);
|
||||||
Thread.Sleep(500);
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
Thread.Sleep(1500);
|
Thread.Sleep(Randomx.GetId(1500, 2000));
|
||||||
|
|
||||||
// 输入内容
|
// 输入内容
|
||||||
// 默认回复
|
// 默认回复
|
||||||
@@ -339,9 +354,15 @@ namespace TemuKJD.WXForms.TalkForms
|
|||||||
row.Cells["colAutoReplyCount"].Value = AutoReplyCount;
|
row.Cells["colAutoReplyCount"].Value = AutoReplyCount;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
Thread.Sleep(Randomx.GetId(100, 200));
|
Invoke(new Action(() => { lblAutoReplyStatus.Text = autoReplayParam.shopId + " 已尝试发送自动回复 " + DateTime.Now.ToString("HH:mm:ss"); }));
|
||||||
|
Thread.Sleep(Randomx.GetId(500, 600));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Invoke(new Action(() => { lblAutoReplyStatus.Visible = false; }));
|
||||||
|
}
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user