1906 lines
117 KiB
C#
1906 lines
117 KiB
C#
using AllBase;
|
||
using AllBase.Helper;
|
||
using AllBase.Model.Config;
|
||
using AllBase.Model.Result;
|
||
using CefSharp;
|
||
using CefSharp.WinForms;
|
||
using NaiBa.CefHelper;
|
||
using NaiBa.CefHelper.Handler;
|
||
using NaiBa.Util;
|
||
using NaiBa.Util.Extension;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using System.Data;
|
||
using System.Diagnostics;
|
||
using System.Drawing;
|
||
using System.IO;
|
||
using System.IO.Compression;
|
||
using System.Linq;
|
||
using System.Media;
|
||
using System.Runtime.InteropServices;
|
||
using System.Text;
|
||
using System.Threading;
|
||
using System.Threading.Tasks;
|
||
using System.Windows.Forms;
|
||
using TemuKJD.BaseForms;
|
||
using TemuKJD.BLL;
|
||
using TemuKJD.BLL.Tools;
|
||
using TemuKJD.Helper;
|
||
using TemuKJD.ToolForms;
|
||
using TemuKJD.WXForms.ShopForms;
|
||
using TemuKJD.WXForms.TalkForms.TalkHelper;
|
||
using TemuKJD.WXForms.TalkForms.TalkModel;
|
||
|
||
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>
|
||
/// 等待自动回复的消息队列
|
||
/// </summary>
|
||
public ConcurrentList<AutoReplayParam> lstAutoReplayParam = new ConcurrentList<AutoReplayParam>();
|
||
|
||
public delegate void SearchResultReceivedHandler(ShopLoginInfo shop);
|
||
/// <summary>
|
||
/// 查询结果事件通知
|
||
/// </summary>
|
||
public event SearchResultReceivedHandler SearchResultReceived;
|
||
|
||
public delegate void InfomationReceivedHandler(string infomation);
|
||
/// <summary>
|
||
/// 消息事件通知,比如:异常等通知
|
||
/// </summary>
|
||
/// <param name="infomation"></param>
|
||
public event InfomationReceivedHandler InfomationReceived;
|
||
|
||
public static ShopLoginInfo currentShop = null;
|
||
ChromiumWebBrowser mainWebBrowser = null;
|
||
|
||
/// <summary>
|
||
/// 弹出框列表
|
||
/// </summary>
|
||
public static List<TalkMessageForm> lstChatMessageForm = new List<TalkMessageForm>();
|
||
public static Dictionary<DataGridViewRow, Color> dicRowColor = new Dictionary<DataGridViewRow, Color>();
|
||
public List<string> LstTagShop = new List<string>();
|
||
|
||
public BuyerOrderListForm orderListForm = null;
|
||
|
||
public int LocationXY = 0;
|
||
public int LocationSize = 200;
|
||
|
||
public WxTalkForm()
|
||
{
|
||
InitializeComponent();
|
||
|
||
ChatConfig.LoadChatSetting();
|
||
}
|
||
|
||
private void WxTalkForm_FormClosed(object sender, FormClosedEventArgs e)
|
||
{
|
||
Process.GetCurrentProcess().Kill();
|
||
}
|
||
|
||
private void WxTalkForm_Load(object sender, EventArgs e)
|
||
{
|
||
this.ucTabControl1.SelectedIndex = 2;
|
||
Task.Run(() =>
|
||
{
|
||
Thread.Sleep(2000);
|
||
Invoke(new Action(() =>
|
||
{
|
||
this.ucTabControl1.SelectedIndex = 0;
|
||
}));
|
||
});
|
||
|
||
if (BaseClass.LogoImage != null)
|
||
pbLogo.Image = BaseClass.LogoImage;
|
||
if (BaseClass.Ico != null)
|
||
this.Icon = BaseClass.Ico;
|
||
else
|
||
this.Icon = BaseClass.Ico = ImageBuild.ConvertToIcon(Properties.Resources.icon);
|
||
|
||
lblProgress.Text = "";
|
||
//SetTitle();
|
||
|
||
#if DEBUG
|
||
#else
|
||
//ucTabControl1.TabPages.Remove(tabPage3);
|
||
#endif
|
||
|
||
// 点击变绿的按钮
|
||
LstTagShop = NaiBa.Util.Helper.ConfigHelper.LoadConfig<List<string>>("wx_talk_tag_shop_list");
|
||
if (LstTagShop == null)
|
||
LstTagShop = new List<string>();
|
||
|
||
// 初始化自动回复话术
|
||
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.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
|
||
this.cmbMessage.SelectedIndex = 0;
|
||
this.chkIsAutoReply.Checked = ChatConfig.ChatSettingConfig.IsAutoReply;
|
||
this.txtAutoReplyText.Text = ChatConfig.ChatSettingConfig.AutoReplayText;
|
||
this.chkNotShowMessageWindow.Checked = ChatConfig.ChatSettingConfig.IsNotShowMessageWindow;
|
||
|
||
this.chkIsAutoReLogin.CheckedChanged += chkIsAutoReLogin_CheckedChanged;
|
||
this.chkIsAutoReply.CheckedChanged += chkIsAutoReply_CheckedChanged;
|
||
this.txtAutoReplyText.TextChanged += txtAutoReplyText_TextChanged;
|
||
this.cmbMessage.SelectedIndexChanged += cmbMessage_SelectedIndexChanged;
|
||
this.chkNotShowMessageWindow.CheckedChanged += chkNotShowMessageWindow_CheckedChanged;
|
||
|
||
SearchResultReceived += Chat_SearchResultReceived;
|
||
InfomationReceived += Collect_InfomationReceived;
|
||
|
||
if (mainWebBrowser == null)
|
||
{
|
||
mainWebBrowser = CEFBrowser.CreateChromiumWebBrowser("about:blank", false);
|
||
mainWebBrowser.KeyboardHandler = new KeyboardHandler();
|
||
mainWebBrowser.Dock = DockStyle.Fill;
|
||
var lifeSpanHandler = new LifeSpanHandlerLocal(PopWindowType.NewTitleWindow);
|
||
lifeSpanHandler.parent = mainWebBrowser;
|
||
lifeSpanHandler.OnPop += MainLifeHandler_OnPop;
|
||
mainWebBrowser.LifeSpanHandler = lifeSpanHandler;
|
||
mainWebBrowser.AddressChanged += MainWebBrowser_AddressChanged;
|
||
mainWebBrowser.FrameLoadEnd += cefWebBrowser1_FrameLoadEnd;
|
||
mainPanel.Controls.Add(mainWebBrowser);
|
||
}
|
||
|
||
Task.Run(() =>
|
||
{
|
||
// 直到店铺加载完后再加载客服内容
|
||
while (!StartUp.IsShopInit)
|
||
Thread.Sleep(100);
|
||
|
||
SetMainBrowserUrl(GlobalConfig.ShopLoginList.FirstOrDefault());
|
||
LoadShop();
|
||
InitOrderForm(); // 加载店铺确认默认店铺后再初始化订单列表读取
|
||
InitAutoExecute();
|
||
Invoke(new Action(() =>
|
||
{
|
||
foreach (var shopNote in GlobalConfig.ShopLoginList.Select(s => s.Notes).Where(s => !s.IsNullOrEmpty()).Distinct())
|
||
{
|
||
this.cmbFiltNotes.Items.Add(shopNote);
|
||
}
|
||
|
||
lstShopAfterSale = NaiBa.Util.Helper.ConfigHelper.LoadConfig<NaiBa.Util.ConcurrentList<WxTalkFormShopMainInfo>>("wx_shop_after_sale_list");
|
||
if (lstShopAfterSale == null)
|
||
lstShopAfterSale = new ConcurrentList<WxTalkFormShopMainInfo>();
|
||
//RefreshAfterSale();
|
||
}));
|
||
|
||
while (true)
|
||
{
|
||
Thread.Sleep(1000);
|
||
if (DateTime.Now > nextRefreshTime)
|
||
{
|
||
|
||
Invoke(new Action(() => { pbLoading.Visible = true; }));
|
||
nextRefreshTime = DateTime.Now.AddMinutes(30);
|
||
try
|
||
{
|
||
RefreshCookie(true);
|
||
}
|
||
catch (Exception ex) { BaseMsgForm.ShowError("刷新Cookie出错 " + ex.Message); }
|
||
try
|
||
{
|
||
RefreshMsgCount();
|
||
}
|
||
catch (Exception ex) { BaseMsgForm.ShowError("刷新客服统计出错 " + ex.Message); }
|
||
try
|
||
{
|
||
RefreshAfterSale(true);
|
||
}
|
||
catch (Exception ex) { BaseMsgForm.ShowError("刷新售后出错 " + ex.Message); }
|
||
|
||
Invoke(new Action(() => { pbLoading.Visible = false; }));
|
||
}
|
||
var deltaTime = nextRefreshTime - DateTime.Now;
|
||
Invoke(new Action(() =>
|
||
{
|
||
this.pnlRefreshShop.Text = "刷 新 店 铺 " + deltaTime.Minutes.ToString("00") + ":" + deltaTime.Seconds.ToString("00");
|
||
}));
|
||
}
|
||
});
|
||
|
||
// 关闭弹窗
|
||
//if (chkIsAutoReply.Checked)
|
||
ClosePopWindow();
|
||
|
||
// 自动回复
|
||
Task.Run(() =>
|
||
{
|
||
while (true)
|
||
{
|
||
//if (lstAutoReplayParam.Count > 0)
|
||
// lstAutoReplayParam.Clear();
|
||
|
||
if (chkIsAutoReply.Checked && 1==1)
|
||
{
|
||
Invoke(new Action(() =>
|
||
{
|
||
lblAutoReplyStatus.Visible = true;
|
||
lblAutoReplyStatus.Text = "自动回复中... 待回复数:" +
|
||
lstAutoReplayParam.Select(rp => rp.nickName).Distinct().ToList().Count + "条 " + DateTime.Now.ToString("HH:mm:ss");
|
||
}));
|
||
|
||
if (lstAutoReplayParam.Count > 0)
|
||
{
|
||
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 shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == autoReplayParam.shopId);
|
||
if (shop == null)
|
||
{
|
||
lstAutoReplayParam.RemoveAll(r => r.shopId == autoReplayParam.shopId);
|
||
continue;
|
||
}
|
||
|
||
// 选择正确的用户
|
||
var jsStr1 = @"function clickUser() {
|
||
var users = document.getElementsByClassName('user-nickname');
|
||
for (i=0; i<users.length; i++) {
|
||
if (users[i].innerHTML == '" + autoReplayParam.nickName + @"') {
|
||
users[i].click();
|
||
//alert('hello world');
|
||
return 'success';
|
||
}
|
||
}
|
||
return 'fail';
|
||
}
|
||
clickUser();";
|
||
var response1 = shop.Chat.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
|
||
response1.Wait(2000);
|
||
if (response1.Result.Result.ParseToString() != "success")
|
||
{
|
||
Thread.Sleep(Randomx.GetId(500, 1000));
|
||
Invoke(new Action(() =>
|
||
{
|
||
lblAutoReplyStatus.Text = "当前用户获取失败,尝试获取全部用户 待回复数:" +
|
||
lstAutoReplayParam.Select(rp => rp.nickName).Distinct().ToList().Count + "条 " + DateTime.Now.ToString("HH:mm:ss");
|
||
}));
|
||
var jsStr2 = @"function clickAllUser() {
|
||
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();
|
||
}
|
||
}
|
||
}
|
||
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.Wait(2000);
|
||
}
|
||
Thread.Sleep(Randomx.GetId(1500, 2000));
|
||
|
||
// 输入内容
|
||
// 默认回复
|
||
string replyContent = "亲,客服打包去了,请稍候!";
|
||
// 分割完整语句匹配
|
||
var replyContentLst = LstTalkTemplatePair
|
||
.Where(t => lstAutoReplayParam.Any(a => t.Key.Split('|').Any(k => !k.IsNullOrEmpty() && a.talkContent == k)))
|
||
.OrderBy(x => Randomx.GetId(100000)).ToList();
|
||
// 分割完整语句匹配(过滤标点符号)
|
||
if (replyContentLst.Count == 0)
|
||
replyContentLst = LstTalkTemplatePair
|
||
.Where(t => lstAutoReplayParam.Any(a => t.Key.Split('|').Any(k => !k.IsNullOrEmpty() && a.talkContent.Trim('?', '?', ',', ',', '.', '。', '!', '!') == k)))
|
||
.OrderBy(x => Randomx.GetId(100000)).ToList();
|
||
// 反向包含匹配
|
||
if (replyContentLst.Count == 0)
|
||
replyContentLst = LstTalkTemplatePair.Where(t => lstAutoReplayParam.Any(a => a.talkContent.Contains(t.Key))).OrderBy(x => Randomx.GetId(100000)).ToList();
|
||
|
||
// 不能匹配的发默认消息
|
||
if (replyContentLst.Count == 0)
|
||
replyContentLst = LstTalkTemplatePair.Where(t => t.Key.IsNullOrEmpty()).OrderBy(x => Randomx.GetId(100000)).ToList();
|
||
if (replyContentLst.Count > 0)
|
||
replyContent = replyContentLst.FirstOrDefault().Value;
|
||
shop.Chat.GetBrowser().MainFrame.EvaluateScriptAsync(KJDForms.ShopForms.ShopLoginForm.sInputValueChange2);
|
||
jsStr1 = "var txtarea = document.getElementById('input-textarea'); " +
|
||
"changeReactInputValue(txtarea,'" + replyContent + "');";
|
||
response1 = shop.Chat.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
|
||
response1.Wait(2000);
|
||
Thread.Sleep(Randomx.GetId(100, 200));
|
||
|
||
// 点击回车发送自动回复
|
||
jsStr1 = @"var event = new KeyboardEvent('keydown', {
|
||
key: 'Enter',
|
||
keyCode: 13,
|
||
code: 'Enter',
|
||
which: 13
|
||
});
|
||
txtarea.dispatchEvent(event);";
|
||
response1 = shop.Chat.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
|
||
response1.Wait(2000);
|
||
|
||
// 删除队列里的消息
|
||
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;
|
||
}));
|
||
}
|
||
Invoke(new Action(() =>
|
||
{
|
||
lblAutoReplyStatus.Text = autoReplayParam.shopId + " 已尝试发送自动回复 待回复数:" +
|
||
lstAutoReplayParam.Select(rp => rp.nickName).Distinct().ToList().Count + "条 " + DateTime.Now.ToString("HH:mm:ss");
|
||
}));
|
||
Thread.Sleep(Randomx.GetId(500, 600));
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Invoke(new Action(() => { lblAutoReplyStatus.Visible = false; }));
|
||
}
|
||
Thread.Sleep(1000);
|
||
}
|
||
});
|
||
|
||
//var _1688AddressForm = new GetAddressForm() { AddressType = "1688" };
|
||
//_1688AddressForm.cmbType.Enabled = false;
|
||
//_1688AddressForm.cmbTypeFilter.Enabled = false;
|
||
//_1688AddressForm.TopLevel = false;
|
||
//_1688AddressForm.FormBorderStyle = FormBorderStyle.None;
|
||
//_1688AddressForm.Dock = DockStyle.Fill;
|
||
//this.panel4.Controls.Add(_1688AddressForm);
|
||
//_1688AddressForm.Show();
|
||
}
|
||
|
||
private void lblAutoReplyStatus_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
}
|
||
|
||
int isDbClick = 0;
|
||
private void lblAutoReplyStatus_DoubleClick(object sender, EventArgs e)
|
||
{
|
||
isDbClick++;
|
||
Task.Run(() =>
|
||
{
|
||
Thread.Sleep(5000);
|
||
if (isDbClick > 0)
|
||
isDbClick--;
|
||
});
|
||
|
||
if (textBox1.Visible == true)
|
||
textBox1.Visible = false;
|
||
|
||
if (isDbClick > 3)
|
||
{
|
||
isDbClick = 0;
|
||
textBox1.Visible = true;
|
||
textBox1.Text = JsonHelper.SerializeObject(lstAutoReplayParam);
|
||
}
|
||
}
|
||
|
||
void InitOrderForm()
|
||
{
|
||
Invoke(new Action(() =>
|
||
{
|
||
|
||
orderListForm = new BuyerOrderListForm();
|
||
orderListForm.TopLevel = false;
|
||
orderListForm.FormBorderStyle = FormBorderStyle.None;
|
||
orderListForm.Dock = DockStyle.Fill;
|
||
orderListForm.lblCurrentShop.Text = currentShop?.ShopAccount;
|
||
orderListForm.lblCurrentShop.Tag = currentShop;
|
||
tabPage3.Controls.Add(orderListForm);
|
||
orderListForm.Show();
|
||
|
||
}));
|
||
}
|
||
|
||
void ClosePopWindow()
|
||
{
|
||
Task.Run(() =>
|
||
{
|
||
for (int i = 0; i < 120; i++)
|
||
{
|
||
foreach (var shop in GlobalConfig.ShopLoginList)
|
||
{
|
||
if (shop.Chat?.IsBrowserInitialized != true)
|
||
continue;
|
||
|
||
//关闭弹窗
|
||
var jsStr1 = @"var btnLst = document.getElementsByTagName('button');
|
||
for (i=0;i<btnLst.length;i++)
|
||
{
|
||
if (btnLst[i].innerHTML.indexOf('暂不启用') !== -1)
|
||
btnLst[i].click();
|
||
}";
|
||
var response1 = shop.Chat.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
|
||
response1.Wait(2000);
|
||
}
|
||
Thread.Sleep(500);
|
||
}
|
||
});
|
||
}
|
||
|
||
private void MainWebBrowser_AddressChanged(object sender, AddressChangedEventArgs e)
|
||
{
|
||
if (sender == currentShop?.Chat)
|
||
this.txtAddress.Text = e.Address;
|
||
}
|
||
|
||
private void cefWebBrowser1_FrameLoadEnd(object sender, CefSharp.FrameLoadEndEventArgs e)
|
||
{
|
||
//ChromiumWebBrowser cefWebBrowser1 = (ChromiumWebBrowser)sender;
|
||
//string url = cefWebBrowser1.Address;
|
||
//if (url.Contains("/mallcenter/info/basic") && cefWebBrowser3.IsBrowserInitialized)
|
||
//{
|
||
// Thread.Sleep(5000);
|
||
// var shop = GetShopLoginInfo.Shops.Find(s => s != null && s.ShopName == ShopName);
|
||
// string code = "document.getElementsByClassName('new-part')[1].innerHTML=\"<div>" + shop.Name + "<i class='mui-icon mui-icon-question-circle content_tip-icon__2u2h2'></i><span class='create-new-mall-tips'><span>?</span><p class='create-new-mall-entry'><!-- react-text: 498 -->当前状态不支持修改店铺名,您可<!-- /react-text --><a href='/mallcenter/info/createNewMall'>一键开新店铺</a></p></span></div>\"";
|
||
// cefWebBrowser3.GetBrowser().MainFrame.ExecuteJavaScriptAsync(code);
|
||
//}
|
||
}
|
||
|
||
[DllImport("winmm.dll")]
|
||
public static extern uint mciSendString(string lpstrCommand, string lpstrReturnString, uint uReturnLength, uint hWndCallback);
|
||
/// <summary>
|
||
/// 播放提示音
|
||
/// </summary>
|
||
public void playSound()
|
||
{
|
||
string musicname = "默认提示音";
|
||
if (!string.IsNullOrEmpty(ChatConfig.ChatSettingConfig.MessageSound))
|
||
musicname = ChatConfig.ChatSettingConfig.MessageSound;
|
||
if (musicname == "无")
|
||
return;
|
||
if (musicname == "默认提示音")
|
||
musicname = "9527.wav";
|
||
else
|
||
musicname = musicname + ".mp3";
|
||
|
||
if (musicname.Contains("wav"))
|
||
{
|
||
try
|
||
{
|
||
SoundPlayer sound = new SoundPlayer("temp/" + musicname);
|
||
sound.Play();
|
||
}
|
||
catch
|
||
{
|
||
|
||
}
|
||
}
|
||
if (musicname.Contains("mp3"))
|
||
{
|
||
try
|
||
{
|
||
mciSendString(@"close ""temp/" + musicname + @"""", null, 0, 0);
|
||
mciSendString(@"open ""temp/" + musicname + @"""", null, 0, 0);
|
||
mciSendString(@"play ""temp/" + musicname + @"""", null, 0, 0);
|
||
}
|
||
catch
|
||
{ }
|
||
}
|
||
}
|
||
|
||
|
||
public void ShowChat(ShopLoginInfo shop)
|
||
{
|
||
while (shop.Chat?.IsBrowserInitialized != true)
|
||
{
|
||
Thread.Sleep(50);
|
||
}
|
||
// 设置cef cookie
|
||
if (shop.Chat != null && shop.Chat.IsBrowserInitialized)
|
||
{
|
||
var cookieManager = shop.Chat.RequestContext.GetCookieManager(null);
|
||
|
||
var cookieLst = new List<Cookie>();
|
||
try
|
||
{
|
||
cookieLst = JsonHelper.DeserializeJsonToList<CefSharp.Cookie>(shop.Cookies.ParseToString().Replace("empty=true;", "[]"));
|
||
}
|
||
catch
|
||
{
|
||
}
|
||
|
||
cookieManager.DeleteCookies("qq.com", null);
|
||
foreach (var cook in cookieLst)
|
||
{
|
||
var t = CEFBrowser.SetCookieAsync(cook.Domain, cook.Name + "=" + cook.Value + ";", cookieManager);
|
||
t.Wait(5000);
|
||
}
|
||
|
||
if (shop.LoginStatus == "登录成功")
|
||
shop.Chat.Load("https://store.weixin.qq.com/shop/kf");
|
||
}
|
||
}
|
||
|
||
|
||
public void LoadShop(List<ShopLoginInfo> shopList = null)
|
||
{
|
||
if (shopList == null)
|
||
shopList = new List<ShopLoginInfo>();
|
||
if (shopList.Count == 0)
|
||
shopList.AddRange(GlobalConfig.ShopLoginList);
|
||
|
||
for (int i = 0; i < shopList.Count; i++)
|
||
{
|
||
var shop = shopList[i];
|
||
ShopLoginInfo result = new ShopLoginInfo();
|
||
result.ShopId = shop.ShopId;
|
||
result.ShopAccount = shop.ShopAccount;
|
||
result.LoginStatus = shop.LoginStatus;
|
||
|
||
var r = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(x => x.Cells["colShopId"].Value.ToString() == shop.ShopId);
|
||
this.Invoke(new Action(() =>
|
||
{
|
||
int iGrid = 0;
|
||
if (r == null)
|
||
{
|
||
iGrid = dgvShop.Rows.Add();
|
||
if (iGrid == 0)
|
||
dgvShop.Rows[iGrid].Cells["colSelect"].Value = true;
|
||
r = dgvShop.Rows[iGrid];
|
||
}
|
||
r.Cells["colShopId"].Value = shop.ShopId; // 店铺ID
|
||
r.Cells["colShopName"].Value = shop.ShopAccount; // 店铺名称
|
||
//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;
|
||
(r.Cells["colLoginStatus"] as DataGridViewLinkCell).LinkColor = canUse ? Color.Blue : Color.Red;
|
||
(r.Cells["colLoginStatus"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightBlue : Color.OrangeRed;
|
||
(r.Cells["colLoginStatus"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkBlue : Color.DarkRed;
|
||
dicRowColor[r] = r.DefaultCellStyle.BackColor;
|
||
|
||
if (shop.Chat == null)
|
||
{
|
||
LocationXY += 5;
|
||
shop.X = LocationXY % LocationSize;
|
||
shop.Y = LocationXY / LocationSize;
|
||
RequestContextSettings requestContextSettings = new RequestContextSettings();
|
||
requestContextSettings.PersistSessionCookies = false;
|
||
//requestContextSettings.PersistUserPreferences = false;
|
||
try
|
||
{
|
||
var cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser("about:blank", false);
|
||
//new ChromiumWebBrowser("https://store.weixin.qq.com/shop/kf);
|
||
|
||
CustomResourceRequestHandler resourceRequestHandler = new CustomResourceRequestHandler();
|
||
Task.Run(() =>
|
||
{
|
||
var handler = resourceRequestHandler;
|
||
//Thread.Sleep(3000);
|
||
handler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadComplete;
|
||
});
|
||
cefWebBrowser.RequestHandler = new CustomRequestHandler(resourceRequestHandler);
|
||
cefWebBrowser.KeyboardHandler = new KeyboardHandler();
|
||
|
||
var lifeHandler = new LifeSpanHandlerLocal(PopWindowType.NewTitleWindow);
|
||
lifeHandler.OnPop += LifeHandler_OnPop;
|
||
lifeHandler.parent = cefWebBrowser;
|
||
cefWebBrowser.LifeSpanHandler = lifeHandler;
|
||
|
||
cefWebBrowser.RequestContext = new RequestContext(requestContextSettings);
|
||
cefWebBrowser.Dock = DockStyle.Fill; //DockStyle.None;
|
||
cefWebBrowser.Location = new Point(shop.X, shop.Y);
|
||
shop.Chat = cefWebBrowser;
|
||
pnlTalk.Controls.Add(shop.Chat);
|
||
|
||
if (i == 0)
|
||
currentShop = shop;
|
||
|
||
Task.Run(() =>
|
||
{
|
||
ShowChat(shop);
|
||
while (shop.Chat.IsLoading)
|
||
{
|
||
Thread.Sleep(50);
|
||
}
|
||
//Thread.Sleep(3000);
|
||
//var t = shop.Chat.GetMainFrame().EvaluateScriptAsync("document.getElementsByClassName('unread-badge bold').length;");
|
||
//t.Wait(2000);
|
||
//if (t.Result?.Result?.ParseToInt() > 0)
|
||
//{
|
||
// var row = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(rw => rw.Cells["colShopId"].Value.ParseToString() == shop.ShopId);
|
||
// if (row != null)
|
||
// {
|
||
// Invoke(new Action(() =>
|
||
// {
|
||
// row.Cells["colMessage"].Value = "有历史未读消息";
|
||
// }));
|
||
// // 进行闪烁
|
||
// Task.Run(() => { FlashDgvRow(row); });
|
||
// // 播放声音
|
||
// playSound();
|
||
// }
|
||
//}
|
||
});
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}));
|
||
}
|
||
}
|
||
|
||
private void LoadShopAfterSale(WxTalkFormShopMainInfo shopAfterSale, string msg)
|
||
{
|
||
var r = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(x => x.Cells["colShopId"].Value.ToString() == shopAfterSale.ShopId);
|
||
if (r != null)
|
||
{
|
||
r.Cells["colMessage"].Value = msg;
|
||
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();
|
||
}
|
||
}
|
||
|
||
private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData)
|
||
{
|
||
//if (responseData.Contains("你好"))
|
||
//{
|
||
//}
|
||
if (url.Contains("action=get_nosession_summary") || url.Contains("action=get_open_session_summary") || url.Contains("action=get_session_summary") || url.Contains("action=get_sync_msg"))
|
||
{
|
||
Task.Run(() =>
|
||
{
|
||
getResourceLoadMsg(sender as ChromiumWebBrowser, url, postData, responseData);
|
||
});
|
||
}
|
||
}
|
||
|
||
private void getResourceLoadMsg(ChromiumWebBrowser cef, string url, string postData, string responseData)
|
||
{
|
||
if (cef == null)
|
||
return;
|
||
|
||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.Chat == cef);
|
||
if (shop == null)
|
||
return;
|
||
|
||
string resData = responseData;
|
||
Task.Run(() =>
|
||
{
|
||
var row = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop.ShopId);
|
||
if (row == null)
|
||
return;
|
||
|
||
string nickName = "";
|
||
string talkContent = "";
|
||
|
||
if (url.Contains("action=get_nosession_summary"))
|
||
{
|
||
//{"base_resp":{"err_msg":"ok","ret":0},"list":[{"session_status":1,"summary":{"accept_by_robot":2,"accept_by_robot_time":"0","complaint_info":{"complaint_expire_time":0,"complaint_id":"0"},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/Q3auHgzwzM6vehibAAib9ia4ejxH7ibula7RuH4rTO7H7equgOZPVZl5Ew\\/64\",\"nickname\":\"Vader\",\"list\":[],\"qa_info_list\":[]}","id":"1","is_delete":0,"lastest_msg_content":"","lastest_msg_id":"4348928114244206592","lastest_msg_kf_content":"{\"content\":\"你好\"}","lastest_user_msg_time":"1768807915","msg_type":1,"recv_open_account":"wxf4460bce24e5d58d","recv_openid":"","room_id":"4348927951587721218","scene":6,"send_open_account":"","send_openid":"o9cq802Ue5pCVRmzuzkFUcnoHjcM","send_scene":6,"unread_msg_num":"1","unreplied_msg_time":"1768807915","update_time":"1768807915"}}],"num":1}
|
||
//{"base_resp":{"err_msg":"ok","ret":0},"list":[],"num":0}
|
||
var jObj = JsonHelper.JObjectParse(resData);
|
||
//{"base_resp":{"err_msg":"ok","ret":0},"list":[{"session_status":1,"summary":{"accept_by_robot":2,"accept_by_robot_time":"0","complaint_info":{"complaint_expire_time":0,"complaint_id":"0"},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/PiajxSqBRaEIuS5Aa65qsCwzKFpmSiciazvMbicxfEyHvTmD8MpQibR85wg\\/64\",\"nickname\":\"jtt\",\"list\":[],\"qa_info_list\":[]}","id":"160","is_delete":0,"lastest_msg_content":"","lastest_msg_id":"4349035115016224786","lastest_msg_kf_content":"{\"type\":13,\"content\":\"{\\\"finder_live_id\\\":\\\"\\\",\\\"finder_username\\\":\\\"\\\",\\\"finder_object_id\\\":\\\"\\\",\\\"finder_nonce_id\\\":\\\"\\\",\\\"app_id\\\":\\\"wxca8d4b8e8feedc2a\\\",\\\"page_path\\\":\\\"main/pages/productDetail/productDetail.html?productId=10000405003763&realappid=wx2664a142d76831dd&cacheKey=3d585c9672aa92a088812cf9f8b30e0a&cacheType=backup&businessId=1&requestId=4349035091393462273&subScene=1208\\\",\\\"product_id\\\":\\\"10000405003763\\\",\\\"cover_url\\\":\\\"https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/695a36c7000ab9b70c029451f0d71715000000a100004f50?imageView2/1/w/400/h/400/q/50\\\",\\\"product_title\\\":\\\"运动套装女春秋2024新款时尚小熊卫衣连帽宽松跑步服休闲两件套潮\\\",\\\"market_price\\\":\\\"39530\\\",\\\"selling_price\\\":\\\"38730\\\",\\\"platform_head_img\\\":\\\"http://mmbiz.qpic.cn/mmbiz_jpg/cpXibyAIsexe8vObd8jWMktZk6sg1kKJgicdnzFiaxR1XvU0Kchlfdewsu7JETDF3lLp5cyULNNee94UPGeU1r9Rw/0?wx_fmt=jpeg/0\\\",\\\"platform_name\\\":\\\"夜笙供应链\\\",\\\"shop_window_id\\\":\\\"\\\",\\\"live_status\\\":\\\"\\\",\\\"flash_sale_price\\\":0,\\\"flash_sale_end_time\\\":0,\\\"ec_source\\\":\\\"\\\",\\\"selling_price_wording\\\":\\\"\\\",\\\"ext_conv\\\":{\\\"ext_conv_type\\\":1,\\\"ec_product_url\\\":\\\"https://channels.weixin.qq.com/shop?login_appid=wx2664a142d76831dd&redirect_url=%2Fgoods%2Fentry%3FproductId%3D10000405003763\\\",\\\"context\\\":\\\"\\\"}}\"}","lastest_user_msg_time":"1768814292","msg_type":11,"recv_open_account":"wx2664a142d76831dd","recv_openid":"","room_id":"4349034984388345858","scene":6,"send_open_account":"","send_openid":"o9cq800-I4XeS-NiBgsIae1y38Ac","send_scene":6,"unread_msg_num":"1","unreplied_msg_time":"1768814293","update_time":"1768814292"}}],"num":1}
|
||
//if (jObj["num"].ParseToInt() <= 0)
|
||
// return;
|
||
return;
|
||
}
|
||
else if (url.Contains("action=get_open_session_summary"))
|
||
{
|
||
//{"base_resp":{"err_msg":"ok","ret":0},"pin_summary_list":[],"summary_cursor":"4349020771451830279","summary_list":[{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/PiajxSqBRaEIuS5Aa65qsCwzKFpmSiciazvMbicxfEyHvTmD8MpQibR85wg\\/64\",\"nickname\":\"jtt\",\"list\":[],\"qa_info_list\":[]}","id":"5","is_delete":0,"is_expired":0,"is_pin":0,"is_pin_update_time":"0","kf_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","kf_reply_status":0,"lastest_msg_content":"","lastest_msg_id":"4349029975415865363","lastest_msg_kf_content":"{\"content\":\"你好\"}","lastest_user_msg_time":"1768813986","msg_type":1,"recv_open_account":"wxad4163db54e87b44","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4348999364009132044","room_session_status":0,"scene":6,"send_open_account":"","send_openid":"o9cq800-I4XeS-NiBgsIae1y38Ac","send_scene":6,"session_close_source":0,"star_label":0,"star_label_update_time":"0","sync_id":"78","unread_msg_num":"1","unreplied_msg_time":"1768813988","update_time":"1768813986","user_openid":"o9cq800-I4XeS-NiBgsIae1y38Ac"}]}
|
||
//{"base_resp":{"err_msg":"ok","ret":0},"pin_summary_list":[],"summary_cursor":"4349035365970083850","summary_list":[{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/PiajxSqBRaEIuS5Aa65qsCwzKFpmSiciazvMbicxfEyHvTmD8MpQibR85wg\\/64\",\"nickname\":\"jtt\",\"list\":[],\"qa_info_list\":[]}","id":"160","is_delete":0,"is_expired":0,"is_pin":0,"is_pin_update_time":"0","kf_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","kf_reply_status":1,"lastest_msg_content":"","lastest_msg_id":"4349035365970083850","lastest_msg_kf_content":"{\"content\":\"在的亲\"}","lastest_user_msg_time":"1768814292","msg_type":1,"recv_open_account":"wx2664a142d76831dd","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4349034984388345858","room_session_status":0,"scene":6,"send_open_account":"wx2664a142d76831dd","send_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","send_scene":6,"session_close_source":0,"star_label":0,"star_label_update_time":"0","sync_id":"3186","unread_msg_num":"0","unreplied_msg_time":"0","update_time":"1768814308","user_openid":"o9cq800-I4XeS-NiBgsIae1y38Ac"},{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/sstLNDibp2U6zXibjfoE1tUiaHCOKX1olnJNZnFGehlibg4liacAAWmj2VQ\\/64\",\"nickname\":\"我是上帝的女儿李善容\",\"list\":[],\"qa_info_list\":[]}","id":"154","is_delete":0,"is_expired":0,"is_pin":0,"is_pin_update_time":"0","kf_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","kf_reply_status":0,"lastest_msg_content":"","lastest_msg_id":"4347360170765271042","lastest_msg_kf_content":"{\"type\":\"SessionTimeoutRedDot\",\"content\":\"你已超过10分钟未回复该会话,请及时处理。\",\"room_id\":\"4339855644638920709\",\"msg_id\":\"4347350053416747021\",\"is_anonymous_msg\":0,\"need_update_summary\":1}","lastest_user_msg_time":"1768713854","msg_type":24,"recv_open_account":"wx2664a142d76831dd","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4339855644638920709","room_session_status":0,"scene":6,"send_open_account":"","send_openid":"o9cq802n8yQWq6bwbx2w8rp_aygk","send_scene":6,"session_close_source":0,"star_label":0,"star_label_update_time":"0","sync_id":"3042","unread_msg_num":"0","unreplied_msg_time":"1768713857","update_time":"1768714458","user_openid":"o9cq802n8yQWq6bwbx2w8rp_aygk"},{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/IbQhd2Y9oKdcIf3tbP1pciaic0icL271V7iaqWQqGvrrrMbq26tSHnFf9Q\\/64\",\"nickname\":\"素色🍃᭄年华\",\"list\":[],\"qa_info_list\":[]}","id":"155","is_delete":0,"is_expired":0,"is_pin":0,"is_pin_update_time":"0","kf_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","kf_reply_status":1,"lastest_msg_content":"","lastest_msg_id":"4347305586245287937","lastest_msg_kf_content":"{\"type\":\"SessionTimeoutRedDot\",\"content\":\"你已超过10分钟未回复该会话,请及时处理。\",\"room_id\":\"4340576309047115777\",\"msg_id\":\"4347295489464516617\",\"is_anonymous_msg\":0,\"need_update_summary\":1}","lastest_user_msg_time":"1768710602","msg_type":24,"recv_open_account":"wx2664a142d76831dd","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4340576309047115777","room_session_status":0,"scene":6,"send_open_account":"","send_openid":"o9cq80-t4oDOfQD6J6oJ8pp4yA7M","send_scene":6,"session_close_source":0,"star_label":0,"star_label_update_time":"0","sync_id":"3035","unread_msg_num":"0","unreplied_msg_time":"1768710604","update_time":"1768711205","user_openid":"o9cq80-t4oDOfQD6J6oJ8pp4yA7M"}]}
|
||
var jObj = JsonHelper.JObjectParse(resData);
|
||
return;
|
||
}
|
||
else if (url.Contains("action=get_session_summary"))
|
||
{
|
||
//{"base_resp":{"err_msg":"ok","ret":0},"pin_summary_list":[],"summary_cursor":"4349042918267191303","summary_list":[{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/PiajxSqBRaEIuS5Aa65qsCwzKFpmSiciazvMbicxfEyHvTmD8MpQibR85wg\\/64\",\"nickname\":\"jtt\",\"list\":[],\"qa_info_list\":[]}","id":"5","is_delete":0,"is_expired":0,"is_pin":0,"is_pin_update_time":"0","kf_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","kf_reply_status":1,"lastest_msg_content":"","lastest_msg_id":"4349042918267191303","lastest_msg_kf_content":"{\"content\":\"您好亲,有什么需要帮助的吗\"}","lastest_user_msg_time":"1768814710","msg_type":1,"recv_open_account":"wxad4163db54e87b44","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4348999364009132044","room_session_status":0,"scene":6,"send_open_account":"wxad4163db54e87b44","send_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","send_scene":6,"session_close_source":0,"star_label":0,"star_label_update_time":"0","sync_id":"87","unread_msg_num":"0","unreplied_msg_time":"0","update_time":"1768814758","user_openid":"o9cq800-I4XeS-NiBgsIae1y38Ac"},{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/Q3auHgzwzM6vehibAAib9ia4ejxH7ibula7RuH4rTO7H7equgOZPVZl5Ew\\/64\",\"nickname\":\"Vader\",\"list\":[],\"qa_info_list\":[]}","id":"2","is_delete":0,"is_expired":1,"is_pin":0,"is_pin_update_time":"0","kf_reply_status":1,"lastest_msg_content":"","lastest_msg_id":"4348993861855264779","lastest_msg_kf_content":"{\"type\":\"EndRoom\",\"content\":\"用户超时未回,会话已结束,两天内仍可再次联系\",\"room_id\":\"4348684483414425612\",\"msg_id\":\"4348993861855264779\",\"is_anonymous_msg\":0,\"need_update_summary\":1}","lastest_user_msg_time":"1768811222","msg_type":5,"recv_open_account":"wxad4163db54e87b44","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4348684483414425612","scene":6,"send_open_account":"","send_openid":"o9cq802Ue5pCVRmzuzkFUcnoHjcM","send_scene":6,"star_label":0,"star_label_update_time":"0","sync_id":"59","unread_msg_num":"0","unreplied_msg_time":"0","update_time":"1768811834","user_openid":"o9cq802Ue5pCVRmzuzkFUcnoHjcM"},{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/Q3auHgzwzM61GOTjShX4GX3aSpuNiavic5xxAickB0fxH1Bic8Az5d0LCA\\/64\",\"nickname\":\"春暖花开\",\"list\":[],\"qa_info_list\":[]}","id":"4","is_delete":0,"is_expired":1,"is_pin":0,"is_pin_update_time":"0","kf_reply_status":1,"lastest_msg_content":"","lastest_msg_id":"4348932333527973902","lastest_msg_kf_content":"{\"type\":\"EndRoom\",\"content\":\"用户超时未回,会话已结束,两天内仍可再次联系\",\"room_id\":\"4348906544732405760\",\"msg_id\":\"4348932333527973902\",\"is_anonymous_msg\":0,\"need_update_summary\":1}","lastest_user_msg_time":"1768807466","msg_type":5,"recv_open_account":"wxad4163db54e87b44","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4348906544732405760","scene":6,"send_open_account":"","send_openid":"o9cq807-mRKhlh-MPBpeYyar46HA","send_scene":6,"star_label":0,"star_label_update_time":"0","sync_id":"44","unread_msg_num":"0","unreplied_msg_time":"0","update_time":"1768808166","user_openid":"o9cq807-mRKhlh-MPBpeYyar46HA"},{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/PdibpV1sFDHeGJDbIwia4cv3UUPxnHqjFQ4piaSFEeJlViaeDPicHuQITkw\\/64\",\"nickname\":\"春雨\",\"list\":[],\"qa_info_list\":[]}","id":"3","is_delete":0,"is_expired":1,"is_pin":0,"is_pin_update_time":"0","kf_reply_status":1,"lastest_msg_content":"","lastest_msg_id":"4348888492147638275","lastest_msg_kf_content":"{\"type\":\"EndRoom\",\"content\":\"用户超时未回,会话已结束,两天内仍可再次联系\",\"room_id\":\"4348715191491690506\",\"msg_id\":\"4348888492147638275\",\"is_anonymous_msg\":0,\"need_update_summary\":1}","lastest_user_msg_time":"1768795504","msg_type":5,"recv_open_account":"wxad4163db54e87b44","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4348715191491690506","scene":6,"send_open_account":"","send_openid":"o9cq805nSmIjHqNthn9QbNimVAsE","send_scene":6,"star_label":0,"star_label_update_time":"0","sync_id":"29","unread_msg_num":"0","unreplied_msg_time":"0","update_time":"1768805553","user_openid":"o9cq805nSmIjHqNthn9QbNimVAsE"},{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/PiajxSqBRaEJLajvZG4pYqhDrljibs7sNChSx6Cib2mN6KicJgbRESR8Rg\\/64\",\"nickname\":\"喂累了额\",\"list\":[],\"qa_info_list\":[]}","id":"1","is_delete":0,"is_expired":1,"is_pin":0,"is_pin_update_time":"0","kf_reply_status":1,"lastest_msg_content":"","lastest_msg_id":"4348884857446612993","lastest_msg_kf_content":"{\"type\":\"EndRoom\",\"content\":\"用户超时未回,会话已结束,两天内仍可再次联系\",\"room_id\":\"4347660512343588869\",\"msg_id\":\"4348884857446612993\",\"is_anonymous_msg\":0,\"need_update_summary\":1}","lastest_user_msg_time":"1768732601","msg_type":5,"recv_open_account":"wxad4163db54e87b44","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4347660512343588869","scene":6,"send_open_account":"","send_openid":"o9cq8038HnVM43HL44F5yGx6S6P0","send_scene":6,"star_label":0,"star_label_update_time":"0","sync_id":"27","unread_msg_num":"0","unreplied_msg_time":"0","update_time":"1768805337","user_openid":"o9cq8038HnVM43HL44F5yGx6S6P0"}]}
|
||
var jObj = JsonHelper.JObjectParse(resData);
|
||
if (jObj.IsNullOrEmpty() || jObj["summary_list"].IsNullOrEmpty())
|
||
{
|
||
return;
|
||
}
|
||
bool needReply = false;
|
||
foreach (var summaryObj in jObj["summary_list"])
|
||
{
|
||
try
|
||
{
|
||
var summary = JsonHelper.SerializeObject(summaryObj);
|
||
if (summary.Contains("更新房间游标"))
|
||
continue;
|
||
// 会话结束,返回
|
||
if (summary.Contains("会话已结束"))
|
||
continue;
|
||
if (summary.Contains("用户已结束会话") || summary.Contains("客服已结束会话"))
|
||
continue;
|
||
if (summary.Contains("用户超时未回"))
|
||
continue;
|
||
if (summary.Contains("该对话已投诉成功, 投诉有效期内不计入考核。"))
|
||
continue;
|
||
// 最后一条是自己回复的,返回
|
||
var send_open_account = summaryObj["send_open_account"].ParseToString();
|
||
if (send_open_account == shop.ShopId)
|
||
continue;
|
||
// 虽然没有回复,但是最后一条消息是一天以前收到的,返回
|
||
var lastUpTime = summaryObj["update_time"].ParseToLong();
|
||
if (lastUpTime < BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddDays(-1)))
|
||
continue;
|
||
// 其他情况,标记需要回复
|
||
needReply = true;
|
||
|
||
|
||
// 历史消息自动回复
|
||
if (chkIsAutoReply.Checked)
|
||
{
|
||
//lastest_msg_kf_content
|
||
var msgObj = summaryObj;
|
||
//var msgStr = JsonHelper.SerializeObject(msgObj);
|
||
// 用户发送商品信息
|
||
if ((msgObj?["msg_type"]).ParseToInt() == 11)
|
||
{
|
||
talkContent = "";
|
||
}
|
||
else if ((msgObj?["recv_open_account"]).ParseToString() == shop.ShopId)
|
||
{
|
||
var contentObj = (msgObj?["lastest_msg_kf_content"]).ParseToString();
|
||
var content = BaseRegex.GetStringJson(ref contentObj, "content").ParseToString();
|
||
talkContent = content;
|
||
}
|
||
|
||
string extra_info = (msgObj?["extra_info"]).ParseToString();
|
||
var extraInfoObj = JsonHelper.JObjectParse(extra_info);
|
||
nickName = (extraInfoObj?["nickname"]).ParseToString();
|
||
if (chkIsAutoReply.Checked && !string.IsNullOrWhiteSpace(nickName))
|
||
{
|
||
lstAutoReplayParam.Add(new AutoReplayParam()
|
||
{
|
||
nickName = nickName,
|
||
shopId = shop.ShopId,
|
||
talkContent = talkContent,
|
||
});
|
||
}
|
||
}
|
||
}
|
||
catch
|
||
{
|
||
continue;
|
||
}
|
||
}
|
||
if (!needReply)
|
||
return;
|
||
else
|
||
{
|
||
Invoke(new Action(() =>
|
||
{
|
||
row.Cells["colMessage"].Value = "有历史未读消息";
|
||
}));
|
||
}
|
||
}
|
||
else if (url.Contains("action=get_sync_msg"))
|
||
{
|
||
//{"finder_live_id":"","finder_username":"","finder_object_id":"","finder_nonce_id":"","app_id":"wxca8d4b8e8feedc2a","page_path":"main/pages/productDetail/productDetail.html?productId=10000444468035&realappid=wx2664a142d76831dd&cacheKey=4f69a37c98838eb27e484b6def86d0ca&cacheType=backup&businessId=1&requestId=4348991209208823817&subScene=1208","product_id":"10000444468035","cover_url":"https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/69677007000d0f3329fc594d77ef1b15000000a000004f50?imageView2/1/w/400/h/400/q/50","product_title":"保暖加绒中老年妈妈装棉服","market_price":"6980","selling_price":"6180","platform_head_img":"http://mmbiz.qpic.cn/mmbiz_jpg/cpXibyAIsexe8vObd8jWMktZk6sg1kKJgicdnzFiaxR1XvU0Kchlfdewsu7JETDF3lLp5cyULNNee94UPGeU1r9Rw/0?wx_fmt=jpeg/0","platform_name":"夜笙供应链","shop_window_id":"","live_status":"","flash_sale_price":0,"flash_sale_end_time":0,"ec_source":"","selling_price_wording":"","ext_conv":{"ext_conv_type":1,"ec_product_url":"https://channels.weixin.qq.com/shop?login_appid=wx2664a142d76831dd&redirect_url=%2Fgoods%2Fentry%3FproductId%3D10000444468035","context":""}}
|
||
try
|
||
{
|
||
if (resData.Contains("\"total_num\":0"))
|
||
return;
|
||
// 只有一条消息且是更新房间游标的直接退出
|
||
if (resData.Contains("\"total_num\":1") && resData.Contains("更新房间游标"))
|
||
return;
|
||
if (resData.Contains("鉴权失败"))
|
||
{
|
||
return;
|
||
//WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||
//LoadShop(new List<ShopLoginInfo>() { shop });
|
||
}
|
||
//{"base_resp":{"ret":30000,"err_msg":"鉴权失败"}}
|
||
|
||
var jObj = JsonHelper.JObjectParse(resData);
|
||
if (jObj["total_num"].ParseToInt() <= 0)
|
||
return;
|
||
// 自己发的消息或者客服自动回复消息不闪烁提示且将表格颜色还原 -----------------------------------------------------------------------------------------------
|
||
// 您好!人工客服目前无法及时回复,您可以留言详细问题,我们会尽快为您服务!
|
||
//"send_open_account": "wxad4163db54e87b44",
|
||
var send_open_account = (jObj["list"].LastOrDefault(l => !JsonHelper.SerializeObject(l).Contains("更新房间游标"))?["send_open_account"]).ParseToString();
|
||
if (send_open_account == shop.ShopId)
|
||
{
|
||
row.DefaultCellStyle.BackColor = row.Tag is Color ? (Color)row.Tag : Color.White;
|
||
row.Cells["colMessage"].Value = "";
|
||
return;
|
||
}
|
||
var msg_kf_content = jObj["list"].LastOrDefault(l => !JsonHelper.SerializeObject(l).Contains("更新房间游标"))?["msg_kf_content"].ParseToString();
|
||
var contentObj = JsonHelper.JObjectParse(msg_kf_content);
|
||
var content = (contentObj?["content"]).ParseToString();
|
||
//if (content.Contains("更新房间游标"))
|
||
// return;
|
||
|
||
// 处理 msg_type=5 的情况 (应该是系统提示消息,有些提示比如关闭会话的无需闪烁) ------------------------------------------------------
|
||
// 以下 "msg_type":5
|
||
// 你已超过90秒未回复该会话,请及时处理。
|
||
// 你已超过3分钟未回复该会话,请及时处理。
|
||
// 你已超过10分钟未回复该会话,请及时处理。
|
||
// 超过48小时未回复用户,会话已结束
|
||
// {"base_resp":{"err_msg":"ok","ret":0},"kf_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","list":[{"accept_by_robot":0,"async_check_spam_stage":0,"client_ms":"1768806150100","create_time":"1768806150","create_time_ms":"1768806150100","encrypt_msg_kf_content":"","extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/Q3auHgzwzM6vehibAAib9ia4ejxH7ibula7RuH4rTO7H7equgOZPVZl5Ew\\/64\",\"nickname\":\"Vader\",\"list\":[],\"qa_info_list\":[]}","id":"31","imunion_msg_id":"mmec-commkf-v2-4348898496719831040","insert_create_time_ms":"1768806150148","is_anonymous_msg":0,"is_delete":0,"is_expired":0,"is_fail":0,"is_hit_spam":0,"is_revoked":0,"is_sys_msg":1,"msg_direction":3,"msg_id":"4348898496719831040","msg_kf_content":"{\"type\":\"EndRoom\",\"content\":\"用户超时未回,会话已结束,两天内仍可再次联系\",\"room_id\":\"4348684483414425612\",\"msg_id\":\"4348898496719831040\",\"is_anonymous_msg\":0,\"need_update_summary\":1}","msg_type":5,"properties":"0","recv_open_account":"wxad4163db54e87b44","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","reply_type":0,"room_id":"4348684483414425612","room_useruin":"0","scene":6,"send_open_account":"","send_openid":"o9cq802Ue5pCVRmzuzkFUcnoHjcM","send_scene":6,"session_id":"0","update_time":"1768806150"}],"total_num":1}
|
||
//{"base_resp":{"err_msg":"ok","ret":0},"kf_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","list":[{"accept_by_robot":2,"async_check_spam_stage":0,"client_ms":"1773134620500","create_time":"1773134620","create_time_ms":"1773134621082","encrypt_msg_kf_content":"","extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/Q3auHgzwzM6vehibAAib9ia4ejxH7ibula7RuH4rTO7H7equgOZPVZl5Ew\\/64\",\"nickname\":\"Vader\",\"unread_msg_num\":1,\"list\":[],\"qa_info_list\":[]}","id":"2280","imunion_msg_id":"4875563441394659225","insert_create_time_ms":"1773134621580","is_anonymous_msg":0,"is_delete":0,"is_expired":0,"is_fail":0,"is_hit_spam":0,"is_revoked":0,"is_sys_msg":0,"msg_direction":1,"msg_id":"4421518190792900611","msg_kf_content":"{\"content\":\"有优惠吗?\"}","msg_type":1,"properties":"0","recv_open_account":"wxf4460bce24e5d58d","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","reply_type":0,"room_id":"4348927951587721218","room_useruin":"0","scene":6,"send_open_account":"","send_openid":"o9cq802Ue5pCVRmzuzkFUcnoHjcM","send_scene":6,"session_id":"4421510266814349317","update_time":"1773134621"}],"total_num":1}
|
||
if (content.Contains("用户超时未回,会话已结束,两天内仍可再次联系"))
|
||
return;
|
||
if (content.Contains("会话已结束"))
|
||
return;
|
||
if (content.Contains("用户已结束会话") || content.Contains("客服已结束会话"))
|
||
return;
|
||
if (content.Contains("用户超时未回"))
|
||
return;
|
||
if (content.Contains("该对话已投诉成功, 投诉有效期内不计入考核。"))
|
||
return;
|
||
|
||
// {"base_resp":{"err_msg":"ok","ret":0},"kf_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","list":[{"accept_by_robot":0,"async_check_spam_stage":0,"client_ms":"1768808777632","create_time":"1768808777","create_time_ms":"1768808777632","encrypt_msg_kf_content":"","extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/Q3auHgzwzM6vehibAAib9ia4ejxH7ibula7RuH4rTO7H7equgOZPVZl5Ew\\/64\",\"nickname\":\"Vader\",\"list\":[],\"qa_info_list\":[]}","id":"46","imunion_msg_id":"mmec-commkf-v2-4348942579357122569","insert_create_time_ms":"1768808777711","is_anonymous_msg":1,"is_delete":0,"is_expired":0,"is_fail":0,"is_hit_spam":0,"is_revoked":0,"is_sys_msg":1,"msg_direction":3,"msg_id":"4348942579357122569","msg_kf_content":"{\"type\":\"AcceptRoom\",\"content\":\"用户已接入\",\"room_id\":\"4348684483414425612\",\"msg_id\":\"4348942569912549377\",\"is_anonymous_msg\":1,\"need_update_summary\":0,\"summary_content\":\"{\\\"id\\\":\\\"2\\\",\\\"room_id\\\":\\\"4348684483414425612\\\",\\\"scene\\\":6,\\\"account\\\":\\\"3641079964\\\",\\\"send_scene\\\":6,\\\"send_account\\\":\\\"user_acct_2044334303_6\\\",\\\"send_uin\\\":2044334303,\\\"lastest_msg_id\\\":\\\"4348942543756476432\\\",\\\"lastest_msg_content\\\":\\\"\\\",\\\"unread_msg_num\\\":\\\"1\\\",\\\"update_time\\\":\\\"1768808774\\\",\\\"kf_uin\\\":1525084715,\\\"extra_info\\\":\\\"{\\\\\\\"head_img\\\\\\\":\\\\\\\"http:\\\\\\\\\\\\\\/\\\\\\\\\\\\\\/wx.qlogo.cn\\\\\\\\\\\\\\/mmhead\\\\\\\\\\\\\\/Q3auHgzwzM6vehibAAib9ia4ejxH7ibula7RuH4rTO7H7equgOZPVZl5Ew\\\\\\\\\\\\\\/64\\\\\\\",\\\\\\\"nickname\\\\\\\":\\\\\\\"Vader\\\\\\\",\\\\\\\"list\\\\\\\":[],\\\\\\\"qa_info_list\\\\\\\":[]}\\\",\\\"lastest_msg_kf_content\\\":\\\"{\\\\\\\"content\\\\\\\":\\\\\\\"测试\\\\\\\"}\\\",\\\"lastest_user_msg_time\\\":\\\"1768808774\\\",\\\"msg_type\\\":1,\\\"send_open_account\\\":\\\"\\\",\\\"recv_open_account\\\":\\\"wxad4163db54e87b44\\\",\\\"send_openid\\\":\\\"o9cq802Ue5pCVRmzuzkFUcnoHjcM\\\",\\\"recv_openid\\\":\\\"o9cq801T0m1dIivQzMyUwBvW5Znk\\\",\\\"is_delete\\\":0,\\\"star_label\\\":0,\\\"star_label_update_time\\\":\\\"0\\\",\\\"unreplied_msg_time\\\":\\\"1768808777\\\",\\\"kf_reply_status\\\":0,\\\"sync_id\\\":\\\"45\\\",\\\"is_pin\\\":0,\\\"is_pin_update_time\\\":\\\"0\\\",\\\"ext_info\\\":{},\\\"complaint_info\\\":{\\\"complaint_expire_time\\\":0,\\\"complaint_id\\\":\\\"\\\",\\\"complaint_status\\\":0},\\\"user_uin\\\":2044334303,\\\"is_expired\\\":0}\"}","msg_type":5,"properties":"0","recv_open_account":"wxad4163db54e87b44","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","reply_type":0,"room_id":"4348684483414425612","room_useruin":"0","scene":6,"send_open_account":"","send_openid":"o9cq802Ue5pCVRmzuzkFUcnoHjcM","send_scene":6,"session_id":"0","update_time":"1768808777"}],"total_num":1}
|
||
//if (content.Contains("用户已接入"))
|
||
// return;
|
||
|
||
//msg_type 11 发送商品
|
||
//content {"finder_live_id":"","finder_username":"","finder_object_id":"","finder_nonce_id":"","app_id":"wxca8d4b8e8feedc2a","page_path":"main/pages/productDetail/productDetail.html?productId=10000458846351&realappid=wxad4163db54e87b44&cacheKey=5e17e5db9339a95043ba1f8a3d02454d&cacheType=backup&businessId=1&requestId=4349008357285756937&subScene=1208","product_id":"10000458846351","cover_url":"https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/695a8faa000d37b31b2e9b6f55e91715000000a100004f50?imageView2/1/w/400/h/400/q/50","product_title":"旗袍复古国风外套新款加绒中老年时尚中式盘扣妈妈唐装开衫上衣女","market_price":"0","selling_price":"15895","platform_head_img":"http://mmbiz.qpic.cn/mmbiz_jpg/v9IeicMmfib92I87ia9hWs58ozuHZ8CRk6jyf6qgLwzibNSjAPekLzdf7yxOdQqR6od63tLH9s2zTxJbuqVTs6E19w/0?wx_fmt=jpeg/0","platform_name":"曼月森工厂店","shop_window_id":"","live_status":"","flash_sale_price":0,"flash_sale_end_time":0,"ec_source":"","selling_price_wording":"","ext_conv":{"ext_conv_type":1,"ec_product_url":"https://channels.weixin.qq.com/shop?login_appid=wxad4163db54e87b44&redirect_url=%2Fgoods%2Fentry%3FproductId%3D10000458846351","context":""}}
|
||
var product_title = BaseRegex.GetStringJson(ref content, "product_title");
|
||
if (!string.IsNullOrWhiteSpace(product_title))
|
||
content = "用户发送商品:" + product_title;
|
||
|
||
// 在消息格子内显示消息
|
||
row.Cells["colMessage"].Value = content;
|
||
|
||
|
||
// 即时消息自动回复
|
||
if(chkIsAutoReply.Checked)
|
||
{
|
||
var msgObj = jObj["list"].LastOrDefault(l => !JsonHelper.SerializeObject(l).Contains("更新房间游标"));
|
||
//var msgStr = JsonHelper.SerializeObject(msgObj);
|
||
// 用户发送商品信息
|
||
if ((msgObj?["msg_type"]).ParseToInt() == 11)
|
||
{
|
||
talkContent = "";
|
||
}
|
||
else if ((msgObj?["recv_open_account"]).ParseToString() == shop.ShopId)
|
||
{
|
||
talkContent = content;
|
||
}
|
||
|
||
string extra_info = (msgObj?["extra_info"]).ParseToString();
|
||
var extraInfoObj = JsonHelper.JObjectParse(extra_info);
|
||
nickName = (extraInfoObj?["nickname"]).ParseToString();
|
||
if (chkIsAutoReply.Checked && !string.IsNullOrWhiteSpace(nickName))
|
||
{
|
||
lstAutoReplayParam.Add(new AutoReplayParam()
|
||
{
|
||
nickName = nickName,
|
||
shopId = shop.ShopId,
|
||
talkContent = talkContent,
|
||
});
|
||
}
|
||
}
|
||
}
|
||
catch
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
// 以上判断需要回复:
|
||
// 弹框
|
||
if (!ChatConfig.ChatSettingConfig.IsNotShowMessageWindow)
|
||
ShowMessageForm(shop);
|
||
// 进行闪烁
|
||
FlashDgvRow(row);
|
||
// 播放声音
|
||
playSound();
|
||
});
|
||
}
|
||
|
||
void FlashDgvRow(DataGridViewRow row)
|
||
{
|
||
Task.Run(() =>
|
||
{
|
||
if (row.Tag == null)
|
||
row.Tag = row.DefaultCellStyle.BackColor;
|
||
for (int j = 0; j < 6; j++)
|
||
{
|
||
Invoke(new Action(() => { row.DefaultCellStyle.BackColor = Color.White; }));
|
||
Thread.Sleep(120);
|
||
Invoke(new Action(() => { row.DefaultCellStyle.BackColor = Color.FromArgb(245, 95, 50); }));
|
||
Thread.Sleep(120);
|
||
Invoke(new Action(() => { row.DefaultCellStyle.BackColor = Color.FromArgb(245, 45, 10); }));
|
||
Thread.Sleep(120);
|
||
}
|
||
});
|
||
}
|
||
|
||
private void MainLifeHandler_OnPop(object sender, PopData e)
|
||
{
|
||
var targetUrl = e.Url;
|
||
var lifeHandler = sender as LifeSpanHandlerLocal;
|
||
|
||
Task.Run(() =>
|
||
{
|
||
if (lifeHandler.parent != null)
|
||
{
|
||
var cookies = CEFBrowser.GetCookieList("", lifeHandler.parent.RequestContext.GetCookieManager(null));
|
||
Invoke(new Action(() =>
|
||
{
|
||
CefForm cefForm = new CefForm(targetUrl, cookies);
|
||
cefForm.Show();
|
||
}));
|
||
}
|
||
});
|
||
}
|
||
|
||
private void LifeHandler_OnPop(object sender, PopData e)
|
||
{
|
||
var targetUrl = e.Url;
|
||
var lifeHandler = sender as LifeSpanHandlerLocal;
|
||
|
||
Task.Run(() =>
|
||
{
|
||
//if (e.Url.StartsWith("https://haohuo.jinritemai.com/views/product/item"))
|
||
//{
|
||
// var productId = BaseRegex.GetMatchRegexString(ref targetUrl, "&id=(\\d{5,30})");
|
||
// if (!string.IsNullOrEmpty(productId))
|
||
// {
|
||
// long product_id = productId.ParseToLong();
|
||
// if (product_id > 0)
|
||
// {
|
||
// string urlx = BaseClass.LoginApiUrl + "?obj=upshopid/upid_dd&act=get";
|
||
// string datax = "&pid=" + product_id + "&table=" + (product_id % 1024);
|
||
// string htmlx = GetHtml.PostUtf8(urlx, UserLogin.GetSignaturex("", "") + datax);
|
||
// string id = BaseRegex.GetMatchRegexString(htmlx, @"([\d]+)");
|
||
// if (htmlx.StartsWith("tb"))
|
||
// targetUrl = "https://item.taobao.com/item.htm?id=" + id;
|
||
// if (htmlx.StartsWith("pd"))
|
||
// targetUrl = "https://mobile.yangkeduo.com/goods.html?goods_id=" + id;
|
||
// if (htmlx.StartsWith("al"))
|
||
// targetUrl = "https://detail.1688.com/offer/" + id + ".html";
|
||
// if (htmlx.StartsWith("dy"))
|
||
// targetUrl = "https://weidian.com/item.html?itemID=" + id;
|
||
// }
|
||
// }
|
||
//}
|
||
//if (lifeHandler.parent != null)
|
||
//{
|
||
// var cookies = CEFBrowser.GetCookieList("", lifeHandler.parent.RequestContext.GetCookieManager(null));
|
||
// Invoke(new Action(() =>
|
||
// {
|
||
// CefForm cefForm = new CefForm(targetUrl, cookies);
|
||
// cefForm.Show();
|
||
// }));
|
||
//}
|
||
});
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 更新店铺后台首页
|
||
/// </summary>
|
||
/// <param name="shop"></param>
|
||
private void SetMainBrowserUrl(ShopLoginInfo shop)
|
||
{
|
||
if (shop == null)
|
||
return;
|
||
|
||
var cookieLst = new List<Cookie>();
|
||
try
|
||
{
|
||
cookieLst = JsonHelper.DeserializeJsonToList<CefSharp.Cookie>(shop.Cookies.ParseToString().Replace("empty=true;", "[]"));
|
||
}
|
||
catch
|
||
{
|
||
}
|
||
|
||
var cookieManager = mainWebBrowser.RequestContext.GetCookieManager(null);
|
||
cookieManager.DeleteCookiesAsync("qq.com", null).Wait();
|
||
foreach (var cook in cookieLst)
|
||
{
|
||
var t = CEFBrowser.SetCookieAsync(cook.Domain, cook.Name + "=" + cook.Value + ";", cookieManager);
|
||
t.Wait(5000);
|
||
}
|
||
|
||
mainWebBrowser.Load("https://store.weixin.qq.com/shop/home");
|
||
}
|
||
|
||
/// <summary>
|
||
/// 自动回复等
|
||
/// </summary>
|
||
public void InitAutoExecute()
|
||
{
|
||
//Task.Run(() =>
|
||
//{
|
||
// while (true)
|
||
// {
|
||
// foreach (var shop in GlobalConfig.DouShopLoginList)
|
||
// {
|
||
// try
|
||
// {
|
||
// Thread.Sleep(new Random(DateTime.Now.Millisecond).Next(300, 500));
|
||
// bool needReLogin = AutoCheckShopLoginStatus(shop);
|
||
// if (ChatConfig.ChatSettingConfig.IsAutoReLogin && needReLogin)
|
||
// AutoReLogin(shop);
|
||
|
||
// if (shop.LoginStatus != "登录成功")
|
||
// continue;
|
||
|
||
// Thread.Sleep(new Random(DateTime.Now.Millisecond).Next(300, 500));
|
||
// AutoReConnect(shop);
|
||
|
||
// Thread.Sleep(new Random(DateTime.Now.Millisecond).Next(300, 500));
|
||
// AutoCloseMaskWindow(shop);
|
||
|
||
|
||
// Thread.Sleep(new Random(DateTime.Now.Millisecond).Next(300, 500));
|
||
// var isNewMessage = AutoGetNewMessage(shop);
|
||
// while (isNewMessage && ChatConfig.ChatSettingConfig.IsAutoReply)
|
||
// {
|
||
// AutoReplyWithJs(shop);
|
||
// Thread.Sleep(new Random(DateTime.Now.Millisecond).Next(300, 500));
|
||
// isNewMessage = AutoGetNewMessage(shop);
|
||
// }
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// }
|
||
// }
|
||
// }
|
||
//});
|
||
|
||
//Task.Run(() =>
|
||
//{
|
||
// var sleepTime = 1000;
|
||
// while (true)
|
||
// {
|
||
// Thread.Sleep(sleepTime);
|
||
// var jsStr = "function getVideo() {\r\n" +
|
||
// " var videos = document.getElementsByTagName('video')\r\n" +
|
||
// " if (videos && videos.length > 0) {\r\n" +
|
||
// " var src = videos[0].src;\r\n" +
|
||
// " videos[0].parentElement.parentElement.click();\r\n" +
|
||
// " return src;\r\n" +
|
||
// " //return '';\r\n" +
|
||
// " }\r\n" +
|
||
// " return '';\r\n" +
|
||
// "}" +
|
||
// "getVideo();\r\n";
|
||
// if (currentShop?.Chat != null && currentShop.Chat.IsBrowserInitialized)
|
||
// {
|
||
// var t = currentShop.Chat.GetMainFrame().EvaluateScriptAsync(jsStr);
|
||
// t.Wait();
|
||
// if (!string.IsNullOrEmpty(t.Result?.Result?.ToString()))
|
||
// {
|
||
// Invoke(new Action(() =>
|
||
// {
|
||
// AllBase.GetHtml.OpenUrl(t.Result.Result.ToString());
|
||
// }));
|
||
// }
|
||
// }
|
||
// }
|
||
//});
|
||
|
||
//Task.Run(() =>
|
||
//{
|
||
// var sleepTime = 2500;
|
||
// while (true)
|
||
// {
|
||
// try
|
||
// {
|
||
// Thread.Sleep(sleepTime);
|
||
// var jsStr1 = "function ClosePopWindow() {\r\n" +
|
||
// " var result = 'no_pop'\r\n" +
|
||
// " var item = document.getElementsByClassName('anticon-close-circle');\r\n" +
|
||
// " for(i = 0; i < item.length; i++) {\r\n" +
|
||
// " item[i].click();\r\n" +
|
||
// " result = 'success'\r\n" +
|
||
// " }\r\n" +
|
||
// " return result;\r\n" +
|
||
// "}\r\n" +
|
||
// "ClosePopWindow();\r\n";
|
||
// var jsStr2 = "function clickPopWindow() {\r\n"
|
||
// + "var child = document.body.firstElementChild;\r\n"
|
||
// + "var element1 = null;\r\n"
|
||
// + " while (child) {\r\n"
|
||
// + " if (child.innerHTML.indexOf('知道了') >= 0) {\r\n"
|
||
// + " element1 = child;\r\n"
|
||
// + " if (child.firstElementChild) {\r\n"
|
||
// + " child = child.firstElementChild; continue;\r\n"
|
||
// + " } else break;\r\n"
|
||
// + " }\r\n"
|
||
// + " child = child.nextElementSibling;\r\n"
|
||
// + " }\r\n"
|
||
// + " if (element1) {\r\n"
|
||
// + " element1.click(); return 'success';\r\n"
|
||
// + " } else return 'no_pop';\r\n"
|
||
// + "}\r\n"
|
||
// + "clickPopWindow();\r\n";
|
||
// if (mainWebBrowser.IsBrowserInitialized)
|
||
// {
|
||
// var t1 = mainWebBrowser.GetMainFrame().EvaluateScriptAsync(jsStr1);
|
||
// t1.Wait();
|
||
// var t2 = mainWebBrowser.GetMainFrame().EvaluateScriptAsync(jsStr2);
|
||
// t2.Wait();
|
||
// if (t1.Result?.Result?.ToString() == "success" || t2.Result?.Result?.ToString() == "success")
|
||
// sleepTime = Randomx.GetId(550, 650);
|
||
// else
|
||
// sleepTime = Randomx.GetId(2500, 3000);
|
||
// }
|
||
// }
|
||
// catch (Exception ex) { }
|
||
// }
|
||
//});
|
||
}
|
||
|
||
private void chkIsAutoReLogin_CheckedChanged(object sender, EventArgs e)
|
||
{
|
||
ChatConfig.ChatSettingConfig.IsAutoReLogin = chkIsAutoReLogin.Checked;
|
||
ChatConfig.SaveChatSettingParam();
|
||
}
|
||
|
||
private void chkIsAutoReply_CheckedChanged(object sender, EventArgs e)
|
||
{
|
||
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)
|
||
{
|
||
ChatConfig.ChatSettingConfig.AutoReplayText = txtAutoReplyText.Text;
|
||
ChatConfig.SaveChatSettingParam();
|
||
}
|
||
|
||
private void cmbMessage_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
ChatConfig.ChatSettingConfig.MessageSound = this.cmbMessage.SelectedItem.ToString();
|
||
ChatConfig.SaveChatSettingParam();
|
||
}
|
||
|
||
private void chkNotShowMessageWindow_CheckedChanged(object sender, EventArgs e)
|
||
{
|
||
ChatConfig.ChatSettingConfig.IsNotShowMessageWindow = chkNotShowMessageWindow.Checked;
|
||
ChatConfig.SaveChatSettingParam();
|
||
|
||
}
|
||
|
||
private void pnlSet_Click(object sender, EventArgs e)
|
||
{
|
||
TalkAutoReplyConfigForm autoReplyConfigForm = new TalkAutoReplyConfigForm(LstTalkTemplatePair);
|
||
autoReplyConfigForm.ShowDialog();
|
||
}
|
||
|
||
private void Chat_SearchResultReceived(ShopLoginInfo shop)
|
||
{
|
||
//var r = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(x => x.Cells["columnShopId"].Value.ToString() == shop.ShopId);
|
||
//if (r != null)
|
||
//{
|
||
// for (int i = 0; i < dgvShop.Rows.Count; i++)
|
||
// {
|
||
// var row = dgvShop.Rows[i];
|
||
|
||
// if (row.Cells[0].Value.ToString() == shop.ShopId && shop != currentShop)
|
||
// {
|
||
// if (ShopChatCount.ContainsKey(shop.ShopId) && ShopChatCount[shop.ShopId] > 0)
|
||
// {
|
||
// Task.Run(() =>
|
||
// {
|
||
// for (int j = 0; j < 4; j++)
|
||
// {
|
||
// Invoke(new Action(() => { row.DefaultCellStyle.BackColor = Color.White; }));
|
||
// Thread.Sleep(100);
|
||
// Invoke(new Action(() => { row.DefaultCellStyle.BackColor = Color.FromArgb(245, 95, 50); }));
|
||
// Thread.Sleep(100);
|
||
// Invoke(new Action(() => { row.DefaultCellStyle.BackColor = Color.FromArgb(245, 45, 10); }));
|
||
// Thread.Sleep(100);
|
||
// }
|
||
// });
|
||
// }
|
||
// else if (row.DefaultCellStyle.BackColor != Color.White)
|
||
// {
|
||
// row.DefaultCellStyle.BackColor = Color.White;
|
||
// }
|
||
// break;
|
||
// }
|
||
// }
|
||
//}
|
||
}
|
||
private void Collect_InfomationReceived(string infomation)
|
||
{
|
||
//try
|
||
//{
|
||
// this.Invoke(new Action(() =>
|
||
// {
|
||
// lblMsg.Text = infomation;
|
||
// var data = infomation.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries);
|
||
// if (data.Length == 2)
|
||
// {
|
||
// if (data[1] == FastCarCollect.FASTCAR_QUOTA_FINISH)
|
||
// {
|
||
// var shop = gridShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(x => x.Cells["columnShopName"].Value.ToString() == data[0]);
|
||
// if (shop != null)
|
||
// {
|
||
// shop.Cells["columnMsg"].Value = data[1];
|
||
// }
|
||
// }
|
||
// }
|
||
// if (infomation == "修改出价结束")
|
||
// this.btnStart.Enabled = true;
|
||
// if (infomation == "暂停推广结束")
|
||
// this.btnStop.Enabled = true;
|
||
// }));
|
||
//}
|
||
//catch { }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 显示右下角消息弹框
|
||
/// </summary>
|
||
/// <param name="shop"></param>
|
||
private void ShowMessageForm(ShopLoginInfo shop)
|
||
{
|
||
if (!lstChatMessageForm.Any(f => f.shop == shop))
|
||
{
|
||
Invoke(new Action(() =>
|
||
{
|
||
TalkMessageForm cmf = new TalkMessageForm(shop, this);
|
||
cmf.Dragable = false;
|
||
cmf.ShowMinimizedBox = false;
|
||
lstChatMessageForm.Add(cmf);
|
||
Point p = new Point(Screen.PrimaryScreen.WorkingArea.Width - cmf.Width, Screen.PrimaryScreen.WorkingArea.Height);
|
||
cmf.PointToScreen(p);
|
||
cmf.Location = p;
|
||
cmf.Show();
|
||
}));
|
||
}
|
||
}
|
||
|
||
|
||
|
||
private void dgvShop_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
||
{
|
||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||
return;
|
||
|
||
if (e.Button != MouseButtons.Right)
|
||
return;
|
||
|
||
string shopId = dgvShop.Rows[e.RowIndex].Cells["colShopId"].Value?.ToString();
|
||
if (string.IsNullOrEmpty(shopId))
|
||
return;
|
||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
|
||
if (shop == null)
|
||
return;
|
||
|
||
if (!LstTagShop.Contains(shop.ShopId))
|
||
{
|
||
LstTagShop.Add(shop.ShopId);
|
||
//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);
|
||
}
|
||
|
||
private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||
{
|
||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||
return;
|
||
|
||
string shopId = dgvShop.Rows[e.RowIndex].Cells["colShopId"].Value?.ToString();
|
||
if (string.IsNullOrEmpty(shopId))
|
||
return;
|
||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
|
||
if (shop == null)
|
||
return;
|
||
|
||
if (dgvShop.Columns[e.ColumnIndex].HeaderText == "状态" && dgvShop.Rows[e.RowIndex].Cells[e.ColumnIndex].Value?.ToString() == "掉线")
|
||
{
|
||
Task.Run(() =>
|
||
{
|
||
// 如需登录,引导至登录窗口,禁止从聊天窗口登录。
|
||
Invoke(new Action(() =>
|
||
{
|
||
// 登录小店
|
||
WXShopLoginForm lf = new WXShopLoginForm(shop);
|
||
lf.openType = EnumOpenType.login;
|
||
lf.ShowDialog();
|
||
}));
|
||
|
||
WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||
LoadShop(new List<ShopLoginInfo>() { shop });
|
||
if (shop.LoginStatus == "登录成功")
|
||
{
|
||
ShowChat(shop);
|
||
while (shop.Chat.IsLoading)
|
||
{
|
||
Thread.Sleep(50);
|
||
}
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
private void dgvShop_CellClick(object sender, DataGridViewCellEventArgs e)
|
||
{
|
||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||
return;
|
||
|
||
foreach (DataGridViewRow r in dgvShop.Rows)
|
||
r.Cells["colSelect"].Value = false;
|
||
|
||
var row = dgvShop.Rows[e.RowIndex];
|
||
row.Cells["colSelect"].Value = true;
|
||
if (row.DefaultCellStyle.BackColor.R == 245 || row.DefaultCellStyle.BackColor == Color.Yellow)
|
||
row.DefaultCellStyle.BackColor = Color.Yellow;
|
||
//if (row.Tag != null)
|
||
// row.DefaultCellStyle.BackColor = row.Tag is Color ? (Color)row.Tag : Color.White;
|
||
|
||
string shopId = row.Cells["colShopId"].Value?.ToString();
|
||
if (string.IsNullOrEmpty(shopId))
|
||
return;
|
||
var shop = GlobalConfig.ShopLoginList.Where(s => s.ShopId == shopId).FirstOrDefault();
|
||
if (shop == null)
|
||
return;
|
||
|
||
if (shop?.Chat != null)
|
||
{
|
||
// 之前的当前店铺如果不在聊天界面强制转回聊天界面
|
||
if (currentShop?.Chat != null)
|
||
{
|
||
//if (currentShop.LoginStatus == "登录成功" && !currentShop.Chat.Address.StartsWith("https://store.weixin.qq.com/shop/kf"))
|
||
// currentShop.Chat.Load("https://store.weixin.qq.com/shop/kf");
|
||
|
||
var script = "document.documentElement.outerHTML;";
|
||
string htmlContent = currentShop.Chat.EvaluateScriptAsync(script).Result.Result.ParseToString();
|
||
if (currentShop.LoginStatus == "登录成功" && !htmlContent.Contains("按Enter发送"))
|
||
currentShop.Chat.Load("https://store.weixin.qq.com/shop/kf");
|
||
}
|
||
|
||
currentShop = shop;
|
||
orderListForm.lblCurrentShop.Text = currentShop.ShopAccount;
|
||
orderListForm.lblCurrentShop.Tag = currentShop;
|
||
|
||
|
||
shop.Chat.Dock = DockStyle.Fill;
|
||
shop.Chat.BringToFront();
|
||
btnPrev.BringToFront();
|
||
btnNext.BringToFront();
|
||
|
||
txtAddress.Text = currentShop.Chat.Address;
|
||
}
|
||
|
||
Task.Run(() =>
|
||
{
|
||
SetMainBrowserUrl(shop);
|
||
});
|
||
}
|
||
|
||
public void DgvShopClick(ShopLoginInfo shop)
|
||
{
|
||
var r = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(x => x.Cells["colShopId"].Value.ToString() == shop.ShopId);
|
||
if (r != null)
|
||
{
|
||
Invoke(new Action(() =>
|
||
{
|
||
//r.Cells[1].Selected = true;
|
||
r.Selected = true;
|
||
}));
|
||
var sender = this.dgvShop;
|
||
DataGridViewCellEventArgs e = new DataGridViewCellEventArgs(0, r.Index);
|
||
dgvShop_CellClick(sender, e);
|
||
}
|
||
}
|
||
|
||
private void pnlRefresh_Click(object sender, EventArgs e)
|
||
{
|
||
//nextRefreshTime = DateTime.Now.AddMinutes(30);
|
||
pbLoading.Visible = true;
|
||
Task.Run(() =>
|
||
{
|
||
RefreshCookie();
|
||
Invoke(new Action(() => { pbLoading.Visible = false; }));
|
||
});
|
||
}
|
||
|
||
DateTime nextRefreshTime = DateTime.Now;
|
||
void RefreshCookie(bool isAuto = false)
|
||
{
|
||
if (!isAuto)
|
||
WXShopListForm.UpdateShop();
|
||
foreach (var shop in GlobalConfig.ShopLoginList)
|
||
{
|
||
var r = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(x => x.Cells["colShopId"].Value.ToString() == shop.ShopId);
|
||
Invoke(new Action(() =>
|
||
{
|
||
if (r != null)
|
||
r.Cells["colMessage"].Value = "正在刷新店铺";
|
||
}));
|
||
WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||
Invoke(new Action(() =>
|
||
{
|
||
if (r != null)
|
||
r.Cells["colMessage"].Value = "";
|
||
}));
|
||
}
|
||
LoadShop();
|
||
}
|
||
|
||
private void btnFilterShop_Click(object sender, EventArgs e)
|
||
{
|
||
string shopName = txtFiltShopName.Text.Trim();
|
||
string notes = cmbFiltNotes.Text.Trim().Trim(';');
|
||
if (notes == "全部")
|
||
notes = "";
|
||
List<string> notesLst = notes.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||
foreach(DataGridViewRow row in dgvShop.Rows)
|
||
{
|
||
if ((string.IsNullOrEmpty(notes) || notesLst.Contains(row.Cells["colShopNotes"].Value.ParseToString())) && row.Cells["colShopName"].Value.ParseToString().Contains(shopName))
|
||
{
|
||
row.Visible = true;
|
||
}
|
||
else
|
||
{
|
||
row.Visible = false;
|
||
}
|
||
}
|
||
}
|
||
|
||
private void btnEmpty_Click(object sender, EventArgs e)
|
||
{
|
||
cmbFiltNotes.Text = "全部";
|
||
btnFilterShop_Click(null, null);
|
||
}
|
||
|
||
private void btnPrev_Click(object sender, EventArgs e)
|
||
{
|
||
currentShop.Chat.Back();
|
||
}
|
||
|
||
private void btnNext_Click(object sender, EventArgs e)
|
||
{
|
||
currentShop.Chat.Forward();
|
||
}
|
||
|
||
private void btnRefreshAfterSale_Click(object sender, EventArgs e)
|
||
{
|
||
this.pbLoading.Visible = true;
|
||
Task.Run(() =>
|
||
{
|
||
RefreshAfterSale(true);
|
||
Invoke(new Action(() => { pbLoading.Visible = false; }));
|
||
});
|
||
}
|
||
|
||
void RefreshAfterSale(bool refreshAll = false)
|
||
{
|
||
List<Task> tList = new List<Task>();
|
||
if (refreshAll)
|
||
lstShopAfterSale.Clear();
|
||
foreach (var shop in GlobalConfig.ShopLoginList)
|
||
{
|
||
var shopMainInfo = lstShopAfterSale.FirstOrDefault(sa => sa.ShopId == shop.ShopId);
|
||
if (shopMainInfo == null)
|
||
shopMainInfo = new WxTalkFormShopMainInfo() { ShopId = shop.ShopId };
|
||
Invoke(new Action(() => { LoadShopAfterSale(shopMainInfo, ""); }));
|
||
var t = Task.Run(() =>
|
||
{
|
||
try
|
||
{
|
||
if (shop.LoginStatus != "登录成功")
|
||
{
|
||
Invoke(new Action(() => { LoadShopAfterSale(new WxTalkFormShopMainInfo() { ShopId = shop.ShopId }, "店铺掉线"); }));
|
||
return;
|
||
}
|
||
|
||
var afterSaleInfo = lstShopAfterSale.FirstOrDefault(sa => sa.ShopId == shop.ShopId);
|
||
if (refreshAll || afterSaleInfo == null || afterSaleInfo.RefreshTime.Date != DateTime.Now.Date)
|
||
{
|
||
lstShopAfterSale.RemoveAll(sa => sa.ShopId == shop.ShopId);
|
||
var rst = WxShopStatisticsForm.GetShopMainInfoList(shop);
|
||
if (!rst.Contains("\"code\":0"))
|
||
rst = WxShopStatisticsForm.GetShopMainInfoList(shop);
|
||
if (!rst.Contains("\"code\":0"))
|
||
{
|
||
WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||
if (shop.LoginStatus != "登录成功")
|
||
{
|
||
Invoke(new Action(() => { LoadShopAfterSale(new WxTalkFormShopMainInfo() { ShopId = shop.ShopId }, "店铺掉线"); }));
|
||
return;
|
||
}
|
||
|
||
string errMsg = BaseRegex.GetStringJson(ref rst, "msg");
|
||
if (string.IsNullOrEmpty(errMsg)) errMsg = BaseRegex.GetStringJson(ref rst, "message");
|
||
if (string.IsNullOrEmpty(errMsg)) errMsg = BaseRegex.GetStringJson(ref rst, "errMsg");
|
||
if (string.IsNullOrEmpty(errMsg)) errMsg = BaseRegex.GetStringJson(ref rst, "errmsg");
|
||
if (string.IsNullOrEmpty(errMsg)) errMsg = rst;
|
||
|
||
shopMainInfo = new WxTalkFormShopMainInfo() { ShopId = shop.ShopId, RefreshTime = DateTime.Now };
|
||
lstShopAfterSale.Add(shopMainInfo);
|
||
Invoke(new Action(() => { LoadShopAfterSale(shopMainInfo, "查询失败 " + errMsg); }));
|
||
return;
|
||
}
|
||
|
||
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,
|
||
RefreshTime = DateTime.Now,
|
||
AfterSaleCount = afterCount,
|
||
WaitSendCount = waitSendCount,
|
||
WaybillError = waybillErrorCount,
|
||
PunishCount = punishCount,
|
||
};
|
||
|
||
var shopScoreRst = WxShopStatisticsForm.GetShopScore(shop);
|
||
System.Threading.Thread.Sleep(Randomx.GetId(50, 100));
|
||
if (shopScoreRst.Contains("\"code\":0"))
|
||
{
|
||
shopMainInfo.ShopScore = BaseRegex.GetDecimalJson(ref shopScoreRst, "curValue");
|
||
}
|
||
else
|
||
{
|
||
string errStr = BaseRegex.GetStringJson(ref shopScoreRst, "errorMsg");
|
||
if (string.IsNullOrEmpty(errStr))
|
||
errStr = BaseRegex.GetStringJson(ref shopScoreRst, "error_msg");
|
||
if (string.IsNullOrEmpty(errStr))
|
||
errStr = shopScoreRst;
|
||
WXShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
|
||
shopMainInfo.err_msg = errStr;
|
||
|
||
Invoke(new Action(() => { LoadShopAfterSale(shopMainInfo, "评分查询失败 " + errStr); }));
|
||
return;
|
||
}
|
||
|
||
lstShopAfterSale.Add(shopMainInfo);
|
||
Invoke(new Action(() => { LoadShopAfterSale(shopMainInfo, "已查询"); }));
|
||
return;
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
}
|
||
});
|
||
tList.Add(t);
|
||
while (tList.Where(ta => !ta.IsFaulted && !ta.IsCompleted).Count() >= 10) { Thread.Sleep(100); }
|
||
}
|
||
while (tList.Where(ta => !ta.IsFaulted && !ta.IsCompleted).Count() >= 1) { Thread.Sleep(100); }
|
||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_shop_after_sale_list", lstShopAfterSale);
|
||
}
|
||
|
||
private void btnToKfMainPage_Click(object sender, EventArgs e)
|
||
{
|
||
if (currentShop?.Chat != null && currentShop.LoginStatus == "登录成功")
|
||
currentShop.Chat.Load("https://store.weixin.qq.com/shop/kf");
|
||
}
|
||
|
||
private void txtAddress_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyCode == Keys.Enter)
|
||
{
|
||
if (currentShop?.Chat != null)
|
||
{
|
||
currentShop?.Chat.Load(txtAddress.Text);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
public static string GetKfMsgStatistics(ShopLoginInfo shop, long beginDateTick, long endDateTick)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop/kf/cgi/data/getRealTimeShopV2?" + "beginDate=" + (beginDateTick / 1000) + "&endDate=" + (endDateTick / 1000m).ToString("0.000");
|
||
string referer = "https://store.weixin.qq.com/shop/kf/data/store";
|
||
var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, referer);
|
||
return result;
|
||
}
|
||
|
||
private void btnRefreshMsgCount_Click(object sender, EventArgs e)
|
||
{
|
||
pbLoading.Visible = true;
|
||
Task.Run(() =>
|
||
{
|
||
RefreshMsgCount();
|
||
Invoke(new Action(() => { pbLoading.Visible = false; }));
|
||
});
|
||
}
|
||
|
||
void RefreshMsgCount()
|
||
{
|
||
lstShopKfStatistics.Clear();
|
||
foreach (var shop in GlobalConfig.ShopLoginList)
|
||
{
|
||
var kfMsg = new WxShopKfStatistics() { ShopId = shop.ShopId };
|
||
var kfMsgRst = GetKfMsgStatistics(shop, BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now.Date), BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now));
|
||
if (!kfMsgRst.Contains("\"ret\":0"))
|
||
continue;
|
||
try
|
||
{
|
||
var jObj = JsonHelper.JObjectParse(kfMsgRst);
|
||
kfMsg.user_cnt = jObj["cardResp"]["objects"]["tableValueLine"][0]["columnValue"][1].ParseToInt();
|
||
kfMsg.sesseion_cnt = jObj["cardResp"]["objects"]["tableValueLine"][0]["columnValue"][2].ParseToInt();
|
||
kfMsg.service_noreply_ratio = jObj["cardResp"]["objects"]["tableValueLine"][0]["columnValue"][5].ParseToDecimal();
|
||
lstShopKfStatistics.Add(kfMsg);
|
||
|
||
Invoke(new Action(() =>
|
||
{
|
||
int count = Math.Max(1, lstShopKfStatistics.Count());
|
||
lblUserCount.Text = lstShopKfStatistics.Sum(s => s.user_cnt).ParseToString();
|
||
lblTalkCount.Text = lstShopKfStatistics.Sum(s => s.sesseion_cnt).ParseToString();
|
||
lblReplyCount.Text = lstShopKfStatistics.Sum(s => s.service_reply_ratio * 100 / count).ParseToDecimal().ToString("0.0") + "%";
|
||
}));
|
||
}
|
||
catch
|
||
{
|
||
}
|
||
}
|
||
Invoke(new Action(() =>
|
||
{
|
||
int count = Math.Max(1, lstShopKfStatistics.Count());
|
||
lblUserCount.Text = lstShopKfStatistics.Sum(s => s.user_cnt).ParseToString();
|
||
lblTalkCount.Text = lstShopKfStatistics.Sum(s => s.sesseion_cnt).ParseToString();
|
||
lblReplyCount.Text = lstShopKfStatistics.Sum(s => s.service_reply_ratio * 100 / count).ParseToDecimal().ToString("0.0") + "%";
|
||
}));
|
||
}
|
||
|
||
public static void InitAutoReply()
|
||
{
|
||
LstTalkTemplatePair = NaiBa.Util.Helper.ConfigHelper.LoadConfig<List<KeyValuePair<string, string>>>("wx_talk_auto_reply_template");
|
||
if (LstTalkTemplatePair == null)
|
||
{
|
||
UpdateAutoReply(defaultTalkTemplate);
|
||
}
|
||
}
|
||
public static void UpdateAutoReply(string talkTemplate)
|
||
{
|
||
LstTalkTemplatePair = new List<KeyValuePair<string, string>>();
|
||
var keyValueStrLst = talkTemplate.Split(new string[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
|
||
foreach (var keyValueStr in keyValueStrLst)
|
||
{
|
||
if (keyValueStr.StartsWith("//"))
|
||
continue;
|
||
var keyValueLst = keyValueStr.Split(new string[] { "###" }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||
if (keyValueLst.Count == 1)
|
||
keyValueLst.Insert(0, "");
|
||
LstTalkTemplatePair.Add(new KeyValuePair<string, string>(keyValueLst.FirstOrDefault(), keyValueLst.LastOrDefault()));
|
||
}
|
||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_talk_auto_reply_template", LstTalkTemplatePair);
|
||
}
|
||
|
||
private void btnMultiLogin_Click(object sender, EventArgs e)
|
||
{
|
||
WXShopListForm.Instance.CheckShopLogin(new string[] { currentShop.LoginName }, false);
|
||
if (currentShop.LoginStatus != "登录成功")
|
||
{
|
||
BaseMsgForm.ShowError("批量登录需要主店铺处于登录状态!");
|
||
}
|
||
else
|
||
{
|
||
WXShopMultiLoginForm shopMultiLoginForm = new WXShopMultiLoginForm(currentShop);
|
||
shopMultiLoginForm.openType = EnumOpenType.multi_login;
|
||
shopMultiLoginForm.ShowDialog();
|
||
|
||
var switchShopLst = shopMultiLoginForm.lstSwitchShop.ToList();
|
||
var needUpdateShopLst = shopMultiLoginForm.lstNeedUpdateShop.ToList();
|
||
pbLoading.Visible = true;
|
||
Task.Run(() =>
|
||
{
|
||
LoadShop(switchShopLst);
|
||
foreach (var shop in needUpdateShopLst)
|
||
{
|
||
ShowChat(shop);
|
||
}
|
||
Invoke(new Action(() => { pbLoading.Visible = false; }));
|
||
});
|
||
}
|
||
}
|
||
|
||
private void btnChangeAddress_Click(object sender, EventArgs e)
|
||
{
|
||
if (!Directory.Exists("temp\\orderInfo"))
|
||
Directory.CreateDirectory("temp\\orderInfo");
|
||
if (!FileBase.Exists("temp\\orderInfo\\订单物流信息更新.exe"))
|
||
{
|
||
Task.Run(() =>
|
||
{
|
||
//if (GetHtml.DownloadFile(BaseClass.ServerUrl + "/Download/" + "orderInfo.zip", "temp\\orderInfo\\orderInfo.zip"))
|
||
if (DownloadBLL.downloadFile(BaseClass.ServerUrl + "/Download/orderInfo.zip", Path.Combine(Environment.CurrentDirectory, "temp\\orderInfo\\orderInfo.zip"), lblProgress) == "下载完成")
|
||
{
|
||
ZipFile.ExtractToDirectory(Path.Combine(Environment.CurrentDirectory, "temp\\orderInfo\\orderInfo.zip"), Path.Combine(Environment.CurrentDirectory, "temp\\orderInfo"));
|
||
File.Delete(Path.Combine(Environment.CurrentDirectory, "temp\\orderInfo\\orderInfo.zip"));
|
||
}
|
||
});
|
||
return;
|
||
}
|
||
|
||
try
|
||
{
|
||
System.Diagnostics.Process[] psiNewcas = System.Diagnostics.Process.GetProcessesByName("订单物流信息更新");
|
||
foreach (System.Diagnostics.Process p in psiNewcas)
|
||
{
|
||
p.Kill();
|
||
}
|
||
|
||
|
||
string cookie = "";
|
||
string biz_magic = "";
|
||
var cookieLst = JsonHelper.DeserializeJsonToList<CefSharp.Cookie>(currentShop.Cookies.ParseToString().Replace("empty=true;", "[]"));
|
||
foreach (var c in cookieLst)
|
||
{
|
||
if (c.Name == "biz_magic")
|
||
biz_magic = c.Value;
|
||
cookie += c.Name + "=" + c.Value + "; ";
|
||
}
|
||
cookie = cookie.Trim(';', ' ');
|
||
File.WriteAllText(Path.Combine(Environment.CurrentDirectory, "temp\\orderInfo\\cookie.txt"), cookie);
|
||
File.WriteAllText(Path.Combine(Environment.CurrentDirectory, "temp\\orderInfo\\biz_magic.txt"), biz_magic);
|
||
|
||
|
||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||
startInfo.FileName = Path.Combine(Environment.CurrentDirectory, "temp\\orderInfo\\订单物流信息更新.exe");
|
||
//startInfo.Arguments = "arg1 arg2"; // exe参数
|
||
startInfo.UseShellExecute = false; // 不使用shell启动
|
||
startInfo.RedirectStandardOutput = false; // 不重定向输出
|
||
startInfo.WorkingDirectory = Path.Combine(Environment.CurrentDirectory, "temp\\orderInfo");
|
||
|
||
using (Process process = Process.Start(startInfo))
|
||
{
|
||
//process.WaitForExit(); // 等待进程退出
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
BaseMsgForm.ShowError("优化工具打开失败 " + ex.Message);
|
||
}
|
||
}
|
||
|
||
|
||
public static string defaultTalkTemplate = @"###亲亲,客服人员正在仓库核实打包发货,您的问题我们记录好,客服小姐姐回来会为您解答哦!
|
||
###亲亲,在的呢亲亲,这款商品质量很好的呢,现在下单为您优先发出哦
|
||
###亲,客户已经听到您的呼叫,请稍等!
|
||
###亲,客服正在来的路上喔,您看到的商品基本都是有货的,请放心购买!
|
||
###亲,如果您有什么疑问可以直接留言,客服看到了会记录下来的,没有及时回复您,真的非常抱歉!
|
||
###亲,您好,有什么需要帮助的吗~喜欢可以直接拍下哦,拍下后尽快给您安排发出~
|
||
###目前顾客比较多哦,客服小姐姐一个一个回复呢,麻烦您耐心等待下
|
||
###客服小姐姐加急回复哦,请您再稍等一下哦
|
||
###亲,已经听到您的呼叫,请稍等!
|
||
###亲,客服正在来的路上喔,您看到的商品基本都是有货的,拍下后尽快给您安排发出~
|
||
###亲,如果您有什么疑问可以直接留言,客服看到了会记录下来的,没有及时回复您,真的非常抱歉!
|
||
###需要可以拍下,这边尽快给您发出,不指定快递哦
|
||
###若客服未及时回,可能是系统延迟,请留言,客服上线后处理,谢谢!
|
||
###客服正在仓库打包包裹,您可以先留言,看到消息后会及时回复~
|
||
###亲,我会乐意为你服务。请收藏一下本小店,我们会不定期上新款。祝你网购愉快。
|
||
###亲~ 不好意思,现在忙于打包发货中,有事请留言,晚点给你回复,谢谢!
|
||
###亲,我会乐意为你服务。收藏一下本小店,我们会不定期上新款。祝你网购愉快。
|
||
快递###亲,我们根据您的收货地址选择最优的快递!
|
||
什么时候发货###亲,我们48小时内发货,一般我们都是当天发货的喔
|
||
什么时候发货###亲,除(预售商品)外我们48小时内发货,一般我们都是当天发货的喔
|
||
哪里发货###亲,我们全国多仓发货,尽快为您发出,随机发极兔,韵达,邮政等(暂不接受指定),一般24小时内发货,慢的48小时内按顺序发货,一般发货后省内1-2天,省外3-4天,偏远地区可能会稍慢一些
|
||
备注一下|标注一下|注明一下###好的,亲!我会为您备注的!
|
||
您好|老板|店家|哈喽|嗨|亲|亲你好|亲,你好###在的,亲!很高兴能为您服务,请问有什么可以帮到您?
|
||
晕!|哦!|喔!|恩!|嗯!|奥!|好!|噢!|噢噢!|奥奥!|哦哦!|喔喔!|!|嗯嗯!|好的!###感谢您的支持呢亲!
|
||
退款|退款吧|退了|退了吧|不要了|买错了|退货###亲,如您未收到货,可直接申请仅退款,如已收到货,退款步骤-个人中心-订单与卡包-申请退款-【我要退货退款】(不是 我要退款)-申请原因-选择第一个【多拍/拍错/不想要】或最后一个【其他】,退货申请会秒通过并自动发送地址给亲的哦。拒收平邮及到付哦!注意:申请通过后请及时填写退货单号,超时会自动关闭退款哦!
|
||
麻烦了###不客气的,亲!
|
||
答复|回答###好的,亲!有结果我们会第一时间答复您的!
|
||
说句话|说话|回话|回个话###在的,亲!我正在想怎样回答您呢,能把问题具体再说一下吗?
|
||
好了吗|可以了吗###亲稍等,正在为您核实处理!
|
||
有货吗|有货?|还有货###亲:我们的库存是很充足得哦。放心好了。
|
||
么回事|咋回事|怎么办|咋办###亲,您不要着急,请把事情的具体情况和我说明一下,如果有图片也最好提供一下,我们会为您核实处理的哦!
|
||
什么情况###虽然我也不清楚什么情况,但我们会为您处理好的哦!
|
||
您好|老板|店家|哈喽|嗨|亲|亲你好|亲,你好###在的,亲!很高兴能为您服务,请问有什么可以帮到您?
|
||
退款|退款吧|退了|退了吧|不要了|买错了###亲,如您未收到货,可直接申请仅退款,如已收到货,退款步骤-个人中心-订单与卡包-申请退款-【我要退货退款】(不是 我要退款)-申请原因-选择第一个【多拍/拍错/不想要】或最后一个【其他】,退货申请会秒通过并自动发送地址给亲的哦。拒收平邮及到付哦!注意:申请通过后请及时填写退货单号,超时会自动关闭退款哦!
|
||
么回事|咋回事|怎么办|咋办###亲,您不要着急,请把事情的具体情况和我说明一下,如果有图片也最好提供一下,我们会为您核实处理的哦!
|
||
怎么申请退货|申请退货|申请退款|怎么退|退###亲,退货步骤-个人中心-订单与卡包-申请退款-【我要退货退款】(不是 我要退款)-申请原因-选择第一个【多拍/拍错/不想要】或最后一个【其他】,退货申请会秒通过并自动发送地址给亲的哦。拒收平邮及到付哦!注意:申请通过后请及时填写退货单号,超时会自动关闭退款哦!
|
||
退了吧|我退款###亲,如您未收到货,可直接申请仅退款,如已收到货,退款步骤-个人中心-订单与卡包-申请退款-【我要退货退款】(不是 我要退款)-申请原因-选择第一个【多拍/拍错/不想要】或最后一个【其他】,退货申请会秒通过并自动发送地址给亲的哦。拒收平邮及到付哦!注意:申请通过后请及时填写退货单号,超时会自动关闭退款哦!
|
||
好评###非常感谢您的支持呢亲
|
||
拍了|已拍|拼了|已买|已下单|现在拍|买好了|下单了|下好单了|下好了|买好了|买完了|拍好了|拍完了|拍下了|购买了|已购买|买单了|拼单成功###好的,亲!这边核实后会及时为您安排发出的哦!
|
||
同意一下|通过一下###好的,亲!我们的售后专员会及时为您处理的。
|
||
差评###亲,差评并不是解决问题的办法,沟通才是最有效的哦,有任何问题欢迎与我们联系哦!
|
||
机器人###哈,我不是机器人,我是可爱的客服妹子哦!(*^__^*) ,您的问题我已经收到,不过现在有点小忙,稍等一会回复您哦!
|
||
我已经拼单成功###好的亲,这边通知仓库为您优先发货!
|
||
发货时间|发货###亲,除(预售商品)外我们48小时内发货,一般我们都是当天发货的喔
|
||
发什么快递###亲,我们在全国有多个仓库,会根据您的收货地址和库存进行动态调配的,请您放心,商品一定会寄送到您手里!
|
||
什么时候发货###拍下后我们会尽快给您安排发出,拍下后亲耐心稍等哦~
|
||
多久能到###亲,一般发货以后3天左右可以到货的呢,您收到货以后可以仔细检查一下,如有任何质量问题,7天内可以无条件退换货的。
|
||
可以便宜###亲,非常抱歉,我们的定价已经是最低销售价格了呢,没有办法再优惠啦~~~
|
||
质量问题###亲,我们是商城正品,质量都是有保证的,您这边可以完全放心拍下哦。。。我们支持7天无理由退货的。
|
||
包邮###亲,我们是全场包邮的喔,请放心拍下。
|
||
我考虑###亲,可以的,等你考虑清楚了再下单,我们尽快给您安排发货。
|
||
物流慢###亲,非常抱歉,最近物流比较繁忙,发货比较慢(容易出错),您这边先不要着急,我先联系一下快递公司询问一下具体是什么情况好吗?然后根据具体情况具体解决。
|
||
质量问题###亲,请您放心哦,如果是我们的质量问题,这边一定会为您处理好的, 您需要配合一下 请您发拍张有质量问题处的图片给我们,好吧?
|
||
是否有货###亲,您看中的这款宝贝是有现货的呢,您可以放心拍哦O(_)O~
|
||
质量怎么样###我们是厂家直接供货,质量绝对保证。保证正品
|
||
//不放卡片|不放清单###好的,亲!我会为您备注不放卡片清单的!
|
||
//已联系卖家尽快为您发|催发货###好的,亲!我们会尽快为您安排发货的哦!
|
||
//商家同意退货,请及时退货###亲,退货后请记得填写退货运单号,方便我们及时为您处理哦!
|
||
//申请未同意,待买家处理###亲,由于快递还在运输途中或已经签收,我们暂时不能同意您的退款,待与快递核实后我们会及时为您处理的哦!
|
||
//物流投诉|我已提交投诉物流单###亲,您的诉求我们已经收到,请不要着急,我们马上联系快递加急处理!
|
||
//纠纷预警,请立即跟进###亲,有什么问题可以随时与我们联系,我们将竭诚为您服务!
|
||
//开启商品卡片自动回复###亲,您的眼光真好,这款产品不仅价格实惠,质量也是非常好的哦!
|
||
//当前用户来自###亲,您正在看的这款宝贝有货的哦,请问有什么可以帮到您?
|
||
//商家购买退货包运费服务后###亲,您拍下商品前,商品标题后显示【退货包运费】的,表示此商品有运费险,当您拍下后订单详情显示运费险生效中就表示此订单您享有运费险的。
|
||
//催处理售后###亲,稍安勿躁,我们的售后专员会及时为您处理的哦!
|
||
//催发货###亲,您的订单我们已经收到,仓库正在为您进行质量检查,确认无误后就会发出的哦!
|
||
//订单编号###亲,您的这笔订单已核实,请问是遇到什么问题了呢?
|
||
//退款成功###亲,您的退款已办理成功,欢迎下次光临哦!";
|
||
|
||
|
||
//https://store.weixin.qq.com/shop-faas/mmchannelstradeorder/list/cgi/orderSearch?token=&lang=zh_CN
|
||
//https://store.weixin.qq.com/shop/order/list
|
||
// 待发货
|
||
//{"isSearch":false,"pageSize":30,"overTime":0,"pengingShipOneDay":0,"pengingShipSixHour":0,"expediteDelivery":0,"stockoutPunishAlert":0,"waybillStatus":0,"pageNum":1,"onAftersaleOrderExist":0,"orderStatus":20}
|
||
// 售后中
|
||
//{"isSearch":false,"pageSize":30,"overTime":0,"pengingShipOneDay":0,"pengingShipSixHour":0,"expediteDelivery":0,"stockoutPunishAlert":0,"waybillStatus":0,"pageNum":1,"onAftersaleOrderExist":1,"orderStatus":0}
|
||
// 已发货
|
||
//{"isSearch":false,"pageSize":30,"overTime":0,"pengingShipOneDay":0,"pengingShipSixHour":0,"expediteDelivery":0,"stockoutPunishAlert":0,"waybillStatus":0,"pageNum":1,"onAftersaleOrderExist":0,"orderStatus":30}
|
||
|
||
// 时间段查询全部
|
||
//{"isSearch":true,"pageSize":30,"overTime":0,"pengingShipOneDay":0,"pengingShipSixHour":0,"expediteDelivery":0,"stockoutPunishAlert":0,"waybillStatus":0,"pageNum":1,"onAftersaleOrderExist":0,"orderStatus":0,"orderId":"","orderTime":{"type":0,"time":[1772380800000,1774868515000]},"telNumber":"","title":"","receiverName":"","finderNickName":"","merchantNotes":"","merchantNotesTagColor":0,"waybillId":"","productCode":"","inspectStatus":"","finderWay":0,"searchOrderType":0,"payMethod":0,"orderChannel":0,"bulkbuyActivityId":"","deliveryNegotiationFlag":0,"transactionId":"","page":1,"status":20,"startCreateTime":1772380800000,"endCreateTime":1774868515000}
|
||
}
|
||
}
|