聚水潭授权 聚水潭爆款采集 其他功能优化

This commit is contained in:
wule committed 2026-02-28 00:33:30 +08:00
1 parent 30efe8fccb
commit d2d2396804
24 files changed
+5000 -695

No files matched your search

@@ -704,11 +704,30 @@ namespace TemuKJD.WXForms.ProductForms
{
row.Cells["colCouponNum"].Value = totalNum;
}));
if (totalNum.ParseToInt() > 0)
var issuedNum = 0;
try
{
var jCoupons = JsonHelper.JObjectParse(searchCouponRst);
foreach(var coupon in jCoupons)
{
var couponStr = JsonHelper.SerializeObject(coupon);
//var receiveNum = BaseRegex.GetStringJson(ref couponStr, "receiveNum");
issuedNum = BaseRegex.GetStringJson(ref couponStr, "issuedNum").ParseToInt();
if (issuedNum > 0)
break;
}
}
catch
{
}
if (issuedNum.ParseToInt() > 0)
{
Invoke(new Action(() =>
{
row.Cells["colOpResult"].Value = "商品已设置专属优惠券,跳过";
row.Cells["colOpResult"].Value = "商品还有未领取的专属优惠券,跳过";
}));
continue;
}
@@ -824,7 +843,7 @@ namespace TemuKJD.WXForms.ProductForms
Invoke(new Action(() => {
if (shopRow != null)
{
shopRow.Cells["colMsg"].Value = error;
shopRow.Cells["colOpResult"].Value = error;
}
}));
break;
@@ -1062,109 +1081,6 @@ namespace TemuKJD.WXForms.ProductForms
PreType = cmbPreType.Text.Trim();
}
private void btnDown_Click(object sender, EventArgs e)
{
var rowLst = dgvSelectProduct.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true).ToList();
if (rowLst.Count <= 0)
{
BaseMsgForm.ShowError("请勾选需要操作的商品!");
return;
}
this.pbLoading.Visible = true;
this.btnSetPreSale.Enabled = false;
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
SetProdDown(rowLst);
Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "商品下架完毕";
BaseMsgForm.ShowInfo("商品下架完毕");
this.pbLoading.Visible = false;
this.btnSetPreSale.Enabled = true;
}));
}, cancellationTokenSource.Token);
}
void SetProdDown(List<DataGridViewRow> rowLst)
{
Invoke(new Action(() =>
{
this.pbLoading.Visible = true;
this.statusBar.lblTaskStatus.Text = "正在下架" + "...".Substring(0, DateTime.Now.Second % 4);
this.statusBar.pgbTaskProgress.Maximum = dgvSelectProduct.Rows.Count;
this.statusBar.UpdateProgressBar(0);
}));
foreach (var row in rowLst)
{
Invoke(new Action(() =>
{
row.Cells["colOpResult"].Value = "";
}));
if (cancellationTokenSource.IsCancellationRequested)
break;
var prodId = row.Cells["colDraftId"].Value.ParseToString();
var shopId = row.Cells["colSupplierId"].Value.ParseToString();
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
if (shop == null)
{
Invoke(new Action(() =>
{
row.Cells["colOpResult"].Value = "店铺不存在";
}));
continue;
}
if (shop.LoginStatus != "登录成功")
{
Invoke(new Action(() =>
{
row.Cells["colOpResult"].Value = "店铺掉线";
}));
continue;
}
var downProdRst = WXPreSale.DownProd(shop, prodId.ParseToLong());
System.Threading.Thread.Sleep(Randomx.GetId(200, 500));
if (!downProdRst.Contains("\"code\":0"))
{
if (downProdRst.Contains("biz magic invalid"))
{
WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
if (shop.LoginStatus != "登录成功")
{
Invoke(new Action(() =>
{
row.Cells["colOpResult"].Value = "店铺掉线";
}));
continue;
}
}
var errmsg = BaseRegex.GetStringJson(ref downProdRst, "msg");
if (string.IsNullOrWhiteSpace(errmsg))
errmsg = downProdRst;
Invoke(new Action(() =>
{
row.Cells["colOpResult"].Value = errmsg;
}));
}
if (downProdRst.Contains("\"code\":0"))
{
Invoke(new Action(() =>
{
row.Cells["colOpResult"].Value = "下架成功";
}));
}
}
}
private void btnFiltSelectMoreThan_Click(object sender, EventArgs e)
{
foreach(DataGridViewRow row in dgvSelectProduct.Rows)