token调用逻辑优化 店铺统计(30%)
This commit is contained in:
1 parent
b42155ae6c
commit
b3f446dee8
7 files changed
+1939
-137
No files matched your search
@@ -191,6 +191,12 @@
|
||||
<Compile Include="WXForms\ProductForms\WXProductForm.Designer.cs">
|
||||
<DependentUpon>WXProductForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WXForms\ShopForms\WxShopStatisticsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="WXForms\ShopForms\WxShopStatisticsForm.Designer.cs">
|
||||
<DependentUpon>WxShopStatisticsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WXForms\ShopForms\WXShopUpdateCookieForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -1069,6 +1075,9 @@
|
||||
<EmbeddedResource Include="WXForms\ProductForms\WXProductForm.resx">
|
||||
<DependentUpon>WXProductForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="WXForms\ShopForms\WxShopStatisticsForm.resx">
|
||||
<DependentUpon>WxShopStatisticsForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="WXForms\ShopForms\WXShopUpdateCookieForm.resx">
|
||||
<DependentUpon>WXShopUpdateCookieForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
+10
-26
@@ -30,19 +30,11 @@
|
||||
{
|
||||
System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("店铺列表");
|
||||
System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("子账号管理");
|
||||
System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("订单金额统计");
|
||||
System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("工作明细统计");
|
||||
System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("运费模板");
|
||||
System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("高级运费模板");
|
||||
System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("素材库管理");
|
||||
System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("店铺管理", new System.Windows.Forms.TreeNode[] {
|
||||
System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("店铺经营统计");
|
||||
System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("店铺管理", new System.Windows.Forms.TreeNode[] {
|
||||
treeNode1,
|
||||
treeNode2,
|
||||
treeNode3,
|
||||
treeNode4,
|
||||
treeNode5,
|
||||
treeNode6,
|
||||
treeNode7});
|
||||
treeNode3});
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
@@ -137,33 +129,25 @@
|
||||
treeNode1.Text = "店铺列表";
|
||||
treeNode2.Name = "子账号管理";
|
||||
treeNode2.Text = "子账号管理";
|
||||
treeNode3.Name = "订单金额统计";
|
||||
treeNode3.Text = "订单金额统计";
|
||||
treeNode4.Name = "工作明细统计";
|
||||
treeNode4.Text = "工作明细统计";
|
||||
treeNode5.Name = "运费模板";
|
||||
treeNode5.Text = "运费模板";
|
||||
treeNode6.Name = "高级运费模板";
|
||||
treeNode6.Text = "高级运费模板";
|
||||
treeNode7.Name = "素材库管理";
|
||||
treeNode7.Text = "素材库管理";
|
||||
treeNode8.Name = "店铺管理";
|
||||
treeNode8.Text = "店铺管理";
|
||||
treeNode3.Name = "店铺经营统计";
|
||||
treeNode3.Text = "店铺经营统计";
|
||||
treeNode4.Name = "店铺管理";
|
||||
treeNode4.Text = "店铺管理";
|
||||
this.tv.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
|
||||
treeNode8});
|
||||
treeNode4});
|
||||
this.tv.OverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
|
||||
this.tv.Size = new System.Drawing.Size(140, 461);
|
||||
this.tv.TabIndex = 1;
|
||||
this.tv.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tv_AfterSelect);
|
||||
//
|
||||
// ShopForm
|
||||
// WXShopForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.ClientSize = new System.Drawing.Size(933, 461);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "ShopForm";
|
||||
this.Name = "WXShopForm";
|
||||
this.Text = "ShopForm";
|
||||
this.Load += new System.EventHandler(this.ShopForm_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
{
|
||||
public Lazy<WXShopListForm> shopListForm = new Lazy<WXShopListForm>();
|
||||
public Lazy<WXSubAccountListForm> sbuAccountForm = new Lazy<WXSubAccountListForm>();
|
||||
public Lazy<WxShopStatisticsForm> shopStatisticsForm = new Lazy<WxShopStatisticsForm>();
|
||||
|
||||
|
||||
public WXShopForm()
|
||||
@@ -68,6 +69,9 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
case "子账号管理":
|
||||
SetForm(sbuAccountForm.Value);
|
||||
break;
|
||||
case "店铺经营统计":
|
||||
SetForm(shopStatisticsForm.Value);
|
||||
break;
|
||||
}
|
||||
}));
|
||||
}).Start();
|
||||
|
||||
+1219
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,396 @@
|
||||
using AllBase;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model.Config;
|
||||
using AllBase.Model.Result;
|
||||
using NaiBa.Util.Extension;
|
||||
using NaiBa.Util.Winform.Extension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TemuKJD.BLL;
|
||||
using TemuKJD.KJDForms.ShopForms;
|
||||
using TemuKJD.UserComponent;
|
||||
|
||||
namespace TemuKJD.WXForms.ShopForms
|
||||
{
|
||||
public partial class WxShopStatisticsForm : BaseForms.BaseForm
|
||||
{
|
||||
bool isInit = false;
|
||||
public List<WxShopSaleStatisticsGroup> lstShopStatisticsInfo = new List<WxShopSaleStatisticsGroup>();
|
||||
public WxShopStatisticsForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void WxShopStatisticsForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.dgvShop.AddSelectorColumn("colSelect");
|
||||
|
||||
foreach(DataGridViewColumn column in dgvShop.Columns)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(column.HeaderText) && column.HeaderText != "店铺登录号码")
|
||||
{
|
||||
var chk = new UcCheckBox() { Name = "chk" + column.Name, Tag = column.Name, Text = column.HeaderText, Checked = column.Visible, };
|
||||
chk.CheckedChanged += Chk_CheckedChanged;
|
||||
this.flowLayoutPanel1.Controls.Add(chk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Chk_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
var chk = sender as UcCheckBox;
|
||||
if (chk != null)
|
||||
{
|
||||
dgvShop.Columns[chk.Tag.ParseToString()].Visible = chk.Checked;
|
||||
}
|
||||
}
|
||||
|
||||
private void WxShopStatisticsForm_VisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Visible == true)
|
||||
{
|
||||
if (!isInit)
|
||||
{
|
||||
isInit = true;
|
||||
RefreshShop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void RefreshShop()
|
||||
{
|
||||
this.pbLoading.Visible = true;
|
||||
// 店铺Id
|
||||
var selectIds = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
|
||||
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
|
||||
// 获取被删除的店铺
|
||||
List<DataGridViewRow> dgvRowList = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
|
||||
=> !GlobalConfig.ShopLoginList.Any(s => s.ShopId == row.Cells["colShopId"]?.Value?.ToString())).ToList();
|
||||
// 更新被删除的店铺列表
|
||||
foreach (var row in dgvRowList)
|
||||
{
|
||||
dgvShop.Rows.Remove(row);
|
||||
}
|
||||
// 获取被删除的统计信息并删除
|
||||
List<WxShopSaleStatisticsGroup> statisticsDeleteLst = lstShopStatisticsInfo.Where(row
|
||||
=> !GlobalConfig.ShopLoginList.Any(s => s.ShopId == row.ShopId.ToString())).ToList();
|
||||
foreach (var s in statisticsDeleteLst)
|
||||
{
|
||||
lstShopStatisticsInfo.Remove(s);
|
||||
}
|
||||
|
||||
// 绑定店铺(含新导入的店铺)
|
||||
foreach (ShopLoginInfo shopEntity in GlobalConfig.ShopLoginList)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(shopEntity.ShopId))
|
||||
BindShop(shopEntity, selectIds);
|
||||
}
|
||||
|
||||
GetShopStatistics(GlobalConfig.ShopLoginList.ToList(), selectIds);
|
||||
}
|
||||
|
||||
private void GetShopStatistics(List<ShopLoginInfo> shops, List<string> selectIds)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
foreach (ShopLoginInfo shopEntity in shops)
|
||||
{
|
||||
if (string.IsNullOrEmpty(shopEntity.ShopId))
|
||||
continue;
|
||||
bool canUse = shopEntity.LoginStatus == "登录成功";
|
||||
if (!canUse)
|
||||
{
|
||||
BindShop(shopEntity, selectIds);
|
||||
continue;
|
||||
}
|
||||
|
||||
WxShopSaleStatisticsGroup statistics = lstShopStatisticsInfo.FirstOrDefault(s => s.ShopId.ToString() == shopEntity.ShopId);
|
||||
if (statistics == null)
|
||||
{
|
||||
statistics = new WxShopSaleStatisticsGroup()
|
||||
{
|
||||
Notes = shopEntity.Notes,
|
||||
GroupName = shopEntity.GroupName,
|
||||
ShopId = shopEntity.ShopId.ParseToString(),
|
||||
ShopAccount = shopEntity.ShopAccount,
|
||||
};
|
||||
lstShopStatisticsInfo.Add(statistics);
|
||||
}
|
||||
GetShopStatistics(shopEntity, statistics);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.lblPayCnt.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfoToday.pay_order_cnt.ParseToLong()).ToString();
|
||||
this.lblPayCnt7.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfo7Day.pay_order_cnt.ParseToLong()).ToString();
|
||||
this.lblPayCnt30.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfo30Day.pay_order_cnt.ParseToLong()).ToString();
|
||||
this.lblPay.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfoToday.pay_gmv.ParseToDecimal()).ToString("f2");
|
||||
this.lblPay7.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfo7Day.pay_gmv.ParseToDecimal()).ToString("f2");
|
||||
this.lblPay30.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfo30Day.pay_gmv.ParseToDecimal()).ToString("f2");
|
||||
this.lblPayRefund.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfoToday.pay_refund_gmv.ParseToLong()).ToString();
|
||||
this.lblPayRefund7.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfo7Day.pay_refund_gmv.ParseToLong()).ToString();
|
||||
this.lblPayRefund30.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfo30Day.pay_refund_gmv.ParseToLong()).ToString();
|
||||
this.lblOrderNum.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopMainInfo.orderNumRet?.num.ParseToInt()).ToString();
|
||||
this.lblWaybillError.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopMainInfo.waybillErrorRet?.num.ParseToInt()).ToString();
|
||||
this.lblAfterSaleAll.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopMainInfo.aftersaleAllRet?.num.ParseToInt()).ToString();
|
||||
this.lblPunish.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopMainInfo.punishRet?.num.ParseToInt()).ToString();
|
||||
|
||||
//this.lblAvailableBalance.Text = this.lstShopStatisticsInfo.Sum(s => s.availableBalance).ToString();
|
||||
//this.lblMallDepositLimitAmount.Text = this.lstShopStatisticsInfo.Sum(s => s.mallDepositLimitAmount).ToString();
|
||||
//this.lblWithdrawCashAmount.Text = this.lstShopStatisticsInfo.Sum(s => s.withdrawCashAmount).ToString();
|
||||
BindShop(shopEntity, selectIds);
|
||||
}));
|
||||
}
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.pbLoading.Visible = false;
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
private void BindShop(ShopLoginInfo shopEntity, List<string> selectShopId = null)
|
||||
{
|
||||
if (shopEntity == null)
|
||||
return;
|
||||
if (selectShopId == null)
|
||||
selectShopId = new List<string>();
|
||||
|
||||
WxShopSaleStatisticsGroup statistics = lstShopStatisticsInfo.FirstOrDefault(s => s.ShopId.ToString() == shopEntity.ShopId);
|
||||
if (statistics == null)
|
||||
{
|
||||
statistics = new WxShopSaleStatisticsGroup()
|
||||
{
|
||||
Notes = shopEntity.Notes,
|
||||
GroupName = shopEntity.GroupName,
|
||||
ShopId = shopEntity.ShopId.ParseToString(),
|
||||
ShopAccount = shopEntity.ShopAccount,
|
||||
};
|
||||
lstShopStatisticsInfo.Add(statistics);
|
||||
}
|
||||
|
||||
bool canUse = shopEntity.LoginStatus == "登录成功";
|
||||
var row = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(
|
||||
p => p.Cells.GetCellValueFromColumnName("colShopId").ParseToString() == shopEntity.ShopId);
|
||||
if (row == null)
|
||||
{
|
||||
int rowId = this.dgvShop.Rows.Add(
|
||||
false,
|
||||
canUse ? "在线" : "掉线",
|
||||
"详情",
|
||||
shopEntity.LoginName,
|
||||
shopEntity.ShopId,
|
||||
shopEntity.ShopAccount,
|
||||
shopEntity.Notes,
|
||||
shopEntity.GroupName,
|
||||
"", // 在售商品
|
||||
"", // 店铺体验分
|
||||
statistics.WxShopSaleInfoToday.pay_order_cnt, // 今日订单
|
||||
statistics.WxShopSaleInfo7Day.pay_order_cnt, // 7日订单
|
||||
statistics.WxShopSaleInfo30Day.pay_order_cnt, // 30日订单
|
||||
statistics.WxShopSaleInfoToday.pay_gmv, // 今日成交金额
|
||||
statistics.WxShopSaleInfo7Day.pay_gmv, // 7日成交金额
|
||||
statistics.WxShopSaleInfo30Day.pay_gmv, // 30日成交金额
|
||||
statistics.WxShopSaleInfoToday.pay_refund_gmv, // 今日退款金额
|
||||
statistics.WxShopSaleInfo7Day.pay_refund_gmv, // 7日退款金额
|
||||
statistics.WxShopSaleInfo30Day.pay_refund_gmv, // 30日退款金额
|
||||
statistics.WxShopMainInfo.orderNumRet?.num, // 待发货
|
||||
statistics.WxShopMainInfo.waybillErrorRet?.num, // 物流异常
|
||||
statistics.WxShopMainInfo.aftersaleAllRet?.num, // 售后
|
||||
statistics.WxShopMainInfo.punishRet?.num, // 店铺违规
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
);
|
||||
row = dgvShop.Rows[rowId];
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Green : Color.Red;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).LinkColor = canUse ? Color.Green : Color.Red;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightGreen : Color.OrangeRed;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkGreen : Color.DarkRed;
|
||||
row.Height = 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
row.Cells["colSelect"].Value = selectShopId.Contains(shopEntity.ShopId) && canUse;
|
||||
row.Cells["colLoginStatus"].Value = canUse ? "在线" : "掉线";
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Green : Color.Red;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).LinkColor = canUse ? Color.Green : Color.Red;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightGreen : Color.OrangeRed;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkGreen : Color.DarkRed;
|
||||
|
||||
row.Cells["colShopLoginName"].Value = shopEntity.LoginName;
|
||||
row.Cells["colShopAccount"].Value = shopEntity.ShopAccount;
|
||||
row.Cells["colNotes"].Value = shopEntity.Notes;
|
||||
row.Cells["colGroup"].Value = shopEntity.GroupName;
|
||||
// 在售商品
|
||||
// 店铺体验分
|
||||
row.Cells["colPayCnt"].Value = statistics.WxShopSaleInfoToday.pay_order_cnt; // 今日订单
|
||||
row.Cells["colPayCnt7"].Value = statistics.WxShopSaleInfo7Day.pay_order_cnt; // 7日订单
|
||||
row.Cells["colPayCnt30"].Value = statistics.WxShopSaleInfo30Day.pay_order_cnt; // 30日订单
|
||||
row.Cells["colPay"].Value = statistics.WxShopSaleInfoToday.pay_gmv; // 今日成交金额
|
||||
row.Cells["colPay7"].Value = statistics.WxShopSaleInfo7Day.pay_gmv; // 7日成交金额
|
||||
row.Cells["colPay30"].Value = statistics.WxShopSaleInfo30Day.pay_gmv; // 30日成交金额
|
||||
row.Cells["colRefund"].Value = statistics.WxShopSaleInfoToday.pay_refund_gmv; // 今日退款金额
|
||||
row.Cells["colRefund7"].Value = statistics.WxShopSaleInfo7Day.pay_refund_gmv; // 7日退款金额
|
||||
row.Cells["colRefund30"].Value = statistics.WxShopSaleInfo30Day.pay_refund_gmv; // 30日退款金额
|
||||
row.Cells["colOrderNum"].Value = statistics.WxShopMainInfo.orderNumRet?.num; // 待发货
|
||||
row.Cells["colShipErr"].Value = statistics.WxShopMainInfo.waybillErrorRet?.num; // 物流异常
|
||||
row.Cells["colAfterSale"].Value = statistics.WxShopMainInfo.aftersaleAllRet?.num; // 售后
|
||||
row.Cells["colPunish"].Value = statistics.WxShopMainInfo.punishRet?.num; // 店铺违规
|
||||
|
||||
//row.Cells["colOnSaleProductNumber"].Value = statistics.onSaleProductNumber == null ? "-" : statistics.onSaleProductNumber.ToString(); //在售商品数
|
||||
//row.Cells["colSaleVolume"].Value = statistics.saleVolume == null ? "-" : statistics.saleVolume.ToString(); //今日销量
|
||||
//row.Cells["colTodayProfit"].Value = statistics.todayProfit == null ? "-" : statistics.todayProfit.Value.ToString("0.00"); //今日利润
|
||||
//row.Cells["colSevenDaysSaleVolume"].Value = statistics.sevenDaysSaleVolume == null ? "-" : statistics.sevenDaysSaleVolume.ToString(); //7日销量
|
||||
//row.Cells["colSevenDaysProfit"].Value = statistics.sevenDaysProfit == null ? "-" : statistics.sevenDaysProfit.Value.ToString("0.00"); //7日利润
|
||||
//row.Cells["colThirtyDaysSaleVolume"].Value = statistics.thirtyDaysSaleVolume == null ? "-" : statistics.thirtyDaysSaleVolume.ToString(); //30日销量
|
||||
//row.Cells["colThirtyDaysProfit"].Value = statistics.thirtyDaysProfit == null ? "-" : statistics.thirtyDaysProfit.Value.ToString("0.00"); //30日利润
|
||||
//row.Cells["colGoodsValue"].Value = statistics.goodsValue == null ? "-" : (statistics.goodsCost.Value * 0.01m).ToString("0.00"); //销售货值
|
||||
//row.Cells["colGoodsCost"].Value = statistics.goodsCost == null ? "-" : (statistics.goodsCost.Value * 0.01m).ToString("0.00"); //成本
|
||||
}
|
||||
}
|
||||
|
||||
private void GetShopStatistics(ShopLoginInfo shop, WxShopSaleStatisticsGroup statistics)
|
||||
{
|
||||
if (statistics == null || statistics.WxShopMainInfo == null || statistics.WxShopSaleInfoToday == null || statistics.WxShopSaleInfo7Day == null || statistics.WxShopSaleInfo30Day == null)
|
||||
return;
|
||||
|
||||
if (statistics.WxShopMainInfo.LastRefreshDate != DateTime.Now.Date)
|
||||
{
|
||||
try
|
||||
{
|
||||
string html = GetShopMainInfoList(shop);
|
||||
if (html.Contains("\"code\":0"))
|
||||
{
|
||||
statistics.WxShopMainInfo = JsonHelper.DeserializeJsonToObject<WxShopMainStatisticsInfo>(html);
|
||||
statistics.WxShopMainInfo.LastRefreshDate = DateTime.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
string errStr = BaseRegex.GetStringJson(ref html, "errorMsg");
|
||||
if (string.IsNullOrEmpty(errStr))
|
||||
errStr = BaseRegex.GetStringJson(ref html, "error_msg");
|
||||
if (string.IsNullOrEmpty(errStr))
|
||||
errStr = html;
|
||||
ShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
|
||||
System.Threading.Thread.Sleep(Randomx.GetId(100, 200));
|
||||
statistics.err_msg = errStr;
|
||||
return;
|
||||
}
|
||||
System.Threading.Thread.Sleep(Randomx.GetId(50, 100));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Threading.Thread.Sleep(Randomx.GetId(50, 100));
|
||||
statistics.err_msg = ex.Message;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void btnSetColumn_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.panel1.Visible = true;
|
||||
}
|
||||
|
||||
private void btnClose_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.panel1.Visible = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取店铺后台主页售后数量等数据
|
||||
/// </summary>
|
||||
/// <param name="shop"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetShopMainInfoList(ShopLoginInfo shop)
|
||||
{
|
||||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradehome/home/main?token=&lang=zh_CN";
|
||||
string referer = "https://store.weixin.qq.com/shop/home";
|
||||
var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, referer);
|
||||
return result;
|
||||
//{"code":0,"orderNumRet":{"code":0,"pendingShipNum":"1"},"waybillErrorRet":{"code":0,"totalNum":0},"aftersaleAllRet":{"code":0,"totalNum":3},"guaranteeRet":{"code":0,"totalNum":0},"prewarnRet":{"code":0,"waitStatusCount":0},"punishRet":{"code":0,"pendingNum":1},"mchUndealRet":{"code":0,"totalNum":0}}
|
||||
//pendingShipNum待发货 waybillErrorRet物流异常 aftersaleAllRet售后 guaranteeRet服务保障 prewarnRet店铺预警 punishRet店铺违规 mchUndealRet工单
|
||||
}
|
||||
|
||||
private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||||
return;
|
||||
string headerText = dgvShop.Columns[e.ColumnIndex].HeaderText;
|
||||
string columnName = dgvShop.Columns[e.ColumnIndex].Name;
|
||||
string shopId = dgvShop.Rows[e.RowIndex].Cells["colShopId"].Value.ParseToString();
|
||||
string shopAccount = dgvShop.Rows[e.RowIndex].Cells["colShopAccount"].Value.ToString();
|
||||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId.ToString());
|
||||
var row = dgvShop.Rows[e.RowIndex];
|
||||
switch (columnName)
|
||||
{
|
||||
case "colSelect":
|
||||
row.Cells["colSelect"].Value = !row.Cells["colSelect"].Value.ParseToBool();
|
||||
break;
|
||||
case "colLoginStatus":
|
||||
{
|
||||
WXShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
|
||||
WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop);
|
||||
if (shop.LoginStatus != "登录成功")
|
||||
{
|
||||
shopLoginForm.openType = EnumOpenType.login;
|
||||
shopLoginForm.ShowDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
shopLoginForm.openType = EnumOpenType.manage;
|
||||
shopLoginForm.WindowState = FormWindowState.Maximized;
|
||||
shopLoginForm.Show();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "colApi":
|
||||
{
|
||||
WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop);
|
||||
shopLoginForm.openType = EnumOpenType.manage;
|
||||
shopLoginForm.WindowState = FormWindowState.Maximized;
|
||||
shopLoginForm.InitUrl = "https://store.weixin.qq.com/shop/servicemarket/detail?serviceId=3984039898079707139";
|
||||
shopLoginForm.Show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnGetSelect_Click(object sender, EventArgs e)
|
||||
{
|
||||
var selectIds = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
|
||||
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
|
||||
|
||||
ReGetStatistics(selectIds);
|
||||
}
|
||||
void ReGetStatistics(List<string> reGetShopIds)
|
||||
{
|
||||
var shopList = GlobalConfig.ShopLoginList.Where(s => reGetShopIds.Contains(s.ShopId)).ToList();
|
||||
foreach (var shop in shopList)
|
||||
{
|
||||
WxShopSaleStatisticsGroup statistics = lstShopStatisticsInfo.FirstOrDefault(s => s.ShopId.ToString() == shop.ShopId);
|
||||
if (statistics != null)
|
||||
{
|
||||
statistics.WxShopMainInfo.LastRefreshDate = DateTime.MinValue;
|
||||
statistics.WxShopSaleInfoToday.LastRefreshDate = DateTime.MinValue;
|
||||
statistics.WxShopSaleInfo7Day.LastRefreshDate = DateTime.MinValue;
|
||||
statistics.WxShopSaleInfo30Day.LastRefreshDate = DateTime.MinValue;
|
||||
}
|
||||
//this.lstSubOrderInfo.RemoveAll(o => o.supplierId.ParseToString() == shop.ShopId);
|
||||
}
|
||||
|
||||
this.pbLoading.Visible = true;
|
||||
GetShopStatistics(shopList, reGetShopIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="colSelect.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colLoginStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colDetail.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colShopLoginName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colShopId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colShopAccount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colNotes.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colGroup.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colOnSaleProductNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colScore.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colPayCnt.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colPayCnt7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colPayCnt30.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colPay.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colPay7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colPay30.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colRefund.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colRefund7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colRefund30.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colOrderNum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colShipErr.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colAfterSale.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colPunish.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colAmount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colAvailableBalance.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colBalance.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colBond.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -133,7 +133,7 @@ namespace TemuKJD.WXForms.TalkForms
|
||||
lstShopAfterSale = NaiBa.Util.Helper.ConfigHelper.LoadConfig<NaiBa.Util.ConcurrentList<WxShopAfterSaleInfo>>("wx_shop_after_sale_list");
|
||||
if (lstShopAfterSale == null)
|
||||
lstShopAfterSale = new ConcurrentList<WxShopAfterSaleInfo>();
|
||||
RefreshAfterSale();
|
||||
//RefreshAfterSale();
|
||||
}));
|
||||
|
||||
while (true)
|
||||
@@ -141,9 +141,12 @@ namespace TemuKJD.WXForms.TalkForms
|
||||
Thread.Sleep(1000);
|
||||
if (DateTime.Now > nextRefreshTime)
|
||||
{
|
||||
Invoke(new Action(() => { pbLoading.Visible = true; }));
|
||||
nextRefreshTime = DateTime.Now.AddMinutes(30);
|
||||
Invoke(new Action(() => { RefreshCookie(true); }));
|
||||
Invoke(new Action(() => { RefreshMsgCount(); }));
|
||||
RefreshCookie(true);
|
||||
RefreshMsgCount();
|
||||
RefreshAfterSale(true);
|
||||
Invoke(new Action(() => { pbLoading.Visible = false; }));
|
||||
}
|
||||
var deltaTime = nextRefreshTime - DateTime.Now;
|
||||
Invoke(new Action(() =>
|
||||
@@ -985,25 +988,25 @@ namespace TemuKJD.WXForms.TalkForms
|
||||
|
||||
private void pnlRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
nextRefreshTime = DateTime.Now.AddMinutes(30);
|
||||
RefreshCookie();
|
||||
//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)
|
||||
{
|
||||
pbLoading.Visible = true;
|
||||
Task.Run(() =>
|
||||
if (!isAuto)
|
||||
WXShopListForm.UpdateShop();
|
||||
foreach (var shop in GlobalConfig.ShopLoginList)
|
||||
{
|
||||
if (!isAuto)
|
||||
WXShopListForm.UpdateShop();
|
||||
foreach (var shop in GlobalConfig.ShopLoginList)
|
||||
{
|
||||
WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||||
}
|
||||
LoadShop();
|
||||
Invoke(new Action(() => { pbLoading.Visible = false; }));
|
||||
});
|
||||
WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||||
}
|
||||
LoadShop();
|
||||
}
|
||||
|
||||
private void btnFilterShop_Click(object sender, EventArgs e)
|
||||
@@ -1045,71 +1048,71 @@ namespace TemuKJD.WXForms.TalkForms
|
||||
|
||||
private void btnRefreshAfterSale_Click(object sender, EventArgs e)
|
||||
{
|
||||
RefreshAfterSale(true);
|
||||
this.pbLoading.Visible = true;
|
||||
Task.Run(() =>
|
||||
{
|
||||
RefreshAfterSale(true);
|
||||
Invoke(new Action(() => { pbLoading.Visible = false; }));
|
||||
});
|
||||
}
|
||||
|
||||
void RefreshAfterSale(bool refreshAll = false)
|
||||
{
|
||||
this.pbLoading.Visible = true;
|
||||
Task.Run(() =>
|
||||
List<Task> tList = new List<Task>();
|
||||
if (refreshAll)
|
||||
lstShopAfterSale.Clear();
|
||||
foreach (var shop in GlobalConfig.ShopLoginList)
|
||||
{
|
||||
List<Task> tList = new List<Task>();
|
||||
if (refreshAll)
|
||||
lstShopAfterSale.Clear();
|
||||
foreach (var shop in GlobalConfig.ShopLoginList)
|
||||
var afterInfo = lstShopAfterSale.FirstOrDefault(sa => sa.ShopId == shop.ShopId);
|
||||
if (afterInfo == null)
|
||||
afterInfo = new WxShopAfterSaleInfo() { ShopId = shop.ShopId };
|
||||
Invoke(new Action(() => { LoadShopAfterSale(afterInfo, ""); }));
|
||||
var t = Task.Run(() =>
|
||||
{
|
||||
var afterInfo = lstShopAfterSale.FirstOrDefault(sa => sa.ShopId == shop.ShopId);
|
||||
if (afterInfo == null)
|
||||
afterInfo = new WxShopAfterSaleInfo() { ShopId = shop.ShopId };
|
||||
Invoke(new Action(() => { LoadShopAfterSale(afterInfo, ""); }));
|
||||
var t = Task.Run(() =>
|
||||
try
|
||||
{
|
||||
try
|
||||
if (shop.LoginStatus != "登录成功")
|
||||
{
|
||||
if (shop.LoginStatus != "登录成功")
|
||||
{
|
||||
Invoke(new Action(() => { LoadShopAfterSale(new WxShopAfterSaleInfo() { ShopId = shop.ShopId }, "店铺掉线"); }));
|
||||
return;
|
||||
}
|
||||
Invoke(new Action(() => { LoadShopAfterSale(new WxShopAfterSaleInfo() { ShopId = shop.ShopId }, "店铺掉线"); }));
|
||||
return;
|
||||
}
|
||||
|
||||
var afterSaleInfo = lstShopAfterSale.FirstOrDefault(sa => sa.ShopId == shop.ShopId);
|
||||
if (refreshAll || afterSaleInfo == null || afterSaleInfo.RefreshTime.Date != DateTime.Now.Date)
|
||||
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"))
|
||||
{
|
||||
lstShopAfterSale.RemoveAll(sa => sa.ShopId == shop.ShopId);
|
||||
var rst = GetApiServiceList(shop);
|
||||
if (!rst.Contains("\"code\":0"))
|
||||
WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||||
if (shop.LoginStatus != "登录成功")
|
||||
{
|
||||
WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||||
if (shop.LoginStatus != "登录成功")
|
||||
{
|
||||
Invoke(new Action(() => { LoadShopAfterSale(new WxShopAfterSaleInfo() { ShopId = shop.ShopId }, "店铺掉线"); }));
|
||||
return;
|
||||
}
|
||||
|
||||
afterInfo = new WxShopAfterSaleInfo() { ShopId = shop.ShopId, RefreshTime = DateTime.Now };
|
||||
lstShopAfterSale.Add(afterInfo);
|
||||
Invoke(new Action(() => { LoadShopAfterSale(afterInfo, "查询失败"); }));
|
||||
Invoke(new Action(() => { LoadShopAfterSale(new WxShopAfterSaleInfo() { ShopId = shop.ShopId }, "店铺掉线"); }));
|
||||
return;
|
||||
}
|
||||
|
||||
var afterCount = JsonHelper.JObjectParse(rst)["aftersaleAllRet"]["totalNum"].ParseToInt();
|
||||
afterInfo = new WxShopAfterSaleInfo() { ShopId = shop.ShopId, RefreshTime = DateTime.Now, AfterSaleCount = afterCount };
|
||||
afterInfo = new WxShopAfterSaleInfo() { ShopId = shop.ShopId, RefreshTime = DateTime.Now };
|
||||
lstShopAfterSale.Add(afterInfo);
|
||||
Invoke(new Action(() => { LoadShopAfterSale(afterInfo, "已查询"); }));
|
||||
Invoke(new Action(() => { LoadShopAfterSale(afterInfo, "查询失败"); }));
|
||||
return;
|
||||
}
|
||||
|
||||
var afterCount = JsonHelper.JObjectParse(rst)["aftersaleAllRet"]["totalNum"].ParseToInt();
|
||||
afterInfo = new WxShopAfterSaleInfo() { ShopId = shop.ShopId, RefreshTime = DateTime.Now, AfterSaleCount = afterCount };
|
||||
lstShopAfterSale.Add(afterInfo);
|
||||
Invoke(new Action(() => { LoadShopAfterSale(afterInfo, "已查询"); }));
|
||||
return;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
});
|
||||
tList.Add(t);
|
||||
while (tList.Where(ta => !ta.IsFaulted && !ta.IsCompleted).Count() >= 20) { 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);
|
||||
Invoke(new Action(() => { pbLoading.Visible = false; }));
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
});
|
||||
tList.Add(t);
|
||||
while (tList.Where(ta => !ta.IsFaulted && !ta.IsCompleted).Count() >= 20) { 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)
|
||||
@@ -1129,20 +1132,6 @@ namespace TemuKJD.WXForms.TalkForms
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取店铺后台主页售后数量等数据
|
||||
/// </summary>
|
||||
/// <param name="shop"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetApiServiceList(ShopLoginInfo shop)
|
||||
{
|
||||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradehome/home/main?token=&lang=zh_CN";
|
||||
string referer = "https://store.weixin.qq.com/shop/home";
|
||||
var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, referer);
|
||||
return result;
|
||||
//{"code":0,"orderNumRet":{"code":0,"pendingShipNum":"1"},"waybillErrorRet":{"code":0,"totalNum":0},"aftersaleAllRet":{"code":0,"totalNum":3},"guaranteeRet":{"code":0,"totalNum":0},"prewarnRet":{"code":0,"waitStatusCount":0},"punishRet":{"code":0,"pendingNum":1},"mchUndealRet":{"code":0,"totalNum":0}}
|
||||
//pendingShipNum待发货 waybillErrorRet物流异常 aftersaleAllRet售后 guaranteeRet服务保障 prewarnRet店铺预警 punishRet店铺违规 mchUndealRet工单
|
||||
}
|
||||
|
||||
public static string GetKfMsgStatistics(ShopLoginInfo shop, long beginDateTick, long endDateTick)
|
||||
{
|
||||
@@ -1154,50 +1143,50 @@ namespace TemuKJD.WXForms.TalkForms
|
||||
|
||||
private void btnRefreshMsgCount_Click(object sender, EventArgs e)
|
||||
{
|
||||
RefreshMsgCount();
|
||||
pbLoading.Visible = true;
|
||||
Task.Run(() =>
|
||||
{
|
||||
RefreshMsgCount();
|
||||
Invoke(new Action(() => { pbLoading.Visible = false; }));
|
||||
});
|
||||
}
|
||||
|
||||
void RefreshMsgCount()
|
||||
{
|
||||
pbLoading.Visible = true;
|
||||
Task.Run(() =>
|
||||
lstShopKfStatistics.Clear();
|
||||
foreach (var shop in GlobalConfig.ShopLoginList)
|
||||
{
|
||||
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 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);
|
||||
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") + "%";
|
||||
}));
|
||||
}
|
||||
Invoke(new Action(() =>
|
||||
catch
|
||||
{
|
||||
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") + "%";
|
||||
pbLoading.Visible = false;
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
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") + "%";
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user