拼多多以图搜款上货 70% 拼多多接口上货和活动报名sku优化 微信店铺统计优化

This commit is contained in:
wule committed 2026-04-21 11:57:22 +08:00
1 parent 90d40a6fd4
commit 79a752027a
20 files changed
+1481 -263

No files matched your search

@@ -26,6 +26,7 @@ namespace TemuKJD.WXForms.ShopForms
{
bool isInit = false;
public List<WxShopSaleStatisticsGroup> lstShopStatisticsInfo = new List<WxShopSaleStatisticsGroup>();
public List<string> lstHideColumns = new List<string>();
public WxShopStatisticsForm()
{
InitializeComponent();
@@ -35,8 +36,15 @@ namespace TemuKJD.WXForms.ShopForms
{
this.dgvShop.AddSelectorColumn("colSelect");
foreach(DataGridViewColumn column in dgvShop.Columns)
lstHideColumns = NaiBa.Util.Helper.ConfigHelper.LoadConfig<List<string>>("wx_shop_sale_statistics_hide_columns");
if (lstHideColumns == null)
lstHideColumns = new List<string>();
foreach (DataGridViewColumn column in dgvShop.Columns)
{
if (lstHideColumns.Contains(column.HeaderText))
column.Visible = false;
if (!string.IsNullOrEmpty(column.HeaderText) && column.HeaderText != "店铺登录号码" && column.HeaderText != "详情")
{
var chk = new UcCheckBox() { Name = "chk" + column.Name, Tag = column.Name, Text = column.HeaderText, Checked = column.Visible, };
@@ -56,6 +64,15 @@ namespace TemuKJD.WXForms.ShopForms
if (chk != null)
{
dgvShop.Columns[chk.Tag.ParseToString()].Visible = chk.Checked;
if (!chk.Checked)
{
lstHideColumns.Add(chk.Text);
}
else
{
lstHideColumns.Remove(chk.Text);
}
NaiBa.Util.Helper.ConfigHelper.SaveConfig<List<string>>("wx_shop_sale_statistics_hide_columns", lstHideColumns);
}
}
@@ -182,12 +199,15 @@ namespace TemuKJD.WXForms.ShopForms
Invoke(new Action(() =>
{
this.lblPayCnt.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfoToday.pay_order_cnt.ParseToLong()).ToString();
this.lblPayCnt1.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfo1Day.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() * 0.01m).ToString("f2");
this.lblPay1.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfo1Day.pay_gmv.ParseToDecimal() * 0.01m).ToString("f2");
this.lblPay7.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfo7Day.pay_gmv.ParseToDecimal() * 0.01m).ToString("f2");
this.lblPay30.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfo30Day.pay_gmv.ParseToDecimal() * 0.01m).ToString("f2");
this.lblPayRefund.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfoToday.pay_refund_gmv.ParseToLong() * 0.01m).ToString();
this.lblPayRefund1.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfo1Day.pay_refund_gmv.ParseToLong() * 0.01m).ToString();
this.lblPayRefund7.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfo7Day.pay_refund_gmv.ParseToLong() * 0.01m).ToString();
this.lblPayRefund30.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopSaleInfo30Day.pay_refund_gmv.ParseToLong() * 0.01m).ToString();
this.lblOrderNum.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopMainInfo.orderNumRet?.num.ParseToInt()).ToString();
@@ -259,12 +279,15 @@ namespace TemuKJD.WXForms.ShopForms
statistics.ProdCount.ParseToNullableInt(), // 在售商品
statistics.curScoreValue.ParseToNullableDecimal(), // 店铺体验分
statistics.WxShopSaleInfoToday.pay_order_cnt, // 今日订单
statistics.WxShopSaleInfo1Day.pay_order_cnt, // 昨日订单
statistics.WxShopSaleInfo7Day.pay_order_cnt, // 7日订单
statistics.WxShopSaleInfo30Day.pay_order_cnt, // 30日订单
statistics.WxShopSaleInfoToday.pay_gmv, // 今日成交金额
statistics.WxShopSaleInfo1Day.pay_gmv, // 昨日成交金额
statistics.WxShopSaleInfo7Day.pay_gmv, // 7日成交金额
statistics.WxShopSaleInfo30Day.pay_gmv, // 30日成交金额
statistics.WxShopSaleInfoToday.pay_refund_gmv, // 今日退款金额
statistics.WxShopSaleInfo1Day.pay_refund_gmv, // 昨日退款金额
statistics.WxShopSaleInfo7Day.pay_refund_gmv, // 7日退款金额
statistics.WxShopSaleInfo30Day.pay_refund_gmv, // 30日退款金额
statistics.WxShopMainInfo.orderNumRet?.num, // 待发货
@@ -299,12 +322,15 @@ namespace TemuKJD.WXForms.ShopForms
row.Cells["colOnSaleProductNumber"].Value = statistics.ProdCount.ParseToNullableInt(); // 商品数量
row.Cells["colScore"].Value = statistics.curScoreValue.ParseToNullableDecimal(); // 店铺体验分
row.Cells["colPayCnt"].Value = statistics.WxShopSaleInfoToday.pay_order_cnt; // 今日订单
row.Cells["colPayCnt1"].Value = statistics.WxShopSaleInfo1Day.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.ParseToNullableLong() * 0.01m; // 今日成交金额
row.Cells["colPay1"].Value = statistics.WxShopSaleInfo1Day.pay_gmv.ParseToNullableLong() * 0.01m; // 昨日成交金额
row.Cells["colPay7"].Value = statistics.WxShopSaleInfo7Day.pay_gmv.ParseToNullableLong() * 0.01m; // 7日成交金额
row.Cells["colPay30"].Value = statistics.WxShopSaleInfo30Day.pay_gmv.ParseToNullableLong() * 0.01m; // 30日成交金额
row.Cells["colRefund"].Value = statistics.WxShopSaleInfoToday.pay_refund_gmv.ParseToNullableLong() * 0.01m; // 今日退款金额
row.Cells["colRefund1"].Value = statistics.WxShopSaleInfo1Day.pay_refund_gmv.ParseToNullableLong() * 0.01m; // 昨日退款金额
row.Cells["colRefund7"].Value = statistics.WxShopSaleInfo7Day.pay_refund_gmv.ParseToNullableLong() * 0.01m; // 7日退款金额
row.Cells["colRefund30"].Value = statistics.WxShopSaleInfo30Day.pay_refund_gmv.ParseToNullableLong() * 0.01m; // 30日退款金额
row.Cells["colOrderNum"].Value = statistics.WxShopMainInfo.orderNumRet?.num; // 待发货
@@ -321,7 +347,8 @@ namespace TemuKJD.WXForms.ShopForms
private void GetShopStatistics(ShopLoginInfo shop, WxShopSaleStatisticsGroup statistics)
{
if (statistics == null || statistics.WxShopMainInfo == null || statistics.WxShopSaleInfoToday == null || statistics.WxShopSaleInfo7Day == null || statistics.WxShopSaleInfo30Day == null)
if (statistics == null || statistics.WxShopMainInfo == null ||
statistics.WxShopSaleInfoToday == null || statistics.WxShopSaleInfo1Day == null || statistics.WxShopSaleInfo7Day == null || statistics.WxShopSaleInfo30Day == null)
return;
if (statistics.lastRefreshDate != DateTime.Now.Date && shop.LoginStatus == "登录成功")
@@ -440,6 +467,40 @@ namespace TemuKJD.WXForms.ShopForms
}
}
if (statistics.WxShopSaleInfo1Day.LastRefreshDate != DateTime.Now.Date && shop.LoginStatus == "登录成功")
{
try
{
string html = GetShopSaleInfoList(shop,
BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now.Date.AddDays(-1)),
BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now.Date) - 1);
System.Threading.Thread.Sleep(Randomx.GetId(50, 100));
if (html.Contains("\"code\":0"))
{
var saleStr = JsonHelper.SerializeObject(JsonHelper.JObjectParse(html)["total"]);
statistics.WxShopSaleInfo1Day = JsonHelper.DeserializeJsonToObject<WxShopSaleStatisticsInfo>(saleStr);
statistics.WxShopSaleInfo1Day.LastRefreshDate = DateTime.Now.Date;
}
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;
WXShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
statistics.err_msg = errStr;
return;
}
}
catch (Exception ex)
{
System.Threading.Thread.Sleep(Randomx.GetId(50, 100));
statistics.err_msg = ex.Message;
return;
}
}
if (statistics.WxShopSaleInfo7Day.LastRefreshDate != DateTime.Now.Date && shop.LoginStatus == "登录成功")
{
try
@@ -689,6 +750,7 @@ namespace TemuKJD.WXForms.ShopForms
{
statistics.WxShopMainInfo.LastRefreshDate = DateTime.MinValue;
statistics.WxShopSaleInfoToday.LastRefreshDate = DateTime.MinValue;
statistics.WxShopSaleInfo1Day.LastRefreshDate = DateTime.MinValue;
statistics.WxShopSaleInfo7Day.LastRefreshDate = DateTime.MinValue;
statistics.WxShopSaleInfo30Day.LastRefreshDate = DateTime.MinValue;
}