1微信店铺切换登录 20% 2过滤筛选备注改为全等于 3数据库数据拉回逻辑优化

This commit is contained in:
wule committed 2026-03-13 16:21:15 +08:00
1 parent dc83334c59
commit 860b4408ef
37 files changed
+2520 -274

No files matched your search

+54 -1
View File
@@ -36,6 +36,8 @@ namespace TemuKJD.WXForms.TalkForms
this.panel3 = new System.Windows.Forms.Panel();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.chkShowShopStatistics = new System.Windows.Forms.CheckBox();
this.chkShowAutoReplyNum = new System.Windows.Forms.CheckBox();
this.chkNotShowMessageWindow = new System.Windows.Forms.CheckBox();
this.cmbMessage = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
@@ -52,9 +54,11 @@ namespace TemuKJD.WXForms.TalkForms
this.colShopNotes = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colLoginStatus = new System.Windows.Forms.DataGridViewLinkColumn();
this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colAutoReplyCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colWaitSend = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colWayBillError = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colAfterSale = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colPunishCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colScore = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colCanUse = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.lblTalkCount = new System.Windows.Forms.Label();
@@ -127,7 +131,7 @@ namespace TemuKJD.WXForms.TalkForms
// lblVersionName
//
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(23685, 33);
this.lblVersionName.Location = new System.Drawing.Point(24753, 33);
//
// panel3
//
@@ -169,6 +173,8 @@ namespace TemuKJD.WXForms.TalkForms
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.chkShowShopStatistics);
this.splitContainer2.Panel1.Controls.Add(this.chkShowAutoReplyNum);
this.splitContainer2.Panel1.Controls.Add(this.chkNotShowMessageWindow);
this.splitContainer2.Panel1.Controls.Add(this.cmbMessage);
this.splitContainer2.Panel1.Controls.Add(this.label1);
@@ -184,6 +190,32 @@ namespace TemuKJD.WXForms.TalkForms
this.splitContainer2.SplitterDistance = 62;
this.splitContainer2.TabIndex = 0;
//
// chkShowShopStatistics
//
this.chkShowShopStatistics.AutoSize = true;
this.chkShowShopStatistics.Checked = true;
this.chkShowShopStatistics.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkShowShopStatistics.Location = new System.Drawing.Point(340, 38);
this.chkShowShopStatistics.Name = "chkShowShopStatistics";
this.chkShowShopStatistics.Size = new System.Drawing.Size(123, 21);
this.chkShowShopStatistics.TabIndex = 206;
this.chkShowShopStatistics.Text = "显示店铺统计信息";
this.chkShowShopStatistics.UseVisualStyleBackColor = true;
this.chkShowShopStatistics.Visible = false;
//
// chkShowAutoReplyNum
//
this.chkShowAutoReplyNum.AutoSize = true;
this.chkShowAutoReplyNum.Checked = true;
this.chkShowAutoReplyNum.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkShowAutoReplyNum.Location = new System.Drawing.Point(211, 38);
this.chkShowAutoReplyNum.Name = "chkShowAutoReplyNum";
this.chkShowAutoReplyNum.Size = new System.Drawing.Size(123, 21);
this.chkShowAutoReplyNum.TabIndex = 205;
this.chkShowAutoReplyNum.Text = "显示自动回复数量";
this.chkShowAutoReplyNum.UseVisualStyleBackColor = true;
this.chkShowAutoReplyNum.Visible = false;
//
// chkNotShowMessageWindow
//
this.chkNotShowMessageWindow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -283,6 +315,7 @@ namespace TemuKJD.WXForms.TalkForms
this.chkIsAutoReply.TabIndex = 0;
this.chkIsAutoReply.Text = "自动回复消息";
this.chkIsAutoReply.UseVisualStyleBackColor = true;
this.chkIsAutoReply.CheckedChanged += new System.EventHandler(this.chkIsAutoReply_CheckedChanged);
//
// splitContainer4
//
@@ -357,9 +390,11 @@ namespace TemuKJD.WXForms.TalkForms
this.colShopNotes,
this.colLoginStatus,
this.colMessage,
this.colAutoReplyCount,
this.colWaitSend,
this.colWayBillError,
this.colAfterSale,
this.colPunishCount,
this.colScore,
this.colCanUse});
this.dgvShop.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -432,6 +467,13 @@ namespace TemuKJD.WXForms.TalkForms
this.colMessage.ReadOnly = true;
this.colMessage.Width = 90;
//
// colAutoReplyCount
//
this.colAutoReplyCount.HeaderText = "自动回复";
this.colAutoReplyCount.Name = "colAutoReplyCount";
this.colAutoReplyCount.ReadOnly = true;
this.colAutoReplyCount.Width = 62;
//
// colWaitSend
//
this.colWaitSend.HeaderText = "待发货";
@@ -453,6 +495,13 @@ namespace TemuKJD.WXForms.TalkForms
this.colAfterSale.ReadOnly = true;
this.colAfterSale.Width = 38;
//
// colPunishCount
//
this.colPunishCount.HeaderText = "店铺违规";
this.colPunishCount.Name = "colPunishCount";
this.colPunishCount.ReadOnly = true;
this.colPunishCount.Width = 62;
//
// colScore
//
this.colScore.HeaderText = "评分";
@@ -1083,6 +1132,8 @@ namespace TemuKJD.WXForms.TalkForms
private DevComponents.DotNetBar.PanelEx btnRefreshMsgCount;
private System.Windows.Forms.Label lblTalkCount;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.CheckBox chkShowShopStatistics;
private System.Windows.Forms.CheckBox chkShowAutoReplyNum;
private UserComponent.UcDataGridViewCheckBoxColumn colSelect;
private System.Windows.Forms.DataGridViewTextBoxColumn colShopLoginName;
private System.Windows.Forms.DataGridViewTextBoxColumn colShopId;
@@ -1090,9 +1141,11 @@ namespace TemuKJD.WXForms.TalkForms
private System.Windows.Forms.DataGridViewTextBoxColumn colShopNotes;
private System.Windows.Forms.DataGridViewLinkColumn colLoginStatus;
private System.Windows.Forms.DataGridViewTextBoxColumn colMessage;
private System.Windows.Forms.DataGridViewTextBoxColumn colAutoReplyCount;
private System.Windows.Forms.DataGridViewTextBoxColumn colWaitSend;
private System.Windows.Forms.DataGridViewTextBoxColumn colWayBillError;
private System.Windows.Forms.DataGridViewTextBoxColumn colAfterSale;
private System.Windows.Forms.DataGridViewTextBoxColumn colPunishCount;
private System.Windows.Forms.DataGridViewTextBoxColumn colScore;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse;
}
+69 -10
View File
@@ -33,9 +33,19 @@ namespace TemuKJD.WXForms.TalkForms
{
public partial class WxTalkForm : BaseTalkForm
{
/// <summary>
/// 自动回复话术信息
/// </summary>
public static List<KeyValuePair<string, string>> LstTalkTemplatePair { get; set; } = null;
public Dictionary<string, int> dicTalkAutoReplyCount = new Dictionary<string, int>();
/// <summary>
/// 客服统计信息
/// </summary>
public ConcurrentList<WxShopKfStatistics> lstShopKfStatistics = new ConcurrentList<WxShopKfStatistics>();
/// <summary>
/// 店铺主页统计信息
/// </summary>
public ConcurrentList<WxTalkFormShopMainInfo> lstShopAfterSale = new ConcurrentList<WxTalkFormShopMainInfo>();
/// <summary>
@@ -99,13 +109,16 @@ namespace TemuKJD.WXForms.TalkForms
// 初始化自动回复话术
InitAutoReply();
dicTalkAutoReplyCount = NaiBa.Util.Helper.ConfigHelper.LoadConfig<Dictionary<string,int>>("wx_talk_auto_reply_count");
if (dicTalkAutoReplyCount == null)
dicTalkAutoReplyCount = new Dictionary<string, int>();
//this.chkIsAutoReLogin.CheckedChanged -= chkIsAutoReLogin_CheckedChanged;
//this.chkIsAutoReply.CheckedChanged -= chkIsAutoReply_CheckedChanged;
this.chkIsAutoReply.CheckedChanged -= chkIsAutoReply_CheckedChanged;
//this.txtAutoReplyText.TextChanged -= txtAutoReplyText_TextChanged;
//this.cmbMessage.SelectedIndexChanged -= cmbMessage_SelectedIndexChanged;
this.chkNotShowMessageWindow.CheckedChanged -= chkNotShowMessageWindow_CheckedChanged;
if (this.cmbMessage.Items.Contains(ChatConfig.ChatSettingConfig.MessageSound))
this.cmbMessage.SelectedItem = ChatConfig.ChatSettingConfig.MessageSound;
else
@@ -224,8 +237,8 @@ namespace TemuKJD.WXForms.TalkForms
//alert('hello world');
return 'success';
}
return 'fail';
}
return 'fail';
}
clickUser();";
var response1 = shop.Chat.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
@@ -233,6 +246,19 @@ namespace TemuKJD.WXForms.TalkForms
if (response1.Result.Result.ParseToString() != "success")
{
Thread.Sleep(500);
jsStr1 = @"function clickUser() {
var users = document.getElementsByClassName('tab-list-item');
for (i=0; i<users.length; i++) {
if (users[i].innerHTML == '全部' && users[i].parentElement.innerHTML.indexOf('当前会话') !== -1) {
users[i].click();
}
}
}
clickUser();";
response1 = shop.Chat.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
response1.Wait(2000);
Thread.Sleep(500);
continue;
}
Thread.Sleep(1500);
@@ -279,6 +305,18 @@ namespace TemuKJD.WXForms.TalkForms
// 删除队列里的消息
lstAutoReplayParam.RemoveAll(r => r.nickName == autoReplayParam.nickName);
var row = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(x => x.Cells["colShopId"].Value.ToString() == shop.ShopId);
if (row != null)
{
int AutoReplyCount = dicTalkAutoReplyCount.FirstOrDefault(t => t.Key == shop.ShopId).Value.ParseToInt();
AutoReplyCount++;
dicTalkAutoReplyCount[shop.ShopId] = AutoReplyCount;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_talk_auto_reply_count", dicTalkAutoReplyCount);
Invoke(new Action(() =>
{
row.Cells["colAutoReplyCount"].Value = AutoReplyCount;
}));
}
Thread.Sleep(Randomx.GetId(100, 200));
}
}
@@ -436,8 +474,10 @@ namespace TemuKJD.WXForms.TalkForms
}
r.Cells["colShopId"].Value = shop.ShopId; // 店铺ID
r.Cells["colShopName"].Value = shop.ShopAccount; // 店铺名称
r.Cells["colShopName"].Style.ForeColor = LstTagShop.Contains(shop.ShopId) ? Color.Green : Control.DefaultForeColor;
//r.Cells["colShopName"].Style.ForeColor = LstTagShop.Contains(shop.ShopId) ? Color.LightGreen : Control.DefaultForeColor;
r.Cells["colShopName"].Style.BackColor = LstTagShop.Contains(shop.ShopId) ? Color.LightGreen : (r.Tag is Color ? (Color)r.Tag : Color.White);
r.Cells["colShopNotes"].Value = shop.Notes; // 备注
r.Cells["colAutoReplyCount"].Value = dicTalkAutoReplyCount.FirstOrDefault(t => t.Key == shop.ShopId).Value.ParseToInt();
r.Cells["colLoginStatus"].Value = shop.LoginStatus == "登录成功" ? "在线" : "掉线"; // 登录状态
bool canUse = shop.LoginStatus == "登录成功";
(r.Cells["colLoginStatus"] as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Blue : Color.Red;
@@ -525,12 +565,14 @@ namespace TemuKJD.WXForms.TalkForms
if (r != null)
{
r.Cells["colMessage"].Value = msg;
r.Cells["colAfterSale"].Value = shopAfterSale.AfterSaleCount;
r.Cells["colAfterSale"].Style.ForeColor = shopAfterSale.AfterSaleCount > 0 ? Color.OrangeRed : Color.Black;
r.Cells["colWaitSend"].Value = shopAfterSale.WaitSendCount;
r.Cells["colWaitSend"].Style.ForeColor = shopAfterSale.WaitSendCount > 0 ? Color.OrangeRed : Color.Black;
r.Cells["colWaybillError"].Value = shopAfterSale.WaybillError;
r.Cells["colWaybillError"].Style.ForeColor = shopAfterSale.WaybillError > 0 ? Color.OrangeRed : Color.Black;
r.Cells["colAfterSale"].Value = shopAfterSale.AfterSaleCount;
r.Cells["colAfterSale"].Style.ForeColor = shopAfterSale.AfterSaleCount > 0 ? Color.OrangeRed : Color.Black;
r.Cells["colPunishCount"].Value = shopAfterSale.PunishCount;
r.Cells["colPunishCount"].Style.ForeColor = shopAfterSale.PunishCount > 0 ? Color.OrangeRed : Color.Black;
r.Cells["colScore"].Value = shopAfterSale.ShopScore.IsNullOrEmpty() ? "-" : shopAfterSale.ShopScore.ParseToString();
}
}
@@ -1036,6 +1078,20 @@ namespace TemuKJD.WXForms.TalkForms
{
ChatConfig.ChatSettingConfig.IsAutoReply = chkIsAutoReply.Checked;
ChatConfig.SaveChatSettingParam();
if (chkIsAutoReply.Checked == false)
{
dicTalkAutoReplyCount = new Dictionary<string, int>();
NaiBa.Util.Helper.ConfigHelper.SaveConfig<Dictionary<string, int>>("wx_talk_auto_reply_count", dicTalkAutoReplyCount);
}
else
{
var dgvRows = dgvShop.Rows.Cast<DataGridViewRow>();
foreach (var row in dgvRows)
{
row.Cells["colAutoReplyCount"].Value = 0;
}
}
}
private void txtAutoReplyText_TextChanged(object sender, EventArgs e)
@@ -1168,12 +1224,14 @@ namespace TemuKJD.WXForms.TalkForms
if (!LstTagShop.Contains(shop.ShopId))
{
LstTagShop.Add(shop.ShopId);
dgvShop.Rows[e.RowIndex].Cells["colShopName"].Style.ForeColor = Color.Green;
//dgvShop.Rows[e.RowIndex].Cells["colShopName"].Style.ForeColor = Color.LightGreen;
dgvShop.Rows[e.RowIndex].Cells["colShopName"].Style.BackColor = Color.LightGreen;
}
else
{
LstTagShop.Remove(shop.ShopId);
dgvShop.Rows[e.RowIndex].Cells["colShopName"].Style.ForeColor = DefaultForeColor;
dgvShop.Rows[e.RowIndex].Cells["colShopName"].Style.BackColor = dgvShop.Rows[e.RowIndex].Tag is Color ? (Color)dgvShop.Rows[e.RowIndex].Tag : Color.White;
}
NaiBa.Util.Helper.ConfigHelper.SaveConfig<List<string>>("wx_talk_tag_shop_list", LstTagShop);
}
@@ -1324,11 +1382,10 @@ namespace TemuKJD.WXForms.TalkForms
string notes = cmbFiltNotes.Text.Trim().Trim(';');
if (notes == "全部")
notes = "";
List<string> notesLst = notes.Split(new string[] { ";", ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries).ToList();
List<string> notesLst = notes.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
foreach(DataGridViewRow row in dgvShop.Rows)
{
if ((row.Cells["colShopNotes"].Value.ParseToString().Contains(notes) || notesLst.Contains(row.Cells["colShopNotes"].Value.ParseToString())) &&
row.Cells["colShopName"].Value.ParseToString().Contains(shopName))
if (string.IsNullOrEmpty(notes) || notesLst.Contains(row.Cells["colShopNotes"].Value.ParseToString()) && row.Cells["colShopName"].Value.ParseToString().Contains(shopName))
{
row.Visible = true;
}
@@ -1417,6 +1474,7 @@ namespace TemuKJD.WXForms.TalkForms
var afterCount = JsonHelper.JObjectParse(rst)["aftersaleAllRet"]["totalNum"].ParseToInt();
var waitSendCount = JsonHelper.JObjectParse(rst)["orderNumRet"]["pendingShipNum"].ParseToInt();
var waybillErrorCount = JsonHelper.JObjectParse(rst)["waybillErrorRet"]["totalNum"].ParseToInt();
var punishCount = JsonHelper.JObjectParse(rst)["punishRet"]["pendingNum"].ParseToInt();
shopMainInfo = new WxTalkFormShopMainInfo()
{
ShopId = shop.ShopId,
@@ -1424,6 +1482,7 @@ namespace TemuKJD.WXForms.TalkForms
AfterSaleCount = afterCount,
WaitSendCount = waitSendCount,
WaybillError = waybillErrorCount,
PunishCount = punishCount,
};
var shopScoreRst = WxShopStatisticsForm.GetShopScore(shop);
@@ -135,6 +135,9 @@
<metadata name="colMessage.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colAutoReplyCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colWaitSend.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -144,6 +147,9 @@
<metadata name="colAfterSale.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colPunishCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colScore.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>