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

+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);