1记住后台登陆的用户信息
2店铺统计展示 3可选预售设置失败下架
This commit is contained in:
1 parent
0c3d232a16
commit
600c009509
19 files changed
+1114
-626
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using AllBase;
|
||||
using AllBase.Extension;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model.Config;
|
||||
using AllBase.Model.Result;
|
||||
@@ -11,11 +12,13 @@ using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TemuKJD.BLL;
|
||||
using TemuKJD.KJDForms.ShopForms;
|
||||
using TemuKJD.UserComponent;
|
||||
using TemuKJD.WXForms.ProductForms;
|
||||
|
||||
namespace TemuKJD.WXForms.ShopForms
|
||||
{
|
||||
@@ -34,13 +37,17 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
|
||||
foreach(DataGridViewColumn column in dgvShop.Columns)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(column.HeaderText) && column.HeaderText != "店铺登录号码")
|
||||
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, };
|
||||
chk.CheckedChanged += Chk_CheckedChanged;
|
||||
this.flowLayoutPanel1.Controls.Add(chk);
|
||||
}
|
||||
}
|
||||
|
||||
lstShopStatisticsInfo = NaiBa.Util.Helper.ConfigHelper.LoadConfig<List<WxShopSaleStatisticsGroup>>("wx_shop_sale_statistics_info");
|
||||
if (lstShopStatisticsInfo == null)
|
||||
lstShopStatisticsInfo = new List<WxShopSaleStatisticsGroup>();
|
||||
}
|
||||
|
||||
private void Chk_CheckedChanged(object sender, EventArgs e)
|
||||
@@ -94,61 +101,122 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
BindShop(shopEntity, selectIds);
|
||||
}
|
||||
|
||||
cmbFilterShopNotes.Items.Clear();
|
||||
//cmbFilterShopNotes.Items.Add("");
|
||||
foreach (var note in GlobalConfig.ShopLoginList.Select(s => s.Notes).Where(s => !s.IsNullOrEmpty()).Distinct())
|
||||
{
|
||||
cmbFilterShopNotes.Items.Add(note);
|
||||
}
|
||||
|
||||
GetShopStatistics(GlobalConfig.ShopLoginList.ToList(), selectIds);
|
||||
}
|
||||
|
||||
private void GetShopStatistics(List<ShopLoginInfo> shops, List<string> selectIds)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.statusBar.pgbTaskProgress.Maximum = shops.Count;
|
||||
this.statusBar.lblTaskStatus.Text = "正在查询";
|
||||
}));
|
||||
Task.Run(() =>
|
||||
{
|
||||
List<Task> tLst = new List<Task>();
|
||||
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.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1);
|
||||
this.statusBar.lblTaskStatus.Text = "正在查询 " + this.statusBar.pgbTaskProgress.Value + "/" + shops.Count;
|
||||
if (this.statusBar.pgbTaskProgress.Value % 10 == 0)
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_shop_sale_statistics_info", lstShopStatisticsInfo);
|
||||
|
||||
//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);
|
||||
var row = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(
|
||||
p => p.Cells.GetCellValueFromColumnName("colShopId").ParseToString() == shopEntity.ShopId);
|
||||
if (row != null)
|
||||
{
|
||||
row.Cells["colOnSaleProductNumber"].Value = ""; // 商品数量
|
||||
row.Cells["colScore"].Value = ""; // 店铺体验分
|
||||
row.Cells["colPayCnt"].Value = ""; // 今日订单
|
||||
row.Cells["colPayCnt7"].Value = ""; // 7日订单
|
||||
row.Cells["colPayCnt30"].Value = ""; // 30日订单
|
||||
row.Cells["colPay"].Value = ""; // 今日成交金额
|
||||
row.Cells["colPay7"].Value = ""; // 7日成交金额
|
||||
row.Cells["colPay30"].Value = ""; // 30日成交金额
|
||||
row.Cells["colRefund"].Value = ""; // 今日退款金额
|
||||
row.Cells["colRefund7"].Value = ""; // 7日退款金额
|
||||
row.Cells["colRefund30"].Value = ""; // 30日退款金额
|
||||
row.Cells["colOrderNum"].Value = ""; // 待发货
|
||||
row.Cells["colShipErr"].Value = ""; // 物流异常
|
||||
row.Cells["colAfterSale"].Value = ""; // 售后
|
||||
row.Cells["colPunish"].Value = ""; // 店铺违规
|
||||
row.Cells["colTotalAmount"].Value = ""; // 货款金额
|
||||
row.Cells["colAvailableAmount"].Value = ""; // 可提现余额
|
||||
row.Cells["colPendingAmount"].Value = ""; // 待结算金额
|
||||
row.Cells["colDepositBalance"].Value = ""; // 保证金
|
||||
}
|
||||
}));
|
||||
var t = Task.Run(() =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(shopEntity.ShopId))
|
||||
return;
|
||||
bool canUse = shopEntity.LoginStatus == "登录成功";
|
||||
if (!canUse)
|
||||
{
|
||||
BindShop(shopEntity, selectIds);
|
||||
return;
|
||||
}
|
||||
|
||||
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() * 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.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();
|
||||
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.lblTotalAmount.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopAmount.totalAmount * 0.01m).ToString();
|
||||
this.lblAvailableAmount.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopAmount.availableAmount * 0.01m).ToString();
|
||||
this.lblPendingAmount.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopAmount.pendingAmount * 0.01m).ToString();
|
||||
this.lblDepositBalance.Text = this.lstShopStatisticsInfo.Sum(s => s.WxShopAmount.DepositBalance * 0.01m).ToString();
|
||||
BindShop(shopEntity, selectIds);
|
||||
}));
|
||||
});
|
||||
//t.Wait();
|
||||
while(tLst.Where(ta => !ta.IsCompleted && !ta.IsFaulted && !ta.IsCanceled).Count() >= 2)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
tLst.Add(t);
|
||||
}
|
||||
while (tLst.Where(ta => !ta.IsCompleted && !ta.IsFaulted && !ta.IsCanceled).Count() > 0)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_shop_sale_statistics_info", lstShopStatisticsInfo);
|
||||
this.statusBar.lblTaskStatus.Text = "查询结束";
|
||||
this.pbLoading.Visible = false;
|
||||
}));
|
||||
});
|
||||
@@ -188,8 +256,8 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
shopEntity.ShopAccount,
|
||||
shopEntity.Notes,
|
||||
shopEntity.GroupName,
|
||||
"", // 在售商品
|
||||
"", // 店铺体验分
|
||||
statistics.ProdCount.ParseToNullableInt(), // 在售商品
|
||||
statistics.curScoreValue.ParseToNullableDecimal(), // 店铺体验分
|
||||
statistics.WxShopSaleInfoToday.pay_order_cnt, // 今日订单
|
||||
statistics.WxShopSaleInfo7Day.pay_order_cnt, // 7日订单
|
||||
statistics.WxShopSaleInfo30Day.pay_order_cnt, // 30日订单
|
||||
@@ -203,10 +271,10 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
statistics.WxShopMainInfo.waybillErrorRet?.num, // 物流异常
|
||||
statistics.WxShopMainInfo.aftersaleAllRet?.num, // 售后
|
||||
statistics.WxShopMainInfo.punishRet?.num, // 店铺违规
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
statistics.WxShopAmount.totalAmount * 0.01m, // 货款金额
|
||||
statistics.WxShopAmount.availableAmount * 0.01m, // 可提现余额
|
||||
statistics.WxShopAmount.pendingAmount * 0.01m, // 待结算金额
|
||||
statistics.WxShopAmount.DepositBalance * 0.01m // 抱枕金
|
||||
);
|
||||
row = dgvShop.Rows[rowId];
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Green : Color.Red;
|
||||
@@ -228,31 +296,26 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
row.Cells["colShopAccount"].Value = shopEntity.ShopAccount;
|
||||
row.Cells["colNotes"].Value = shopEntity.Notes;
|
||||
row.Cells["colGroup"].Value = shopEntity.GroupName;
|
||||
// 在售商品
|
||||
// 店铺体验分
|
||||
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["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["colPay"].Value = statistics.WxShopSaleInfoToday.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["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; // 待发货
|
||||
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["colTotalAmount"].Value = statistics.WxShopAmount.totalAmount * 0.01m; // 货款金额
|
||||
row.Cells["colAvailableAmount"].Value = statistics.WxShopAmount.availableAmount * 0.01m; ; // 可提现余额
|
||||
row.Cells["colPendingAmount"].Value = statistics.WxShopAmount.pendingAmount * 0.01m; // 待结算金额
|
||||
row.Cells["colDepositBalance"].Value = statistics.WxShopAmount.DepositBalance * 0.01m; ; // 保证金
|
||||
|
||||
//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"); //成本
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,15 +324,67 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
if (statistics == null || statistics.WxShopMainInfo == null || statistics.WxShopSaleInfoToday == null || statistics.WxShopSaleInfo7Day == null || statistics.WxShopSaleInfo30Day == null)
|
||||
return;
|
||||
|
||||
if (statistics.WxShopMainInfo.LastRefreshDate != DateTime.Now.Date)
|
||||
if (statistics.lastRefreshDate != DateTime.Now.Date && shop.LoginStatus == "登录成功")
|
||||
{
|
||||
try
|
||||
{
|
||||
var shopScoreRst = GetShopScore(shop);
|
||||
System.Threading.Thread.Sleep(Randomx.GetId(50, 100));
|
||||
if (shopScoreRst.Contains("\"code\":0"))
|
||||
{
|
||||
statistics.curScoreValue = 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;
|
||||
ShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
|
||||
statistics.err_msg = errStr;
|
||||
return;
|
||||
}
|
||||
|
||||
var prodLstRst = WXPreSale.scanProductPreview(shop, 1, "", 20);
|
||||
System.Threading.Thread.Sleep(Randomx.GetId(50, 100));
|
||||
if (prodLstRst.Contains("\"success\":true"))
|
||||
{
|
||||
var prodObjs = JsonHelper.JObjectParse(prodLstRst);
|
||||
var totalNum = prodObjs["totalNum"].ParseToInt();
|
||||
statistics.ProdCount = totalNum;
|
||||
}
|
||||
else
|
||||
{
|
||||
string errStr = BaseRegex.GetStringJson(ref prodLstRst, "errorMsg");
|
||||
if (string.IsNullOrEmpty(errStr))
|
||||
errStr = BaseRegex.GetStringJson(ref prodLstRst, "error_msg");
|
||||
if (string.IsNullOrEmpty(errStr))
|
||||
errStr = prodLstRst;
|
||||
ShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
|
||||
statistics.err_msg = errStr;
|
||||
return;
|
||||
}
|
||||
statistics.lastRefreshDate = DateTime.Now.Date;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Threading.Thread.Sleep(Randomx.GetId(50, 100));
|
||||
statistics.err_msg = ex.Message;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (statistics.WxShopMainInfo.LastRefreshDate != DateTime.Now.Date && shop.LoginStatus == "登录成功")
|
||||
{
|
||||
try
|
||||
{
|
||||
string html = GetShopMainInfoList(shop);
|
||||
System.Threading.Thread.Sleep(Randomx.GetId(50, 100));
|
||||
if (html.Contains("\"code\":0"))
|
||||
{
|
||||
statistics.WxShopMainInfo = JsonHelper.DeserializeJsonToObject<WxShopMainStatisticsInfo>(html);
|
||||
statistics.WxShopMainInfo.LastRefreshDate = DateTime.Now;
|
||||
statistics.WxShopMainInfo.LastRefreshDate = DateTime.Now.Date;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -279,11 +394,161 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
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;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Threading.Thread.Sleep(Randomx.GetId(50, 100));
|
||||
statistics.err_msg = ex.Message;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (statistics.WxShopSaleInfoToday.LastRefreshDate != DateTime.Now.Date && shop.LoginStatus == "登录成功")
|
||||
{
|
||||
try
|
||||
{
|
||||
string html = GetShopSaleInfoList(shop,
|
||||
BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now.Date),
|
||||
BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now));
|
||||
System.Threading.Thread.Sleep(Randomx.GetId(50, 100));
|
||||
if (html.Contains("\"code\":0"))
|
||||
{
|
||||
var saleStr = JsonHelper.SerializeObject(JsonHelper.JObjectParse(html)["total"]);
|
||||
statistics.WxShopSaleInfoToday = JsonHelper.DeserializeJsonToObject<WxShopSaleStatisticsInfo>(saleStr);
|
||||
statistics.WxShopSaleInfoToday.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;
|
||||
ShopListForm.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
|
||||
{
|
||||
string html = GetShopSaleInfoList(shop,
|
||||
BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now.Date.AddDays(-7)),
|
||||
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.WxShopSaleInfo7Day = JsonHelper.DeserializeJsonToObject<WxShopSaleStatisticsInfo>(saleStr);
|
||||
statistics.WxShopSaleInfo7Day.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;
|
||||
ShopListForm.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.WxShopSaleInfo30Day.LastRefreshDate != DateTime.Now.Date && shop.LoginStatus == "登录成功")
|
||||
{
|
||||
try
|
||||
{
|
||||
string html = GetShopSaleInfoList(shop,
|
||||
BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now.Date.AddDays(-30)),
|
||||
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.WxShopSaleInfo30Day = JsonHelper.DeserializeJsonToObject<WxShopSaleStatisticsInfo>(saleStr);
|
||||
statistics.WxShopSaleInfo30Day.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;
|
||||
ShopListForm.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.WxShopAmount.LastRefreshDate != DateTime.Now.Date && shop.LoginStatus == "登录成功")
|
||||
{
|
||||
try
|
||||
{
|
||||
string html = GetShopAmount(shop);
|
||||
System.Threading.Thread.Sleep(Randomx.GetId(50, 100));
|
||||
if (html.Contains("\"code\":0"))
|
||||
{
|
||||
var amountStr = JsonHelper.SerializeObject(JsonHelper.JObjectParse(html)["data"]);
|
||||
statistics.WxShopAmount = JsonHelper.DeserializeJsonToObject<WxAmount>(amountStr);
|
||||
}
|
||||
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);
|
||||
statistics.err_msg = errStr;
|
||||
return;
|
||||
}
|
||||
|
||||
html = GetShopBalance(shop);
|
||||
System.Threading.Thread.Sleep(Randomx.GetId(50, 100));
|
||||
if (html.Contains("\"code\":0"))
|
||||
{
|
||||
statistics.WxShopAmount.DepositBalance = BaseRegex.GetIntJson(ref html, "depositBalance");
|
||||
}
|
||||
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);
|
||||
statistics.err_msg = errStr;
|
||||
return;
|
||||
}
|
||||
statistics.WxShopAmount.LastRefreshDate = DateTime.Now.Date;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -321,6 +586,38 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
//{"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 GetShopSaleInfoList(ShopLoginInfo shop, long startTime, long endTime)
|
||||
{
|
||||
string url = "https://store.weixin.qq.com/shop-faas/mmecnodelinercgi/cgi/liner_query/3/home-overview-shop-offline?token=&lang=zh_CN";
|
||||
string referer = "https://store.weixin.qq.com/shop/home";
|
||||
//string data = @"{""time_query"":{""dateFormat"":2,""dateType"":0,""dateRange"":7,""startMs"":1767974400000,""endMs"":1770566399999}}";
|
||||
string data = @"{""time_query"":{""dateFormat"":2,""dateType"":0,""dateRange"":7,""startMs"":" + startTime + @",""endMs"":" + endTime + "}}";
|
||||
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, data, referer);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string GetShopScore(ShopLoginInfo shop)
|
||||
{
|
||||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradehome/home/minor?token=&lang=zh_CN";
|
||||
string referer = "https://store.weixin.qq.com/shop/home";
|
||||
var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, referer);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string GetShopAmount(ShopLoginInfo shop)
|
||||
{
|
||||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradefunds/cgi/generalAccount/getGeneralAccountBalance?token=&lang=zh_CN";
|
||||
string referer = "https://store.weixin.qq.com/shop/funds/home";
|
||||
var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, referer);
|
||||
return result;
|
||||
}
|
||||
public static string GetShopBalance(ShopLoginInfo shop)
|
||||
{
|
||||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradedeposit/home/cgi/getDepositMPayState?token=&lang=zh_CN";
|
||||
string referer = "https://store.weixin.qq.com/shop/funds/home";
|
||||
var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, referer);
|
||||
return result;
|
||||
}
|
||||
|
||||
private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
@@ -387,10 +684,48 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
statistics.WxShopSaleInfo30Day.LastRefreshDate = DateTime.MinValue;
|
||||
}
|
||||
//this.lstSubOrderInfo.RemoveAll(o => o.supplierId.ParseToString() == shop.ShopId);
|
||||
|
||||
}
|
||||
|
||||
this.pbLoading.Visible = true;
|
||||
GetShopStatistics(shopList, reGetShopIds);
|
||||
}
|
||||
|
||||
private void btnGetNotGet_Click(object sender, EventArgs e)
|
||||
{
|
||||
RefreshShop();
|
||||
}
|
||||
|
||||
private void pnlFliter_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (DataGridViewRow row in dgvShop.Rows)
|
||||
{
|
||||
string notes = cmbFilterShopNotes.Text.Trim().Trim(';');
|
||||
if (notes == "全部")
|
||||
notes = "";
|
||||
List<string> notesLst = notes.Split(new string[] { ";", ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
if (!row.Cells["colShopAccount"].Value.ParseToString().Contains(txtFilterShopName.Text.Trim()))
|
||||
{
|
||||
row.Visible = false;
|
||||
row.Cells["colSelect"].Value = false;
|
||||
continue;
|
||||
}
|
||||
if (!row.Cells["colNotes"].Value.ParseToString().Contains(notes) && !notesLst.Contains(row.Cells["colNotes"].Value.ParseToString()))
|
||||
{
|
||||
row.Visible = false;
|
||||
row.Cells["colSelect"].Value = false;
|
||||
continue;
|
||||
}
|
||||
row.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void pnlClear_Click(object sender, EventArgs e)
|
||||
{
|
||||
txtFilterShopName.Text = "";
|
||||
cmbFilterShopNotes.Text = "全部";
|
||||
pnlFliter_Click(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user